When building a rig utility nodes like mulipyDivide or reverse are a handy way of setting up functionality of controls. But after you've setup an IKFK blend for what feels like the hundredth time you start looking for a way to automate connecting up all those attributes.
If you go to the pymel docs and search for how to create these nodes you probably wont find what you where hoping for. While the latest docs have information on the nodes themselves there aren't any good examples like there are for most of the other pymel commands.
Since the docs aren't helping lets go back to Maya and look at what is output to the script editor when we make these nodes by hand. Open up the hypershade or node editor and make some of the nodes we want. You should see something like this.
Looking at these they are all made with the shadingNode command. If we go back to the pymel docs we can find a command that matches up in rendering/shadingNode. The examples are still pretty sparse but essentially we use the command like this.
For [NODETYPE] we enter what node we want as a string, in our case 'reverse' or 'multiplyDivide'. [NODECLASSIFICATION] is needed to tell maya where to put this node in the hypershade. We use as asUtility=True since we are making utility nodes, if you are making a light or shader you should use asLight or asShader respectively following the docs. So when we fill those things in our code will look like this.
The command returns a pynode which contains the node made which we can store in a variable in this case utility. With our node safely in a variable we can use it however we want.
Now that we have our utility nodes how do we hook it up?
To do this we have to look into pymel's attribute system which I'll be getting into next time.
I had someone ask if they could use my unicycle from my short film. Since I probly wont have too many more uses for it why not just release it to everyone. There is a pretty comprehensive readme included that should explain the complicated parts. and I would recommend reading the suggested usage section before animating with it. I 'm releasing this under a creative commons license.
I wrote this tool so I wouldn't have keep doing the same things over and over when making my blend shapes.
Its pretty easy to add new stuff just make a new subclass and make sure to implement 3 methods, then add a button to the right side for it. Its on my maya scripts bitbucket as blendshapetoolkit.py
The things the tool does are.
The first part I wrote because I wanted my blendshapes to keep the cylindrical nature of the helmet.
It has the option to select only the verts that I want to affect
In order to keep things organized it moves the newly created shape to the next spot.
Put a new material on the object with the option to only affect certain faces
For symmetrical meshes mirrors the shape node and moves it to -x
Adds the shape to the blendshape node of the target object
not shown in the video are the ability to rearrange the order and to save and load the list.
not quite getting the range i was hoping for. I used a log scale to get the values to be reasonable in maya and it kinda killed the peaks, but we'll see how it works when I get the audio its going to be used on.
So I'm just gonna say this right now the finale of my film is pretty awesome, I mean it has a unicycle for pete's sake. Of course that means I would have to animate a unicycle. Screw that lets script it.
It's really not that hard once you get down to it.
The first step for both direction and wheel rotation, get a vector of where you are now compared to where you just were.
for wheel rotation take that vector and divide it by the radius of your wheel and you have the amount of rotation in radians, easy.
For direction use atan2 on the vector to get the rotation for the direction. I also check to see if I'm moving backwards from where I was just and then offset the rotation so it doesn't just flip around.
one problem right now is to have auto/manual control I add the change in rotation for both the auto and manual controls to the the current rotation, which is going to cause problems for direction at least when I loop through the animation.
I'll need to add a hard manual mode where the rotations are directly linked to the manual controls. Then I just have to start my animation in that mode so it resets every time it loops
I need a scroll in my film so I came up with this.
There were a lot of constraints and expressions for this so I used pymel scripts to do all that for me (code is on my bitbucket site under randomMelAndPymel.py)
how i works:
each of the curl controls has a locator that has the same y position as the control unless the control is on the far side of the other control
that locator drives set driven keys on its curl chain and bend deformer fix
if the bottom locator is above a bind joint (actually reference joints off to the right in the video) that joint is constrained to the bottom curl otherwise its constrained to the top
I was a little lazy with the orientations(lack of sleep due to last week of term) so I couldn't use a parent constraint and had to use separate point and orient constraints.
So I've been in Vancouver for about 5 weeks now going to VFS to study Digital Character Animation. Its been fun getting to know the other students and working on my own film. I got my apartment a block from school last week and I'm really enjoying being this close to campus. 10 minutes a day of commuting is so much better then an hour especially when class goes to 10pm
I've started trying to write some python scripts to do things in maya that can be a pain in the ass. The coolest one is a script that makes towers based on a curve profile and stacking an object on top of itself over and over. I call it 'Towerfy' and its been really helpful for the set I'm making. I'll probly do a post or video about it once I get it to a 1.0 stage, but its up on my bitbucket account right now.