Identify a track
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/09/2011 at 23:04, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R12
Platform:
Language(s) : C++ ; PYTHON ;---------
Hi,this is actually a Python question but I think it's the same in C++.
How can I identifiy a CTrack object ? I mean, calling BaseList2D.GetCTracks() returns all CTracks of the object. But how can I know from what parameter this track is ? I'd need to find all rotation keys and modify their values.Thanks.
-Niklas -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2011 at 08:01, xxxxxxxx wrote:
I usually loop through the Timeline hierarchy to find specific objects and their children(their tracks).
The same way I loop through the regular OM hierarchy.Here's an old Coffee example:
var op = doc->GetActiveObject(); var ft = op->GetFirstCTrack(); //Get the first tag on the object while(ft && ft->GetName() != "Position . Y") //If this name is not found { ft = ft->GetNext(); //keep looking } if(!ft) //If the name isn't found { println("Name Not Found"); //print this to the console }
Note: The naming structure for tracks is a bit strange. There's a space before and after the DOT.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2011 at 09:45, xxxxxxxx wrote:
There are some more efficient Methods than comparing to a String (which is never a good thing). Your code may already fail on a Cinema version having a different language.
But you can for example retrieve a certain Track with the BaseList2D Function :CTrack* FindCTrack(const DescID& id)_<_h4_>_
Find the track for the specified description id. _h5_<_h5_>_rn
> CTrack*
>
>> The track found, or NULL if there was no match.For example to retrieve the relative position track:
CTrack *track = op->FindCTrack(DescID(DescLevel(ID_BASEOBJECT_REL_POSITION,DTYPE_VECTOR,0),DescLevel(VECTOR_X,DTYPE_REAL,0)));
Always use descriptions to directly retrieve such things, which is a lot faster then cycling through the tracks each frame and do the "bad" string comparison.
Cheers,
maxx -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 10/09/2011 at 09:48, xxxxxxxx wrote:
Howdy,
Well, in C++, to get to a specific track you use BaseList2D::FindCTrack() and pass it the description ID of the track you're seeking.
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/09/2011 at 08:25, xxxxxxxx wrote:
Thank you. It's also available in Python. But it doesn't work, seems to be a bug.
It should take an argument but it doesn't and it raises an error when calling it without.
It isn't even documented in the SDK and the same counts for R13. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 11/09/2011 at 15:19, xxxxxxxx wrote:
I'm curious what makes you think FindCTrack() is available in Python?
It looks to me like he set up
GetCTracks
() to be used in place of FindCTrack().
It creates a list of tracks found on the object. Then you grab the one you want from the list. Or loop through the list to find the one you're looking for.That's what it looks like to me anyway.
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/09/2011 at 11:03, xxxxxxxx wrote:
No, in Python you dont have FindCTrack() or GetName() on the
Ctrack,
that would be great! It is so sad instead I do something like this to loop over the channels, because I really need to access all of em:track = obj.GetCTracks() # 0,1,2 = Position, 3,4,5 = Scale, 6,7,8 = Rotation, 9 = PLA for t in range(0,9) : curve = track[t].GetCurve() #Get the curve for the track found
But if someone rearrange the order of the channels in the Time-line editor it is bollocks with this. So that implies me to convert my Python script into C in the end. Because I can not trust that the channels are in a specific order.