Python
problem downloading scripts?
It was brought to my attention that my Python scripts weren’t uploaded correctly, so I just re-uploaded them as .ZIP files and updated the links. Hopefully now my server isn’t going to try to compile them…
It was brought to my attention that my Python scripts weren’t uploaded correctly, so I just re-uploaded them as .ZIP files and updated the links. Hopefully now my server isn’t going to try to compile them…
I’ve been working on a project that incorporates a lot of models that were made by duplicating or importing things into a scene over and over again. When this happens, you have lots of nodes that will have the same name, and Maya will differentiate between them by tacking the Read more…
There are plenty of situations in motion graphics where you have tons of repeating elements. Designers love that kind of thing. You’ll also often be expected to make slight variations of these repeating elements… like a bunch of dots or squares or something that have slightly different textures to them, but are essentially the same thing. You could make a unique shader or a separate referenced asset for each one of these variations, if, say, you really hated yourself. Instead you could build the texture swap right into a rig, so the animator or designer or whoever could just pick a color or a texture for each object while animating the scene. This makes it way easier to direct, and you can just reference the same object over and over again instead of making multiple assets. I was just showing somebody how to do this the other day and figured it’d be a good thing to post about. Here’s how the setup works…
If you’re using mental ray as your renderer, chances are that you aren’t going to get a whole lot out of the passes system, especially if you’re trying to write custom color buffers. It’s a slow, buggy, work-intensive process to get a lot of passes out of mental ray that Vray has absolutely no trouble with. You could use render layers instead of custom passes, but mental ray also has a particularly long translation time for complex scenes (think of any scene where you see mental ray hang for about 10 minutes before it even starts to render a frame). So you can’t exactly add render layers haphazardly… you need to condense things as much as possible.
Someone told me about a neat trick that they saw at a studio they were freelancing at where three data channels would be written to RGB channels, almost like an RGB matte pass except with “technical” passes instead of mattes or beauty or whatever. Since the data being written only needs a single channel, you can get three kinds of data written to one image and then split them apart later in post. Simple enough when you think about it…
A big part of how I started learning Python was to find out ways to port my old MEL scripts into Python. It’s always easier writing it the second time, not only because I already have the logic of the script down but because Python is a way, way better language than MEL. Seriously, I can hardly stand to look at MEL anymore. Anyways, one of the simpler scripts I wrote when I was starting off with MEL was a copy/paste script for the channel box. Maya is one of the most complex programs I’ve ever encountered and yet there is no built-in way to copy and paste attributes between objects. Whatever.
The script was really handy, but because I was really new at MEL it didn’t copy and paste between separate instances of Maya, and it only copied transform channels. This new one in Python takes advantage of the pickle module to store variables to a temporary file on the user’s hard drive, and retrieve them later when running the paste operation. Here’s what the code looks like:
(more…)
As promised, a useful post! And probably a long one.
As far as rendering goes, the problem that I see people running into more often than anything else is render layers mysteriously breaking, especially when file referencing is involved. The symptoms are typically either objects disappearing or Maya simply being unwilling to switch to a specific render layer, claiming in the Script Editor that there are “overrides to a node in a missing reference” or something to that effect. A lot of less experienced or just less technical types will try to solve the problem by either importing their references into the scene (which is rarely a good idea), or by screaming obscenities (which is exhilarating but ineffective). There is a better way to get your scene to render with no problems, and be able to use file referencing. The trick is to use shared render layers properly, only allow certain edits to your references in your final scene, and make sure that your references are clean.