After loading a mesh into Blender, I want to apply a material on them and color it. I am doing this using the code below:
for ob in bpy.context.selectable_objects: #if ob.name.startswith('simplified_model'): if ob.type == 'MESH': obj = ob # this is for scoping reasons obj.select = True self.scene.objects.active = obj bpy.ops.object.select_all(action='SELECT') self.model = obj mat = bpy.data.materials.new('colored') color = [0., 191./255, 255./255] mat.diffuse_color = color mat.specular_intensity = 0.3 self.model.active_material = mat
Using the code above, some of the meshes are colored the way I expect, but as you can see below most of them are painted incompletely and the material has not been applied the way it was expected to:
The meshes are expected to be colored as follow:
Can anyone tell me what I'm doing wrong?