Adverti horiz upsell
Fast, Easy, Flexible Selection UI Method
Fast, Easy, Flexible Selection UI Method
John David Marte, added 2009-10-13 02:18:30 UTC 26,113 views  Rating:
(6 ratings)
Page 1 of 1

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 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:

1. Create a curves and shape them according to how you’d like your interface to look like.
2. Duplicate the curve. For this tutorial’s purposes, rename it to “duplicateCurve”, but you could give it any name you want so long as when I refer to a curve you duplicated, you know that it is that curve that we mean.
3. Get the name of the shape associated to the duplicate curve (we talked about this). Normally, it’s the name of the curve with the word “shape” suffixed to the it (e.g. duplicateCurveShape). In the Attribute editor, it’s usually the tab right next to your objects (transform) tab. In the channel editor, it is the name of the next section immediately after your visibility attribute/channel. In the outliner, if you click on display and turn on shapes, uncollapsing objects would reveal shapes associated to them.
4. Select the control you would like to add the extension shape to. Enter this command (sorry, there is no tool-based alternative to this.) parent -add -shape [shapename]; (e.g. parent -add -shape “duplicateCurveShape”; )
5. Delete the duplicate curve (e.g. duplicateCurve). Now if you check the outliner, under the control curve where you wanted to add a shape to, there is another shape. It is the shape you added. You successfully transferred the duplicate shape unto the control you are adding an extension to.
6. Select the shape node of the curve you created in step 1. This is best done through the use of the outliner.
7. Shift+select the shape node of the curve you added in step 4. Again, this is best done through the use of the outliner.
8. Go to [Animation] Create Deformers->Blend Shape.
9. Select the blendShape transform node.
10. Go to the Attribute Editor. Set all weights to 1.000. Set origin method to world.
11. Set the visibility of the shape you created to off.

    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;

    specialControls ;

    // note: the last command was there to call the procedure we just created.

    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 step

    1. You’ll need to acquire a ready working rig.
    2. Select the mesh. Apply a ‘duplicate special’ on it, making sure you have “Duplicate input connections” enabled. Make as many duplicates as the controls that you’ll have to replace.
    3. These duplicates should react exactly like how the original was moving. Test this by moving controllers. Make sure the duplicates are following the original exactly.
    4. Delete faces from the duplicates, leaving only faces that you would represent the control you are making. Make sure you have  Construction history turned on.
    5. Select the control. Shift-select the duplicated mesh (with deleted faces).  Run the script.
    6. Put the original mesh in a layer that set to Referenced.
    7. Repeat steps 4-6 for each duplicate/control curve.

      This tutorial is also at my site: