Material by Element

I’ve published my blender script as an addon:

Knows anyone “Material by Element” modifier in 3D Studio Max? Well, my scripts is born due to this task inside my every days workflow: I needed to generate a list of material (with precise name and random diffuse variations), to get it back, to assign randomly and to delete it or modify easly.
I’ve added some more features (find objects without materials, remove unused materials, select objects involved in a known list, …).
I’ve been using all this tools as macro, finally I’ve got the time to build’em together into an addon; it seems to be quite easy to use and intuitive (I hope!) so I’d like to share it.

Let me know if you like it!


Thanks ! Thanks !

Uhm, it looks good…

Do it assign different materials to every element of an object, without separate it in different objects? This days I had the problem to assign different materials to a board pavement in a random way. So I wonder if this add-on could solve my problem.

Remove unused very apreciated!

P.S. sei Italiano?

Ciao Lell!
Yes, I’m Italian but on this wall I’d prefer to discuss in English so everybody can understand us :slight_smile:

At the moment the scripts focuses on separated objects but thank you for the suggestion! I’ll work on this feature. By the way, now you could split the elements, assign material list, select the elements with “select MBE objects” button and CTRL+J them toghether to get back the single big objects with multimaterial applyied.

Buona festa dei lavoratori!

Of course! Anche a te! :wink:

Thanks! I’ll give it a whirl and check it out, but I can see this already proving to be quite useful.


added 3 new buttons, fixed a startup problem and a few code improvements… now it’s texture’s time!


A little video tutorial

very very good job man!
thank you!

I’ve updated my script:

  • cleaner and compact interface
  • it manages lists with dropdown menu and name, more comfortable
  • uses internal blender properties in order to track materials and list: names don’t care, so you can call your material as you want
  • faster and cleaner code, splitted into more files so you can easly reuse it for your projects

working on : subobject assignment

more infos on blog:

Bis bald!

Another quick update…
maybe too early, but my “assign to subobject” seems to work correctly so I decided to put it on as a button.
Thanks to CodeMax for helping me in the discussion (have a look to it in Python support forum).


Ok I am going to look at the sites that you posted to see if I can answer this question by reading and viewing them. But what exactly do you mean “by element” I have never heard of anything in blender called an “element”

Hi shaba, thank you a lot for your post!
At the moment i’m in sicily working and I haven’t got my pc with me. On wednsday I will be back in milano so I will explain with screenshots what I want to get from this script.

pietro you never did answer my question from monthsi ago. What is and “element”?

Sorry, you’re right.
I’ll try to be as clear as I can, feel free to ask me more:

  • a polygon is a blender polygon
  • an object is a blender object (n polygons)
  • an element is a number of polygons linked each other. The “test” to determine where an element starts and where it finishes is to selected one polygon and run “select linked” (CTRL+L in edit mode)
    So we have a new ierarchy: [vertex-edge-polygon] -> elements -> mesh -> object
    Blender doesn’t track the elements (so far I couldn’t find them) so I have to remap them each time: but I’m not a python ninja, so I think that my code could be better implemented.

The name “elements” come from max, I was only looking for a definition for it, don’t want to make blender similar to max, only add an useful (in my opinion) feature.

Thank you a lot, I apologize for my delay in answering you.


I’m reading what I’ve written when I’ve got an idea: could the meshes be elements?

No, they can’t as a mesh can contain unlinked polygons… too good to be true :slight_smile:

Sounds great - but is giving me an error on 2.77 .
Any chance to get it running in current Blender Version.

Thank you for the work :slight_smile: