0
$\begingroup$

I have a model about blender,there is a object (name's car_AudiA8) with multi-material,I want to copy a new object from the object ("car_AudiA8"),then change new object's color and old object's color is not affected,my method is :

obj = bpy.data.objects["car_AudiA8"] mesh = obj.data new_obj = bpy.data.objects.new("car_AudiA8", mesh) bpy.context.scene.objects.link(new_obj) bpy.ops.object.make_single_user(object = True, obdata = True, material=True,texture = True ) for slot in bpy.data.objects[new_obj.name].material_slots: if (slot.name.startswith("carpaint.Black")): bpy.data.materials[slot.name].diffuse_color = (1,0,0)

but when the method doesn't work,I don't know reason. when render the object , car's color doesn't change.

enter image description here

$\endgroup$
  • 1
    $\begingroup$ Script works fine, but maybe you use cycles? $\endgroup$ – Crantisz Jul 3 '17 at 8:01
  • $\begingroup$ how do it I should ? $\endgroup$ – user824624 Jul 3 '17 at 8:13
  • $\begingroup$ provide a screenshot, please $\endgroup$ – Crantisz Jul 3 '17 at 8:45
  • $\begingroup$ I render model with python . I use the code --"bpy.ops.render.render(write_still = True ) " $\endgroup$ – user824624 Jul 3 '17 at 8:50
  • $\begingroup$ Ok, you have cycles renderer, but diffuse_color is internal renderer value. So you mast recreate you materials to internal, or change color in nodes $\endgroup$ – Crantisz Jul 3 '17 at 8:57