def _clearScene(self): if self._object is not None: if self._object._mesh is not None: if self._object._mesh.vbo is not None and self._object._mesh.vbo.decRef(): self.glReleaseList.append(self._object._mesh.vbo) del self._object._mesh del self._object self._object = None gc.collect() newZoom = numpy.max(self._machineSize) self._animView = openglGui.animation(self, self._viewTarget.copy(), numpy.array([0,0,0], numpy.float32), 0.5) self._animZoom = openglGui.animation(self, self._zoom, newZoom, 0.5)
def centerObject(self): if self._object is None: newViewPos = numpy.array([0,0,-self._zOffset], numpy.float32) newZoom = 300 else: height = self._object.getSize()[2] / 2 if abs(height) > abs(self._hOffset): height -= self._hOffset newViewPos = numpy.array([self._object.getPosition()[0], self._object.getPosition()[1], height-self._zOffset]) newZoom = self._object.getBoundaryCircle() * 4 if newZoom > numpy.max(self._machineSize) * 3: newZoom = numpy.max(self._machineSize) * 3 self._animZoom = openglGui.animation(self, self._zoom, newZoom, 0.5) self._animView = openglGui.animation(self, self._viewTarget.copy(), newViewPos, 0.5)
def centerHeight(self): if self._object is None: return height = self._object.getSize()[2] / 2 if abs(height) > abs(self._hOffset): height -= self._hOffset newViewPos = numpy.array([self._object.getPosition()[0], self._object.getPosition()[1], height-self._zOffset]) self._animView = openglGui.animation(self, self._viewTarget.copy(), newViewPos, 0.5)
def _clearScene(self): if self._object is not None: if self._object._mesh is not None: if self._object._mesh.vbo is not None and self._object._mesh.vbo.decRef( ): self.glReleaseList.append(self._object._mesh.vbo) del self._object._mesh del self._object self._object = None gc.collect() newZoom = numpy.max(self._machineSize) self._animView = openglGui.animation( self, self._viewTarget.copy(), numpy.array([0, 0, 0], numpy.float32), 0.5) self._animZoom = openglGui.animation(self, self._zoom, newZoom, 0.5)
def _selectObject(self, obj, zoom=True): self._offset = 0 if obj != self._selectedObj: self._selectedObj = obj self.updateModelSettingsToControls() if zoom and obj is not None: newViewPos = numpy.array([ obj.getPosition()[0], obj.getPosition()[1], obj.getSize()[2] / 2 ]) self._animView = openglGui.animation(self, self._viewTarget.copy(), newViewPos, 0.5) newZoom = obj.getBoundaryCircle() * 6 if newZoom > numpy.max(self._machineSize) * 3: newZoom = numpy.max(self._machineSize) * 3 self._animZoom = openglGui.animation(self, self._zoom, newZoom, 0.5)
def _selectObject(self, obj, zoom = True): if obj != self._selectedObj: self._selectedObj = obj self.updateModelSettingsToControls() if zoom: if self._selectedObj is None: newViewPos = numpy.array([0,0,0], numpy.float32) newZoom = 300 else: newViewPos = numpy.array([obj.getPosition()[0], obj.getPosition()[1], obj.getSize()[2] / 2]) newZoom = obj.getBoundaryCircle() * 6 if newZoom > numpy.max(self._machineSize) * 3: newZoom = numpy.max(self._machineSize) * 3 self._animZoom = openglGui.animation(self, self._zoom, newZoom, 0.5) self._animView = openglGui.animation(self, self._viewTarget.copy(), newViewPos, 0.5)
def OnCenter(self, e): if self._focusObj is None: return self._focusObj.setPosition(numpy.array([0.0, 0.0])) newViewPos = numpy.array([ self._focusObj.getPosition()[0], self._focusObj.getPosition()[1], self._focusObj.getSize()[2] / 2 ]) self._animView = openglGui.animation(self, self._viewTarget.copy(), newViewPos, 0.5)
def OnCenter(self, e): if self._focusObj is None: return self._focusObj.setPosition(numpy.array([0.0, 0.0])) newViewPos = numpy.array([self._focusObj.getPosition()[0], self._focusObj.getPosition()[1], self._focusObj.getSize()[2] / 2]) self._animView = openglGui.animation(self, self._viewTarget.copy(), newViewPos, 0.5)