@m_adam @blastframe
Man your replies are a treasure trove of valuable info for me lol. I’ve found it tough finding focused info on c4d/python methods and the documentation lacks some context that makes it tough for beginners to implement, let alone “best practices”.
Ya I had a version where I was handling all the “get active” stuff in “main” but tied myself in knots in other ways so reverted back to a safe place haha.
Yes children are what I want, the purpose of the script is as follows:
With my job I have to re-create a lot of Ui and their components in C4D. I built an xPresso rig onto an Instance object that dynamically sets reference object based on defined hierarchy [so I want all of the children in the root]. Then manually create the user data to reflect that hierarchy, setting the reference object. That’s all well and good, from that point I can dup my “icon” instance (that’s referencing all the objects in my “icon” root) and just pick which icon it is from the user data list. Makes it easy/fast and clean creating large scenes of Ui.
But who wants to manually populate, and have to manually keep up with the user data fields to make sure they reflect children in your desired root. Didn’t see a way to automate that in xPresso so figured would be the perfect python exercise for me.
Select root, run script. Script creates your instance and integer cycle user data populated with the child hierarchy...and also creates the xPresso with node network, but I suspect I may find keeping all that functionality (selecting ref object for given instance) in python will be easier than figured out how to create the xPresso node network in python.
Again, thanks for the help!