def on_mousedrag(self, mouseinfo): if not self.editing: return """dragging objects around - now free movement based on view, dragging different axis etc in the manipulator to be added.""" width, height = renderer.GetWindowWidth(), renderer.GetWindowHeight() normalized_width = 1 / width normalized_height = 1 / height mouse_abs_x = normalized_width * mouseinfo.x mouse_abs_y = normalized_height * mouseinfo.y movedx = mouse_abs_x - self.prev_mouse_abs_x movedy = mouse_abs_y - self.prev_mouse_abs_y if self.left_button_down: if self.selection_rect_startpos is not None: rectx, recty, rectwidth, rectheight = self.selectionRectDimensions( mouseinfo) self.selection_rect.setRect(rectx, recty, rectwidth, rectheight) self.selection_box.SetBoundingBox(self.selection_rect) # TODO: test if hit update here makes sense else: ent = self.active if ent is not None and self.sel_activated and self.canmove: self.dragging = True self.manipulator.manipulate(self.sels, movedx, movedy) self.prev_mouse_abs_x = mouse_abs_x self.prev_mouse_abs_y = mouse_abs_y
def dragStarted(self, mouseinfo): width, height = renderer.GetWindowWidth(), renderer.GetWindowHeight() normalized_width = 1 / width normalized_height = 1 / height mouse_abs_x = normalized_width * mouseinfo.x mouse_abs_y = normalized_height * mouseinfo.y self.prev_mouse_abs_x = mouse_abs_x self.prev_mouse_abs_y = mouse_abs_y
def on_mousedrag(self, mouseinfo): """dragging objects around - now free movement based on view, dragging different axis etc in the manipulator to be added.""" if self.windowActive: width, height = renderer.GetWindowWidth( ), renderer.GetWindowHeight() normalized_width = 1 / width normalized_height = 1 / height mouse_abs_x = normalized_width * mouseinfo.x mouse_abs_y = normalized_height * mouseinfo.y movedx = mouse_abs_x - self.prev_mouse_abs_x movedy = mouse_abs_y - self.prev_mouse_abs_y if self.left_button_down: if self.selection_rect_startpos is not None: rectx, recty, rectwidth, rectheight = self.selectionRectDimensions( mouseinfo) self.selection_rect.setGeometry(rectx, recty, rectwidth, rectheight) self.selection_rect.show() #XXX change? rect = self.selection_rect.rect #0,0 - x, y rect.translate(mouseinfo.x, mouseinfo.y) hits = renderer.FrustumQuery(rect) #the wish else: ent = self.active if ent is not None and self.sel_activated and self.canmove: self.dragging = True self.manipulator.manipulate(self.sels, movedx, movedy) self.prev_mouse_abs_x = mouse_abs_x self.prev_mouse_abs_y = mouse_abs_y self.window.update_guivals(ent)