Search the Community
Showing results for tags 'binding'.
-
I need to create a HDA with uisoparm handle which will be show/hide on hotkey, and dynamically tune different parameters in my hda. For example by pressing some hotkey it will tune param0, and after pressing same hotkey it will tune param1, etc... The problem is that I can't understand why uisoparm handle doesn't shows in viewport after its creation. Another handles like circle, xform, vector works fine. template.bindHandle("circle", "my_handle") But uisoparm handle doesn't appear in viewport , and I can't understand why here is example of my code. also I attached a hip file with hda. import hou import viewerstate.utils as su class State(object): def __init__(self, state_name, scene_viewer): self.state_name = state_name self.scene_viewer = scene_viewer self.node = None self.start_pt = None self.end_pt = None self.displayRotHandle = True self.start_handle = hou.Handle(self.scene_viewer, "rotate_start") self.end_handle = hou.Handle(self.scene_viewer, "rotate_end") self.displayCarveHandle = True self.carve0_handle = hou.Handle(self.scene_viewer, "carve_0") self.carve1_handle = hou.Handle(self.scene_viewer, "carve_1") def onEnter(self, kwargs): self.node = kwargs["node"] # rotation handles init self.start_handle.disableParms(["tx", "ty", "tz", "rx", "rz"]) self.end_handle.disableParms(["tx", "ty", "tz", "rx", "rz"]) self.start_handle.show(True) self.end_handle.show(True) self.start_handle.update() self.end_handle.update() self.displayRotHandle = True # carve handles init self.carve0_handle.show(True) self.carve1_handle.show(True) self.carve0_handle.enableParms(["input", "k","onoff"]) self.carve1_handle.enableParms(["input", "k","onoff"]) self.carve0_handle.update() self.carve1_handle.update() self.displayCarveHandle = True self.start_pt = self.node.node("start_pt").geometry() self.end_pt = self.node.node("end_pt").geometry() def onMouseEvent(self, kwargs): """ Find the position of the point to add by intersecting the construction plane. """ ui_event = kwargs["ui_event"] device = ui_event.device() origin, direction = ui_event.ray() return True def onKeyEvent(self, kwargs): ui_device = kwargs["ui_event"].device() self.key_pressed = ui_device.keyString() if self.key_pressed == "a": if self.displayRotHandle == True: self.scene_viewer.showHandle("rotate_start", 0) self.scene_viewer.showHandle("rotate_end", 0) self.scene_viewer.showHandle("carve_0", 0) self.scene_viewer.showHandle("carve_1", 0) self.displayRotHandle = False else : self.displayRotHandle = True self.scene_viewer.showHandle("rotate_start", 1) self.scene_viewer.showHandle("rotate_end", 1) self.scene_viewer.showHandle("carve_0", 1) self.scene_viewer.showHandle("carve_1", 1) return True def onHandleToState(self, kwargs): # Called when the user manipulates a handle handle_name = kwargs["handle"] parms = kwargs["parms"] prev_parms = kwargs["prev_parms"] node = kwargs["node"] if handle_name == self.start_handle.name(): # user manipulates rotation start handle node.parm("rot_start").set(parms["ry"]) if handle_name == self.end_handle.name(): # user manipulates rotation end handle node.parm("rot_end").set(parms["ry"]) if handle_name == self.carve0_handle.name(): # user manipulates carve 0 handle node.parm("carve_0").set(parms["k"]) node.parm("first_u").set(parms["onoff"]) if handle_name == self.carve1_handle.name(): # user manipulates carve 1 handle node.parm("carve_1").set(parms["k"]) node.parm("second_u").set(parms["onoff"]) def onStateToHandle(self, kwargs): # Called when the user changes parameter(s), so you can update dynamic handles if necessary handle = kwargs["handle"] handle_parms = kwargs["parms"] node = kwargs["node"] if self.start_pt != None: pos_start = self.start_pt.point(0).position() else: pos_start = [0.0, 0.0, 0.0] if self.end_pt != None: pos_end = self.end_pt.point(0).position() else: pos_end = [0.0, 0.0, 0.0] if handle == "rotate_start": handle_parms["tx"] = pos_start[0] handle_parms["ty"] = pos_start[1] handle_parms["tz"] = pos_start[2] if handle == "rotate_end": handle_parms["tx"] = pos_end[0] handle_parms["ty"] = pos_end[1] handle_parms["tz"] = pos_end[2] if handle == "carve_0" : handle_parms["k"] = 0 if handle == "carve_1" : handle_parms["k"] = 1 def createViewerStateTemplate(): """ Mandatory entry point to create and return the viewer state template to register. """ state_typename = kwargs["type"].definition().sections()["DefaultState"].contents() state_label = "Denis test dynamic handle" state_cat = hou.sopNodeTypeCategory() template = hou.ViewerStateTemplate(state_typename, state_label, state_cat) template.bindFactory(State) template.bindIcon(kwargs["type"].icon()) template.bindHandle("circle", "rotate_start") template.bindHandle("circle", "rotate_end") template.bindHandle("uisoparm", "carve_0", "ownerop('carve_0') owneropgroup('group')", cache_previous_parms=True, handle_parms=["input", "k","onoff"] ) template.bindHandle("uisoparm", "carve_1", "ownerop('carve_0') owneropgroup('group')", cache_previous_parms=True, handle_parms=["input", "k","onoff"] ) return template carve_python_states_v01.zip
-
Hi, I have an effect where I want to create multiple orbiting asteroids, eventually they will be fractured, constrained, and collide with each other as orbits change. So far I have put my RBD Packed Object into a MultiSolver with a POP Curve Force that references a path in a SOP solver as the first attached data, followed by a Bullet Solver. That works well for one asteroid, or for multiple asteroids on the same orbit. Im wondering if theres a way to only need to make one RBD Packed Object but have each named packed prim follow a different curve? It'd be even cooler to only have to make one POP Curve Force that actually references different paths per names, but if thats not possible then I will have to create a POP Curve Force for each asteroid, my question in that case is what parameter do I need to assign to my geo to be able to do this? I see under 'Bindings' on the POP Curve Force a channel named Geometry with "Geometry" as the default, if I change this to anything else my asteroids aren't affected by the force anymore, is there anyway to set this in SOPS per asteroid? multiple_orbits.hipnc
- 2 replies
-
- pop curve force
- binding
-
(and 1 more)
Tagged with: