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
    • Recent
    • Tags
    • Users
    • Login

    Storing rotation in keyframes

    Scheduled Pinned Locked Moved SDK Help
    2 Posts 0 Posters 197 Views
    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 Offline
      Helper
      last edited by

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

      On 27/12/2009 at 07:12, xxxxxxxx wrote:

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

      ---------
      So I am using the same type of code that I did before to set keyframes for rotation.   With the code that I have, I am able to set keyframes on the rotation track but I am not able ot access the rotation.h track on it's own.   How would I create the track for just rotation.h?

      Here's the code I have.

        
      //Planet CLOCKWISE Rotation  
            if (op->GetDataInstance()->GetBool(ENABLE_ROTATION)  &&  prnt)  
            {  
                          
                //Insert the Track  
                CTrack *track = prnt->FindCTrack(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_REAL,0));  
                if (!track)  
                    {  
                        track = CTrack::Alloc(prnt,DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_REAL,0));  
                        if (!track) return FALSE;  
                        prnt->InsertTrackSorted(track);  
                    }  
                          
                    //Get the Base Time  
                    BaseTime bstime = doc->GetTime();  
                      
                    //Set the Frame Rate (FPS)  
                    bstime.SetDenominator(op->GetDataInstance()->GetReal(ROTATION_SPEED));  
                          
                    Real deNomin;  
                    deNomin = bstime.GetDenominator();  
        
                      
                      
                    //First Key will be set at 0  
                    bstime.SetNominator(0);  
                    CKey *keyX = track->GetCurve()->AddKey(bstime,0);  
                    if (!keyX) return false;  
                       
                    keyX->SetValue(track->GetCurve(),0); //Set Position to 0  
                      
                    //Second Key will be placed at 1.5 times the location of the frame rate (i.e. if FPS is set to 30, then the key will be placed at frame 45.  
                    bstime.SetNominator(deNomin * 1.5);  
                    CKey *keyX2 = track->GetCurve()->AddKey(bstime,0);  
                    if (!keyX2) return false;  
                    keyX2->SetValue(track->GetCurve(),360); //Set Position to 360  
        
                    track->SetAfter(CLOOP_REPEAT);  
            }  
        
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 27/12/2009 at 23:52, xxxxxxxx wrote:

        To add a Rotation.H tarck you do something like this:

          
        CTrack *track = op->FindCTrack(DescID(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_VECTOR,0), DescLevel(VECTOR_X,DTYPE_REAL,0)));  
        if (!track)  
        {  
          track = CTrack::Alloc(op,DescID(DescLevel(ID_BASEOBJECT_ROTATION,DTYPE_VECTOR,0), DescLevel(VECTOR_X,DTYPE_REAL,0)));  
          if (!track) return FALSE;  
          op->InsertTrackSorted(track);  
        }  
        

        This is also mentioned in the docu under CTrack::Alloc with some other lines of example code.

        cheers,
        Matthias

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