4
$\begingroup$

As a follow up of my question What does the 'F' button and '2' button do (materials tab)?, I have another question:

When I added an object mesh and applied a material, and I added another mesh, not duplicate but with ShiftA, and choose this same material than it is added as a new user (checked by press the 'F'-button and look at the number next to it).

When I duplicate linked an object by AltD their material data are linked, but this duplicated linked object mesh is not added as a new user (checked by press the 'F'-button and look at the number next to it)

But when I change the viewport color of the material then the added objects meshes (with ShiftA) and the duplicate linked object meshes (AltD) do change their viewport color. So are material from added objects linked different then the material from duplicate linked objects?

$\endgroup$
5
$\begingroup$

By default materials are linked to the object data. Hence when you instance the object data you are not duplicating the material, or the users of the material.

When you AltD an object, you are keeping the same object data.
If you look at the Data tab of the properties window for any linked duplicate object, you will see that the Mesh Data has the number of users.

The material still only has one user because part of the object data is the materials.


material link button
However if the material link is set to "Object" then AltD duplicating an object will increase the user count for the material.

$\endgroup$
3
$\begingroup$

The answers by David and TARDIS Maker demonstrate an understanding of the mechanisms in play, but don't use exactly the jargon I would prefer.

When you use Alt-d to duplicate an object, you are creating a new Object datablock (which live in bpy.data.objects[]) but that new object points at the SAME Mesh datablock (from bpy.data.meshes[]) as the original. That mesh now has two users:

two objects share a mesh datablock

If you were to modify that shared mesh then both objects would be affected.

That single mesh datablock points at the material datablock, so the material datablock has only one user.

The mesh datablock is what David refers to as "object data", because in the python API it is accessible as obj.data. There are a couple of other kinds of datablocks that can be object data such as curves (text and bezier), lamps, armatures, etc.

When you add a new cube object without duplicating it comes with a brand new mesh datablock different than the other ones in the scene, and when you assign the material datablock to that new cube's mesh datablock the material now has two users.

David also did a good job pointing out the per-object materials option which is a useful technique.

$\endgroup$
  • $\begingroup$ Thanks for clarifying :D You mean 1 user (just before your picture), right? :) $\endgroup$ – Faceb Faceb Jun 18 '15 at 20:56
  • $\begingroup$ When you use Alt-D to duplicate an object, the mesh (or lamp or whatever the object points to) will have its user count incremented. Compare the object data pane before and after and you should see that the user count increases (either from no button to [2] or from [n] to [n+1]). $\endgroup$ – Mutant Bob Jun 18 '15 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.