Some some of the stuff I mentioned in the last video post about using Python. There's some very cool stuff out there to check out if you have the cajones to try to pull them apart a bit. Kudos to all these guys for making awesome stuff, THEN making it available to us all for free (for the most part)!
Hamish McKenzie - Zoo tools - I've mentioned him a bunch of times. Really great stuff in terms of tools and also on the blog. http://www.macaronikazoo.com/
CG Monks - Awesome toolset! http://www.cgmonks.com/
Mark Jackson - Red9 Tools - Holy moly! That's some heavy duty scripting stuff he's giving away! http://red9-consultancy.blogspot.com/
Morgan Loomis - http://morganloomis.com/downloads/
Michael Comet - http://www.comet-cartoons.com/
Brendan Ross - http://www.supercrumbly.com/latest.php
WillieWork
On the weaslings and workings of wee little me.
Wednesday, June 05, 2013
Some Python in Maya basics
I've been working a ton lately, so sorry for the lack of posts. Some day I'll figure out how to do smaller things a little more regularly.
Annnyyyywayyys . . . On the last job I was on (and in a rigging class I taught recently), I was demo-ing some little scripts I'd written and realized that I'd forgotten how confusing it can be to run python stuff in Maya if you don't have any experience doing it or know why things are done the way they are. In fact, I recall being able to put together a fairly competent script in python (cuz I knew a bunch of MEL already) and actually not knowing how to run it in maya! So I would just copy and paste the whole thing to the script editor each time or make a button out of the whole code. . . until I was like "What the hell am I doing? Figure this out!". Turns out it wasn't too hard, but it can be a bit confusing sometimes, certainly at the beginning and so I made a couple of quick videos walking through a few things you might want to know about how (and occasionally why) you do things in Maya with Python. Absolutely nothing fancy or tricky here, just the basics for those of you who haven't quite wrapped your heads around it.
Two videos: the first one is the really basic stuff (importing a module and running a function from it) and the second goes into a few other areas that are a bit more advanced (reloading scripts, what those .pyc files are and how they can trip you up sometimes, messing with the python path [sys.path] to load files from other folders, setting up a package in python and so on).
BTW, I've done a dump of some scripts onto the Downloads page above ^, and I'll do a quick video walkthrough of them in short order
Maya/Python: The basics of using python scripts in Maya (Pt 1) from zeth willie on Vimeo.
Maya/Python: The basics of using python scripts in Maya (Pt 2) from zeth willie on Vimeo.
Annnyyyywayyys . . . On the last job I was on (and in a rigging class I taught recently), I was demo-ing some little scripts I'd written and realized that I'd forgotten how confusing it can be to run python stuff in Maya if you don't have any experience doing it or know why things are done the way they are. In fact, I recall being able to put together a fairly competent script in python (cuz I knew a bunch of MEL already) and actually not knowing how to run it in maya! So I would just copy and paste the whole thing to the script editor each time or make a button out of the whole code. . . until I was like "What the hell am I doing? Figure this out!". Turns out it wasn't too hard, but it can be a bit confusing sometimes, certainly at the beginning and so I made a couple of quick videos walking through a few things you might want to know about how (and occasionally why) you do things in Maya with Python. Absolutely nothing fancy or tricky here, just the basics for those of you who haven't quite wrapped your heads around it.
Two videos: the first one is the really basic stuff (importing a module and running a function from it) and the second goes into a few other areas that are a bit more advanced (reloading scripts, what those .pyc files are and how they can trip you up sometimes, messing with the python path [sys.path] to load files from other folders, setting up a package in python and so on).
BTW, I've done a dump of some scripts onto the Downloads page above ^, and I'll do a quick video walkthrough of them in short order
Maya/Python: The basics of using python scripts in Maya (Pt 1) from zeth willie on Vimeo.
Maya/Python: The basics of using python scripts in Maya (Pt 2) from zeth willie on Vimeo.
Some links I like . . .
Just some quick things that I thought were cool and worth checking out if you're interested in the kind of stuff I generally post here. . . .
Marco Giordano has been cranking out some sweet tutorials on Maya using math-y stuff. This one caught my eye: https://vimeo.com/66262994
Great stuff! He does the pole vector in essentially the same way I do, but he goes the extra mile and orients it. Which is sweet. You should check out some of his others too. I especially liked the one about using a cone to drive pose space correctives: https://vimeo.com/64958089
Charles Looker going over some math stuff, which is always cool in the context of 3D: http://charleslooker.wordpress.com/2013/05/21/maths-101-back-to-basics-matrices/
Danny Williams. His stuff is always nasty. Here's some artwork via Flooby Nooby: http://floobynooby.blogspot.com/2013/05/the-art-of-danny-williams.html
Here's some modeling stuff. Really? Modeling like that from a 3/4 view? https://vimeo.com/59582056
His blog: http://www.pointpusher.com/
I generally don't aggregate much here (read: churn other people's stuff) mostly cuz I feel like there're enough places around that do it better, more often, etc (like Lester Banks, etc), but once in a while is okay, right?
Friday, January 25, 2013
Rigging a shock absorber and so much more . . .
"So much more" might really be an overstatement. In fact, it is.
But there actually IS other stuff in there. As I mention in the vid, I was recently rigging a mechanical "tranformer-ish" guy and had some troubles with the model I got and thought it might be worth pointing out some of the way you could avoid the same issues. Things like how to avoid/deal with the skewing from uneven scaling etc. The shock absorber stuff is in there too :)
Here's the vid:
Maya/rigging: Setting up shock absorber and some notes on mechanical modeling from zeth willie on Vimeo.
Oh and btw, I'm an idiot because I wrote a bunch of code to zero out the rots and trans, then freeze the transforms, then reapply the rots and trans when, in fact, one line of code will do it (never really looked into the arguments for the "makeIdentity" command before. The "scale" flag will just freeze the scale attrs.):
But here's the gist of the code to make the single bone stretchy IK (at least it does the annoying parts for you):
zbw_smallIKStretch.py.zip
But there actually IS other stuff in there. As I mention in the vid, I was recently rigging a mechanical "tranformer-ish" guy and had some troubles with the model I got and thought it might be worth pointing out some of the way you could avoid the same issues. Things like how to avoid/deal with the skewing from uneven scaling etc. The shock absorber stuff is in there too :)
Here's the vid:
Maya/rigging: Setting up shock absorber and some notes on mechanical modeling from zeth willie on Vimeo.
Oh and btw, I'm an idiot because I wrote a bunch of code to zero out the rots and trans, then freeze the transforms, then reapply the rots and trans when, in fact, one line of code will do it (never really looked into the arguments for the "makeIdentity" command before. The "scale" flag will just freeze the scale attrs.):
cmds.makeIdentity("yourObject", a=True, s=True)And of course you could just do it from the menu options for "Freeze Transforms". Geez. . .
But here's the gist of the code to make the single bone stretchy IK (at least it does the annoying parts for you):
zbw_smallIKStretch.py.zip
import zbw_smallIKStretch as sik sik.smallIKStretch()
Python append to path tool
Here is a little script that allows you to browse for and select paths to add to your sys.path list for python.
I generally don't keep my python scripts (at least the ones I write myself) in my scripts folder, I keep them in one of a couple "Git" folders that allow me to easily load/sync my scripts over GitHub so I can work on them on various computers (I suppose I could arrange things so that my scripts stay separate from all the other script in my scripts folder and point Git there, but I don't).
This works fine for me, but it's a bit a pain to have to keep pointing Maya there to look for my Python scripts. Up til I wrote this script I just wrote a little bit of python code in Maya to append to my sys.path and just copied that to the shelf. No problem. Unless I'm on another computer at home or at a studio. Still not a big deal, but I still have to put the scripts somewhere and point Maya there, and when I'm at a studio I often have stuff in a few places (desktop, folder on the desktop, etc). And I'm so lazy that I think it's a pain to grab the path name to add it to the "sys.path.append(pathName)" in Maya (especially on a Mac). So I wrote this.
Basically, it has two parts (the two tabs). The first part lets you browse for up to three paths and then add em with a click. It dummy checks that a) you've added something and b) what you've added is actually a path that exists.
The second tab is just a quick list of the paths that Maya is currently looking in, it refreshes once you've added new paths or you can manually refresh it if you've added paths elsewhere. Since I didn't want to make this window soooo big that it could catch any potential long path names, if you double click on a path in the "View Paths" tab, it will print that name in the script editor.
There's also the option in the menu bar to save out your entered paths (it will write a "zbw_appendPathSave.txt" file to your user prefs folder). You can then load it later to save some time (it will just overwrite itself if necessary) and it will reload the paths you've browsed for.
Here's a link to the script or it's in the NEW downloads section above. (note: slowly but surely I'll get the other scripts up there too)
Basically, I just drop this in my scripts folder (it's the only python script I keep there, except for stuff that might point Maya elsewhere) and run it from my shelf. Here's the code to do call the script (obviously python):
Hope it's useful to someone as lazy as me!
I generally don't keep my python scripts (at least the ones I write myself) in my scripts folder, I keep them in one of a couple "Git" folders that allow me to easily load/sync my scripts over GitHub so I can work on them on various computers (I suppose I could arrange things so that my scripts stay separate from all the other script in my scripts folder and point Git there, but I don't).
This works fine for me, but it's a bit a pain to have to keep pointing Maya there to look for my Python scripts. Up til I wrote this script I just wrote a little bit of python code in Maya to append to my sys.path and just copied that to the shelf. No problem. Unless I'm on another computer at home or at a studio. Still not a big deal, but I still have to put the scripts somewhere and point Maya there, and when I'm at a studio I often have stuff in a few places (desktop, folder on the desktop, etc). And I'm so lazy that I think it's a pain to grab the path name to add it to the "sys.path.append(pathName)" in Maya (especially on a Mac). So I wrote this.
Basically, it has two parts (the two tabs). The first part lets you browse for up to three paths and then add em with a click. It dummy checks that a) you've added something and b) what you've added is actually a path that exists.
The second tab is just a quick list of the paths that Maya is currently looking in, it refreshes once you've added new paths or you can manually refresh it if you've added paths elsewhere. Since I didn't want to make this window soooo big that it could catch any potential long path names, if you double click on a path in the "View Paths" tab, it will print that name in the script editor.
There's also the option in the menu bar to save out your entered paths (it will write a "zbw_appendPathSave.txt" file to your user prefs folder). You can then load it later to save some time (it will just overwrite itself if necessary) and it will reload the paths you've browsed for.
Here's a link to the script or it's in the NEW downloads section above. (note: slowly but surely I'll get the other scripts up there too)
Basically, I just drop this in my scripts folder (it's the only python script I keep there, except for stuff that might point Maya elsewhere) and run it from my shelf. Here's the code to do call the script (obviously python):
import zbw_appendPath zbw_appendPath.appendPath()
Hope it's useful to someone as lazy as me!
Shape node scaling tool
Here's a little thing that I made a while ago as a little hacked-together tool for some job I was working on. Eventually I added little bits until it ended up as this kind of done-ish version. (I know that's a real sales job, isn't it?:)
But it actually is pretty useful to me on a regular basis for everyday stuff, especially for scaling controls. The short description is that this grabs all of the components of each selected object (surfaces, curves and polys) and scales them. That is, your objects gets scaled without affecting the scale attributes or the transform node.
The setup looks a bit confusing (and maybe it is), but there are a few things you can do. There are two ways to scale things, either drag the slider (which will automatically recenter itself. Kind of weird, but I felt it gave better sensitivity and still allowed me to scale things very large with a few pulls) or type a number and press "scale". When you use the slider, the value that you slid gets entered into the field, so you can repeat it on the same object by clicking the scale button, or use the same value for other objects.
The stuff on the right is a bit more esoteric. What was happening was that I would scale a bunch of controls and then realize that I forgot to select one control. It was then tricky to repeat the same slider values, etc. So the top field on the right tracks the cumulative value change to the scales. So you can select a bunch of objects, change the values arbitrarily and this will keep track of the changes from where you started. You can then copy down that number and enter it into the text field if you need to grab another object and match it, though this will then change your tracked value. To get around that, you can "reset" the tracked value back to 100% once you select a new object(s). Similarly, if you do a bunch of scaling it can be tough to get back to the original value without hitting undo a bunch of times. So if you've tracked your changes (by starting with a "change" value of 100, via "reset") you can get back to the original state with the "orig" button (it will just figure out what you need to get back to 100% scale and multiply by that). This change will then be reflected in the "scale %" field if you want to apply it to something else (or just know what the number is).
Whew. Sounds like a lot for a simple tool, but I feel like maybe the naming, etc isn't super clear. Maybe at some point I'll put a "help" menu in there or something. . .
Hope it's useful!
import zbw_shapeScale zbw_shapeScale.shapeScale()
Subscribe to:
Posts (Atom)