Browse Source

keyframed walk ready for lag

Johann Woelper 8 years ago
parent
commit
377308197e
2 changed files with 45 additions and 1 deletions
  1. BIN
      procwalk/walk.hiplc
  2. 45 1
      procwalk/walk.py

BIN
procwalk/walk.hiplc


+ 45 - 1
procwalk/walk.py

@@ -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()