Using CKey to obtain Rotational values?



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

    On 16/03/2009 at 08:37, xxxxxxxx wrote:

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

    ---------
    Hi all,

    I am trying to write a custom exporter in either COFFEE (which I've already started) or C++ which I may have to turn to. Essentially I have a series of animated objects and I want to write an export plugin that takes the rotational value of those objects at all their key frames, i.e.

    Object 1: frame 1: h=12degrees, p=45degrees
    Object 2: frame 1: h=15degrees, p=32degrees
    .
    .
    . to n objects
    Object 1: frame 2: h=32degrees, p=48degrees
    Object 2: frame 2: h=16degrees, p=33degrees
    .
    .
    . to n objects... to n frames
    (I know the output is radians but you get the idea)

    and outputs them to a text file or XML file.

    so, questions:
    1. Now, I've seen in other posts that apparently the function of analyzing the key value from the old Key class (i.e. GetValue()) won't allow me to access PSR values in COFFEE but will it now with the new CKey class?

    getValue from this class (in COFFEE) seems to output the position.x but I can't seem to get it to output any other data from the key.

    2. If I'm not able to do this within COFFE... can it be done in C++ using the SDK? if so, how?

    thanks for you time!

    Stuart



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

    On 19/03/2009 at 04:40, xxxxxxxx wrote:

    It seems that it is not possible to retrieve the track's description ID in COFFEE. So I think it may be not possible in COFFEE after all. In C++ it is fairly easy. You just step through the tracks and check for their description ID. Here is a little example checking for position and rotation tracks.

    > \> Bool MenuTest::Execute(BaseDocument \*doc) \> { \>      BaseObject \*op = doc->GetActiveObject(); \> \>      CTrack \*track = NULL; \>      track = op->GetFirstCTrack(); \> \>      while(track) \>      { \>           if(track->GetDescriptionID() == DescID(DescLevel(ID_BASEOBJECT_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_X,DTYPE_REAL,0))) \>           { \>                GePrint("X position"); \>           } \>           else if(track->GetDescriptionID() == DescID(DescLevel(ID_BASEOBJECT_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_Y,DTYPE_REAL,0))) \>           { \>                GePrint("Y position"); \>           } \>           else if(track->GetDescriptionID() == DescID(DescLevel(ID_BASEOBJECT_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_Z,DTYPE_REAL,0))) \>           { \>                GePrint("Z position"); \>           } \>           else if(track->GetDescriptionID() == DescID(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_VECTOR,0),DescLevel(VECTOR_X,DTYPE_REAL,0))) \>           { \>                GePrint("H rotation"); \>           } \>           else if(track->GetDescriptionID() == DescID(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_VECTOR,0),DescLevel(VECTOR_Y,DTYPE_REAL,0))) \>           { \>                GePrint("P position"); \>           } \>           else if(track->GetDescriptionID() == DescID(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_VECTOR,0),DescLevel(VECTOR_Z,DTYPE_REAL,0))) \>           { \>                GePrint("B position"); \>           } \> \>           track = track->GetNext(); \>      } \>       \>      return TRUE; \> } \>

    cheers,
    Matthias


Log in to reply