Hello, I’m trying to figure out the best way of creating preset values for some of my custom written mental ray shaders using a drop down enum menu. I am still fairly new to writing shaders, so I’m not sure if it would be best to do this in the mi file for the shaders, or if it would be best to use an ini file, or to do it with the shader itself, but I am trying to stay away from this one, because then all of my shaders would need to be recompiled.
I thought I saw how to do this inside of an mi file awhile ago, but I can’t seem to find it at all now.
For example, here’s the mi file for a basic constant shader-
declare shader
color "Null_Color" (
color "color"
)
version 1
apply texture
gui "gui_Null_Color" {
control "Global" "Global" (
"uiName" "Null Color",
"category" "Texture"
)
control "color" "color" (
"uiName" "Color",
"value" 1.0 0.0 0.0 1.0
)
}
end declare
I’d like to be able to put in a control called “'Preset” that changes the color’s values when you select a different preset, for example-
control "Preset" "integer" (
"enum",
"uiName" "Preset",
"value" "0 Red, 1 Green, 2 Blue",
"range" 0 2
)
Choosing 0 would change the color’s input value to 1.0 0.0 0.0 1.0, Green, 0.0 1.0 0.0 1.0, and so on, but of coarse I want to be able to change the value to whatever I wanted. So pretty much I need a drop down menu with default presets that changes the UI input values for the shader, like the the Arch & Desigh Material, but for shader maps. Hopefully this is possible to do in the mi file.
The only solution I can think of right now, is to use max script to create a scripted shader, and have a new interface that would replace the mi’s interface, and make presets with that, which would also be a pain. The main problem with this is that I would have a duplicate shader, and I would want to hide the original shader, which if I have a lot of custom shaders, this probably would take up a decent amount of ram.
Let me know if I need to clarify on anything, and if you want me to post the original dll and cpp source file.
Thanks in advance!