[Closed] Material template system?
You know how the A&D material has this? It basically reads from a certain material library, listing them in a pulldown and if you select one it loads those settings. Has anyone attempted to duplicate this as a material wrapper for another material type? It’s an extremely useful system and somewhat less cumbersome than loading a library and the material (which loads a whole new material rather than just the settings, which breaks the material instances).
Can’t share mine, but yes – been there and done that by writing a scripted material plugin that extended a Shell material (it evaluates quickly) and only added one rollout with a combobox to load/save settings. The settings files stored in $plugcfg\somedir, each filename prepended with the classname of the main sub-material for fast enumeration of applicable settings files. The settings themselves are just basic getProperty / setProperty bits to .ini-style files.
It’s entirely doable, but even better would have been if you could automagically add a ‘presets’ rollout to any material… having to go up in the hierarchy to get to the preset load/save, seeing a bunch of Shell materials in the scene when browsing around, etc. tends to break normal workflow.
Worse on the coding end, though, is determining what to save/load. In a standard material, are the map amount values something that would be in a preset? Probably not, but without you specifically writing that up, any automated system will happily save/load those anyway. The other way around – if you do want to save everything – means also saving sub-material/map hierarchies… for a lot of things, that just can’t be done (Gradient Ramp being a good example… that map sees use all over the place, but maxscript access to it is pretty bad) without having to essentially save those as material library entries in the first place… at which point, why not just store the material as a material library entry?
Dealing with instances isn’t too bad, though – you can traverse the scene and look for materials (very few edge cases that you can’t seem to access), grab the ones that are instances of eachother (simple ‘materialA == materialB’), and replace them if one of them is replaced.