[cura] Added patch to not crash while trying to load missing STLs
Miro Hrončok
churchyard at fedoraproject.org
Wed Oct 16 12:26:56 UTC 2013
commit 5a2d10019bb5f7166ebc4f7738d41e2eaf0a3785
Author: Miro Hrončok <miro at hroncok.cz>
Date: Wed Oct 16 14:19:22 2013 +0200
Added patch to not crash while trying to load missing STLs
cura-dont-show-nc-stls.patch | 85 ++++++++++++++++++++++++++++++++++++++++++
cura.spec | 4 ++
2 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/cura-dont-show-nc-stls.patch b/cura-dont-show-nc-stls.patch
new file mode 100644
index 0000000..b9544b6
--- /dev/null
+++ b/cura-dont-show-nc-stls.patch
@@ -0,0 +1,85 @@
+diff --git a/gui/sceneView.py b/gui/sceneView.py
+index ead3086..a4f9fb3 100644
+--- a/gui/sceneView.py
++++ b/gui/sceneView.py
+@@ -1201,70 +1201,16 @@ void main(void)
+ size = [profile.getMachineSettingFloat('machine_width'), profile.getMachineSettingFloat('machine_depth'), profile.getMachineSettingFloat('machine_height')]
+
+ machine = profile.getMachineSetting('machine_type')
+- if profile.getMachineSetting('machine_type').startswith('ultimaker'):
+- if machine not in self._platformMesh:
+- meshes = meshLoader.loadMeshes(resources.getPathForMesh(machine + '_platform.stl'))
+- if len(meshes) > 0:
+- self._platformMesh[machine] = meshes[0]
+- else:
+- self._platformMesh[machine] = None
+- if machine == 'ultimaker2':
+- self._platformMesh[machine]._drawOffset = numpy.array([0,-37,145], numpy.float32)
+- else:
+- self._platformMesh[machine]._drawOffset = numpy.array([0,0,2.5], numpy.float32)
+- glColor4f(1,1,1,0.5)
+- self._objectShader.bind()
+- self._renderObject(self._platformMesh[machine], False, False)
+- self._objectShader.unbind()
+-
+- #For the Ultimaker 2 render the texture on the back plate to show the Ultimaker2 text.
+- if machine == 'ultimaker2':
+- if not hasattr(self._platformMesh[machine], 'texture'):
+- self._platformMesh[machine].texture = opengl.loadGLTexture('Ultimaker2backplate.png')
+- glBindTexture(GL_TEXTURE_2D, self._platformMesh[machine].texture)
+- glEnable(GL_TEXTURE_2D)
+- glPushMatrix()
+- glColor4f(1,1,1,1)
+-
+- glTranslate(0,150,-5)
+- h = 50
+- d = 8
+- w = 100
+- glEnable(GL_BLEND)
+- glBlendFunc(GL_DST_COLOR, GL_ZERO)
+- glBegin(GL_QUADS)
+- glTexCoord2f(1, 0)
+- glVertex3f( w, 0, h)
+- glTexCoord2f(0, 0)
+- glVertex3f(-w, 0, h)
+- glTexCoord2f(0, 1)
+- glVertex3f(-w, 0, 0)
+- glTexCoord2f(1, 1)
+- glVertex3f( w, 0, 0)
+-
+- glTexCoord2f(1, 0)
+- glVertex3f(-w, d, h)
+- glTexCoord2f(0, 0)
+- glVertex3f( w, d, h)
+- glTexCoord2f(0, 1)
+- glVertex3f( w, d, 0)
+- glTexCoord2f(1, 1)
+- glVertex3f(-w, d, 0)
+- glEnd()
+- glDisable(GL_TEXTURE_2D)
+- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
+- glPopMatrix()
+- else:
+- glColor4f(0,0,0,1)
+- glLineWidth(3)
+- glBegin(GL_LINES)
+- glVertex3f(-size[0] / 2, -size[1] / 2, 0)
+- glVertex3f(-size[0] / 2, -size[1] / 2, 10)
+- glVertex3f(-size[0] / 2, -size[1] / 2, 0)
+- glVertex3f(-size[0] / 2+10, -size[1] / 2, 0)
+- glVertex3f(-size[0] / 2, -size[1] / 2, 0)
+- glVertex3f(-size[0] / 2, -size[1] / 2+10, 0)
+- glEnd()
++ glColor4f(0,0,0,1)
++ glLineWidth(3)
++ glBegin(GL_LINES)
++ glVertex3f(-size[0] / 2, -size[1] / 2, 0)
++ glVertex3f(-size[0] / 2, -size[1] / 2, 10)
++ glVertex3f(-size[0] / 2, -size[1] / 2, 0)
++ glVertex3f(-size[0] / 2+10, -size[1] / 2, 0)
++ glVertex3f(-size[0] / 2, -size[1] / 2, 0)
++ glVertex3f(-size[0] / 2, -size[1] / 2+10, 0)
++ glEnd()
+
+ v0 = [ size[0] / 2, size[1] / 2, size[2]]
+ v1 = [ size[0] / 2,-size[1] / 2, size[2]]
diff --git a/cura.spec b/cura.spec
index 1e64a44..861335b 100644
--- a/cura.spec
+++ b/cura.spec
@@ -24,6 +24,9 @@ Patch0: %{name}-future-import-first.patch
# Use systems CuraEngine
Patch1: %{name}-CuraEngine.patch
+# UltimakerPlatforms STLs were stripped from the tarball, don't crash because of that
+Patch2: %{name}-dont-show-nc-stls.patch
+
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: dos2unix
@@ -50,6 +53,7 @@ settings and send this G-Code to the 3D printer for printing.
%setup -qn Cura-%{version}/Cura
%patch0 -p1
%patch1 -p1
+%patch2 -p1
dos2unix resources/example/Attribution.txt
More information about the scm-commits
mailing list