Code: Select all
o = bpy.data.scenes.active.objects o.getData(mesh=True).materials m = Mesh.New() m.getFromObject(o) m.materials
In addition, the call m.getFromObject(o) somehow seems to actually damage the material (or at least affect it in some way) - its box in the Outliner Oops Schematic becomes empty (I don't know exactly what that means), and when I want to edit it in the Material buttons, the Link to Object field in the Links and Pipeline panel with contents MA:MatShlWal has a red background.
Possibly related observation: When I select the object, the Links and Pipeline panel in the Material buttons has the OB button pressed. When I switch to the ME button before running the exercise above, everything works correctly.
Here is a screenshot of the situation. The oops schematic shown in it has not been touched since running the Python commands, so it still shows the state from before.
Is this the intended behavior?
- If yes: Could somebody explain to me why? My experience so far has been that the original (cage) mesh from Object.getData() always has the same materials as the deformed mesh from Mesh.getFromObject(), even if the object has modifiers. Under what circumstances is this not the case?
- If not: Is this a bug in Blender 2.46? Or could it be that the file is somehow corrupted? I don't know exactly how that file was created, I got it from someone else and for this demonstration stripped it down to the minimum that still exhibits the problem.