Tuesday, March 25, 2014

Overriding Maya's duplicate defaults for better stability

Everything in Maya is basically name based. Move the sphere named "ball" over by 24 units etc.

Amazingly you can break a lot of simplicity of Maya by simply having 2 objects named the same thing.
In the following, if you were to type "select ball" Maya will return an error: or "setAttr ball.ty 100;" or basically any command that doesn't use the full path of the object. which is very common.( in Maya default and in many online scripts)

// Error: line 1: More than one object matches name: ball
 "group1| ball"  & "group2|ball"



Obviously this is not ideal.
In my experience I've found it is just easier to give every node in Maya a unique name and avoid name clashing as much as possible.

 However. The duplicate and duplicate with transform in Maya no longer has any options that you can customize, and by default is not set to rename children.

so if you duplicate "group2|ball" you will get "group3|ball"   as it only cares about objects in the same parent space.

I'm not exactly why it was decided to remove the options for duplicate and duplicate with transform , but I'm not a fan.

So I hijack the scripts and put them in my prefs/scripts/ directory and let it ignore the embedded Maya commands.

for Duplicate do a "whatIs performDuplicate.mel" and copy paste that script into your prefs dir.
then edit that script with the info below

//___________performDuplicate.mel____________________________

find the line that says :
int $renameChild = 0;
and replace the 0 with a 1
int $renameChild = 1;



for Duplicate with Transforms its a little easier, as it just uses the duplicate command , so you can add the following as a script in your prefs/scripts/ dir.


//___________DuplicateWithTransforms.mel____________________________
global proc DuplicateWithTransform ()
{
evalEcho("duplicate -rc -smartTransform")
}


the nice thing is, Duplicate Special still has an option box (for now) so if you want to duplicate a bunch of objects and retain non-unique child names, you can.





hope this helps
-=s

Friday, March 14, 2014

Smann's Toolbox Shelf for Maya


Okay, I hate the toolbox, I think it's a waste of space. So I started tinkering around with adding a shelf to it to make it more useful. 

 I've got everything working, now I'm just gonna try it out in production and see how it all holds up.

Right Now I'm over writing Maya's internal toobox,mel by putting mine in the prefs/scripts folder, but I think eventually I'd like to do it like addSideShelf.mel and have it just add to the toolbox rather than override.. but first I have to see how well this idea even works.

also, right now I only made 1 possible shelf available.. maybe down the line I'll add tabs.  but at some point the internal maya commend "shelfLayout" lost its ability to be vertical.