Archive for December, 2017

Maya GUI button commands, how they work, Maya Scripting

Posted by:

I was a bit confused on how Maya GUI button command calls work.

It seems that when I was following tutorials they put the variables from the GUI into the parameters for the call which of course meant that they needed to be in the definition too.

After working with Maya GUI interactions for a while I realized that information that is derived from the GUI need not be included in the parameters because they are derived directly from the GUI interface, ...

Continue Reading →
0

Script: Duplicate hierarchy and parent constrain existing hierarchy to duplicate hierarchy, Maya, Python

Posted by:

This script will duplicate the selected hierarchy and parent constrain each child of the first hierarchy to its twin in the new hierarchy.  This script opens a window that allows you to select the root object to duplicate then duplicates, renames the new hierarchy, establishes the parent constraint and sets up a control for all of the parent constraints to be controlled from a single attribute on the original root object.

 

Continue Reading →
0

Passing single objects into functions, getting operations on the name string rather than the object itself

Posted by:

When I first started passing single objects into functions and loops I found that python(maya) was treating them as the strings of the object’s name rather than the object itself.

 

This error depends on how the variable of the object is structured.  If it is a single object in a list then you will get this problem.  The solution is to simply encapsulate the variable in a list when you call the function:

function([object])

Continue Reading →
0

IK handle disappears and fails while parenting, Maya, Python

Posted by:

So I wrote a function to parent IK Handles under a shape and after the parent there was no IK handle and it didn’t work.
Autodesk documentation says the the return is a string, but it is actually a list.
It turns out that what is returned in an IkHandle() command is both the handle and the effector,  In that order.  So if you want that to work you have to specify the handle:
cmds.parent(ikHandle[0], parentShape)

Continue Reading →
0

Maya Error Message: Invalid arguments for flag ‘startJoint’. Expected string, got [ unicode ] # Maya, Python

Posted by:

I was working on a function that setup IK handles and I got this error message:

Invalid arguments for flag ‘startJoint’. Expected string, got [ unicode ] #

It turns out that even though the item being passed to the ikHandle() command was not specified as being a list, that is how it was being read.
This may be something peculiar in python, it seems that python may treat anything added to a selection as an array item even if the item is ...

Continue Reading →
0