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... (more...)

toggle hypershade thumbnail updates

david | dj mod, mel script | Friday, July 4th, 2008

A few weeks ago I saw this thread on cgtalk where Matt Estela offered a workaround for the slowness that we experience when using the hypershade when complex shaders or shaders with large file textures are involved. The update lag seems worse if some of the new mia shaders are involved. Matt's workaround is to simply disable the thumbnail updates while you are changing attribute values and to re-enable the updates again later when its more convenient.

I spent some time modifying a maya2008 sp1 mel script called hyperShadePanel.mel to add Matt's suggested workaround to a new button. Its the one with the little green shader ball icon in the center collumn as shown here

thumbnailUpdatesToggleButton.jpg

You can use it to toggle thumbnail updates on and off. You'll get one of those purple warnings in the info window to tell you the update state has changed.

warningMessage.jpg

You can download my modified version with the button icons from my downloads page. Put hyperShadePanel.mel in your local scripts folder and the xpm files in your icons folder and you'll get the new button when you restart maya.

Download here.

I previously uploaded an earlier mod version soon after reading the cgtalk post, but the button behavior was slightly awkward. This has been corrected now, so this note is for anybody who tried it before - its better now.

poseDeformer for maya2008-x64

david | animation, mel script | Monday, May 26th, 2008

My downloads page now has a version of Michael Comet's poseDeformer which I have compiled for maya2008-x64.

I have not done much testing, but it seems to be working ok on vista 64 with maya2008 sp1 64 bit.

Please test it properly yourself before committing to a production that relys on this plugin. If you encounter problems, feel free to comment here.

Download here. (Its near the bottom of the page)

Update: I've discovered you need to install .net framework 3.5 for this to work correctly.

djSetKeyframe.mel and “straight ahead” animation

david | animation, mel script | Tuesday, April 22nd, 2008

I usually animate in a straight ahead manner, where I create a pose... keyframe... move forward on the timeline... create the next pose and so on. Since there are no keys ahead of where I am working, the last pose is held when I move forward. I find it easy to do a first pass this way.

But the first pass is rarely final and when changing some animation in the middle of a sequence it is often easier to delete a block of keyframes rather than mess with the existing ones. But now the keyframes that come after the deleted section mean those poses are no longer held when I move forward in time.

djSetKeyframe.mel was written to enable a more "straight ahead" approach when making changes to these middle bits.

Say for example, I delete all the keyframes between frame 100 and 200 so I can redo that section. I would then start by setting a new keyframe at frame 199. Then I goto to the last keyframe before frame 100 and run djSetKeyframe 1 0; which copies that keyframe to frame 199 and sets the inbetween tangents to linear. This creates a "hold" until frame 199.

Now I can work forward as I did in my first pass. Each new keyframe I set using djSetKeyframe 1 0; to simultaneously update the hold frame at 199. Of course, at some point the new animation needs to blend back into the old, so then I just delete the keyframe at 199.

The numbers you see after the command in the above examples, change its behaviour. The first is the "push" flag; set to 0 behaves just like the channel box rmb-menu Key Selected. Set to 1 and it will also copy the new keyframe forward.

The second number is the "unlock tangent weights" flag. (I wish I knew how to make unlocked weighted tangents the default in maya) Set this 2nd number to 0 and you get the usual locked tangent weights, but set it to 1 and the weights will be unlocked as you create new keyframes.

djSetKeyframe.mel was written to be mapped to hot-keys (or marking menus if you prefer). I have djSetKeyframe 0 1; mapped to [s] and djSetKeyframe 1 1; mapped to [S].

NOTES and CREDITS: This script requires the installation of Hamish McKenzies zooToolbox. I have used a proc called zooSetkeyPush which is just one of many useful functions that are part of the marking menu built by zooSetKey.mel.

Download djSetKeyframe.rar from here. (see file header for full usage details)

An afterthought: As I re-read this tonight, I realize that I will probably be asked "Why dont you just use "step" tangents instead ?". The simple answer is... um... that's not the way I prefer to work. I like to be able to scrub through my animation as I am creating it so I can judge the momentum and flow of my action. I know this is a departure from the widely used workflow of blocking out the action using only poses and step tangents on the first pass. (And I was reminded of this recently while reading Cameron Fielding's blog where he links to a nice document by Mike Walling) Getting those key poses down is essential, I agree. I'm impatient though. I want to see it move too. This is what I have become used to.

djSwitchManipOnSelection.mel

david | mel script | Friday, April 18th, 2008

In my last post I wrote about two methods for getting the manipulator handle to change automatically when you select an object. Then, thanks to Brad Clark's post on cgtalk I discovered yet another way (actually the same technique as zooTriggered, but doesnt require the zooToolbox to be installed).

I thought it would be useful to put Brad's whichTool() proc into an easy to use mel script. I've called it djSwitchManipOnSelection.mel to stick with my usual naming, but really the guts of this are Brad's code and a bit from Hamish - thanks guys.

You need to source djSwitchManipOnSelection.mel, probably by adding a line to your userSetup.mel. Then you have a few commands you can use. Here is a basic work flow.

Select some objects. Then in the cmd window type djCreateDefaultToolAttr 0 to flag those objects for worldspace move (substitute 1 for object move, 2 for rotate, 3 for scale). An attribute called defaultTool is added to the objects and specifies the manipulator type, which you can change later if you wish.

djSwitchManipOnSelection 1 activates the manipulator switching scriptJob. Now a change of selection will check for the defaultTool attribute and change manipulator accordingly.

djSwitchManipOnSelection 0 deactivates manipulator switching.

djRemoveDefaultToolAttr removes the defaultTool attribute from selected objects.

These commands will be easier to use if you assign them to shelf buttons or marking menus.

Download djSwitchManipOnSelection.rar here.

default manipulators and zooTriggered

david | animation, mel script, tutorials | Wednesday, April 16th, 2008

Yesterday I learned something new. Stev Kalinowski posted this on CGTalk

In the attribute editor, under the Display rollout you set the "Show Manip Default" drop down list to Translate or Rotate for each control. Then to select objects hit "t" (Show Manipulators) instead of the move or rotate tool. Now when you select objects you'll get the manipulator you set for each control.

I tested it out using two objects called "translateMe" and "rotateMe" and I set the Show Manip Default attribute as shown here

defaultManipAttrEd_translate.jpg

defaultManipAttrEd_rotate.jpg

Now, as long as I am in Show Manipulators mode (invoked with the "t" hotkey by default) then the manipulator handle will change based on my selection.

This is quite handy when animating, but it depends on being in the Show Manipulators mode, which I would not be as comfortable with alot of the time, since I frequently need to also use the translate, rotate and scale modes.

Well, there is another way to do the same thing using Hamish McKenzie's zooTriggered scripts.

I have written about using zooTriggered here, but if you read that quick walk-through, you might think it's use is restricted to selecting a control object to trigger the selection of another object(s). In fact zooTriggered can trigger almost any mel command(s) which means it can be used to activate a specified manipulator when you select an object.

Here's a really quick look.

Open the zooTriggered UI and in the View menu make sure "Edit zooTriggered command" is selected. Then add the objects you want to configure (to the top left pane). Then right-mouse-click in the lower pane and select either the "use move tool preset" or the "use rotate tool preset".

zooTriggeredMoveToolPreset1.jpg

You should end up with something like this

zooTriggeredRotateToolPreset2.jpg

Now enable the trigger by clicking the "load" button so that the "load status" bar changes to green

zooTriggeredEnable.jpg

That's it. Now whenever you select the object, the manipulator tool you specified will become active.

There is a slight delay between your selection and the change of the manipulator, which is not the case with the Show Manipulators mode, but my preference is still the zooTriggered method since it allows me to stick with the regular translate, rotate, scale modes that I generally use.

cMuscleCreatorUI.mel modification

david | dj mod, mel script | Sunday, April 6th, 2008

I've been playing with the new maya 2008 ext 2 muscle system. The old ext 1 muscles are now refered to as "simple" so I was not surprised at the apparant complexity of the ext 2 Muscle Creator UI. It's going to take some getting used to.

One thing that bugged me right from the start was the size of the frames in the lower half of the "Edit" tab of the UI. The default muscles have 5 basic controls but the frame only shows 2 and you need to scroll to get to the others, as you can see in this snapshot of part of the UI

cMuscleCreatorUI_before.jpg

I found this to be a major stumbling block as I tried to navigate my way around the various muscle cross-section curves and controls.

To make it easier I had to edit cMuscleCreatorUI.mel and now the same part of the UI looks like this

cMuscleCreatorUI_after.jpg

This makes it much easier to find things.

You can get my modified cMuscleCreatorUI.mel from the downloads page. It's not quite perfect though. I struggle a bit with the mel for formLayout. If you collapse one of the other tabs in the UI those fields will revert to their smaller size. To get them back again you have to close and reopen the UI. Oh well. Better than nothing.

Downloads it here.

createMentalRayGlobalsTab.mel for maya 2008 sp1

david | mel script, rendering | Wednesday, March 19th, 2008

I always tell people to never modify the original maya mel scripts. Always make changes to a copy that is in your local scripts folder. This modified copy will over-ride the original maya version.

The downside to this is that when you upgrade to a new version of maya, the modified script may now be out of date, and since it still overrides the newer version, it could cause unpredictable problems.

A while ago I modified createMentalRayGlobalsTab.mel to add the ability to choose a tone mapper when creaing the physical sun/sky environment. After upgrading to maya 2008 sp1 this week I discovered that the "Render Settings" window loaded with an unhelpful error message and was completely blank. It took me a while to realize that my modified createMentalRayGlobalsTab.mel was to blame.

Often when things go wrong after an upgrade people start by removing their prefs folder, but if you have modified mel scripts, try removing them first.

I have updated the createMentalRayGlobalsTab.rar on the downloads page. It now contains a sp1 version as well as the original.

user marking menu hot keys

david | mel script | Thursday, March 13th, 2008

In maya I have a lot of marking menus, several of which are "user marking menus" that I created using the marking menu editor, while others are created dynamically by mel scripts, and all are assigned to hot keys.

What has bugged me for a long time is that some of these marking menus (all of my user marking menus) dont work when I click in a non-viewport window, like the graph editor for example. Today I set up a marking menu for some keyframe editing so I thought I should try to find out how to make it work in the graph editor.

I found the solution by poking around in one of Hamish McKenzie's zoo scripts. Here's what I did...

I created a marking menu, called KeyFrameEdit, with the marking menu editor and specified that it should be available for editing in the Hotkey Editor. Then I opened the Hotkey Editor and located the new marking menu which is listed twice as a command in the User Marking Menus section - KeyFrameEdit_Press and KeyFrameEdit_Release.

I highlighted KeyFrameEdit_Press and assigned alt-j as the hotkey. The following mel code appears in the lower half of the Hotkey Editor.

if (`popupMenu -exists tempMM`) { deleteUI tempMM; }
popupMenu -button 1 -ctl false -alt true -sh false -allowOptionBoxes true -parent viewPanes -mm 1 tempMM;
source "menu_KeyFrameEdit";

The mel command shown is executed when I hold alt-j and left-mouse click in the viewports as expected, but to make it work in the graph editor I had to edit the command in the Hotkey Editor. Here is the result.

string $panel = `getPanel -up`;
if (`popupMenu -exists tempMM`) { deleteUI tempMM; }
if( !`control -ex $panel` ) $panel = "viewPanes";
popupMenu -button 1 -ctl false -alt true -sh false -allowOptionBoxes true -parent $panel -mm 1 tempMM;
source "menu_KeyFrameEdit";

The extra code gets the name of the window the cursor is in and to passes it to the popupMenu command.

cMusclePaint.mel update for maya2008 ext2

david | mel script | Saturday, March 8th, 2008

If you downloaded my modified version of cMusclePaint.mel recently and you have since upgraded to maya2008 ext2 then you should download my updated version of cMusclePaint.mel

The cMusclePaint RAR file on the downloads page now contains both versions. Choose the one thats right for you.

Next Page »

Powered by WordPress | Based on a theme by Roy Tanck