for example I have a null object with 2 children, one child is a rectangleSpline and the other is a sphere. The sphere has an align-to-spline-tag with the rectangle as spline-path source. If I clone the null with null.GetClone() the new spline-path links to the old rectangle, but I want it to link to the new rectangle. So, how can I get the behavior alike copy paste groups in OM?
Thx for any hints
Hello and welcome to the PluginCafe,
Please post your questions regarding the Cinema 4D API in the "Cinema 4D Development" forum.
Also, please use tags and the Q&A system to mark questions. Please read "Read Before Posting".
To handle links when coping objects one can use a AliasTrans object. This object allows to fix links after objects are copied.
trans = c4d.AliasTrans()
if trans is None or trans.Init(doc) is False:
objects = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_0)
for obj in objects:
clone = obj.GetClone(c4d.COPYFLAGS_0, trans)
if clone is not None:
clone.SetName(obj.GetName() + " clone")
doc.InsertObject(clone, None, None)
You find more information in the C4DAtom Manual or the AliasTrans Python documentation.
Very cool, thx alot Sebastian