Condense and Swap SubMaterials
Hello, I've been searching and didn't found something doing this, maybe some of you know if this exist or how it can be done.
All faces on all selected objects (these objects are using different multimaterials) pointing to the material named "Grass" before the script (id 2 5 and 1 in the exemple) are, after the script, assigned to id 30, and all the objects are using a single multimaterial.
I have a scene organized like this :
Id - name - Sub-Material
[Multimaterial A]
[1] [ ] [Dirt]
[2] [ ] [Grass]
...
[12] [ ] [Rock]
[Multimaterial B]
[1] [ ] [Dirt]
[5] [ ] [Grass]
[25] [ ] [Rock]
[Multimaterial C]
[1] [ ] [Grass]
[2] [ ] [Dirt]
[25] [ ] [Rock]
etc...
after running the script,I need all the selected objects to use :
- [MY Multimaterial]
- ...
- [30] [ ] [30-Grass]
- ...
- [42] [ ] [42-Dirt]
- ...
- [46] [ ] [46-Rock]
Where the correspondance [ID]<-->[SubMaterial] has been defined by me, the renaming here is not mandatory, but I will name the material this way in the future, so this naming convention could be used as input for the script.
It's a kind of "organized condense materials"
Thanks !
Comments
...
What kind of script you talking about?
bga
Kind of script ?
I don't understand the question, what are the different kinds of scripts ?
I'd say it's a utility script, thats is run on a selection of EditPolys using different MultiMaterials; that condense the different MultiMaterials into a single one, while modifying the selected EditPolys faces' IDs to fit the new Id's order.
...
Try this
bga
It works
Thanks a lot barigazy for the time spent writing this script.
It works, excepted the submaterial changes aren't undo-able.
I'll try to learn how to make it evolve to support multiple objects selected, with different multimaterials, and resolve ID conflicts, I don't want to take too much of your time.
Because in this state, it's almost more powerfull to add an EditPoly modifier on all objects sharing the same multimaterial, select faces by ID and assign a new ID.
Thanks again for your help.
...
Here we go.
Now this tool works with multiple selected objects that share same multimaterial.
Also undo is supported here. ;)
Try it and thel me what you think
bga
...
edit:
Find in "undo" list "ReassigneID" if you want to back to previous state.
When use this version make sure that first you select object with multimaterial and
then ctrl + select the rest.
Also if "Auto deselect intruders" is checked then all object in selection which not share same material as first selected object will be automatically deselected from process.
I hope this is the option that you looking for :)
bga
Awesome !
Thank you very much, this is really helpfull and pretty robust :)
...
My pleasure :)
Cheers!
bga
how it works
Select an object which have assigned Multimaterial.
Set *SubMat ID* value to be sub-material that you want to change.
Set *"NewFace ID* value to be new object face ID.
Note: New edit poly modifier will take care of face ID.
If "Change SubMat ID" checkbox is checked then object material ID will be also changed to correspond to face ID else sub-mat that you have chosen will be new object material.
bga
...
Small correction. Use this code
bga