@zipit Hey, again! I've just tested your script and it definitely works, but it leaves duplicate tracks behind. I'm pretty sure there's an easy way out for it.
I have to spend more time analyzing your code to learn this stuff right.
I did make another attempt, but it failed tremendously!
When I say "full name", I mean I want to iterate thru Userdata parameters just as I do when I get a list from srcObjs = objs.GetCTracks() , or in a similar fashion. That's what I've been doing with the info retrieved from the Basecontainer.
Please, have a look at this rather short code of mine. Once again, thanks a lot!
import c4d
from c4d import gui
def main():
objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
obj = objs[0] #Grab the Null that has relevant Userdata only
UD_ids, UD_names, UD_types, UD_values = [],[],[],[]
for descID, bc in obj.GetUserDataContainer():
UD_ids.append(descID[1].id) #list of IDs
UD_names.append(bc[c4d.DESC_NAME]) #list of names
UD_types.append(type((obj[c4d.ID_USERDATA,descID[1].id]))) #list of types
UD_values.append(obj[c4d.ID_USERDATA, descID[1].id]) #list of values
#just checking if I'm really looking at the right data.
print "Userdata Parameters: " + str(UD_names)
print "Respective IDs: " + str(UD_ids)
print "Respective types: "+ str(UD_types)
print "Respective values: " + str(UD_values)
print " "
srcObjs = obj.GetCTracks() #This is just a test for this specific Null. Only 'Stratocaster_R' is supposed have a CTrack for now.
srcObj = srcObjs[0] #this is meant to work just once, for this test.
if UD_names[0][:-2] == srcObj.GetName()[:-2]: #Force test to see if name comparisons are really working.
print str((srcObj.GetName())+" -> Match Found!\n ")
track = obj.FindCTrack(UD_ids[0])
if track == None:
print str("There are no keyframes at the \'"+str(UD_names[0])+"\' Userdata parameter.")
print "Creating a track for it now...\n "
track = c4d.CTrack(obj, UD_ids[0]) #Create Track using the first Userdata ID.
obj.InsertTrackSorted(track)
obj.Message(c4d.MSG_UPDATE)
c4d.EventAdd()
print "Look at the Timeline... the Null has a new track, but it's not where I want it to be. It's not even Userdata!\n "
print "I tried GetClone() earlier, and it gave me a duplicate of Stratocaster_R. Just as bad.\n "
print "If I were a programmer, and the World depended on my skills, it would have ended long ago.\n "
tgtTestObjs = obj.GetCTracks()
print tgtTestObjs
if __name__=='__main__':
main()