Scripted Material Plugin help (Max 2009)

I’m having some trouble getting scripted material plugins to extend the DirectX_9_Shader. I’ve gone through a few tutorials and examples now, including Rob’s on the wiki, but I keep hitting the same issue, so I’m wondering what I’m missing.

Basically the plugin isn’t seeing any of the properties exposed in the .fx shader, so it will error out on setting, eg. delegate.g_glossiness from Rob’s tutorial. Additionally, checking meditMaterials[m].effectfile gives me

– Unknown property: “effectfile” in test:Radiant_Machine_Shader

I’ve tried a completely cut down plugin file (just the definition, an empty rollout) with the same results. Not sure what I’m doing wrong here.

Max 2009 64-bit, btw.

If you load that FX file directly in a DirectX material (skipping the MaxScript layer), do you see those parameters in its auto-generated UI? If not, that means the FX is incompatible with Max somehow.

If they show up then I’d expect what you did to work.

Wait a sec. I believe the “effectfile” property is on the delegate material, not the scripted one. Isn’t this what you’re after?

meditMaterials[m].delegate.effectfile

?

Well that was silly of me. I thought I’d already tried that, but it turns out I hadn’t. The example fx file loads up with a bunch of vars undefined, so it wasn’t compiling in the first place.

Thanks for helping me sort that out! (also for the bit about adding .delegate. I’d assumed delegate referred to meditMaterials[m] in the first place :p)