I copy one object in Blender with python。but when I change the old object's color , the new object's color also change. I know that because the new object and the old object have the same material。my way is that:

obj = bpy.data.objects[old_object_name]
mesh = obj.data
new_obj = bpy.data.objects.new(name, mesh)
bpy.ops.object.make_single_user(object = True, obdata = True, material = True,texture = True )

I want to Separate the new object's material and the old object's material.when I change one object's color ,another object's color doesn't change. but my way doesn't work.


1 Answer 1


Material.copy() is what you want. Also you have to duplicate the object's mesh because materials link to the object's data by default.

import bpy

scn = bpy.context.scene
obj = bpy.context.active_object
mat = obj.active_material
mesh = obj.data

dup = bpy.data.objects.new(obj.name, mesh.copy())
dup.active_material = mat.copy()

dup.location.x += 3    # just for clarity
  • 1
    $\begingroup$ Thank you! For Blender 2.9, I changed the scn.objects line to: bpy.context.collection.objects.link(dup) $\endgroup$
    – CJD
    Apr 13, 2021 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.