The only way to fly
One valuable bit of information gleaned from an entire day’s worth of mind-numbing airport/airplane time — if you have to have a stop, go through Hong Kong international airport if at all possible. Lots of decent looking food options and free wifi throughout the airport. Better yet, move to Hong Kong so you can always [...]
It’s Alive!
A few people have asked me about the shake plugin tutorials I used to have up on the web. They got blown to the corners of the intertubes while I was moving to London and starting work at the Foundry on Nuke and I haven’t had time to deal with it. Well I’ve finally got [...]
Is This a GUI or a Render?
Sometimes it’s useful to know if the script is executing in the GUI or a background render — maybe you’ve got a really processing-intensive node that you’d like to put a Select around so it only runs when you render.
Reference the variable “sys.runLevel” (note the capital-L, case matters!).
0 = render, 1 = GUI.
Using Functions From External Libraries in Expressions and Macros
To use a function from a .dll (or .so or .dylib depending on your platform) with C bindings you simply need to declare it to Shake. In fact, if you look at Shake’s nreal.h file you’ll see this done in many places, including making available a number of math functions. If you have a library [...]
Setting Quality For .jpg Output on the Command Line
Normally you can find out what the arguments for a command line call to a Shake node are with -help, but in the case of FileOut it comes up a little short:
mplec% shake -help fileout
-fileout <imageName> [fileFormat] [...]
In cases like this you can figure out what [...]
Setting cacheMode at Startup
To set the global cacheMode parameter at startup, put a .h file in your nreal/include/startup/ui folder containing:
script.cacheMode = 3;
Where:
0 = None
1 = Read Only
2 = Normal
3 = Aggressive
Launching An External Process With “popen()”
In an earlier tip I showed how to use system() to run an external process. But sometimes just running the process isn’t enough. If you need to read the output of the process or write to it as a user would by typing into the shell you can use popen() to create a pipe to [...]
Launching An External Process With “system()”
People are always coming up with things that they’d like to launch directly from a menu item in Shake, a common case being some kind of render queue manager. This can be done by putting a few lines like the following in a .h file in your $HOME/nreal/include/startup/ui folder.
extern “C” { int system(char [...]
Exactly What Frame Is This FileIn Reading?
You can get the complete filename of the current image that a FileIn/SFileIn node is reading by referencing SFileIn1._curImageName (replacing SFileIn1 with your input node’s name, of course).
You can get the frame number (as a text string) from _curFrameStr. To use this in an expression you’ll need to convert it to a floating point number. [...]
Determining the DOD of a Node
You can reference the extents of the DOD with:
dod[0] –> left
dod[1] –> bottom
dod[2] –> right
dod[3] –> top
