Topics by tag:
Recently published articles by Dave G:
In an older post and in my 101 Autodesk Maya Tips, I talked about how you can send UNIX standard output to Maya via its commandPort and I just made a tool that batch generates previews for files using an open session of Maya. I made something similar in the past but it was slow because it launched a new session of Maya for each file via command line rendering. This is very quick because it just tells an already-open app to make a new scene, import the file, kick out an antialiased viewport 2 render to JPEG, wash, rinse and repeat.
Here is the Automator workflow file to install. Don’t rename it because it contains a shell script (stmaya) that bounces commands to Maya. You need to enable commandPort on port 2222 before Maya will accept input from the action. Do it with this command (I put this line in userSetup.mel so it is executed on Maya’s launch):
commandPort -n ":2222";
The only thing to keep in mind is that the script sets the imported file folder to your working project directory, so just remember to change it to your desired project after you’re done batching or you’ll be rendering into the last-previewed /tmp folder. Also, save your existing open work before you start doing these because it uses the “file -f -new” command meaning it won’t prompt you to save if you have an open doc with unsaved changes.
If you’re on Linux, you can do a similar thing with the two shell scripts that the Automator action uses. This is the script that operates on your input 3D file and this is the stmaya script that passes standard output to Maya. It’s a bit of a hairy combo that would be much nicer as one Python script but I am just updating existing bash scripts.
Sorry, Windows users – there’s no way to pipe standard output to Maya from the command prompt in Windows, so this can’t be adapted for non-UNIX OSes.
When Maya crashes, it tries to save out a file to a temp folder that you can recover on relaunch. In my 101 Autodesk Maya Tips I mention how you can get this file to open in Maya without digging through temp folders on Mac/Win/Linux but it seems that, due to what I think is V-Ray’s redirection of standard output, I no longer get the path of the crash file in the system log. So, I’m updating the script to work more like the Linux version. It does the exact same thing but by parsing the TMPDIR environment variable:
Grab the updated shell script or Automator Service which doesn’t require a terminal. Just open it from the Services menu in OS X.. After Maya 2014 is out, I’ll be releasing an updated version of 101 Autodesk Maya Tips to incorporate this change and I’ll add some new tips as well. Existing owners should receive the updated copy for free.
1 note | Permalink
I mentioned a while ago that Maya 2013 breaks compatibility with older versions since it added some data to the Maya ASCII format that the other versions don’t understand. Well, it seems that this is pretty easily addressed with a simple find and replace in a text editor. The offending flag is “-ch #####”, where the ### is any number of whatever length. To make 2013 scenes compatible with older Maya versions, just replace that flag and the space after it with nothing:
If you have a text editor that supports regular expressions, use a regular expression in the find field and replace all with nothing. This is what that would look like:
Note that there is a space at the end after the “" that you can’t see – In BBEdit, regular expressions are referred to as GREP, the Unix app that finds things by regular expressions. I’m using BBEdit and it’s really good with giant text files like these but I went a step further and made a shell script for OS X and Linux that just does it all in one step with sed and saves out a file at the same location with a “_2012_compatible.ma” extension. Anyway, you can see it all works perfectly in this video:
Update: There is now a Python version of the stripper script that works with Windows as well as OS X and Linux. Thanks to Dhruv Govil for that. The Python script can be run from within Maya or from a command line. To run it from a command line, enter “python /path/to/stripper_2013.py /path/to/scene.ma”. Check the script contents on how to run it from within Maya.
I also made an Automator action for OS X that does the same thing:
Grab that here.
If you don’t know what version the document was created with, I made another Automator action that reads Maya ASCII files and tells you what it is with Growl:
Grab that here. It requires the growlnotify command line app be installed in /usr/local/bin/
5 notes | Permalink
There are some Windows thumbnail apps for Maya docs that get mixed results and cost cash money. I just whipped up something that uses Maya itself to generate a hardware rendered preview for selected .ma or .mb files (it also works on OBJ, FBX, etc):
It’s just a shell script that can be adapted to work in Linux as well as OS X (and Windows if you use Cygwin).
Here’s the shell script (run it by doing path/to/script.sh file1.mb file2.ma file3.obj)
Grab the Automator workflow here.
Both the shell script and Automator actions reference Maya 2012 on OS X. Just change the path to reference your Maya version.
Update: I made a revised version that renders the preview to /tmp and uses QuickLook to preview the document, for less clutter:
Grab it here: QuickLook_Maya.workflow
I made this Automator service a while ago for making V-Ray Proxies and I added a prompt for the face count.
So here are the downloads for the multithreaded Python image converters and multithreaded rar/unrar scripts I made yesterday. You’ll need Python 3.2 to run them, since they rely on the concurrent.futures module from 3.2. Grab the installer here: http://www.python.org/getit/releases/3.2/. The Mac installer doesn’t overwrite your existing 2.7.1 Python install so you invoke the new python by typing “python3” in the Terminal.The .py scripts:
sips_PNG This uses sips in OS X for conversion, so if you’re looking to use it in Linux, you’ll probably want to rewrite the last line of def sipper to use Imagemagick’s convert or something built-in.
unrar_threaded This should work in Linux without modification.
rar_threaded This should work in Linux without modification.
How to run the scripts: these take a batch of paths to items from standard input and then process them, so the easiest way to run them is to type “find /path/to/images/ | python3 path/to/sips_threaded.py” or “find /path/to/whattocompress | python3 path/to/rar_threaded.py”
For OS X only – Automator workflows
First, the sips conversion workflow files (PNG, TIF, TGA, PSD, JPG). If you just want something to make image conversion fast and easy in OS X, I made Automator services for OS X 10.7 (might work in 10.6) that don’t depend on the terminal or the scripts:
Grab them here: Download here. The only catch is that these Automator workflows require that you make Python 3.2 the default version run when typing “python” in the terminal. That’s done by writing this in the terminal:
sudo cp /usr/local/bin/python3 /usr/bin/python
The good news is that this isn’t destructive since /usr/bin/python was just a duplicate of /usr/bin/python2.7. /usr/bin/ still has Python 2.7, 2.6, and 2.5 from the default OS X install, so I can still use older versions of those by typing “python2.7”.
23 notes | Permalink
I just got through a rather crazy few weeks of magazine production and I’ve got some time now, as I babysit the PDF uploads, to talk about some techniques for making your work easier in a similar case of do-or-die. I was brought in to take over art direction for a magazine that was dangerously close to the deadline and I had to use some efficient techniques and tools, some that I scripted, to keep from missing a barrage of tight deadlines. I know most of my readers are 3D artists so I’ll make this relevant to you guys thinking this is just about print design stuff. Aside from the workflow tips, which are Mac and Unix user-oriented, the CMYK and colour gamut info is relevant to everyone, and important to know since it will affect the quality of the work you submit to publications if you’re a 3D artist.
To speed up the approval process, I mad an Automator workflow to move files to my Public Dropbox folder and then send all the links to the clipboard for emailing. The built-in Dropbox plug-in only copies one document link at a time so this killed two birds with a big giant rock – web-res PDF files moved and all links copied for my email:
Grab the Automator workflow here and replace the part before “/Public” with your account number and you’re good to go. If you’d rather have it copy instead of move, just replace “mv” in the script with “cp”.
Finder labels for change tracking
If you’re a long-time Mac user, you’ll know the value of Finder labels. If you’re new to Macs, start using them and you’ll wonder how you managed without them before. They are a simple and effective way of tracking to-dos:
If you’re working off of a server with multiple people on a project, put a screenshot of your label guide in the folder and suddenly everyone knows the status of all folders and files. Great for bringing in last-minute help when there’s a crunch.
You’re not doing anyone any favours by sending them CMYK images
Keep everything in RGB mode. For our magazine workflow, we send everything to press as high-res CMYK PDFs but I leave everything in RGB in the layouts and it’s actually much better to do this to get the best quality. Images should never be adjusted in CMYK mode, unless it’s an illustration where you need specific values looked up in a book or chart. We almost always have to tweak the balance, contrast and curves for images destined for press because what others see on their screens is very different from what press-calibrated settings look like. My calibrated NEC Spectraviews are set up for a very low luminance and 5000K white point for press (yes, it looks like ass), on top of being hardware calibrated. CMYK is a destination, not a good working colour space and the gamut is very small compared to AdobeRGB (or even sRGB). Here is a Colorsync Utility plot of a US sheet-feed coated CMYK profile inside AdobeRGB:
That’s a lot of colour info missing in that white area.
When I have to adjust an image, I might convert it back to RGB for drastic changes because adjusting image balance is not like adjusting CMYK values, that should always be left at your conversion settings for optimum ink density. So, if a photographer sends me an image in CMYK mode, they’ve effectively tossed away a lot of colour information needlessly, then had a lossy adjustment (curves, contrast, etc) on a smaller-gamut image, which further degrades the image and then had it converted back to CMYK. Leaving it in RGB mode for every stage, right up until they are made into CMYK PDFs for press by Indesign, means I can adjust after I get my proofs and always have the best quality possible. It also means I don’t have to manually change images to CMYK mode, saving time. So, if you’re sending your 3D illustration to a magazine for a portfolio submission, always send them an RGB image (8-bit, usually) and embed the colour profile. If you want to be extra anal about how it looks, send a colour proof they can try to match, because sRGB or AdobeRGB profiles don’t tell them anything about white point (Kelvin) or luminance. A colour profile alone is not enough to guarantee your work will be seen the same on someone else’s end – it’s just a colour look-up-table (a palette) and a gamma value.
Symlinks to the rescue
When it came time to leave my home office and head to the publishing company for proofreading and corrections, I had to put everything on my laptop. The problem is that this breaks the image links in Indesign, because they are absolute (not relative) paths. You can work around this by putting all the images in the folder with the layout but that’s a mess, so I used a symlink to fake a link to the original volume. The layout files were looking for images in /Volumes/HOME_RAID/WORK/Tourism_Toronto/ but all the layouts are in /Users/beige/WORK/Tourism_Toronto/ so I opened the terminal on my MacBook Pro and did the following commands:
sudo mkdir /Volumes/HOME_RAID
sudo mkdir /Volumes/HOME_RAID/WORK/
sudo ln -s /Users/beige/WORK/Tourism_Toronto/ /Volumes/HOME_RAID/WORK/Tourism_Toronto
The first command makes a folder in the Volumes folder. The second makes the WORK folder in there and the last command is the creation of a symlink in the WORK folder that links to the copied Tourism_Toronto folder. Once I open the layout in Indesign, all the image links work since it is simply redirected at the OS level to look in the copied folder and the absolute paths work fine. The I’ve used this in the past with V-Ray network renderings that were looking for similar absolute paths to textures and it works perfectly and there’s no risk to doing it. If you mount the actual real volume later, it just does what OS X used to do when you accidentally disconnected/reconnected a volume – it appends a -1 on the volume name so nothing is overwritten:
Just delete the HOME_RAID folder from the Volumes folder and it will mount normally:
That saved a lot of time.
Indesign tools for maximum awesome
If you’re an Indesign user and need to do very specifically named, single-page PDFs for press, Zevrix Batch Output (now Output Factory) is great and their Link Optimizer helped me swap out giant JPEGs for perfectly-scaled TIFFs. It saved a ton of time that otherwise would have been spent doing manual conversions/resizing/placement.
Anyway, you can tell that I’m a bit of a workflow nut but, if you are efficient at what you do, and become known as someone who will get your clients out of a ridiculous deadline unscathed, you can charge more and they won’t balk at the price tag because they know it will be done right – you’re Mr. Wolf from Pulp Fiction. For a freelancer, having a reputation as a reliable and efficient professional, in any field, is critical. Word travels fast when you have a bad reputation, so don’t let that happen, no matter how crappy the gig. Anyway, hope these tips prove helpful to others on brutal deadlines.
3 notes | Permalink
Maya has three methods of interacting with it without a GUI. The first is by sending it commands via Unix standard output and a commandPrompt port (covered here), the second is in prompt mode where it basically runs in a terminal as a MEL or Python interpreter, letting you open scenes and process them with text commands. The other method is to ask it to do commands while opening a scene for rendering, and this sounds like a hack but it’s actually really powerful because it can be shell scripted and used with variables like multiple selected files. It also assumes you’re working with the file you’ve specified to render, so you don’t have to explicitly open it like when using the -prompt mode interpreter. I’ve been playing with UDK in Parallels Desktop 7 (works great) and I have all these stock tree models in Maya format that I’d like in FBX for UDK. Since FBXConverter can’t handle Maya files, the only GUI alternative is to open these one by one and export FBX files. Very tedious. So what I’ve done is used the render command with a -preRender “FBXExport -f /path/to/file.fbx” argument and just made the render a hardware render and written to /tmp so it doesn’t take any render time and it will be deleted by the OS later.
For the commands, the headless interpreter mode works by launching Maya with “-prompt” at the end of the launch command in a terminal window:
That’s on OS X and same in Linux with different bath to the maya binary. In Windows it’s done with a launch flag on the application, I think. The render command works like this:
/Applications/Autodesk/maya2012/Maya.app/Contents/MacOS/Render -r hw -s 1 -e 1 -rd /tmp/ -preRender “putYourCodeHere” /path/to/file.mb
On Windows, you’ll need to use a different temp path. Here’s an example of the two latter methods doing the same action.
The drawback to the renderer method is that it’s not really meant for multi-line operations (merge, then export, for example) so it’s best used for simple exporting. If you want to do multiline processing as a batch, take a look at piping stdout to Maya. But for the simple export of FBX files, it’s great and I whipped up a shell script and Automator action to work with multiple files:
You can grab the shell script here and the Automator action here. Both the Automator action and the shell script accept multiple files as input and will save the FBX files to the same folder as the source file. Sorry, Windows users - it uses bash so there’s no way to get this to run on a Windows machine without Cygwin and I’m not sure that would work either.
4 notes | Permalink
My WordService utility was broken by the Lion update and it doesn’t look supported anymore, so I made these conversion services from shell scripts I found around the Net.
Put them into ~/Library/Services/ to install. [Optional] Assign hotkeys in Services system preference panel and you’re set for quick conversion of text.
1 note | Permalink