Allocating Track types and loops



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

    On 04/11/2006 at 10:25, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10.0 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    I have two major concerns with my import plugin:

    How do I migrate the AllocTimeTrack() and BaseTrack::Alloc(type) methods over to CTrack::Alloc(baselist, descID)?

    How would one migrate old BaseSequence loops to what appears to be looping on the new CTrack?

    Information on these two areas would probably allow me to finish the migration of the import/export plugin from R8.5 to R10 and move on.

    Thank you very much,



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

    On 04/11/2006 at 12:55, xxxxxxxx wrote:

    I will take a look at your Track problems on Monday but I have to get some informations from the developers first.

    cheers and have a nice weekend,
    Matthias



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

    On 06/11/2006 at 01:31, xxxxxxxx wrote:

    Btw. did you take a look at the Morphmixer SDK example? There is the CTrack::Alloc used. Maybe this already helps you.

    I will take a look at the looping stuff.

    cheers,
    Matthias



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

    On 06/11/2006 at 01:40, xxxxxxxx wrote:

    As there are no sequences yet in the new timeline there are no loops. I am afraid you have to set keys for your loops.

    cheers,
    Matthias



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

    On 06/11/2006 at 12:34, xxxxxxxx wrote:

    _
    > Quote: Btw. did you take a look at the Morphmixer SDK example? There is the CTrack::Alloc used. Maybe this already helps you.
    >
    > * * *
    >
    > * * *

    _
    Oh, I know how to allocate the new CTrack - if it's one that has an associated DescID. But how do you allocate a Timetrack or PLATrack? These had special methods in previous SDKs - AllocTimeTrack() and BaseTrack::Alloc(Spla). There is no more Alloc(type) - none that I can find. What replaces "Spla" type when it now expects a DescID?

    Does one just do this? -

    CTrack::Alloc(op, DescID(DescLevel(Spla, DTYPE_????,0)));

    That just doesn't seem correct.

    Come on here. These guys (the developers) wrote this bugger - and they don't know how to allocate a PLA track and keys (or just won't say)? I surely haven't figured it out - I'm drawing blanks on this.



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

    On 06/11/2006 at 12:36, xxxxxxxx wrote:

    Quote: _As there are no sequences yet in the new timeline there are no loops. I am afraid you have to set keys for your loops.
    >
    > * * *
    _


    Not a big problem there. After talking to the customer, he didn't even know that there were animation loops in C4D! ;) His company doesn't use them, so I can safely ignore supporting them.

    Thanks,



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

    On 08/11/2006 at 02:31, xxxxxxxx wrote:

    ok, it seems there is a bug in the SDK for special tracks like PLA and Sound. For other tracks like Position/Scale/Rotation it works like this:

      
    CTrack::Alloc(op,DescID(DescLevel(ID_BASEOBJECT_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_X,DTYPE_REAL,0)));  
    CTrack::Alloc(op,DescID(DescLevel(ID_BASEOBJECT_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_Y,DTYPE_REAL,0)));  
    CTrack::Alloc(op,DescID(DescLevel(ID_BASEOBJECT_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_Z,DTYPE_REAL,0)));  
      
    CTrack::Alloc(op,DescID(DescLevel(ID_BASEOBJECT_SCALE,DTYPE_VECTOR,0),DescLevel(VECTOR_X,DTYPE_REAL,0)));  
    CTrack::Alloc(op,DescID(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_VECTOR,0),DescLevel(VECTOR_X,DTYPE_REAL,0)));  
    

    I let you know when I find a working solution for PLA tracks.

    cheers,
    Matthias



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

    On 08/11/2006 at 08:21, xxxxxxxx wrote:

    Thanks Matthias.

    I already have the PSR tracks sorted - just need to substitute AllocValueTrack() with CTrack::Alloc() as they are identical (both take the same arguments).

    Sad to hear that they haven't sorted PLA, Sound, etc. Has the SDK (resource) been updated between the demo and now-shipping full version of Cinema 4D? I haven't received my full versions yet, so can't compare them.

    Hope they sort this out soon. :)

    Thanks,



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

    On 09/11/2006 at 12:39, xxxxxxxx wrote:

    ok, for allocating PLA tracks you write something like this:

      
    mytrack = CTrack::Alloc(op,DescLevel(ID_ANIM_PLA,ID_ANIM_PLA,0));  
    if(mytrack) op->InsertTrackSorted(mytrack);  
    

    Problem is you have to manually include the ID declarations for the tracks (ID_ANIM_PLA, ID_ANIM_SOUND...) as they are not in the main c4d_symbols.h. You can find the declarations in the c4d_symbols.h in the newman folder in resources/modules. This seems like a bug/oversight to me but it will work. I reported this to the developers so chances are it will be fixed soon.

    hope this helps

    cheers,
    Matthias



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

    On 09/11/2006 at 13:23, xxxxxxxx wrote:

    Thank you very much, Matthias!

    Now for the fun part. After that, PLA keys still need to be allocated and, worst of all, their data set with the changed points. I see that the ckpla.res file has this:

    REAL     CK_PLA_BIAS { UNIT PERCENT; MIN -100.0; MAX 100.0; }
    BOOL     CK_PLA_CUBIC { }
    PLADATATYPE CK_PLA_DATA { }

    My best guess is that PLADATATYPE CK_PLA_DATA is where either the VariableTag with the points is stored or the points directly (?). I'm leaning towards the latter since this appears to be a custom data type, not just a link or something.

    Again, thank you for your work so far!



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

    On 11/11/2006 at 08:25, xxxxxxxx wrote:

    Sorry I have no answer for the key allocation yet. I will let you know when I know how to do so.

    cheers,
    Matthias



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

    On 29/11/2006 at 03:21, xxxxxxxx wrote:

    Here is how you can write PLA keys. It works like this, change the points in your object, then run FillKey, after this reset points if needed. Little code exapmle:

      
    CTrack *mytrack = CTrack::Alloc(op,DescLevel(ID_ANIM_PLA,ID_ANIM_PLA,0));  
    if(mytrack) op->InsertTrackSorted(mytrack);  
    CCurve *seq=mytrack->GetCurve(); if (!seq) return FALSE;  
    BaseTime time = BaseTime(0);  
    CKey *key = seq->AddKey(time); if (!key) return FALSE;  
    if (!mytrack->FillKey(doc,op,key)) return FALSE;  
    

    hope this helps

    cheers,
    Matthias



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

    On 29/11/2006 at 07:11, xxxxxxxx wrote:

    Is there a similar way to migrate COFFEE scripts for PLA keys allocation?
    Thanks...
    Riccardo



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

    On 29/11/2006 at 12:38, xxxxxxxx wrote:

    Thank you very much, Matthias.

    A quick question. So, if I'm converting standard animation of a polygon object to PLA animation, I would just animate (AnimateTrack() or whatnot) as before (as this changes the points on the object) and then run FillKey to set those current points as the PLA point data?

    Will try this out soon (too many things happening at once here!). :)



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

    On 29/11/2006 at 12:52, xxxxxxxx wrote:

    Quote: Originally posted by kuroyume0161
    >
    > * * *
    >
    > A quick question. So, if I'm converting standard animation of a polygon object to PLA animation, I would just animate (AnimateTrack() or whatnot) as before (as this changes the points on the object) and then run FillKey to set those current points as the PLA point data?
    >
    >
    > * * *

    yes, that should do the trick. afaik there is a more convenient way to this planned for future sdk versions, but for now this is the way to go.

    cheers,
    Matthias



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

    On 03/12/2006 at 07:58, xxxxxxxx wrote:

    Thank you, Matthias. Now it seems, that I can fix all my animation code to R10. One little question:

    I'm using DelKey(index) to delete obsolete keys after creating my tracks and keys for every frame. Do I have to add CKey::Free() all the same or does DelKey() do it for me? In R9 I used
            key->Remove();
            BaseKey::Free(key);
    now I just use
            seq->DelKey(index);

    Is that clean?



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

    On 03/12/2006 at 13:24, xxxxxxxx wrote:

    delighted too early.

    The optimization I described above works fine with value keys, but I can't figure out how to access the data of data keys. I use the following code to write data keys and that works:

      
         track = op->FindCTrack(descID);  
         if (!track)  
         {  
              track = CTrack::Alloc(op, descID);   
              if (!track)   
                   return FALSE;  
              op->InsertTrackSorted(track);  
         }  
         seq = track->GetCurve();   
         if (!seq)   
              return FALSE;  
         key = seq->AddKey(time);  
         if (!key)   
              return FALSE;  
    //     key->SetGeData(seq, data); <<-- DOESN'T WORK  
         if (!track->FillKey(doc, op, key))   
              return FALSE;  
    

    But how can I access the data? I tried it with:

      
         track = op->FindCTrack(descID);               // check if track exists  
         if (!track)  
              return;  
         seq = track->GetCurve();   
         if (!seq)  
              return;  
         nKeys = seq->GetKeyCount();  
         if (nKeys < 2)  
              return;  
         key = seq->GetKey(0);  
         if (!key)  
              return;  
         data = key->GetGeData();  
         type = data.GetType();  
         if ((type != DA_REAL) && (type != DA_LONG) && (type != DA_STRING))  
              return;  
    

    type is always NIL, except if it is a string(!), very curious. The code also works for data keys that record visibilities (e.g. ID_BASEOBJECT_VISIBILITY_EDITOR). Again: The tracks and keys are ok, as checked in the timeline. I also tried key->GetParameter(descID, data, 0)), but that fails.

    <some times later...>

    Now I use a (hopefully temporary) workaround with key->GetValue(), if none of the supported types can't be detected. Curiously, that works. Looks not clean, looks buggy.

    Waiting for the SDK 10...



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

    On 03/12/2006 at 14:42, xxxxxxxx wrote:

    Ok, back to PLA. Writing keys as described above by Matthias works fine. Step by step I'll get an understanding of the new animation system. It seems to be much clearer and easier especially by this FillKey() killer function.

    But again I have the problem, that I can't figure out, how to get access to the PLA key data. Formerly, there was a tag, that stored the points. How is it organized now?



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

    On 05/03/2007 at 05:49, xxxxxxxx wrote:

    Hi Robert!

    Have you found out anything more on the track allocation matter? Like for allocating plugin tracks?

    /Jonas



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

    On 06/03/2007 at 07:05, xxxxxxxx wrote:

    PLA data access is currently not possible in R10.0.
    This will be fixed with the next bugfix update.


Log in to reply