Commit 43655cc3 authored by Guillaume Seguin's avatar Guillaume Seguin

Draw objects centered on the offset position in plater

parent 76860fb6
...@@ -327,10 +327,9 @@ class StlPlater(Plater): ...@@ -327,10 +327,9 @@ class StlPlater(Plater):
maxz = j[2] maxz = j[2]
model.dims = [minx, maxx, miny, maxy, minz, maxz] model.dims = [minx, maxx, miny, maxy, minz, maxz]
self.add_model(name, model) self.add_model(name, model)
#if minx < 0: model.centeroffset = [(maxx - minx) / 2,
# model.offsets[0] = -minx (maxy - miny) / 2,
#if miny < 0: 0]
# model.offsets[1] = -miny
self.s.drawmodel(model, 2) self.s.drawmodel(model, 2)
def export_to(self, name): def export_to(self, name):
......
...@@ -354,12 +354,14 @@ class StlViewPanel(wxGLPanel): ...@@ -354,12 +354,14 @@ class StlViewPanel(wxGLPanel):
glPushMatrix() glPushMatrix()
# Draw objects # Draw objects
for i in self.parent.models.values(): for i in self.parent.models:
model = self.parent.models[i]
glPushMatrix() glPushMatrix()
glTranslatef(*(i.offsets)) glTranslatef(*(model.offsets))
glRotatef(i.rot, 0.0, 0.0, 1.0) glTranslatef(*(model.centeroffset))
glScalef(*i.scale) glRotatef(model.rot, 0.0, 0.0, 1.0)
i.batch.draw() glScalef(*model.scale)
model.batch.draw()
glPopMatrix() glPopMatrix()
glPopMatrix() glPopMatrix()
glPopMatrix() glPopMatrix()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment