Ejemplo n.º 1
0
    def onEnter(self, kwargs):
        """ Called on node bound states when it starts
        """

        self.log("onEnter")
        self._node = kwargs["node"]
        #state_parms = kwargs["state_parms"]

        self._stasherAllPoints = self._node.node("OUT_ALL_POINTS_EDITED")

        self._geometry = self._node.node(
            "OUT_POSITION_HANDLE_PATHS").geometry()
        self._geometryHandles = self._node.node(
            "OUT_POSITION_HANDLE_GEO").geometry()
        self._geometryAgentAnchors = self._node.node(
            "OUT_AGENT_ANCHOR_GEO").geometry()

        geobrush = self._node.node("OUT_GUIDE_BRUSH").geometry()
        self._guideBrush = hou.SimpleDrawable(self._scene_viewer, geobrush,
                                              "my_guidebrush")
        self._guideBrush.setDisplayMode(
            hou.drawableDisplayMode.CurrentViewportMode)
        self._guideBrush.enable(True)
        self.setGuidesVisible(True)

        self._textBrushMode = hou.TextDrawable(self._scene_viewer,
                                               'textBrushMode')
        self._textBrushMode.show(True)

        self.initFromNodeParms()
        self.setCursorInViewport(True)

        self.updatePromptMessage()
Ejemplo n.º 2
0
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer
        self.poly_id = -1
        self.cursor_text = "Text"
        self.geometry = None
        self.geometryHandles = None
        self.mouseStart = hou.Vector2()
        self.mouseXLast = -1
        self.mouse_screen = hou.Vector2()
        self.cursorStartPos = hou.Vector3()
        self.dragStartValue = 0
        self.handleStartPos = hou.Vector3()
        self.currentPoint = -1
        self.currentHandleIdx = -1
        self.currentPrimid = -1
        self.currentPrimu = -1
        self.currentPrimDist = -1
        self.dragAction = False
        self.isHandle = False
        self.autoSlide = False
        self.slideHandlesAhead = False
        self.slideHandlesBehind = False
        self.handlePosMethod = 0

        self.text = hou.TextDrawable(self.scene_viewer, "text")

        # Construct a geometry drawable group
        line = hou.GeometryDrawable(self.scene_viewer, hou.drawableGeometryType.Line, "line",
                                    params={
                                        "color1": (0.0, 0.0, 1.0, 1.0),
                                        "style": hou.drawableGeometryLineStyle.Plain,
                                        "line_width": 3}
                                    )

        face = hou.GeometryDrawable(self.scene_viewer, hou.drawableGeometryType.Face, "face",
                                    params={
                                        "style": hou.drawableGeometryFaceStyle.Plain,
                                        "color1": (0.0, 1.0, 0.0, 1.0)}
                                    )

        point = hou.GeometryDrawable(self.scene_viewer, hou.drawableGeometryType.Point, "point",
                                     params={
                                         "num_rings": 2,
                                         "radius": 8,
                                         "color1": (1.0, 0.0, 0.0, 1.0),
                                         "style": hou.drawableGeometryPointStyle.LinearCircle}
                                     )

        self.poly_guide = hou.GeometryDrawableGroup("poly_guide")

        self.poly_guide.addDrawable(face)
        self.poly_guide.addDrawable(line)
        self.poly_guide.addDrawable(point)
Ejemplo n.º 3
0
 def __init__(self, scene_viewer, color, show_text, text_scale):
     line = createLineGeometry()
     frustum = createFrustumGeometry()
     self.color = color
     self.disk_x = Measurement.disk_maker.makeDisk((1, 0, 0), (.7, .2, .2))
     self.disk_y = Measurement.disk_maker.makeDisk((0, 1, 0), (.2, .7, .2))
     self.disk_z = Measurement.disk_maker.makeDisk((0, 0, 1), (.2, .2, .7))
     self.scene_viewer = scene_viewer
     self.tail_spot_drawable = hou.GeometryDrawable(
         scene_viewer, hou.drawableGeometryType.Line, "tail_spot", frustum)
     self.head_spot_drawable = hou.GeometryDrawable(
         scene_viewer, hou.drawableGeometryType.Line, "head_spot", frustum)
     self.line_drawable = hou.GeometryDrawable(
         scene_viewer, hou.drawableGeometryType.Line, "line", line)
     self.tail_disk_drawable = None
     self.head_disk_drawable = None
     self.text_drawable = hou.TextDrawable(scene_viewer, "text_drawable")
     self.text_params = {
         'text': None,
         'translate': hou.Vector3(0.0, 0.0, 0.0),
         'highlight_mode': hou.drawableHighlightMode.MatteOverGlow,
         'glow_width': 10,
         'color2': hou.Vector4(0, 0, 0, 0.5),
         'scale': hou.Vector3(text_scale, text_scale, text_scale)
     }
     self.spot_params = {
         'color1': color.getVec(),
         'fade_factor': 0.5,
         'highlight_mode': hou.drawableHighlightMode.MatteOverGlow,
         'glow_width': 5
     }
     self.line_params = {
         'line_width': 4.0,
         'style': (10.0, 5.0),
         'color1': color.getVec(),
         'fade_factor': 0.3,
         'highlight_mode': hou.drawableHighlightMode.MatteOverGlow,
         'glow_width': 5
     }
     self.tail_pos = hou.Vector3(0.0, 0.0, 0.0)
     self.head_pos = hou.Vector3(0.0, 0.0, 0.0)
     self.spot_size = 0.01
     self.measurement = 0.0
     self.font_size = Measurement.default_font_size
     self.font_color = color.getHexStr()
     self.text = Measurement.default_text
     self.curPlane = None
     self.angle_snapping = False
     self.name = ""
     self.show_text = show_text
     self.updateTextField()
Ejemplo n.º 4
0
    def __init__(self, sceneviewer, name, position, value):

        self.scene_viewer = sceneviewer
        self.geoViewport = self.scene_viewer.curViewport()
        pos2 = self.geoViewport.mapToScreen(position)
        pos3 = hou.Vector3(pos2[0], pos2[1], 0)
        scale = 0.5
        self.text_drawable = hou.TextDrawable(
            self.scene_viewer,
            name,
            params={
                'text': "<font size=7>" + str(value) + "</font>",
                'translate': pos3,
                'scale': hou.Vector3(scale, scale, scale),
                'origin': hou.drawableTextOrigin.BottomLeft
            })
        self.show(False)
Ejemplo n.º 5
0
 def __init__(self, state_name, scene_viewer):
     self.state_name = state_name
     self.scene_viewer = scene_viewer
     self.geometry_viewport = hou.SceneViewer.curViewport(self.scene_viewer)
     self.geo_intersector = None
     self.geometry = None
     self.measurements = MeasurementContainer(self.geometry_viewport,
                                              State.text_size)
     self.current_node = None
     self.curPlane = None
     self.show(False)
     self.angle_snapping = False
     self.cur_angle = 0
     point = createPointGeometry()
     self.point_drawable = hou.GeometryDrawable(
         scene_viewer, hou.drawableGeometryType.Point, "point", point)
     self.point_params = {
         'style': hou.drawableGeometryPointStyle.SmoothCircle,
         'radius': 2,
         'color2': hou.Vector4(0, 1, 1, 1),
         'color1': hou.Vector4(.9, .8, .1, 1.),
         'highlight_mode': hou.drawableHighlightMode.MatteOverGlow,
         'glow_width': 20
     }
     self.active = False
     self.angle_text_drawable = hou.TextDrawable(self.scene_viewer,
                                                 "angle_text")
     self.angle_text_params = {
         'text': "Fizz",
         'translate': hou.Vector3(0.0, 0.0, 0.0),
         'highlight_mode': hou.drawableHighlightMode.MatteOverGlow,
         'glow_width': 10,
         'color2': hou.Vector4(0, 0, 0, 0.5)
     }
     self.arc_drawable = hou.GeometryDrawable(self.scene_viewer,
                                              hou.drawableGeometryType.Line,
                                              "arc")
     self.mode = Mode.doing_nothing