Set Keyframe Interpolation



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 03/01/2010 at 23:23, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.5 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hey Folks,

    I'm working on a little animation workflow script that I nearly have working, but I'm stuck on one thing.

    Basically I have a script that when called jumps back a frame, selects the first child of the currently selected object and then records a keyframe for both objects. Then it deselects the child object and jumps back to the current frame.

    What I want it to do in addition to this is to set the keyframe interpolation for the keys on the child object only to Stepped, while leaving the keys on the original selected object as they are. I've tried a bunch of variations, deselecting the original object before switching the interpolation, but nothing works so far, all I get is the keys of all objects switching instead of just the ones I want.

    Is this possible? I believe R11 brought in more control over keys via Coffee but my understanding of this is a little limited right now.

    Any ideas appreciated, here's how the code looks right now.

      
        
        
           doc->StartUndo();  
             
           var ctrlr=doc->GetActiveObject();  
           var pivotNull=ctrlr->GetDown();// get 1st child of the controller (pivot null)  
             
           pivotNull->SetBit(BIT_AOBJ); // select the pivot null  
             
           CallCommand(12413); // Goto Prev Frame  
             
             
             
           CallCommand(12410);// Record key on active Objects (controller and Pivot Null)  
             
             
           /////// - Here is where I want to set the interpolation on the  
          // key on the Pivot Null to Stepped Interpolation  
             
           // this is what I'm trying but it selects ALL keys in the timeline -  
          // I just want the keys of the pivot   
          // null to be switched to stepped, not the ones on the Controller   
             
           CallCommand(465001012);// select all Keys < is there a select keys of one object version of this?  
           CallCommand(465001093);// set the selected keys to stepped  
             
             
             
             
           //  
           pivotNull#ID_USERDATA:1=1;  
           pivotNull->DelBit(BIT_AOBJ);//Deselect the Pivot Null again  
          CallCommand(12414); // Goto Next Frame *back to the original frame again)  
          
        
    
    Cheers,  
    Brian  
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 04/01/2010 at 20:22, xxxxxxxx wrote:

    No Ideas?

    I realise my question probably shows off my coding ignorance like a sore thumb, but I have taken this script a lot further since my original post.. I now have a fully working 'Move animation pivot' and 'Snap animation pivot' pair of scripts that I've translated from Mel script which are working great.. but I just can't figure out the Interpolation issue. I've looked in the SDK update and searched the forums here.

    Main thing really is just to know if this is at all possible in Coffee, I'm a little unclear as to what it can and can't do regarding keyframes but I know it's a bit limited. If I could just get it to select only the keys for a particular object I think I'd be there really.

    Cheers,
    Brian



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/01/2010 at 05:58, xxxxxxxx wrote:

    I got this code from a user over on CGTalk which seems like it should work but doesn't quite yet.
    It seems to search for a position track alright but I can't seem to make it select that track to make it active before running the 'step' command.

      
    //Change just the Position Y interpolation to stepped mode  
      
    var op = doc->GetActiveObject();  
    var ft = op->GetFirstCTrack(); //Get the first tag on the object  
     while(ft && ft->GetName() != "Position . Y") // if this name is not found  
      { ft = ft->GetNext(); } //keep looking  
    if(!ft) // if the name can't be found  
    {  
    println("Name Not Found"); //print this to the console. Then end script.   
    return;  
    }  
      
    CallCommand(465001093);// set the selected keys to stepped mode  
      
    

    Cheers,
    Brian



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/01/2010 at 06:42, xxxxxxxx wrote:

    It's not possible in COFFEE. Remember that you can have several timelines open and can have different selections. There is no way in COFFEE to select tracks, curves or keys because you can't access the timelines independently. More specifically there is no GetNBit() and ChangeNBit() function in COFFEE.

    This is all possible in C++ though and may be possible in Python as well.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 05/01/2010 at 09:30, xxxxxxxx wrote:

    Thanks for the confirmation, that will stop me wasting my time with it anyway! I did get another suggestion to call the Link TL/OM command with the object selected and then to switch the keys of the active object  to stepped. This works OK but isn't something I'd like to pass on to an animator to use as it's likely they might start working with TL/OM already enabled and then the toggle wouldn't work properly.

    Is there a way you can tell the Link TL/OM option to be definitely ON rather than just using the toggle command? This would be one way to ensure more consistency.

    Cheers,
    Brian


Log in to reply