Replace all duplicate materials with one click of a buttonE.g. An Sci-fi set may have many same objects in the scene. If these were not instance based, all the objects will have their own texture maps (Diffuse, Normal, Bump, Specular, Roughness, etc). But each of them would be pointing to the same image file on the disk. In the
Materials Tab each of the object surface material will be appearing as a separate material item under the
OctaneRender Materials (Left side panel of the Material Tab's UI).
Can you add a button that will check if the materials under the
OctaneRender Materials are the same and then link them to first entry (of that material) and remove the rest of the duplicate material entries ? Something like dragging and dropping the a material from the left side panel to all the surfaces on the right side panels (
Scene Surfaces) to link them to the same material item.
Though these sometimes can be done manually but some of the sets there are a lot of such items so manually doing it becomes very tedious. Having a button that does this will be great and would save a huge amount of time.
Below is the example scene :
- Duplicate materials of the left panel. E.g. Light2
Now in the above scene so many of the materials have (2) ,(3),(4) etc against there name. If you look at the Light2 Material there are all the same material even though they are named differently (Light2, Section1:light2, etc) . So if on a button click all the Light2 became one entry it makes things more efficient and manageable. Similarly, all the other duplicates will be reduced to one each making the material list more manageable.
- All duplicate Light2 replaced by one Light2 material
If anyone wanted to make a separate material for one of the surfaces, they could easily do the Auto Material and modify that as they please.
The logic might be something like this :
1. Create a empty array.
2. Scan item in the material list
3. Check if the material is the same as one of the materials in the array in terms of the material nodes/ definition irrespective of the name
- If no, add the material item to the array
- If yes, increment the count for that material in the array and keep track of the surface it is linked to.
4. Loop from 2 until the list is fully scanned
5. Once done, look at the array where the count is more than 1 meaning duplicate entries.
6. For each of them, link the material to the new material surface so that they are all linked to the same material.
This is a simplified take on the logic. You will probably need to create C/C++ structures / classes to store in the array with all the material definition, count and surface links.