How can I duplicate an object with independent meshes? I am trying to duplicate a mesh object using python. After duplication I try to change the duplicated object's mesh, but the original object's mesh also changes.
Seem like both objects have the same mesh. How can I also duplicate the mesh?
Here is some Code:
&gt;&gt;&gt; obj1 = bpy.data.objects['Cube']
&gt;&gt;&gt; obj2 = obj1.copy()
&gt;&gt;&gt; bpy.context.collection.objects.link(obj2)
&gt;&gt;&gt; obj1.location = Vector((3,0,0))
&gt;&gt;&gt; obj2.animation_data_clear()
&gt;&gt;&gt; ve = obj2.data.vertices[0]
&gt;&gt;&gt; ve.co = ve.co*2
You should copy object data.
obj1 = bpy.data.objects['Cube']
data = obj1.data.copy()
obj2 = obj1.copy()
obj2.data = data
bpy.context.collection.objects.link(obj2)
obj1.location = Vector((3,0,0))
obj2.animation_data_clear()
ve = obj2.data.vertices[0]
ve.co = ve.co*2