Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- camera
- if($F >= ch("start") && $F < ch("start") + ch("length"), 360 * ($F - ch("start")) / ch("length"), 0)
- lights
- if($F >= ch("start") && $F < ch("start") + ch("length"), -360 * ($F - ch("start")) / ch("length"), 0)
- import hou
- # Get HDA node
- hda_node = hou.node("/obj/your_hda_node")
- # Create nulls
- null_camera = hda_node.createNode("null", "null_camera")
- null_lights = hda_node.createNode("null", "null_lights")
- # Set rotation expressions
- null_camera.parm("ry").setExpression("if($F >= ch(\"start\") && $F < ch(\"start\") + ch(\"length\"), 360 * ($F - ch(\"start\")) / ch(\"length\"), 0)", hou.exprLanguage.Hscript)
- null_lights.parm("ry").setExpression("if($F >= ch(\"start\") && $F < ch(\"start\") + ch(\"length\"), -360 * ($F - ch(\"start\")) / ch(\"length\"), 0)", hou.exprLanguage.Hscript)
- # Add parameters to HDA
- length_parm = hda_node.addParmTuple(hou.StringParmTemplate("length", "Length", 1, default_value=("240",), naming_scheme=hou.parmNamingScheme.Base1))
- start_parm = hda_node.addParmTuple(hou.StringParmTemplate("start", "Start", 1, default_value=("1",), naming_scheme=hou.parmNamingScheme.Base1))
- # Link parameters
- null_camera.parm("length").set(length_parm[0])
- null_camera.parm("start").set(start_parm[0])
- null_lights.parm("length").set(length_parm[0])
- null_lights.parm("start").set(start_parm[0])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement