예제 #1
0
파일: edit.py 프로젝트: bigjun/TundraAddons
    def on_mouseleftreleased(self, mouseinfo):
        if not self.editing:
            return
        self.left_button_down = False
        if self.active:  #XXX something here?
            self.sel_activated = True

        if self.dragging:
            self.dragging = False

        if self.selection_rect_startpos is not None:
            hits = renderer.FrustumQuery(self.selection_rect)

            for hit in hits:
                if hit in self.sels: continue
                if not editable(hit): continue
                try:
                    self.multiselect(hit)
                except ValueError:
                    pass

            self.selection_rect_startpos = None
            self.selection_rect.setRect(0, 0, 0, 0)
            self.selection_box.Hide()

        self.manipulator.stopManipulating()
        self.manipulator.showManipulator(self.sels)
        self.usingManipulator = False
예제 #2
0
    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)