Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to create pos/rot tracks/seq/keys?

    SDK Help
    0
    2
    399
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

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

      On 22/02/2003 at 05:07, xxxxxxxx wrote:

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

      ---------
      Hi,
      i took the morphmixer sdk example as a base to create standard position and rotation tracks, but i can't figure out how to set up the right value descriptions.
      I just want to record positions and rotations of an object , that my plugin moves. By using GetDescriptionID() I found out, that e.g. position tracks have the ID 903, but when I use this, I'll get only Position Tracks without the splitting to the vector components. And since the AnimValue struct that GetKeyValue() returns accepts Real values only, I really don't know how to go on.
      Thanks for any help.
      Klaus Heyne

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

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

        On 22/02/2003 at 06:53, xxxxxxxx wrote:

        Puh! OK. I've got it.
        By random, I found the description of the function

            
            
            Bool CheckDescID(const DescID& searchid, const AtomArray& ops, DescID* completeid)
        

        . There war an example:
        >>For example, if you pass
         
          DescID(DescLevel(ID_BASEOBJECT_POSITION, 0, 0), DescLevel(VECTOR_X, 0, 0))
         
        it will return
        ...<<
        This was the missing puzzle part:

            
            
            
            
            static Bool Create_Key(BaseDocument *doc, BaseObject *op, const BaseTime &time, LONG index, Vector value)  
            {
            
            
            
            
             DescID descID;  
             BaseTrack *track;  
             BaseSequence *seq;  
             BaseKey *key;  
             AnimValue *av;  
             Real val[3];  
             val[0] = value.x;  
             val[1] = value.y;  
             val[2] = value.z;  
             LONG i;
            
            
            
            
             for (i=0; i<3; i++)  
             {
            
            
            
            
             // check if track exists  
              descID = DescID(DescLevel(index, 0, 0), DescLevel(VECTOR_X+i, 0, 0));  
              track = op->FindTrack(descID);  
              if (!track)  
              {  
               track = AllocValueTrack(op,descID); if (!track) return FALSE;  
               op->InsertTrackLast(track);  
              }
            
            
            
            
             // check for sequence  
              seq = NULL;  
              for (seq = track->GetFirstSequence(); seq; seq=seq->GetNext())  
               if (time>=seq->GetT1() && time<=seq->GetT2())  
                break;
            
            
            
            
              if (!seq)  
              {  
               seq = track->AutoAddSequence(doc,time);   
               if (!seq) return FALSE;  
              }
            
            
            
            
              key = BaseKey::Alloc(seq->GetType()); if (!key) return FALSE;
            
            
            
            
              av = GetKeyValue(key); if (!av) return FALSE;
            
            
            
            
              av->value = val[i];
            
            
            
            
              key->SetTime(time);  
              seq->InsertKey(key);  
             }
            
            
            
            
             return TRUE;  
            
        

        Unfortunately, I can't really record the object's movement by now, because when the first sequence is created, my expression plugin can't move the object any more, although the priority is lower than animation (EXECUTION_EXPRESSION). 😞

        1 Reply Last reply Reply Quote 0
        • First post
          Last post