What was I smoking? This code is much simpler this way.
This commit is contained in:
parent
7f57669280
commit
666bbbb6b0
2 changed files with 12 additions and 21 deletions
|
|
@ -138,7 +138,7 @@ def getProfileInformation():
|
||||||
'Widen_Width_over_Edge_Width_ratio': DEFSET,
|
'Widen_Width_over_Edge_Width_ratio': DEFSET,
|
||||||
},'inset': {
|
},'inset': {
|
||||||
'Add_Custom_Code_for_Temperature_Reading': "False",
|
'Add_Custom_Code_for_Temperature_Reading': "False",
|
||||||
'Infill_in_Direction_of_Bridge': "True",
|
'Infill_in_Direction_of_Bridge': ifSettingAboveZero('fill_density'),
|
||||||
'Infill_Width': storedSettingFloat("nozzle_size"),
|
'Infill_Width': storedSettingFloat("nozzle_size"),
|
||||||
'Loop_Order_Choice': DEFSET,
|
'Loop_Order_Choice': DEFSET,
|
||||||
'Overlap_Removal_Width_over_Perimeter_Width_ratio': DEFSET,
|
'Overlap_Removal_Width_over_Perimeter_Width_ratio': DEFSET,
|
||||||
|
|
|
||||||
|
|
@ -447,39 +447,30 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
||||||
self.gcodeDisplayList = glGenLists(len(self.parent.gcode.layerList));
|
self.gcodeDisplayList = glGenLists(len(self.parent.gcode.layerList));
|
||||||
self.gcodeDisplayListCount = len(self.parent.gcode.layerList)
|
self.gcodeDisplayListCount = len(self.parent.gcode.layerList)
|
||||||
self.parent.gcodeDirty = False
|
self.parent.gcodeDirty = False
|
||||||
self.gcodeDisplayListMade = []
|
self.gcodeDisplayListMade = 0
|
||||||
for idx in xrange(0, len(self.parent.gcode.layerList)):
|
|
||||||
self.gcodeDisplayListMade.append(False)
|
|
||||||
|
|
||||||
if self.gcodeDisplayListMade != None:
|
if self.parent.gcode != None and self.gcodeDisplayListMade < len(self.parent.gcode.layerList):
|
||||||
curLayerNum = 0
|
glNewList(self.gcodeDisplayList + self.gcodeDisplayListMade, GL_COMPILE)
|
||||||
for layer in self.parent.gcode.layerList:
|
opengl.DrawGCodeLayer(self.parent.gcode.layerList[self.gcodeDisplayListMade])
|
||||||
if not self.gcodeDisplayListMade[curLayerNum]:
|
glEndList()
|
||||||
glNewList(self.gcodeDisplayList + curLayerNum, GL_COMPILE)
|
self.gcodeDisplayListMade += 1
|
||||||
opengl.DrawGCodeLayer(layer)
|
self.Refresh()
|
||||||
glEndList()
|
|
||||||
self.gcodeDisplayListMade[curLayerNum] = True
|
|
||||||
self.Refresh()
|
|
||||||
break
|
|
||||||
curLayerNum += 1
|
|
||||||
if curLayerNum == len(self.parent.gcode.layerList):
|
|
||||||
self.gcodeDisplayListMade = None
|
|
||||||
|
|
||||||
if self.parent.gcode != None and (self.viewMode == "GCode" or self.viewMode == "Mixed"):
|
if self.parent.gcode != None and (self.viewMode == "GCode" or self.viewMode == "Mixed"):
|
||||||
glEnable(GL_COLOR_MATERIAL)
|
glEnable(GL_COLOR_MATERIAL)
|
||||||
glEnable(GL_LIGHTING)
|
glEnable(GL_LIGHTING)
|
||||||
for i in xrange(0, self.parent.layerSpin.GetValue() + 1):
|
drawUpToLayer = min(self.gcodeDisplayListMade, self.parent.layerSpin.GetValue() + 1)
|
||||||
|
for i in xrange(0, drawUpToLayer):
|
||||||
c = 1.0
|
c = 1.0
|
||||||
if i < self.parent.layerSpin.GetValue():
|
if i < self.parent.layerSpin.GetValue():
|
||||||
c = 0.9 - (self.parent.layerSpin.GetValue() - i) * 0.1
|
c = 0.9 - (drawUpToLayer - i) * 0.1
|
||||||
if c < 0.4:
|
if c < 0.4:
|
||||||
c = (0.4 + c) / 2
|
c = (0.4 + c) / 2
|
||||||
if c < 0.1:
|
if c < 0.1:
|
||||||
c = 0.1
|
c = 0.1
|
||||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, [0,0,0,0])
|
glLightfv(GL_LIGHT0, GL_DIFFUSE, [0,0,0,0])
|
||||||
glLightfv(GL_LIGHT0, GL_AMBIENT, [c,c,c,c])
|
glLightfv(GL_LIGHT0, GL_AMBIENT, [c,c,c,c])
|
||||||
if self.gcodeDisplayListMade == None or self.gcodeDisplayListMade[i]:
|
glCallList(self.gcodeDisplayList + i)
|
||||||
glCallList(self.gcodeDisplayList + i)
|
|
||||||
glDisable(GL_LIGHTING)
|
glDisable(GL_LIGHTING)
|
||||||
glDisable(GL_COLOR_MATERIAL)
|
glDisable(GL_COLOR_MATERIAL)
|
||||||
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, [0.2, 0.2, 0.2, 1.0]);
|
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, [0.2, 0.2, 0.2, 1.0]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue