Jump to content

keyframes in python dont animate objects?


katisss

Recommended Posts

Can you see the keys in the graph editor? If not, then it probably isn't applying the keys properly. Below is a section of a script that sets key frames for reference.

    # Prepare keys for emission
    emissionKey1 = hou.Keyframe()
    emissionKey1.setFrame(startFrame)
    emissionKey1.setValue(0)
    emissionKey1.setExpression("linear()", hou.exprLanguage.Hscript)

    emissionKey2 = hou.Keyframe()
    emissionKey2.setFrame(startFrame + startPadding)
    emissionKey2.setValue(1)
    emissionKey2.setExpression("linear()", hou.exprLanguage.Hscript)

    emissionKey3 = hou.Keyframe()
    emissionKey3.setFrame(endFrame - endPadding)
    emissionKey3.setValue(1)
    emissionKey3.setExpression("linear()", hou.exprLanguage.Hscript)

    emissionKey4 = hou.Keyframe()
    emissionKey4.setFrame(endFrame)
    emissionKey4.setValue(0)
    emissionKey4.setExpression("linear()", hou.exprLanguage.Hscript)

    # Set keys for source emission
    amountParm = hou.parm('/obj/volumeSim/apply_source/scale')
    amountParm.deleteAllKeyframes()
    amountParm.setKeyframe(emissionKey1)
    amountParm.setKeyframe(emissionKey2)
    amountParm.setKeyframe(emissionKey3)
    amountParm.setKeyframe(emissionKey4)

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...