Example #1
0
    def mouseMove(self, event):
        if self.dragStartPoint:
            # Show new box being dragged out
            newBox = self.boxFromDragSelect(event.ray)
            self.bounds = newBox

        if self.bounds is not None:
            if self.dragResizeFace is not None:
                # Hilite face being dragged
                newBox = self.boxFromDragResize(self.oldBounds, event.ray)
                self.faceDragNode.selectionBox = newBox
                self.faceDragNode.visible = True

                # Update selection box to resized size in progress
                newBox = self.boxFromDragResize(self.oldBounds, event.ray)
                self.bounds = newBox

            elif self.hiliteFace:
                # Hilite face cursor is over
                point, face = boxFaceUnderCursor(self.bounds, event.ray)
                if face is not None:
                    self.faceDragNode.visible = True
                    self.faceDragNode.face = face
                    self.faceDragNode.selectionBox = self.bounds
                else:
                    self.faceDragNode.visible = False
Example #2
0
    def mouseMove(self, event):
        if self.dragStartPoint:
            # Show new box being dragged out
            newBox = self.boxFromDragSelect(event.ray)
            self.bounds = newBox

        if self.bounds is not None:
            if self.dragResizeFace is not None:
                # Hilite face being dragged
                newBox = self.boxFromDragResize(self.oldBounds, event.ray)
                self.faceDragNode.selectionBox = newBox
                self.faceDragNode.visible = True

                # Update selection box to resized size in progress
                newBox = self.boxFromDragResize(self.oldBounds, event.ray)
                self.bounds = newBox

            elif self.hiliteFace:
                # Hilite face cursor is over
                point, face = boxFaceUnderCursor(self.bounds, event.ray)
                if face is not None:
                    self.faceDragNode.visible = True
                    self.faceDragNode.face = face
                    self.faceDragNode.selectionBox = self.bounds
                else:
                    self.faceDragNode.visible = False
Example #3
0
    def mousePress(self, event):

        # Find side of existing selection to drag
        # xxxx can't do this with disjoint selections?
        if self.bounds is not None:
            point, face = boxFaceUnderCursor(self.bounds, event.ray)

            if face is not None:
                log.info("Beginning drag resize")
                self.dragResizeFace = face
                # Choose a dimension perpendicular to the dragged face
                # Try not to pick a dimension close to edge-on with the view vector
                dim = ((face.dimension + 1) % 3)

                dim1 = (dim+1) % 3

                vector = event.view.cameraVector.abs()
                if vector[dim1] > vector[dim]:
                    dim = dim1

                self.dragResizeDimension = dim
                self.dragResizePosition = point[self.dragResizeDimension]
                self.oldBounds = self.bounds
                return True
            else:
                # Didn't hit - start new selection
                self.bounds = None

        # Get ready to start new selection
        if self.bounds is None:
            self.dragStartPoint = event.blockPosition
            self.dragStartFace = faces.FaceYIncreasing  # event.blockFace
            return
Example #4
0
 def beginMove(self, event):
     point, face = boxFaceUnderCursor(self.bounds, event.ray)
     self.dragStartFace = face
     self.dragStartPoint = point
     self.dragStartMovePosition = self.bounds.origin
     self.oldBounds = self.bounds
     self.isMoving = True
Example #5
0
    def mousePress(self, event):

        # Find side of existing selection to drag
        # xxxx can't do this with disjoint selections?
        if self.bounds is not None:
            point, face = boxFaceUnderCursor(self.bounds, event.ray)

            if face is not None:
                log.info("Beginning drag resize")
                self.dragResizeFace = face
                # Choose a dimension perpendicular to the dragged face
                # Try not to pick a dimension close to edge-on with the view vector
                dim = ((face.dimension + 1) % 3)

                dim1 = (dim + 1) % 3

                vector = event.view.cameraVector.abs()
                if vector[dim1] > vector[dim]:
                    dim = dim1

                self.dragResizeDimension = dim
                self.dragResizePosition = point[self.dragResizeDimension]
                self.oldBounds = self.bounds
                return True
            else:
                # Didn't hit - start new selection
                self.bounds = None

        # Get ready to start new selection
        if self.bounds is None:
            self.dragStartPoint = event.blockPosition
            self.dragStartFace = faces.FaceYIncreasing  # event.blockFace
            return
Example #6
0
 def beginMove(self, event):
     point, face = boxFaceUnderCursor(self.bounds, event.ray)
     self.dragStartFace = face
     self.dragStartPoint = point
     self.dragStartMovePosition = self.bounds.origin
     self.oldBounds = self.bounds
     self.isMoving = True
Example #7
0
    def mouseMove(self, event):
        # Hilite face cursor is over
        if self.currentImport is None:
            return

        node = self.currentImportNode
        point, face = boxFaceUnderCursor(self.schematicBox, event.ray)
        node.hoverFace(face)

        # Highlight face of box to move along, or else axis pointers to grab and drag?
        pass
Example #8
0
    def mouseMove(self, event):
        # Hilite face cursor is over
        if self.currentImport is None:
            return

        node = self.currentImportNode
        if node:
            point, face = boxFaceUnderCursor(self.schematicBox, event.ray)
            node.hoverFace(face)

        # Highlight face of box to move along, or else axis pointers to grab and drag?
        pass
Example #9
0
    def mousePress(self, event):
        # Record which face/axis was clicked for mouseDrag. Store current revision # in MoveCommand, begin undo
        # revision, cut selection from world, end undo revision, create overlay node for pasted selection
        # Inform EditorSession that a multi-step undo is being recorded and give it a callback to use when something
        # else tries to call beginUndo before we're done - call it an "undo block"

        # begin drag
        if self.currentImport is not None:
            point, face = boxFaceUnderCursor(self.schematicBox, event.ray)
            self.dragStartFace = face
            self.dragStartPoint = point
            self.dragStartMovePosition = self.movePosition
Example #10
0
    def mousePress(self, event):
        # Record which face/axis was clicked for mouseDrag. Store current revision # in MoveCommand, begin undo
        # revision, cut selection from world, end undo revision, create overlay node for pasted selection
        # Inform EditorSession that a multi-step undo is being recorded and give it a callback to use when something
        # else tries to call beginUndo before we're done - call it an "undo block"


        # begin drag
        if self.currentImport is not None:
            point, face = boxFaceUnderCursor(self.schematicBox, event.ray)
            self.dragStartFace = face
            self.dragStartPoint = point
            self.dragStartMovePosition = self.movePosition
Example #11
0
 def updateMouseHover(self, event):
     """
     Update visuals for the mouse hovering over this box.
     """
     # Hilite face cursor is over
     if self.bounds is None:
         return
     point, face = boxFaceUnderCursor(self.bounds, event.ray)
     if face is not None:
         self.faceDragNode.visible = True
         self.faceDragNode.face = face
         self.faceDragNode.selectionBox = self.bounds
     else:
         self.faceDragNode.visible = False
     if self.moveModifierDown(event):
         self.faceDragNode.color = self._moveFaceColor
     else:
         self.faceDragNode.color = self._resizeFaceColor
Example #12
0
 def updateMouseHover(self, event):
     """
     Update visuals for the mouse hovering over this box.
     """
     # Hilite face cursor is over
     if self.bounds is None:
         return
     point, face = boxFaceUnderCursor(self.bounds, event.ray)
     if face is not None:
         self.faceDragNode.visible = True
         self.faceDragNode.face = face
         self.faceDragNode.selectionBox = self.bounds
     else:
         self.faceDragNode.visible = False
     if self.moveModifierDown(event):
         self.faceDragNode.color = self._moveFaceColor
     else:
         self.faceDragNode.color = self._resizeFaceColor
Example #13
0
    def beginResize(self, event):
        log.debug("beginResize")
        point, face = boxFaceUnderCursor(self.bounds, event.ray)

        if face is not None:
            self.dragResizeFace = face
            # Choose a dimension perpendicular to the dragged face
            # Try not to pick a dimension close to edge-on with the view vector
            dim = ((face.dimension + 1) % 3)

            dim1 = (dim + 1) % 3

            vector = event.view.cameraVector.abs()
            if vector[dim1] > vector[dim]:
                dim = dim1

            self.dragResizeDimension = dim
            self.dragResizePosition = point[self.dragResizeDimension]
            self.oldBounds = self.bounds
            self.isResizing = True
            return True
        else:
            # Didn't hit - start new selection
            self.changeBounds(None)
Example #14
0
    def beginResize(self, event):
        log.info("beginResize")
        point, face = boxFaceUnderCursor(self.bounds, event.ray)

        if face is not None:
            self.dragResizeFace = face
            # Choose a dimension perpendicular to the dragged face
            # Try not to pick a dimension close to edge-on with the view vector
            dim = ((face.dimension + 1) % 3)

            dim1 = (dim+1) % 3

            vector = event.view.cameraVector.abs()
            if vector[dim1] > vector[dim]:
                dim = dim1

            self.dragResizeDimension = dim
            self.dragResizePosition = point[self.dragResizeDimension]
            self.oldBounds = self.bounds
            self.isResizing = True
            return True
        else:
            # Didn't hit - start new selection
            self.bounds = None