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

    Generate pos and rot anim. tracks

    SDK Help
    0
    3
    247
    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/09/2004 at 00:12, xxxxxxxx wrote:

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

      ---------
      Hi.
      How can i generate position and rotation tracks (with anim. keys / values on keys) for some objects?

      Thx for answers.

      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/09/2004 at 05:30, xxxxxxxx wrote:

        Something like this:

          
        // Create KeyFrame for specified BaseDocument doc, BaseObject obj, type(id, sid) and Real value at Real frame  
        void CreateKeyFrame(BaseDocument *doc, BaseObject* obj, LONG id, LONG sid, Real frame, Real value)  
        {  
             BaseTime time = BaseTime::BaseTime(frame, doc->GetFps());  
             BaseTrack *track;  
             BaseSequence *seq;  
             BaseKey *key;  
             AnimValue *av;  
          
             // Add KeyFrame  
             if (!(track = AllocValueTrack(obj, DescID(DescLevel(id),DescLevel(sid, DTYPE_REAL, 0))))) throw ErrorException(ERROR_MEMORY, "CreateKeyFrame.track");  
             obj->InsertTrackLast(track);  
          
             if (!(seq = track->AutoAddSequence(doc,time))) throw ErrorException(ERROR_MEMORY, "CreateKeyFrame.seq");  
             if (!(key = BaseKey::Alloc(seq->GetType()))) throw ErrorException(ERROR_MEMORY, "CreateKeyFrame.key");  
             if (!(av = GetKeyValue(key))) throw ErrorException(ERROR_MEMORY, "CreateKeyFrame.av");  
          
             av->value = value;  
             key->SetTime(time);  
             seq->InsertKey(key);  
        }  
        

        id is the track ID - i.e.: ID_BASEOBJECT_POSITION (see .res files for ids for tracks).

        sid is the sub ID - i.e.: VECTOR_X, VECTOR_Y, VECTOR_Z

        Robert

        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/09/2004 at 05:45, xxxxxxxx wrote:

          Thx you very much!

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