[Solved] Attaching material to object vs to obData

Hello,

In the preferences of Blender, there is an option to attach materials to object or to obData.

Let use the example of a mesh : the mesh is a data block on its own, and it is associated to an object data block, which holds position ans scale.

It’s clear to me, what object and mesh data blocks are.

It’s less clear to me what obData data blocks are.

In the context of Blender 2.5 : is a material a data block ?

If it is, I suppose it’s better to attach it to an object instead of to an obData.

If it is not, where is it stored ? Perhaps the obData is made for that ? To hold material data ?

I feel lost with it.

What’s going on if I choose to link materials to object vs to obData ?

If obData are dedicated to hold something special (I do not know what), then linking material to obData should not be a good idea and I suppose, if it is so, linking to object instead helps re-usability of materials or at least makes these easier to manage.

Am I wrong or right with this last assumption ?

Have a nice day all

Oh, Ok, it seems object and obData always comes together. It can be understood in the classes terminology : objects holds data defined by the root class and obData holds data of extension to the root class. Although that’s my own wording, it seems to be a correct interpretation of what’s explained in Blender API Into

So, materials should finally be linked to obData, that seems the best choice, as materials may be specific to some kind of object only.

But what is the effect of linking material to objects so ? (I want to understand the effect of both choices)

The effect of linking a material to an object is so you can have different materials on objects that share the same mesh. By default materials are linked to the obData (i.e. mesh). Say I have a mesh cube shape key animation. Now I want 10 of those in my scene. So I create 10 objects and link them to the same mesh so I don’t have to re-animate each one.By default, they will all have the same material because the material is linked to the mesh. By overriding this, you can link the material to the object and then each of your 10 objects can have a different material, but still be linked to a single instance of the animated mesh.

Just an example of when you might want to link to object instead of mesh.

Ah, Yes, I See : if the material is linked to the obData, then it is linked to the mesh’s specific data, so if you link to the mesh data, you always link to its material in the mean time. But if you link the material to the object, if you link to the mesh data, you do not link to any material data in the mean time and can or have to link to it apart,

So linking material to obData (i.e. to mesh specific data) is nice when you want a mash to always have the same material (may be cooler and less confusing for beginners or little modeling stuff). And linking to object is nice to achieve a better abstraction and keep a formal distinction between meshes (as models) and materials, which make this way more also flexible.

Thanks Atom

(I mark this topic as solved)

P.S. There is something strange in this area : the preference has a choice for linking to object or obData, but when you create a material, you also have the choice to create it linking to the object or to the obData, and the option defined in the preferences does not have any effect on the default choice of the group of controls which is used to create a new material. I will open a topic about it.