sjt.is

Pipeline. Period.

Select constraining object

This is a tiny snippet I threw together today to speed up selecting the object that was controlling my selected object. In this case the object that was being controlled was a curve, but the constraining object (controlling the curve) was an invisible transform node, so instead of going through the hypergraph I wrote this:

import maya.cmds as mc
selection = mc.ls(sl=1)
toSelect = []
for item in selection:
   constraint = mc.listConnections( item+'.parentInverseMatrix[0]', d=1, s=0,type='constraint')
   if constraint:
      constraint = constraint[0]
      src = mc.listConnections(constraint+'.target[0].targetParentMatrix', d=0, s=1)
      if src:
         toSelect.extend(src)
try:
   mc.select(toSelect)
except:
   pass

Note: this allows you to select multiple constrained objects and this will try and find the driving objects, this does not handle multiple constraints or anything fancy like that. Enjoy

What I learned today #5: Quicktime COM object’s volume range.

When setting the volume of a quicktime player through COM please keep in mind that the range is from 0-1 NOT 0-100 as I thought (since there doesn’t seem to be any good documentation about the QT COM interface). QT allows you to set the volume to 100 and you end up with painfully loud sound. So set your volume to 1 to allow people to enjoy their hearing for a new day.

What I learned today #4:Center Current Frame

When using Maya’s Dope Sheet and Graph Editor you sometimes want to quickly center the editors on the current active frame. You can do this by going ‘View’>’Center Current Frame’ - or - you can add these two commands to your hotkey editor and map that functionality to some spiffy hotkeys: For the Graph Editor: animCurveEditor -edit -lookAt currentTime graphEditor1GraphEd; For the Dope Sheet: dopeSheetEditor -edit -lookAt currentTime dopeSheetPanel1DopeSheetEd; For those who like this sort of stuff there is Cameron Fielding’s ‘Tap your timing’ - tip

What I learned today #3: Wrapping your paths in quotes!

Always always always remember wrapping your paths in quotes. I keep running into stuff I wrote break because someone saved a file with a space in it and I forgot to wrap the path in quotes. This works: blackwave.exe -d 50 superwave.wav This doesn’t: blackwave.exe -d 50 super 2.wav (two file arguments, ‘super’ and ‘2.wav’) To fix this: blackwave.exe -d 50 "super 2.wav" So remember: whenever you are using path rembemer the "\""+ variable + "\"" (or something else that suits your language)

What I learned today #2: Various definitions of TEMP

In Softimage on Windows, if you fetch the TEMP environment variable e.g. from witihn python (with the os.environ dictionary), you will get a different directory when you get the TEMP variable from outside Softimage. Outside Softimage you get: C:\Users\<username>\some\path\I\cannot\rembemer within it you get: C:\Users\<username>\some\path\I\cannot\rembemer\XSI_temp_### Just in case you wanted to write files to TEMP and read from them later.

What I learned today #1: profiling helps you make things run faster

After seeing an excellent post (as usual) on Hamish’s site about a profiling utility he wrote I decided to give it a try today, and man is this thing useful or what. It helped me find bottlenecks in two of my scripts today and I can only imagine how much of the user’s time it will save.

Something sketchy

These have been making their rounds on the internet the last few days, and rightly so, they are absolutely fantastic. Sketchy Duel: Sketchy Ice Cream: Sketchy Guard: Truly fantastic work. Simple, clear, freaking hillarious.

doughellmann.com - a fantastic python resource

I ran into Doug Hellmann’s site the other day doughellmann.com. And he an excellent collection of articles and examples for a bunch of modules from python’s standard library called Python Module of the Week. The one’s I’ve used and had no idea existed were configparser, optparser and the logging module. But there are many, many more there. Absolute gold for those of us who havent gone through every page of the documentation.

An even tinier update

Well, this place sure has been quiet for the last few months. Might have something to do with having a 14 month old son coupled with working on Thor. Recently I’ve mostly been making some handy tools for Maya. One thing I learned is that if you playblast from maya using the x264 codec you simply need to remux the file and package it in an mp4 container and then you got yourself a nice quicktime-playing h264 playblast. Very handy stuff. Busy times. Who knows when i’ll post something again. The supsense is probably unbearable. As always you can catch my slighly more frequent posts on twitter.

tiny update

A small tiny update with some fun news. I started working at CAOZ in Reykjavik a couple of months back. (Before that switch I animated two frog-filled Vodafone spots for Mistrti). I’ll be working on the first Icelandic CGI-feature Thor - the edda chronicles which is a co-production between CAOZ in Reykjavik, Ulyesses in Hamburg, Germany and Magma Productions in Galway, Ireland. I’ve been working on the storyboards (editing them together and such) and writing some rigging scripts and soon I’ll move over to some pipeline tools and some more rigging scripts. And of course animating once animation starts. Fun times ahead. So expect fewer posts than usual. (There is something less than 0?)