djParentShape.mel

david | animation,mel script | Sunday, July 6th, 2008

I've been doing a fair amount of rigging where I use joints and empty groups as controllers. I try to minimize the need for going to the outliner to select things by adding shapeNodes to these controllers so that they can be selected directly in the viewport.

To parent a shapeNode to a different transform you need to use the command

parent -r -shape;

but often you'll get the shape jumping to a new location when it adjusts to its new parent. If that happens you can select the cv's or verts and move them to where you want them, but if you are doing this alot it can get messy and becomes time consuming. And that was the motivation for writing djParentShape.mel

With djParentShape you select the new controller object, shift-select the joint and run the script. It has two modes of operation: move to position or preserve position so you simply choose the one you need.

Download from here.

Keep reading for details...

move to position

We have a joint chain and we want to add a controller to one of the joints so that we can select it in the viewport even when joints are not displayed. We create a sphere to use as a control object and assign it a transparent shader.

djParentShape01.jpg

Select the sphere and then shift-select the joint

djParentShape02.jpg

source djParentShape.mel; djParentShapeMoveToPos;

The sphereShape is now parented under the joint transform. The old sphere transform has been deleted. Now when you select the sphere you are actually selecting the joint.

djParentShape03.jpg

preserve position

In this case you want to place a control handle precisely. You create a poly cube and move it to the location where you want the handle - either by transforming the object or its vertices, or both.

djParentShape04.jpg

djParentShape05.jpg

Now select the cube (transform node) and shift-select the joint

djParentShape06.jpg

source djParentShape.mel; djParentShapePreservePos;

djParentShape07.jpg

The pCubeShape is now parented under the joint and its position was preserved. The old pCube transform was deleted. Now selecting the cube is actually selecting the joint.

The djParentShape.mel is intended to be invoked using a shelf button or a marking menu, which is why the commands shown above include a source command. djParentShape.mel must be sourced before the other commands will be recognised. However, if you wanted to, you could add the following line to userSetup.mel

source djParentShape.mel

Then you would be able to simply type

djParentShapeMoveToPos;

or

djParentShapePreservePos;

Download from here.

2 Comments »

  1. Not a big fan of the outliner ,huh?

    Comment by designingpatrick — July 23, 2009 @ 10:36 pm

  2. As far as I know it is not possible to parent a shapeNode to a different transform using the outliner.

    Comment by david — July 24, 2009 @ 12:58 am

RSS feed for comments on this post.

Leave a comment

You must be logged in to post a comment.

Powered by WordPress | Based on a theme by Roy Tanck