Thank you for this write up, I started writing something similar, but this is a huge help understanding how to get and set the data for BaseLink. I'll need to add FieldList and InExcludeData as you mentioned, knowing the getting and adding the new object is a little more involved than just setting the property id directly. I'll reach out here again if I have any followups.
C
Posts made by curtwart
-
RE: Get all BaseListLink parameters using specific BaseObject
-
Get all BaseListLink parameters using specific BaseObject
Hey guys, I'm new to working in Cinema 4D and the Cinema 4D python SDK, I am trying to relink a BaseObject into DTYPE_BASELISTLINK parameters after running a join on a BaseObject. I'm wondering if there is a simple way to get all other objects a single BaseObject is linked within, something like a get all objects a BaseObject is referenced by. I have a code snippet below that hopefully demonstrates what I'm trying to achieve.
def join_object(obj : c4d.BaseObject): # Gets the objects that the obj is used in linked_objects = get_references(obj) # Join the object, this will remove the obj from all of its linked parameters of type DTYPE_BASELISTLINK new_obj = c4d.utils.SendModelingCommand(command=c4d.MCOMMAND_JOIN, list=[obj], doc=doc)[0] doc.InsertObject(new_obj, None, obj) obj.Remove() # Relink the new_obj into where the obj was used relink_object(linked_objects, obj) return new_obj