today I finally found the time to clean out the code and to organize interface:
downlad link:
material_by_element.py
A few words about this script
The goal would be, having an object with some element (like rooftile or bricks):
- generate 'N' materials based on the first and varying diffuse color of 'K
- splitt the former mesh into more objects
- apply randomly the materials to each object
Beside this 'core functionality' I needed some more functions:
- find a precise 'mbe' list, in order to have more in one scene without contrast
- select all objects involved in a selected list
- find out objects without material (in a big scene could be tricky)
- remove all unused material from scene (I know: just restart blender. But the keyword is: FAST and EASY)
- completely remove active material from scene and objects with one click
- completely remove materials of an 'mbe' list from scene and objects, and get back base material
- any suggestion? :-)
For more explanation I suggest you to read previous posts about "Material By Element".
MORE INFO:
the scripts is able to find materials throug a marker string ('.mbe-') and the basename (all you have before marker) so... DON'T change material's name after, because you could have problems.
Installation: copy python script into your addons folder and check it on into "User Preferences\Addons\Material"
more info at http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Add-Ons
MORE INFO:
the scripts is able to find materials throug a marker string ('.mbe-') and the basename (all you have before marker) so... DON'T change material's name after, because you could have problems.
Installation: copy python script into your addons folder and check it on into "User Preferences\Addons\Material"
more info at http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Add-Ons
As soon as possible I'll make videotutorial, wikipage and all that "bureocraty" stuff :)
The script is released under GPL 2.0, feel free to reuse/modify/cook/freeze/blend... but please let me know :-) I'm curious.
Pietro