User Interfaces has been around for decades. For a while we had been using text input UI’s. There was a huge following for the voice-activated UI’s. But the most prevalent and most used UI is the graphic UI. People have been reinventing it ever since it’s first conception.
So much so that it has been held in heavy regard that UI’s can make or break an OS; and we’ve seen this happen time and again. UI’s also make or break game consoles, even games themselves. I would even go as far as to say (without valid citations) that development for the, CG and UI, should have and have been going hand in hand. (This guy here, Renato Polimeno, has a list of UI’s he compiled from the web in his website.)So wouldn’t it be funny if our rigs would be using primitive UI’s? Aha! I developed a script that automates a system to create a UI for any Maya rig. The method is very promising, and I am here to share it to everyone. As a disclaimer, allow me to just say, the technology is old. I just developed new way to use old methods. As a testament to its simplicity a script could be written to automate the process for just 15 lines. It can even be shorter. But it is the methods behind that I would like to share here. Hopefully, you guys would appreciate it and start using it with your rigs. And since it is so easy, you might even consider adding UIs to rigs that you don’t own.
Here is an example of a UI that you could create using this tutorial as a guide. You could design your UI in any way you deem fit. Allow nothing but your creativity to limit you. The idea is that controls should be easily accessible at all times or at least much of the time. UIs are great but are hard to create. This method would make it easy.
There is just two basic tools that Maya already offers that we shall exploit to get the results that we want. The first is the parent command. The same procedure being activated whenever you press on the p key. The difference is we run it with flags to make sure it works on shape nodes instead of just transform nodes’ hieirarchy. We could therefore have extension shapes for any control.
The line to use is ‘parent -add -shape shapename‘. You can enter the command while an object where you want to add a shape name is already selected. You can include names, a name of a list of names of shape nodes you wish to add followed by the transform node you want to add it to, after the command to be explicit.
The next tool we wish to exploit from Maya, believe it or not, is blendshapes. Blendshapes allow us to make a base object shape blend into the target shapes. Normally, blendshapes are set to local mode, which means it will ignore differences in position, rotation and scale between the base object and target objects. For facial animation setups, this is what we normally use. There is another mode though, that has been forgotten for lack of a genuine practical usage and that is setting the mode to world. This will make your base mesh blend into its target mesh, taking into account any differences in position, rotation and scale. This is what we want and what we will use.
So in effect, what we are trying to do here, is 1) add an extension shape to the controllers that we want to be able to control. Then, 2) we give these extra shapes blendshapes in world mode. These extra shapes would then follow the shape of their targets, while also following their size, position and orientation. And true to the nature of any extra shape node for any transform node, clicking or selecting it would be just as if you selected the transform node.
If you prefer seeing a step by step for this tutorial, minus explanations, follow these:
Note: You can have anything happen to the curve you created. You could make it change shape with more blendshapes that are also driven by the control object. You could constrain it to the camera. You could give it set driven keys so that they would change according proximity of objects to each other.
If you would like to see a script, that does this exactly, run this:
global proc specialControls () {
$selectionList = `ls -sl -type transform`;
$selectionSize = `size $selectionList`;
string $selListShapeEquivalent[];
for ($i = 0; $i < $selectionSize; $i++) {
select -r $selectionList[$i];
select -hi;
$listOfShapes = `ls -sl -type shape`;
$selListShapeEquivalent[$i] = $listOfShapes[0];
}
for ($i = 1; $i < $selectionSize; $i++) {
$duplicateObj = `duplicate -name ($selectionList[$i]+"duplicate") $selectionList[$i] `;
select -r $duplicateObj;
select -hi; $duplicateShape = `ls -sl -type shape`;
parent -add -shape $duplicateShape $selectionList[0];
delete $duplicateObj;
blendShape -origin world -weight 0 1 $selListShapeEquivalent[$i] $duplicateShape; setAttr ($selectionList[$i]+".v") 0;
}
}
Now, all you need to do is run the command specialControls, while having two or more objects selected. The first object being the control you’d like add curves to.
This here is another way of applying this method–taking it to the next level. It was an attempt (successful to my surprise) to emulate the same effect that Paolo Dominici had for his control free rig that could be viewed here. As a disclaimer: I did not intend the script to accomplish something like this. But it works! Check it out and see if you could think of ways to use it for other mind bogging creations.
These are the steps:
NOTE: In copying the lines of the code from my notepad, I somehow missed a line. $selectionSize = `size $selectionList`; It’s the second line of the procedure. Thanks to Johnny Z for pointing this out to me.
This tutorial also @ creativecrash.
One Response
Say something!
hey!
i’m interested in your controlless rig but the script you provided doesn’t seem to work for me and i can’t find a relevant place to contact you about it, so here i am. the error i get:
// Error: “$duplicateObj” is an undeclared variable.
i’m pretty new to scripting and am about half way through a book so in other words i know nothing. if you could help me troubleshoot this i’d be very grateful as my animators have been begging me for this exact thing. thanks!
-jz