Script to remove unused keys

Puppeteer has a habit of adding a key for everything when you click the dot (it seems to record everything too), rather than only things that changed between one pose and the next.  This is extremely irritating (hint to Daz Devs... Puppeteer concept is great and very useful, but has a poor impl/usability).

Does anybody know of a "cleanup" script that'll inspect and remove any keys with values that don't change between one time and the next?  I imagine it's not all that difficult to write either, though I'm not sure how.

Comments

  • Richard HaseltineRichard Haseltine Posts: 101,066

    Two consecutive keys with the same value may not be unused - they may be acting as pins through which a curve runs, or acting to keep the line straight in the absence of adjusting the interpolation.

  • RobinsonRobinson Posts: 751

    Yes, but in this case where I know what I've changed and get a thousand extra keys added by puppeteer regardless (I may exaggerate, I haven't counted), it would be nice to be able to delete them.  I mean that would be easier than Daz devs changing Puppeteer such that it only recorded what changed (I live in hope that this useful tool gets some love).

  • wolf359wolf359 Posts: 3,828
    There is a general keyframe culling script by Mcasual call Decimate. ....not what you are seeking but can get the total number down to manageable levels.
  • RobinsonRobinson Posts: 751
    edited April 2021

    wolf359 said:

    There is a general keyframe culling script by Mcasual call Decimate. ....not what you are seeking but can get the total number down to manageable levels.

    Yea that's not what I mean.  If you use Puppeteer, when you click a dot it'll add a keyframe for basically everything, as everything is recorded when you added the dot in the first place.  99.9% of these keys are useless and eat performance (or have to be found and manually deleted if you want to animate that particular property).  Ideal solution is to give Puppeteer an upgrade so it only records certain subsets (just bones, for example, or just an arm, etc.).  This would make layers actually useful.  Anyway it's these useless keys I want to remove.

    Edit: if there's a dev out there who understands the framework (I'm a dev but I know I'll spend 3 months learning it before I can do anything useful), I'd definitely buy a new, upgraded Puppeteer plugin that's a bit more intelligent.

    Post edited by Robinson on
  • wolf359wolf359 Posts: 3,828
    edited April 2021

    I understood what you were asking.

    I made a feature length animated film with Daz studio  in which
    puppteer was used with many other methods
    including BVH import from Iclone, which  presented the same
    challenge as puppeteer or baking aniblocks to the timeline.


    100 percent population of every frame of every channel with a keyframe!!.angry

    This happens by default with every motion data "recording" system I have ever used.
    linear or nonlinear.( Maxon C4D, Iclone ,Blender,Lightwave)

    Although iclone has a selectable body part exclusion option for motion clip recording and I beleive Blender does although have yet to find it.
    I would imagine Maya/MOBU does also

    Even in systems where you can isolate specific channels such as a wrist,shoulder etc if the "recording" lasts for 20 seconds @ 30 FPS
    you will have to deal with 600  packed keyframes for that channel of you wish to refine /edit the motion in the spline graph editor.

    Blender ,Maya, Maxon etc have native culling options for reducing keys
    for easier spline graph editing.

    I was suggesting the Mcasual script as general key frame culling does not exsit in Daz studio and you really need it for editing puppeteer recordings or baked aniblocks

    Captur crpde.png
    1898 x 1080 - 295K
    Post edited by wolf359 on
  • RobinsonRobinson Posts: 751
    edited April 2021

    Of course there no implicit temporal ordering of dots in Puppeteer, so it's not possible to automatically filter out properties that aren't needed because they haven't changed.  So when the user adds a dot it has to record all properties (subject to aforementioned filter of course, i.e. each layer has a filter).  When the user clicks a dot, the way it's applied to the timeline could be as simple as, "if there's a previous key to this one with the same value as the value stored in the dot, or no previous key and the value is default, don't add a new key".

     

    I think that would work (perhaps there are some tricky corner cases I haven't thought about...).

     

    Whilst I'm blue-sky thinking on this, Puppeteer should snap dots to the grid (optional).  I get so triggered when things aren't aligned!  I'd love to do this myself actually.  I did get the plugin framework to compile and the hello world example to work, but the UI framework is a mystery to me and I just don't have to the time to learn it.  Perhaps I should make it a project...

     

    Post edited by Robinson on
  • duckdoom5duckdoom5 Posts: 11
    edited October 2021

    I know this is quite an old post, but I was looking for the same sort of thing. I couldn't find anything online, so I just went ahead and created the script myself. I've added it for anyone who is interested.

    I've tested it many times on my current scenes and everything seems to work fine, but please be warned that this could mess with your animations.

     

    This script will check for keyframes that stay the same over a span of 3 frames. If it finds one it removes the middle key and sets the interpolation value of the other two to constant to make sure no curves change the animation. If you wish to add the curves you can change the interpolation option. (Daz's scripting engine is slow, so it might freeze for a while on big scenes.)

     

    MAKE A BACKUP BEFORE YOU USE THIS!

    dsa
    dsa
    RemoveUnusedKeyframes.dsa
    6K
    Post edited by duckdoom5 on
  • duckdoom5 said:

    I know this is quite an old post, but I was looking for the same sort of thing. I couldn't find anything online, so I just went ahead and created the script myself. I've added it for anyone who is interested.

    I've tested it many times on my current scenes and everything seems to work fine, but please be warned that this could mess with your animations.

     

    This script will check for keyframes that stay the same over a span of 3 frames. If it finds one it removes the middle key and sets the interpolation value of the other two to constant to make sure no curves change the animation. If you wish to add the curves you can change the interpolation option. (Daz's scripting engine is slow, so it might freeze for a while on big scenes.)

     

    MAKE A BACKUP BEFORE YOU USE THIS!

     

    I am facing exactly the same problem right now and was looking for a similar script.

    If I couldn't find it, I was going to make my own, but duckdoom5, your script worked wonderfully and perfectly!

    Not only that. Your script also saved me a scene file that had become bloated and unreadable.

    The amount of time this has saved me is immeasurable. Thank you so much!!!!

Sign In or Register to comment.