Advertisement
thureinfree

tt hscript

Jun 24th, 2024 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. camera
  2. if($F >= ch("start") && $F < ch("start") + ch("length"), 360 * ($F - ch("start")) / ch("length"), 0)
  3.  
  4. lights
  5. if($F >= ch("start") && $F < ch("start") + ch("length"), -360 * ($F - ch("start")) / ch("length"), 0)
  6.  
  7.  
  8. import hou
  9.  
  10. # Get HDA node
  11. hda_node = hou.node("/obj/your_hda_node")
  12.  
  13. # Create nulls
  14. null_camera = hda_node.createNode("null", "null_camera")
  15. null_lights = hda_node.createNode("null", "null_lights")
  16.  
  17. # Set rotation expressions
  18. null_camera.parm("ry").setExpression("if($F >= ch(\"start\") && $F < ch(\"start\") + ch(\"length\"), 360 * ($F - ch(\"start\")) / ch(\"length\"), 0)", hou.exprLanguage.Hscript)
  19. null_lights.parm("ry").setExpression("if($F >= ch(\"start\") && $F < ch(\"start\") + ch(\"length\"), -360 * ($F - ch(\"start\")) / ch(\"length\"), 0)", hou.exprLanguage.Hscript)
  20.  
  21. # Add parameters to HDA
  22. length_parm = hda_node.addParmTuple(hou.StringParmTemplate("length", "Length", 1, default_value=("240",), naming_scheme=hou.parmNamingScheme.Base1))
  23. start_parm = hda_node.addParmTuple(hou.StringParmTemplate("start", "Start", 1, default_value=("1",), naming_scheme=hou.parmNamingScheme.Base1))
  24.  
  25. # Link parameters
  26. null_camera.parm("length").set(length_parm[0])
  27. null_camera.parm("start").set(start_parm[0])
  28. null_lights.parm("length").set(length_parm[0])
  29. null_lights.parm("start").set(start_parm[0])
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement