A little background
I am creating an addon that enables the user to import and export models from a format called “OpenFormats” for the video game Grand Theft Auto V. A program called OpenIV allows you to browse the files of the video game and export them into the decrypted “OpenFormats” file, and OpenIV can also convert them back into the correct format so that the game can interpret them. OpenIV has a massive XML file that contains a list of organized shader parameters. These parameters are simply either a collection of float values or an image path. What I need to do in Blender is have some sort of material editor, where, for each material in an object, the user can select a shader defined in the XML file (I would do some sort of parsing of the XML file but that doesn’t matter for this question). These shaders would do nothing to the object in the scene, but would just be used for the exporter. The material editor’s data would also have to be saved in the file somehow.
TL;DR
I need a way for the user to set certain options for each material of an object and have those options saved in the save file. These options (other than a diffuse map) would have no effect on how Blender renders the object, but they would just be used for my custom exporter. A diffuse map (which is in many of the shaders from the XML file) is the only thing that needs to affect the rendering of the object, as I want the users to be able to see the textures they apply.
Here is an example of what it might look like from a similar plugin for 3ds max: https://gyazo.com/e44f91a46f8efcbbfa50d8c601960861
Here is the XML file containing the shaders (had to cut off a good portion but should be enough to get the gist of it): https://pastebin.com/1nnT5Yyg
What I’ve thought of doing so far
-
Could I have some custom property of each object that is a dictionary storing all of the options? I have considered that approach, but have found it difficult to figure out a way to make sure the dictionary stays in sync. For instance, how could I update the dictionary when I change the name of the material?
-
Is there some sort of way I could dynamically create my own custom shaders from the XML file? For instance, my addon would, at runtime, create a large amount of shaders from the XML file. The only “real value” these shaders would ever have would be a diffuse map. Other than that the values would just be floats or vectors that do nothing in Blender, but are used in the exporter.
Also, please bear in mind that I have no Blender modeling experience, but I do have a lot of experience programming. My purpose in creating this plugin is so I (and many others in the community) could use Blender for modding GTA V, and it seems I am the only one who is willing to do it. Thanks!