I have a bunch of Blender files with similar content. The files share a lot of common objects with identical names. I would like to propagate materials between the files. I plan to achieve this with a script that maintains a database of materials and associates them with objects based on their names.
All the materials will probably be simple - just diffuse and specular components. Some of them will perhaps also have a texture. However, it seems that rna2xml does not work on such a simple material:
for o in context.scene.objects:
for m in o.material_slots:
rna2xml(root_node="Material", root_rna=m.material)
Here's the output:
<Material>
<texture_paint_images>
</texture_paint_images>
<texture_paint_slots>
</texture_paint_slots>
<texture_slots>
</texture_slots>
</Material>
Looks a bit too empty (no diffuse, specular components).
Moreover, it seems that Material does not have _ _dict__ attribute nor an _asdict() method, and _ _slots__ appears to be empty. Well, theoretically could look through the attribute list provided by dir(), but I'm probably approaching this issue from the wrong side already.
Edit: For completeness, I also verified that pickle produces identical output for materials with different diffuse colors.
Except for hard-coding material parameters (which should be simple in my case - because I just need simple materials anyway), are there any ideas or suggestions?
I'm using Blender 2.76 on Windows 7 x64.
root_rna=m.material.node_tree
$\endgroup$