chiark / gitweb /
Improve platform texture rendering. Add UM2go platform.
authordaid <daid303@gmail.com>
Wed, 7 Jan 2015 10:06:28 +0000 (11:06 +0100)
committerdaid <daid303@gmail.com>
Wed, 7 Jan 2015 10:06:28 +0000 (11:06 +0100)
Cura/gui/sceneView.py
Cura/util/profile.py
resources/images/Ultimaker2backplate.png
resources/images/UltimakerPlusbackplate.png
resources/meshes/ultimaker2go_platform.stl [new file with mode: 0644]
resources/meshes/ultimaker_plus_platform.stl [deleted file]

index c81ea4986415370b11a5a66aca021e508c9de116..799e92c67c08b98e28b9a049391d0693f75d92b5 100644 (file)
@@ -648,6 +648,8 @@ class SceneView(openglGui.glGuiPanel):
                self._objColors[2] = profile.getPreferenceColour('model_colour3')
                self._objColors[3] = profile.getPreferenceColour('model_colour4')
                self._scene.updateMachineDimensions()
+               if self._zoom > numpy.max(self._machineSize) * 3:
+                       self._animZoom = openglGui.animation(self, self._zoom, numpy.max(self._machineSize) * 3, 0.5)
                self.updateModelSettingsToControls()
 
        def updateModelSettingsToControls(self):
@@ -1244,20 +1246,27 @@ class SceneView(openglGui.glGuiPanel):
                        texture_name = None
                        offset = [0,0,0]
                        texture_offset = [0,0,0]
+                       texture_scale = 1.0
                        if machine_type == 'ultimaker2' or machine_type == 'ultimaker2extended':
                                filename = resources.getPathForMesh('ultimaker2_platform.stl')
                                offset = [0,-37,145]
                                texture_name = 'Ultimaker2backplate.png'
                                texture_offset = [0,150,-5]
-                       if machine_type == 'ultimaker_plus':
+                       elif machine_type == 'ultimaker2go':
+                               filename = resources.getPathForMesh('ultimaker2go_platform.stl')
+                               offset = [0,-42,145]
+                               texture_offset = [0,105,-5]
+                               texture_name = 'Ultimaker2backplate.png'
+                               texture_scale = 0.9
+                       elif machine_type == 'ultimaker_plus':
                                filename = resources.getPathForMesh('ultimaker2_platform.stl')
                                offset = [0,-37,145]
                                texture_offset = [0,150,-5]
                                texture_name = 'UltimakerPlusbackplate.png'
-                       if machine_type == 'ultimaker':
+                       elif machine_type == 'ultimaker':
                                filename = resources.getPathForMesh('ultimaker_platform.stl')
                                offset = [0,0,2.5]
-                       if machine_type == 'Witbox':
+                       elif machine_type == 'Witbox':
                                filename = resources.getPathForMesh('Witbox_platform.stl')
                                offset = [0,-37,145]
 
@@ -1270,6 +1279,7 @@ class SceneView(openglGui.glGuiPanel):
                                        if texture_name is not None:
                                                self._platformMesh[machine_type].texture = openglHelpers.loadGLTexture(texture_name)
                                                self._platformMesh[machine_type].texture_offset = texture_offset
+                                               self._platformMesh[machine_type].texture_scale = texture_scale
                if self._platformMesh[machine_type] is not None:
                        mesh = self._platformMesh[machine_type]
                        glColor4f(1,1,1,0.5)
@@ -1285,11 +1295,14 @@ class SceneView(openglGui.glGuiPanel):
                                glColor4f(1,1,1,1)
 
                                glTranslate(mesh.texture_offset[0], mesh.texture_offset[1], mesh.texture_offset[2])
+                               glScalef(mesh.texture_scale, mesh.texture_scale, mesh.texture_scale)
                                h = 50
                                d = 8
                                w = 100
                                glEnable(GL_BLEND)
-                               glBlendFunc(GL_DST_COLOR, GL_ZERO)
+                               glBlendFunc(GL_DST_COLOR, GL_ONE_MINUS_SRC_ALPHA)
+                               glEnable(GL_ALPHA_TEST)
+                               glAlphaFunc(GL_GREATER, 0.0)
                                glBegin(GL_QUADS)
                                glTexCoord2f(1, 0)
                                glVertex3f( w, 0, h)
index d404dbee11b6bfbf5b6ac2b6ac0fd69b26ee1323..86f003053284340823907c86d9f73491cda2d216 100644 (file)
@@ -776,7 +776,7 @@ def resetProfile():
        elif getMachineSetting('machine_type') == 'ultimaker_plus':
                putProfileSetting('nozzle_size', '0.4')
                putProfileSetting('retraction_enable', 'True')
-       elif getMachineSetting('machine_type') == 'ultimaker2':
+       elif getMachineSetting('machine_type').startswith('ultimaker2'):
                putProfileSetting('nozzle_size', '0.4')
                putProfileSetting('retraction_enable', 'True')
        else:
@@ -1170,10 +1170,10 @@ def getMachineSizePolygons():
        else:
                ret.append(numpy.array([[-size[0]/2,-size[1]/2],[size[0]/2,-size[1]/2],[size[0]/2, size[1]/2], [-size[0]/2, size[1]/2]], numpy.float32))
 
-       if getMachineSetting('machine_type') == 'ultimaker2':
+       if getMachineSetting('machine_type').startswith('ultimaker2'):
                #UM2 no-go zones
                w = 25
-               h = 10
+               h = 8
                ret.append(numpy.array([[-size[0]/2,-size[1]/2],[-size[0]/2+w+2,-size[1]/2], [-size[0]/2+w,-size[1]/2+h], [-size[0]/2,-size[1]/2+h]], numpy.float32))
                ret.append(numpy.array([[ size[0]/2-w-2,-size[1]/2],[ size[0]/2,-size[1]/2], [ size[0]/2,-size[1]/2+h],[ size[0]/2-w,-size[1]/2+h]], numpy.float32))
                ret.append(numpy.array([[-size[0]/2+w+2, size[1]/2],[-size[0]/2, size[1]/2], [-size[0]/2, size[1]/2-h],[-size[0]/2+w, size[1]/2-h]], numpy.float32))
index 9b663bf1b669856b96a67f7083660169dfe83e89..73c9d624483bb627e3278c01b523e823415bc344 100644 (file)
Binary files a/resources/images/Ultimaker2backplate.png and b/resources/images/Ultimaker2backplate.png differ
index 01f5d5f3a5890497b5adc3d4b35d8759dd01b74e..9e0392956c6060926e987acecdab3b4363562e63 100644 (file)
Binary files a/resources/images/UltimakerPlusbackplate.png and b/resources/images/UltimakerPlusbackplate.png differ
diff --git a/resources/meshes/ultimaker2go_platform.stl b/resources/meshes/ultimaker2go_platform.stl
new file mode 100644 (file)
index 0000000..cd60b19
Binary files /dev/null and b/resources/meshes/ultimaker2go_platform.stl differ
diff --git a/resources/meshes/ultimaker_plus_platform.stl b/resources/meshes/ultimaker_plus_platform.stl
deleted file mode 100644 (file)
index 5a1bb14..0000000
Binary files a/resources/meshes/ultimaker_plus_platform.stl and /dev/null differ