import awesomeness as awsm

 

awsm.get_fortune('random')

I cannot conceive that anybody will require multiplications at the rate of 40,000 or even 4,000 per hour ... -- F. H. Wales (1936)

 

awsm.get_page_content('Tips & Tricks')

Alright, so within these pages we’ll have a few tips and tricks that I’ve found while working either in Maya, Windows, OSX or Linux. While they may not be the best tips and tricks in the world, they are things that I’ve found useful and wanted to pass them on to everyone else. Enjoi!

Maya Rigging and Skinning:

IK Stickiness:
If you forget to set “sticky” for your ik’s you can always just turn it on by selecting the ik, going into the attribute editor and selecting the IK Handle Attributes. Under that select the stickiness and either turn it on or of.

Mis-Rotated joints:
If you somehow rotate a joint out of place and it doesn’t want to go back simply do this:

setAttr “nameofjoint.rotate” -type “double3″ 0 0 0;

this sets the rotation back to x: 0 y: 0 z: 0. If you want it at an angle simply replace the zero with the angle you wish. Using just setAttr “nameofjoint.rotateX” (Y or Z) wont give you the correct results, for some reason. As a note, it’s actually better to recreate the joint, because there’s something wrong with it, initially. However, here’s another example for changing the rotations on 3 joints in the right leg chain:

setAttr “R_hip.rotate” -type “double3″ 0 0 0;
setAttr “R_ankle.rotate” -type “double3″ 0 0 0;
setAttr “R_ball.rotate” -type “double3″ 0 0 0;

Inserting a joint:
Let’s say you’ve got your hand setup, but you want another joint from the wrist to the hand because it’ll be easier to control the fingers that way. Ok. So you try to insert a joint from the wrist, but it just keeps making a new joint. Why? Because you’re splitting off that main joint. So first click on the first thumb joint hit shift+p to unparent it. Then insert your joint using the insert joint tool (click on the wrist joint and then drag it down the bone)! Done. Now re-parent the thumb to the wrist or to the new hand joint you made and that’s that!

Mirroring Weights:
Let’s say you imported your model from another file. It doesn’t set it at 0,0,0 for whatever reason. Generally it puts it so the grid is in the “chest” of the model. So in your brilliance you choose to move it up so it’s on the ground plane. You forget to freeze transforms. You rig it up and bind it and then paint some weights. Then you go to mirror those weights and they are all borked. Why? Well, as you can see from the last few sentences, it’s all a mistake. So what do you do? Well, just set the model back to 0,0,0 (assuming you haven’t frozen the geometry yet or you can at least undo it), then mirror your weights. Then move it back to where you originally had it and BAM! Nice weights again. An easier way would to be to remember to freeze transforms from the jump, but hey, we all screw up. I found this out, because it’s exactly what I did. :)

OS X file save issues:
Sometimes when working in maya on OS X the menus won’t work. Why? I have no idea. Well when this happens you have to shut maya down and restart it. Well, lets say you’ve made some large changes to your files and haven’t saved it lately and want to save a new version. Here’s how to fix the issue so you can restart it. Simply open the script editor and type in this:

string $fileName = `file -q -sn -shn`;
string $newName = “newSave_” + $fileName;
file -rename $newName; file -save;

What this does is it take the current file name and adds “newSave_” to the beginning of the file name and then saves it. So let’s say your current file name is test.mb. The new save name will be newSave_test.mb . And that’s that!

How to find files after a maya crash.
We’ve all been there. Maya crashes. It happens. And if you’re using a computer at your university, it’ll happen more often than you’d like to remember. Regardless of where it happens though Maya does attempt to save a version of your file before it crashes. Unfortunately, where it saves it isn’t very convenient. So I decided to write a script that would search for the .ma file that maya creates and move it to the desktop. We’ll start with the OSX version, since where Maya saves it in OSX is absolutely idiotic. To use any of these “helper” scripts you’ll need to either open up the terminal in OSX or the Command Shell in Windows (you could also save them as either an .sh or a .bat file and make them exectuable).

OSX Version

This command simply finds the file and tells you where it is, basing it’s output on the file type and how long ago it was created (which I’ve set to 5 minutes, but you can change it to whatever you’d like):

sudo find /private/var/folders -newerct ’5 minutes ago’ -print | grep .ma

This version puts the output into a variable and then moves the crashed file to your desktop. It should be saved as a bash script, but can run from the command line:

#!/bin/bash
export  ma_file=`sudo find /private/var/folders -newerct ’5 minutes ago’ -print | grep .ma`
echo $ma_file
cp $ma_file ~/Desktop

Windows Version:

This version of the script finds and moves the file to your desktop. This works in XP, but does not in Windows 7. It throws an error no matter what your privileges are due to a permissions error. However, here it is for XP users until I figure out a better way to fix it. (To be honest, if you’re running windows and care about the command line, you should probably download cygwin anyways.):

For /F “Tokens=2″ %%I in (`find /I %TEMP% “.ma”`) Do Set ma_file=%%I; copy “%ma_file%” %USERPROFILE%\Desktop

For Windows 7 users, you’ll have to navigate to your %TEMP% directory, which is fairly easy. Just open up explorer and type in %TEMP%. Done. Now just search the contents of that folder. Not pretty like code, but it works and that’s all we care about right? :)

Windows Tips & Tricks

One annoyance I have with windows is their print queue. When something fails to print, it stays there in an endless loop of non-printing. You can restart your computer and sometimes they’ll go away, but sometimes they wont. I got tired of dealing with this (which is why I’ve written most of my scripts) so I decided to write a small batch file to kill all the current print jobs. As a note, it does NOT care about print jobs you may want to keep. It kills them all. Dead. So use it with caution if you’re worried about breaking stuff you may want to keep. So without further ado, here you go:

kill-print-jobs

Just unzip it and run it (if you’re using Vista or Windows 7 you may have to run it as administrator since it kills a process). If you’re worried about what’s going on in the background with it, here’s the exact code of the .bat file:

:: kill-print-jobs.bat
:: Ever have those pesky damn print jobs that just wont print, but
:: wont go away? Well, this kills them PERMANENTLY AND DESTROYS YOUR COMPUTER!!!
:: Just kidding. It just destroys the print jobs and then gets you back
:: up and running.
::
@ECHO OFF

net stop spooler
cd %SystemRoot%\system32\spool\PRINTERS\
del /F *.spl
del /F *.shd
net start spooler

That’s all for now folks! Keep checking back as there will be new content as I find new stuff to figure out!