Hello! First time posting here, sorry. I’ve been visiting this place for a while and found a lot of very useful tips and solutions. But my search skills finally failed me and I can’t seem to find an answer to my problem.
I wanted to write this simple duplicating script and broken as it was it served its purpose. Sort of. But now it’s time to tidy things up a bit and I don’t really know much about either Python or Blender.
So, reducing the problem to 2 objects and 2 lines…
Suppose I have a parent object and its child. Both selected. If I type
bpy.ops.object.duplicate()
everything works exactly as one would expect: New parent and a child created and selected.
But this
override = bpy.context.copy()
bpy.ops.object.duplicate(override)
results in reshuffling of the children somehow:
Selection is expected, but what with this parenting? Also the children are linked. But if I make more duplicates only the latest two will stay linked.
What am I doing wrong? Or rather what causes this behavior? Is copy of the context different from the actual thing? Is it even a right question?
Please advise. Thank you