THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/01/2012 at 08:09, xxxxxxxx wrote:
Started looking at adding and removing user data
I can see how to add
and remove
now if I have this correct
the remove relies on the number ID
obj.RemoveUserData([c4d.ID_USERDATA, 1])
But if a user has already added user data
the number will not always start at one
2 Qs:
1 how do you get that number
2 how do you track the user data items that you add?
I've tried getting the number ID_USERDATA but with no luck
I can only get what I think is referred to as a tuple
(1,15,0)
and guessing this is reflects the user data (numerical index, type, ???)
thoughts appreciated
Paul
add a cube
add user data
select cube
run script
import c4d
from c4d import gui
#Welcome to the world of Python
def main() :
c4d.CallCommand(13957); # Clear console
doc = c4d.documents.GetActiveDocument()
sel_obj = doc.GetActiveObject()
id_with_bc = sel_obj.GetUserDataContainer()
for id, bc in sel_obj.GetUserDataContainer() :
print id, bc, bc[c4d.DESC_NAME], bc[c4d.ID_USERDATA]
print " "
print "is this the id", id_with_bc[0][0]
if __name__=='__main__':
main()