need help with custom attributes
What I'm trying to do is set up some controls for a pair of materials. I've got a ui set up with spinners, etc that will adjust properties of both materials at the same time. That all works fine after running an initial script that creates the materials sets up all the connections. However, I want to be able to close down Max, restart it, open my scene file with those materials in it, and still have the CA be able to tweak the settings.
My first problem is that upon restarting max, I get a missing DLL error. I'm pretty certain this has something to do with where I saved the CA script file. I've tried it in maxRoot/scripts/myfolder, scripts/startup, stdplugins/stdscripts, and none of those seem to make any difference.
My second problem is that in the script I use variables to identify the materials I want to tweak. When I restart Max, those variable are undefined, and I'm not sure how to define those variables automatically, or how to "hard code" them into the scene (if that's even possible). I will eventually be distributing this script publicly so I don't want to rely on the user in any way to define variables. One option I was hoping to figure out is similar to using the $ for scene objects, but do materials have something similar? For instance, if you're in the Material editor looking at the custom attribute rollout of a material, is there any way to script something like "foo = thisMaterial.diffusemap" where "thisMaterial" would be the same as using $ for scene objects?
Well... that's enough for the moment. Any help would be seriously appreciated.