CTrack backtracking

On 15/01/2014 at 17:53, xxxxxxxx wrote:

So I have a track of an object using:

object = doc.GetActiveObject()
  
for track in object.GetCTracks() :
	#do something

What I would like to do is get the user data the track belongs to.

for example Position Y the track is:

<c4d.CTrack object called 'Position . Y/Track' with ID 5350 at 0x00000026E9C7D190>

What I want to get:

Cube[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_Y]

How do I get from CTrack to c4d.VECTOR_Y?

Overall what I am trying to do is create a port in an XPresso node for the attribute that is creating that curve.

Let me know if I am not being clear enough.

Thanks

On 16/01/2014 at 00:12, xxxxxxxx wrote:

Hi Shawn,

You can simply call CTrack.GetDescriptionID():

import c4d
  
def main() :
    for track in op.GetCTracks() :
        print track, track.GetDescriptionID()
        print op[track.GetDescriptionID()]
  
if __name__=='__main__':
    main()

On 16/01/2014 at 09:08, xxxxxxxx wrote:

Thanks for the reply Yannick,

using GetDescriptionID() : I get (1001,19,23) which I am guessing is the ID for the attribute that is animated. 
I am not familiar/still new to scripting, How do you use an ID once you have one?

to create a node im using

Node.AddPort(c4d.GV_PORT_OUTPUT,[c4d.ID_BASEOBJECT_POSITION])

I am trying to get from the found track Position.Y to c4d.ID_BASEOBJECT_POSITION_Y .

On 21/01/2014 at 09:21, xxxxxxxx wrote:

Using

track.GetDescriptionID()[1].id

I was able to get just the id of Position.Y "1001"

I then found out that this can replace c4d.ID_BASEOBJECT_POSITION like so:

Node.AddPort(c4d.GV_PORT_OUTPUT,[1001])

Thanks for getting me on the right track!

On 21/01/2014 at 11:48, xxxxxxxx wrote:

I lied,

A more advanced setup was getting lost with just the ID you do need all 3 numbers. Honestly not sure how it was working with just a single ID.