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);
}