My company has a custom .fx 3d Max material and I'm trying to hack together a script to automatically assign texture to it. I have it working however the box with the texture name is "disabled" and I'm trying to figure out how to enable it. I don't really even know what to search for.
This is the code from the material rollout
group "Base"
(
checkbox cbox_diffuse "Diffuse . . . ." align:#left across:3 offset:[0,0]
mapbutton b_diffuse "None" enabled:false align:#left height:16 width:190 offset:[-20,0]
)
The basic test of what Im doing is this. Asking for a file via prompt and assigning it.
n askForfile =
(
fileD = getOpenFileName caption: "Pick ur " \
types:"Targa(*.tga)" \
)
fn assignDiffuse =
(
meditMaterials[curMet].g_DiffuseTex = Bitmaptexture fileName:fileD
meditMaterials[curMet].g_bDiffuseMap = on
)
The thing that is confusing to me is the listener calls the diffuse "g_DiffuseTex" and in the actual .ms its called "b_diffuse"? The scripts are kind-of a mess and I'm a newb so that is a bad combo. I'm not sure what other info would be helpful without posting the whole mess of scripts. I'll post what I can without getting into trouble.
Replies
This WYSWIG editor is funky haha
But really you don't even need to enable b_diffuse to work just do something like this:
This will make Max think you pressed the button.
I tried enabling it but I'm not sure if I was doing it right or if it just doesn't work. I tried
meditMaterials[curMet].b_diffuse.enabled = true
and
meditMaterials[curMet].g_DiffuseTex.enabled = true
but neither of those worked. The listener said, "Unknown property: "enabled"
@monster
Awesome! That is what i was looking for but couldn't find out how to "press" a button... How do I find the RolloutName I need? Is there an easy way to do this in max without opening the script file? I tried the displayed name but that didn't work.
That should load a texture to that sampler. Guessing this is a scripted material plugin? Hard to debug from here but not sure if you know but you can do for example