|
@@ -2,6 +2,9 @@ import hou
|
|
|
import math
|
|
|
import random
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
this_node = hou.pwd()
|
|
|
|
|
|
|
|
@@ -127,4 +130,45 @@ def move_legs_maxlen():
|
|
|
t = hou.hmath.buildTranslate(lt_r[0], 0, lt_r[2])
|
|
|
leg.setParmTransform(t)
|
|
|
|
|
|
-#move_legs_maxlen()
|
|
|
+#move_legs_maxlen()
|
|
|
+
|
|
|
+
|
|
|
+if hou.frame() == 1:
|
|
|
+ """
|
|
|
+ delete all keyframes if rewound
|
|
|
+ """
|
|
|
+ for no, leg in enumerate(legs):
|
|
|
+ parm = leg.parmTuple("t")
|
|
|
+ parm.deleteAllKeyframes()
|
|
|
+
|
|
|
+
|
|
|
+def set_keys():
|
|
|
+ """
|
|
|
+ Set keyframe for all legs
|
|
|
+ """
|
|
|
+ for no, leg in enumerate(legs):
|
|
|
+
|
|
|
+ pos = hou.Vector3(leg.parmTuple("t").eval())
|
|
|
+
|
|
|
+ kfx = hou.Keyframe()
|
|
|
+ kfx.setFrame(hou.frame())
|
|
|
+ kfx.setValue(pos[0])
|
|
|
+
|
|
|
+ kfy = hou.Keyframe()
|
|
|
+ kfy.setFrame(hou.frame())
|
|
|
+ kfy.setValue(pos[1])
|
|
|
+
|
|
|
+ kfz = hou.Keyframe()
|
|
|
+ kfz.setFrame(hou.frame())
|
|
|
+ kfz.setValue(pos[2])
|
|
|
+
|
|
|
+ tchanx = hou.parm('../' + leg.name() + '/tx')
|
|
|
+ tchany = hou.parm('../' + leg.name() + '/ty')
|
|
|
+ tchanz = hou.parm('../' + leg.name() + '/tz')
|
|
|
+
|
|
|
+ tchanx.setKeyframe(kfx)
|
|
|
+ tchany.setKeyframe(kfy)
|
|
|
+ tchanz.setKeyframe(kfz)
|
|
|
+
|
|
|
+
|
|
|
+set_keys()
|