Hi @ferdinand, thanks for the feedback, I've got it working with your suggestion. The method B was correct but the undo part was wrong ( the undo step was applied on the original objects instead of the new ones, thus leading to a mess when performing an undo). I also added the bit part to keep new objects folded in the OM. Here is the code :
# CopyDeformers
import c4d
doc = c4d.documents.GetActiveDocument()
def main():
doc.StartUndo()
objs = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER)
if len(objs) >= 2:
# Get the last selected object
active = objs.pop(-1)
# Get the deformers
deformers = [i for i in active.GetChildren()]
# Copy deformers to selection
if deformers:
for o in objs:
for d in deformers[::-1]:
dcopy = d.GetClone(c4d.COPYFLAGS_NO_BITS)
doc.InsertObject(dcopy, parent=o)
doc.AddUndo(c4d.UNDOTYPE_NEW, dcopy)
o.SetBit(c4d.BIT_MFOLD)
doc.EndUndo()
c4d.EventAdd()
if __name__ == '__main__':
main()