Jump to content

Convert Channels To Keyframes


Lyonz

Recommended Posts

Hey All,

Wondering is it possible to convert channel referenced animation to keyframes ? As i am driving a fan in dops by referencing animation created in sops but is not updating the position when simulating.

Cheers

Lyonz

Link to comment
Share on other sites

Hi Lyonz,

I have had a same problem then I made a script.

Just put this in new shelf tool then push the button :)

sel = hou.selectedNodes()

parms = sel[0].parms()
keyedParmList = []
parmNames = []
for i in parms:
    if i.isTimeDependent() == 1:
        keyedParmList.append(i)
        parmNames.append(i.description() + "(" + i.name() + ")")

bakes = hou.ui.selectFromList(parmNames, message='Select Parms to bake key')

framerange = range(int(hou.expandString('$RFSTART')), int(hou.expandString('$RFEND')) + 1 )

for i in bakes:
    keyVals = {}
    for kf in framerange:
        keyVals[kf] = keyedParmList[i].evalAtFrame(kf)

    keyedParmList[i].deleteAllKeyframes()

    for kf in framerange:
        setKey = hou.Keyframe()
        setKey.setFrame(kf)
        setKey.setValue( keyVals[kf] )

        keyedParmList[i].setKeyframe(setKey)

Thanks,

Ryoji

Edited by ryoji
  • Like 1
Link to comment
Share on other sites

Hi Lyonz,

I have had a same problem then I made a script.

Just put this in new shelf tool then push the button :)

sel = hou.selectedNodes()

parms = sel[0].parms()
keyedParmList = []
parmNames = []
for i in parms:
    if i.isTimeDependent() == 1:
        keyedParmList.append(i)
        parmNames.append(i.description() + "(" + i.name() + ")")

bakes = hou.ui.selectFromList(parmNames, message='Select Parms to bake key')

framerange = range(int(hou.expandString('$RFSTART')), int(hou.expandString('$RFEND')) + 1 )

for i in bakes:
    keyVals = {}
    for kf in framerange:
        keyVals[kf] = keyedParmList[i].evalAtFrame(kf)

    keyedParmList[i].deleteAllKeyframes()

    for kf in framerange:
        setKey = hou.Keyframe()
        setKey.setFrame(kf)
        setKey.setValue( keyVals[kf] )

        keyedParmList[i].setKeyframe(setKey)

Thanks,

Ryoji

Cheers really appreciate it will test it out soon

Lyonz

Link to comment
Share on other sites

Hey All,

Wondering is it possible to convert channel referenced animation to keyframes ? As i am driving a fan in dops by referencing animation created in sops but is not updating the position when simulating.

Cheers

Lyonz

I'm pretty sure, there is another, more procedural way of doing this. Try to figure out, why dops didn't updates correctly. Perhaps "Set Always" should be set on some data....

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...