From: daid Date: Wed, 7 Jan 2015 10:06:28 +0000 (+0100) Subject: Improve platform texture rendering. Add UM2go platform. X-Git-Tag: 15.01-RC7~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=89a39e819a0caf576a5cd05935556deef448d7ad;p=cura.git Improve platform texture rendering. Add UM2go platform. --- diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index c81ea498..799e92c6 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -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) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index d404dbee..86f00305 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -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)) diff --git a/resources/images/Ultimaker2backplate.png b/resources/images/Ultimaker2backplate.png index 9b663bf1..73c9d624 100644 Binary files a/resources/images/Ultimaker2backplate.png and b/resources/images/Ultimaker2backplate.png differ diff --git a/resources/images/UltimakerPlusbackplate.png b/resources/images/UltimakerPlusbackplate.png index 01f5d5f3..9e039295 100644 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 index 00000000..cd60b19a 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 index 5a1bb140..00000000 Binary files a/resources/meshes/ultimaker_plus_platform.stl and /dev/null differ