Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/12/2009 at 18:13, xxxxxxxx wrote:
User Information: Cinema 4D Version: 11 Platform: Windows ; Language(s) : C++ ;
--------- I am trying to set up so that the users of my planet generator plugin (which is an object plugin) can click a check box and set up looping orbits. I have it set up so that when the user enables orbit, they can drag another object into a link box and the new object then gets aligned to a spline that is the orbit path. My goal is then to allow the user to click a check box and this will set up a loop so that the new object orbits the planet continuously. I have been trying to set this up with keyframes. Here's what I have so far.
//Orbit Looping if (op->GetDataInstance()->GetBool(ORBIT_LOOP)) { LONG lngI = 0; Real nom; Real deNom; BaseTime btime = doc->GetTime(); btime.SetDenominator(op->GetDataInstance()->GetReal(ORBIT_SPEED)); btime.SetNominator(0); deNom = btime.GetDenominator(); for (lngI; lngI < 50; lngI++) { nom = btime.GetNominator(); btime.SetNominator(nom + deNom); GePrint("The NOM is: " + RealToString(btime.GetNominator())); //Add a key if (lngI == 1 || lngI == 3 || lngI == 5 ) { op->GetDataInstance()->SetReal(ORBIT_POSITION, 0); GePrint("lngI is ODD" + RealToString(op->GetDataInstance()->GetReal(ORBIT_POSITION))); } if (lngI == 2 || lngI == 4 || lngI == 6 ) { op->GetDataInstance()->SetReal(ORBIT_POSITION, 1.0); GePrint("lngI is EVEN" + RealToString(op->GetDataInstance()->GetReal(ORBIT_POSITION))); } CKey *key = track->GetCurve()->AddKey(btime,0); if (!key) return false; } }
I would like for the ORBIT POSITION to be at 0 on teh first pass, and then 100 on the second pass.. and to alternate back and forth until all keyframes are added and at each pass set a keyframe so that the object appears to continuously orbit the planet. As I am typing this I think it might be better to set up one loop and then to do a repeat command somehow.. like you can in the timeline.. is that possible?
Anyway, I would love to hear some ideas on how I could achieve this effectively.
Or any thoughts on the code I have provided.
Thanks.
~Shawn
On 21/12/2009 at 02:35, xxxxxxxx wrote:
You can set the track's loop mode with CTrack's SetAfter() and SetBefore() methods.
cheers, Matthias