Moving keyframes



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

    On 14/11/2008 at 12:13, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.1 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hello,

    is it possible to move the keyframes of an object? I get the impression that these commands (bottom post) may hold the answer, but I don't know where to start. With R11 is it possible to shift Motion Clips along the timeline?

    Thanks

    Jon



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

    On 14/11/2008 at 13:12, xxxxxxxx wrote:

    You can move keyframes in R11 but not R10 and there is no access to R11 Motion Clips (not even in C++ afaict). The COFFEE in R10 was still R9.5-related but the entire animation system changed in R10.



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

    On 14/11/2008 at 13:21, xxxxxxxx wrote:

    Ah OK... thanks for all the help Robert. So how would I go about doing that in R11? I'd like to have a crack on the demo.



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

    On 14/11/2008 at 14:10, xxxxxxxx wrote:

    Good question. :) I haven't used any new R11 COFFEE features yet. As that post you linked pointed out, there are a new set of classes for the new animation system - but no COFFEE docs yet to explain the innards. I'd suspect some similarities to the same C++ classes but then... (and Matthias points that out)

    The problem is how to get at the object's animation tracks. It may be as simple as op->GetFirstTrack() or it may be the new C++ way as in op->GetFirst C Track().



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

    On 14/11/2008 at 14:23, xxxxxxxx wrote:

    Thanks again. I'll have a play when I get a chance, and let you know of any findings if I have any luck (with my limited experience I wouldn't hold your breath though ;-)

    Some official documentation would be very welcome.

    Jon



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

    On 17/11/2008 at 11:13, xxxxxxxx wrote:

    OK... with R11 I've managed to change the key frame values:

    main(doc,op)
    {
    var obj = doc->FindObject("Cube");
    var track = obj->GetFirstCTrack();
    var myKey = track->GetCurve()->GetKey(0); // key 0 is first key frame
    myKey->SetValue(track->GetCurve(),70); // in this case, changes x pos to 70 m
    }

    That's all good, but I can't figure out how to move the keyframe positions in the timeline. This doesn't work (an attempt to move the key frame to frame 10:

    myKey->SetTime(10,doc->GetFps());

    Does anyone know how to achieve this?

    Thanks

    Jon



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

    On 17/11/2008 at 11:32, xxxxxxxx wrote:

    In C++, it is: key->SetTime(CCurve, BaseTime);

    So, you might want to try it like this:

    var time = BaseTime();
    myKey->SetTime(track->GetCurve(), time->SetFrame(10,doc->GetFps()));



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

    On 17/11/2008 at 11:53, xxxxxxxx wrote:

    Hey Robert,

    thanks for the super quick reply!

    An error is thrown at BaseTime() ... 'CLASS is not a function'.

    I tried swapping with:

    var time = myKey->GetTime();

    ... but nothing happens.

    Any thoughts?



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

    On 17/11/2008 at 12:58, xxxxxxxx wrote:

    That's interesting considering there is a function in the BaseTime class BaseTime(). :)

    You could try:

    var time = doc->GetTime();

    and go from there.



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

    On 17/11/2008 at 15:25, xxxxxxxx wrote:

    Thanks again, but no joy. I've tried all manner of nonsense, but I'm shooting in the dark.

    Is this to be unknown until official documentation?



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

    On 17/11/2008 at 15:56, xxxxxxxx wrote:

    I think you must fill the BaseTime with a value.

    var bt = new(BaseTime);
    bt->SetData(/*the time you want*/);

    You then use bt as your time to set a key (or anything else).

    Cheers
    Lennart



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

    On 18/11/2008 at 02:50, xxxxxxxx wrote:

    Blimey what a palaver that was!

    Thanks so much Robert and Lennart for helping to steer me in the right direction.

    This seems to work:

    > \> main(doc,op) \> { \> \> var obj = doc->FindObject("Cube"); \> var track = obj->GetFirstCTrack(); \> var myKey = track->GetCurve()->GetKey()); // key 0 is first key \> var time = new(BaseTime); \> time = doc->GetTime(); \> myKey->SetTime(track->GetCurve(), time->SetFrame(10,doc->GetFps())); // move key frame to frame 10 \> \> } \>



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

    On 18/11/2008 at 04:38, xxxxxxxx wrote:

    Apologies, major balls-up!

    Above code doesn't work (aside from typo 'GetKey(0)') - don't know what's going on - I did get it to work, but not with above code. Aaah!



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

    On 18/11/2008 at 05:14, xxxxxxxx wrote:

    Phew! I'm able to wipe that ostrich egg off my face...

    main(doc,op)
    {

    var obj = doc->FindObject("Cube");
    var track = obj->GetFirstCTrack();
    var myKey = track->GetCurve()->GetKey(0)); // key 0 is first key
    var time = new(BaseTime);
    time->SetFrame(10, doc->GetFps()); // move key frame to frame 10
    myKey->SetTime(track->GetCurve(), time);

    }


Log in to reply