0
$\begingroup$

I want to apply or use the same material for multiple objects. How can I do this without doing it per object ? The target objects already have their own materials and I don't want to override them. I just want to add new material slot and same material across multiple objects.

I can't use Ctrl+L to link material because it will replace existing material.

Any solution ?


The real case is, I'm building a house (3 floors) with basic furnitures. So I got many walls, floors, windows, doors, kitchen set , fence etc.

All these objects has their own basic material setup :

  • wall : concrete, white paint
  • door : wood panel, inox, black frame
  • window : glass, inox ,black frame, alluminium
  • etc.

There is a unique wall (wall A) has a material i want to copy.

  • wall A : concrete, white paint, SECTION

So I want to use this section material into all other objects on the scene (those other walls, doors, windows, kitchen set etc). There are many objects so I'm looking a way to apply this section material without manually applying per object. And I want to keep the existing material :

  • wall : concrete, white paint, SECTION
  • door : wood panel, inox, black frame, SECTION
  • window : glass, inox ,black frame, aluminum, SECTION

I can't find a way to apply selected material to multiple objects without replacing the existing material.

Thanks

$\endgroup$
5
  • 1
    $\begingroup$ To clarify: You have many objects with many materials and you want to add a second material slot to these objects so that they all still have their own first materials and share a second material in their second slot? $\endgroup$ – Allen Simpson Dec 2 '20 at 19:17
  • $\begingroup$ @Allen : yes, the target objecs already have 1 or more material. So i want to add second/third slot with this new material. (not replacing the existing slots). $\endgroup$ – andio Dec 2 '20 at 19:23
  • 2
    $\begingroup$ Can you add more details? I mean if some function can add these materials, how about link them to the object faces? So why just add? $\endgroup$ – lemon Dec 2 '20 at 19:48
  • $\begingroup$ @lemon i've edited my post , adding some more details on it. Pls have a look. Thanks. $\endgroup$ – andio Dec 3 '20 at 3:11
  • $\begingroup$ Python is needed again here. $\endgroup$ – lemon Dec 3 '20 at 13:34
2
$\begingroup$
import bpy


# Input material's name to append
matname = "SECTION" 

if matname in bpy.data.materials :
    mat = bpy.data.materials[matname]
    objs= bpy.context.selected_objects
    for obj in objs :
        if obj.type == "MESH" :
            if matname not in obj.data.materials :
                obj.data.materials.append(mat)
else :
    print("Material '" + matname+ "' does not exist")
            
$\endgroup$
2
  • $\begingroup$ matvalid = matname in bpy.data.materials, matexist = matname in obj.data.materials $\endgroup$ – scurest Dec 3 '20 at 17:59
  • $\begingroup$ @scurest , thanks a lot ! $\endgroup$ – andio Dec 3 '20 at 18:26

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.