[Closed] Need Help with (what should be simple) MaxScript
Hi. I know MEL fairly well, but have to use Max now. I rig a lot and I am making a custom UI facial rig for our animators. It’s based on Jason Osipa’s stop staring setup and I have everything pretty much set up except for linking the customAttributes I’ve made to the UI, which consists of splines (circles, etc).
So, in MEL, I would write something like this:
UserInterface.Custom_Attributes.BrowUpDown = BrowsController.translateY;
UserInterface.Custom_Attributes.BrowSqueeze = BrowsController.translateX;
Basically what this does is allow the movement of a spline circle on the x or y to control a customAttribute slider that has control over facial bones.
I would love it if someone would tell me an equivalent script in MaxScript. I’ve tried a similar script but I get an error message saying that Position_Y is undefined, as if I were trying to make it a variable, but that’s not what I’m trying to do. I’ve also searched everywhere and looked through the help, but to no avail. So…I’m just a little confuddled.
I’ve also tried wire parameters as an alternative but that doesn’t seem to work at all.
Here’s an example of the interface in Maya so you can see what I’m going for as an end result:
http://www.rigging3d.com/digitalabyss/rigging/apeWebDemo2.mov
Thanks in advance!
Tonya
I think the paramwire interface is what you’re looking for; it links up two tracks like what you’re talking about. It doesn’t really need to be maxscripted though, if you right click on your facial bone, go to wire parameters, then choose say… a rotation track, you can then drag the rubber band to wire it to your facial control splines. You’ll get a little interface with control directions and optional expressions. It might take a little fiddling to get the values right. You might find it easier to set it up using reaction controllers, which are just like driven keys in Maya. This way you can set up each extreme position on your control to correspond with your facial bone. If you’re using joystick controllers, this might be the best route. If its just a slider-type manipulator then wire parameters can usually do the job.
you could also instance the controllers. this is the fastest connection you can make in max.
to do this, open the curve editor or dope sheet, look for one of the position tracks of your control object, select it, right-click and choose copy controller.
select the object with the custom attribute, in the curve editor, look for the channel you want to control, right click, choose paste, choose instance in the dialog that pops up
now if you need something like a multiplier for the connected values (e.g. your control moves from -1 to 1 and the custom attribute has a range of -100 to 100) you can apply a float list controller to one of the tracks, then change the weight of the float list, which will act like a multiplier.
this is like a connection in maya’s connection editor. paramwire involves expressions and is not as fast, you shouldn’t use it if it’s not necessary for what you’re doing
Hey Kai,
Funny you should mention this, because I was just wondering the other day about whether or not this was better than wiring. My question to you is, have you used this in production? Are there any situations where the instanced controllers are accidentally made unique?
Lata,
Stev
Could you elaborate on this? It sounds like a great method. However, when I click on a position track in the curve editor, there is no “copy controller” option, so I didn’t get very far with it.
Thanks!
yes we use this on our rigs whenever possible, it is the fastest way for simple connections.
for very complex tasks it can actually slow things down though. i have tried connecting our skin rig to animation rigs using instanced rotation controllers, but it was actually slower than constraints, probably because of the complex rotation controllers
this is probably quite obvious, but another great thing about instanced controllers is, they enable you to have the same parameter on several objects, wherever it is appropriate. for example to have the ik/fk parameters on both the ik handles and the fk chain objects
why would you accidentally make them unique? we didn’t have this problem yet, no.
Thanks for all the info.
By “accidentally make unique” I meant, did animators ever break the connections unintentionally? Good to know it wasn’t a problem.
Thanks again,
Stev
there should be a way to lock the motion panel among other stuff for animators (link/unlink as well…)
i’m not sure what happens if you merge only one object with an instance, but if you merge the whole rig there are no problem
here is one more technique you can use to connect channels this way (in this case a float):
-> Float List
-> Offset 100.0 (use this controller to add an offset to the instanced value)
-> Instanced Float Controller
-> Weights
-> Offset Weight
-> Instance Weight (use the weight to as multiplier)
lets say you want to connect the x-scale of a bone to an attribute that is zero’d out. you would apply the above float list to the x-scale controller. you set the first channel(offset) to 100.0, and instance the attribute to the second channel, the value of the float list will be 100.0 when the attribute is at zero.
now you can have the attribute in a range of, say, -1 to 1 and use the weight track of the instanced controller as a multiplier, for example if you set the weight to 5000 instead of 100, you can have a x-scale range of 100-50 to 100+50
this may seem heavier than a wire connection, but in my experience list controllers and instances of floats are free or very very cheap in max. always do some testing though, as i said before in some cases it gets slow when you instance more complex controllers.
i tried to align two objects by instancing the rotation channel, the rotating object had 4 euler channels and and orient constraint. using an orientation constraint instead of instancing was faster in this case