From: daid303 Date: Thu, 8 Nov 2012 07:38:37 +0000 (+0100) Subject: Fixed the top down view light issue, made the project planner use the configured... X-Git-Tag: 13.03~202 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=3fa28497ac978284f47a7849255d133cfbd0cdc0;p=cura.git Fixed the top down view light issue, made the project planner use the configured color for objects. --- diff --git a/Cura/gui/opengl.py b/Cura/gui/opengl.py index 29b3f0c9..8a61d16e 100644 --- a/Cura/gui/opengl.py +++ b/Cura/gui/opengl.py @@ -41,7 +41,7 @@ def InitGL(window, view3D, zoom): if view3D: gluPerspective(45.0, aspect, 1.0, 1000.0) else: - glOrtho(-aspect, aspect, -1, 1, -1000.0, 1000.0) + glOrtho(-aspect * (zoom), aspect * (zoom), -1.0 * (zoom), 1.0 * (zoom), -1000.0, 1000.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() diff --git a/Cura/gui/preview3d.py b/Cura/gui/preview3d.py index 023720a2..fb9df643 100644 --- a/Cura/gui/preview3d.py +++ b/Cura/gui/preview3d.py @@ -544,8 +544,7 @@ class PreviewGLCanvas(glcanvas.GLCanvas): if self.parent.objectsMaxV != None: glTranslate(0,0,-(self.parent.objectsMaxV[2]-self.parent.objectsMinV[2]) * profile.getProfileSettingFloat('model_scale') / 2) else: - glScale(1.0/self.zoom, 1.0/self.zoom, 1.0) - glTranslate(self.offsetX, self.offsetY, 0.0) + glTranslate(self.offsetX, self.offsetY, 0) self.viewport = glGetIntegerv(GL_VIEWPORT); self.modelMatrix = glGetDoublev(GL_MODELVIEW_MATRIX); diff --git a/Cura/gui/projectPlanner.py b/Cura/gui/projectPlanner.py index 943eed52..767ca075 100644 --- a/Cura/gui/projectPlanner.py +++ b/Cura/gui/projectPlanner.py @@ -722,7 +722,9 @@ class PreviewGLCanvas(glcanvas.GLCanvas): self.offsetY = 0 self.view3D = False self.allowDrag = False - + + self.objColor = profile.getPreferenceColour('model_colour') + def OnMouseLeftDown(self,e): self.allowDrag = True @@ -780,7 +782,6 @@ class PreviewGLCanvas(glcanvas.GLCanvas): glRotate(-self.pitch, 1,0,0) glRotate(self.yaw, 0,0,1) else: - glScale(1.0/self.zoom, 1.0/self.zoom, 1.0) glTranslate(self.offsetX, self.offsetY, 0.0) glTranslate(-self.parent.machineSize[0]/2, -self.parent.machineSize[1]/2, 0) @@ -822,11 +823,11 @@ class PreviewGLCanvas(glcanvas.GLCanvas): if item.validPlacement: if self.parent.selection == item: - glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.9, 0.7, 1.0]) - glLightfv(GL_LIGHT0, GL_AMBIENT, [0.2, 0.3, 0.2, 0.0]) + glLightfv(GL_LIGHT0, GL_DIFFUSE, map(lambda x: x + 0.2, self.objColor)) + glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x / 2, self.objColor)) else: - glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.8, 0.6, 1.0]) - glLightfv(GL_LIGHT0, GL_AMBIENT, [0.2, 0.1, 0.1, 0.0]) + glLightfv(GL_LIGHT0, GL_DIFFUSE, self.objColor) + glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x / 2, self.objColor)) else: if self.parent.selection == item: glLightfv(GL_LIGHT0, GL_DIFFUSE, [1.0, 0.0, 0.0, 0.0])