Setting Preferences and Customizing Shake |
This page explains how to customize the appearance of Shake, macros interactivity, and performance parameters. It also lists environment variables you can set to help Shake's performance.
Where to Put .h Files and Custom Icons |
Shake uses two important files in the <ShakeInstall>/Contents/Resources (<ShakeDir>/include for non-MacOSX) directory, named nreal.h and nrui.h. The first file, nreal.h, lists every function and all default performance settings. This file should not be touched by the user, but may be read as a formatting reference. The commands found in this file can be copied and placed in your own startup Directory (see below). The second file, nrui.h, contains the information to build the interface. It assigns menu names and members, tabs, buttons, slider settings, and all of the default settings when they are called up in the interface. The commands in this file can be copied and placed in your ui Directory. As with the nreal.h file, you shouldn't modify the nrui.h file. Create your own preference files to either add to or change Shake's performance.
To add your own files, create the following directory subtree:
<somewhere>/include/startup/ui.
"Somewhere" can be one or more of three possible locations (read by Shake in the order they are listed below):
|
Setttings that change performance or add macros (see below) are located in <somewhere>/include/startup, and have a .h file extension, for example,
/Users/me/nreal/include/startup/memory_settings.h
This is refered to as the startup directory. Files in this locations are refered to as startup .h files.
Settings that change the interface in some way (see below) are usually located in <somewhere>/include/startup/ui, and have a .h file extension, for example,
/Users/me/nreal/include/startup/ui/slider_settings.h
This is refered to as the ui directory or sometimes startup/ui directory. Files inside it are refered to as ui .h files.
Files that change additional default settings or add extra controls are in the templates directory, which is always under a ui directory:
/Users/me/nreal/include/startup/ui/templates/defaultfilter.h
All of these files can have any name, except "nreal.h" or "nrui.h", which are reserved files used by Shake as the standard list of functions and settings. Also, they must have the .h extension, so a fast way of disabling a file is to remove the extension.
Within a startup or startup/ui directory, files are loaded in no specific order. If it is important that a file gets loaded before another one, this can be accomplished by either:
#include <common.h>
#include <mystuff/loadmefirst.h>
#include <mystuff/nowloadthis.h>
#include <mystuff/andthistoo.h>
Include files are never loaded twice, so it's OK if two .h files contain the
same #include <somefile.h>
If these files do not appear to be working, refer to the following check list:
Just as you can create preference files, you can also create your own icons to be used. The description of the actual icons can be found below on the section on Changing the Interface. Icons can be found in one of 3 locations:
General Settings |
The // means that line is commented out and inactive.
Color Settings
Setting Tab Colors
In the ui directory:
nuiPushToolBox("Image"); nuiSetObjectColor("ImageToolBox",
tabRed, tabGreen, tabBlue,
textRed, textGreen, textBlue); nuiPopToolBox();
This is an excerpt from the include/nrui.h file. The Image tab has been opened, and assigned a color for both the tab and the text on the tab. Instead of numbers for the color values, variables here to indicate what the parameter is. Search for the variable names above or enter your own explicit values. Doing this does not automatically assign color to nodes within the tab.
Setting Colors for the Nodes in the Node View
In the ui directory:
nuiSetMultipleObjectsColor( nodeRed, nodeGreen, nodeBlue, textRed, textGreen, textBlue, "DisplaceX", "IDisplace", "PinCushion", "Randomize", "Turbulate", "Twirl", "WarpX" );
This command assigns colors to node in the Node View. The nodeRed, green, etc and textRed, green, etc are supposed to be float values. When coloring the nodes, keep in mind the default artwork is a medium grey, so you can have numbers above 1 for the node color parameters to multiply it up.
Setting Colors for the Time Bar
In the ui directory:
gui.color.timeSliderTop = 0x373737FF;
gui.color.timeSliderBottom = 0x4B4B4BFF;
gui.color.timeSliderFocus = 0x5B5B5BFF;
gui.color.timeSliderText = 0x0A0A0AFF;
gui.color.timeSliderTextFocus = 0x000000FF; gui.color.timeSliderRange = 0x373737FF;
gui.color.timeSliderRangeReversed = 0x505037FF;
gui.color.timeSliderRangeText = 0x0A0A0AFF;
gui.color.timeSliderLines = 0xFFFFFFFF; gui.color.timeSliderCurrent = 0x00FF00FF; gui.color.timeSliderMouseTime=0xACAC33FF; gui.color.timeSliderMouseTimeKey=0xFCFC65FF;
Just a few plugs to change the coloring of the text in all time-based windows like Curve Editor, Time Bar, and so on. The numbers are, obviously, all in Hex just to make things more difficult. Ignore the 0x and the last FFs. Note you often have control over a basic color and its mouse-focused variation.
Setting Colors for the Curves in the Editor
In the ui directory:
gui.color.curveDef = 0x658a61;
gui.color.curveDefFoc = 0xcccc26; gui.color.curveDefSel = 0xcccc26; gui.color.curveDefFocSel = 0xffff26; //Curves starting with 'r' or 'R' gui.color.curveR = 0xa74044;
gui.color.curveRFoc = 0xff0000; gui.color.curveRSel = 0xff0000; gui.color.curveRFocSel = 0xff8888; //Curves starting with 'g' or 'G' gui.color.curveG = 0x8de48d;
gui.color.curveGFoc = 0x00ff00; gui.color.curveGSel = 0x00ff00; gui.color.curveGFocSel = 0xaaffaa; //Curves starting with 'b' or 'B' gui.color.curveB = 0x406bf7;
gui.color.curveBFoc = 0x1818ff; gui.color.curveBSel = 0x1818ff; gui.color.curveBFocSel = 0x8888ff; //Curves starting with 'a' or 'A' gui.color.curveA = 0x888888;
gui.color.curveAFoc = 0xbbbbbb; gui.color.curveASel = 0xbbbbbb; gui.color.curveAFocSel = 0xeeeeee;
Setting Colors for Text
In the ui directory:
gui.fontColor = 0xFFFFFF; gui.textField.fontColor = 0xFFFFFF;
gui.textField.tempKeyBackClr = 0xFFFFFF; //For Tremor-style layout: gui.textField.valModClr = 0xFFFFFF;
gui.textField.setKeyClr = 0xFFFFFF;
gui.textField.expressionColor = 0xFFFFFF; //the color of text on an active tab gui.tabber.activeTint.red = .9; gui.tabber.activeTint.green = .9; gui.tabber.activeTint.blue = .87; //the color of text on an inactive tab gui.tabber.tint.red = .65; gui.tabber.tint.green = .65; gui.tabber.tint.blue = .63;
This colors the text in hexadecimal. There are a series of expressions near the very end of the nrui.h file that allow you to put in normalized RGB values which are then fed into the hex number, but you can also figure out your color using the Color Picker.
fontColor = the color of the actual parameter name, messages, and also of macros without declared coloring.
textfield.fontColor = the color of the values within the textfield.
valModClr = the color of modified values in the Tremor-style layout.
setKeyClr = the color of parameters with keys in the Tremor-style layout.
expressionColor = the color of parameters using expressions in the Tremor-style layout.
tempKeyBackClr = a warning color for values enter when not in autosave mode for animated parameters. Since autokey isn't on, the value won't be saved until autokey is turned on.
Some text colors can also be interactively modified in the Global's settings. These are saved into <UserDir>/nreal/settings when you press File - Save Interface Settings.
Setting Time View Colors
In the startup or ui directory:
gui.color.timeViewBarStd = 0x737373; gui.color.timeViewBarTop = 0x909090; gui.color.timeViewBarBtm = 0x303030; gui.color.timeViewBarCut = 0x101010; gui.color.timeViewBarRpt = 0x5a5a5a; gui.color.timeViewBarMir = 0x5a5a5a; gui.color.timeViewBarFrz = 0x424242; gui.color.timeViewBarBlk = 0x0; gui.color.timeViewBarClpLine = 0x0; gui.color.timeViewFontInOut = 0x111144; gui.color.timeViewFontStEnd = 0x441111; gui.color.timeViewFontStd = 0xFFFFFF; gui.color.timeViewIgnLine = 0xFF0000; gui.color.stripedRowColLight = 0x373737; gui.color.stripedRowColDark = 0x474747; gui.color.timeViewDarkStripe = 0x373737; gui.color.timeViewLightStripe = 0x474747;
The BarCut, BarRpt, BarMir, BarFrz, and BarBlk refer to the repeat modes, so each one has a different color.Creating a Custom Palette
In the ui directory:
![]()
nuiSetColor(1,1,0,0); nuiSetColor(2,1,0.5,0); nuiSetColor(3,1,1,0); etc
Assigns default colors to the palette icons, with the first number being the button number.
Format (resolution, timecode, etc)
Creating custom listings for the Format pop-up
In startup:
![]() |
DefFormatType( "string", width, height, aspectRatio, viewerAspectRatio, framesPerSecond, fieldRendering ); DefFormatType( "Academy", 1828, 1556, 1,1,24,"24 FPS" ); |
To set the default format choice whenever you launch Shake or Tremor, you can use:script.format = "FormatName";
Automatically Assigning the default width and height to a parameter in a macro
In either startup or ui (typically inside of a macro's parameter settings) :
image MyGenerator( int width=GetDefaultWidth(), int height=GetDefaultHeight(), float aspectRatio=GetDefaultAspect(), int bytes = GetDefaultBytes() )These four commands check the default global settings and return the value at the time of node creation; they are not dynamically linked. Therefore, if you change the default parameters, the node's values do not change.
Setting Format defaults
In startup:
script.defaultWidth = 720; script.defaultHeight = 486; script.defaultAspect = 1; script.defaultBytes = 1; script.format = "Full";Using the script.format overrides the other settings, that is, you either set it or the first four or the format settings, as shown above.
Setting Maximum Viewer Resolution in the Interface:
In the ui directory:
gui.viewer.maxWidth = 4096; gui.viewer.maxHeight = 4096;By default, Shake protects the user from test rendering an enormous image by limiting the resolution of the Viewer to 4k. If the user accidently puts a Zoom of 200 on the comp, it won't try to render some astronomically enormous file, but instead only renders the lower-left corner of the image cropped at 4k. To change this behavior, set a higher or lower pixel resolution. These assignments have no effect on files written to disk.
Creating custom listings for the Format pop-up
In startup directory:
DefTimecodeMode( "Name", fps, numFramesToDrop, numSecondsDropIntervals, numSecondsDropException ); DefTimecodeMode("24 FPS", 24); DefTimecodeMode("30 FPS DF", 30, 2, 60, 600);
These define the timecode modes for the Globals pop-up.
To set the default timecodeMode, use:
script.timecodeMode = "24 FPS";
Default timecode modes and displays
In the startup or ui directory:
script.framesPerSecond = 24; script.timecodeMode = "24 FPS"; gui.timecodeDisplay = 0;Set one or the other. Setting the timecodeMode allows you to use drop-frame settings. See above to set the Timecode Modes. The third line is to display the frames in the Curve Editor and Time Bar as frames or timecode. 1 = timecode, 0 = frames. The other timecode modes are: "25 FPS", "30 FPS DF" and "30 FPS ND"
Other Settings
script.autoSaveDelay = 60;How often the autoSave script is done in seconds. The script is saved automatically in your User Directory as autoSave1.shk, autoSave2.shk, etc, up to autoSave5.shk. It then recycles back to 1. If you lose a script due to a crash, you can load in the autoSave script.
Undo levels Amount
In the ui directory:
gui.numUndoLevels= 100;How many steps back of undo you want to keep. Undo scripts are stored in the TEMP directory.
Amount of processors to assign to GUI
In the ui directory:sys.maxThread = nrcGetAvailableProcessors();This sets the amount of processors when using the interface. The nrcGetAvailableProcessors automatically calculates and assigns all of them to be used. If you only want a limited number, assign that number here.
You can assign the number of processors to be used when batch processing with the -cpus flag. The default is 1. For example,
shake -exec my_script.shk -cpus 2
Font Size for Menus and Popups
In the startup directory:
// It can take the following values: //tiny, small, medium, big, std gui.menu.fontSize= "std";
I know, this should be in a ui .h file, but it has to be set before the interface is built, so it goes in a startup file. The example is "tiny". "std" is the default.
Adding Functions to the Right-Mouse Menu
In the ui directory:
nuiPushMenu("NRiNodeViewPopup",1); nuiPushMenu(
"This makes a Sub-Menu",0
); nuiMenuItem(
"Grad",
nuiToolBoxMenuCall({{Grad()}}) ); nuiPopMenu();
This is one example that creates a sub-tab called "This makes a Sub-Menu" in the Node View, and attaches the Grad function to its list. This is just one example. Take a look at the nrui.h file, since all right-mouse menus are built there. The first line declares under what menu it is built, so typically these commands are added directly into the nrui.h file.
nuiOpenMenu("Render"); nuiMenuSeparator(); nuiMenuItem(
"Highend2D", LaunchBrowser( "http://www.highend2d.com",1 ) ); nuiPopMenu();
This creates an entry in the Render menu, split from the other entries with a separator.
Memory and the Cache.
Curve Editor/Time Bar |
Setting the Time Bar frame range
In ui directory:
![]()
gui.timeRangeMin=1; gui.timeRangeMax=100;
Pretty much says it all, doesn't it?
Default timecode modes and displays
In the startup or ui directory:
script.framesPerSecond = 24; script.timecodeMode = "24 FPS"; gui.timecodeDisplay = 0;Set one or the other. Setting the timecodeMode allows you to use drop-frame settings. See above to set the Timecode Modes. The third line is to display the frames in the Curve Editor and Time Bar as frames or timecode. 1 = timecode, 0 = frames.
File Path/Browsers Controls |
In the ui directory:
gui.fileBrowser.lastImageDir= "C:/pix/" ; gui.fileBrowser.lastScriptDir= "$MYPROJ/shakeScripts/" ; gui.fileBrowser.lastExprDir= "//Server/shakeExpressions/" ; gui.fileBrowser.lastTrackerDir= "$MYPROJ/tracks/" ; gui.fileBrowser.lastAnyDir= "C:/Jojo/" ;You can assign specific directories the Browser looks in when you start the GUI. You can assign different directories to different types of files, i.e., scripts, images, trackers, and expressions. Important: There must be a slash at the end of the path.
Using the UNC File Name convention
In startup directory:
script.uncFileNames = 1;
Shake automatically assigns the UNC file name, that is, the entire file path name using the network address starting with //MachineName//DriveName/path. This ensures proper network rendering. However, you can turn this off by assigning the uncFileNames to 0, at which point local file paths are maintained. You can use local paths in either case, but they get converted when UNC is on.
Adding Personal Favorites into the Browser
In ui directory:
nuiFileBrowserAddFavorite( "D:/icons/scr/" ); nuiFileBrowserAddFavorite( "$nr_train/" );
All directories you assign here appear in your Favorites area of the Directories pop-up menu in the Browser so you can quickly jump to them. You can also Bookmark a directory with the Browser's Bookmark button
and then select Save Interface Settings in the File menu. This saves a setting in your $HOME/nreal/settings directory.
Assigning a Browser-Popup to a Parameter
In ui directory:
nuxDefBrowseCtrl( "Macro.imageName", kImageIn ); nuxDefBrowseCtrl( "Macro.imageName", kImageOut ); nuxDefBrowseCtrl( "Macro.fileName", kAnyIn ); nuxDefBrowseCtrl( "Macro.lookupFile", kExprIn ); nuxDefBrowseCtrl( "Macro.scriptName", kScriptIn ); nuxDefBrowseCtrl( "Macro.renderPath", kAnyOut );
This assigns a folder button to a string so that you can re-launch the File Browser. The Browser remembers the last directories you were in for any different type, so you can assign the type of file the Browser should be looking for as well with kImageIn/Out, etc. For example, if you have a macro which browses an image to be read in, you would use kImageIn, so when you press that button, it jumps to the last directory you read an image from.
- kImageIn: Directory of the last image input directory
- kImageOut: Directory of the last image ouput directory
- kAnyIn: Directory of the last input directory of any type.
- kAnyOut: Directory of the last output directory of any type.
- kScriptIn: Directory of the last script input directory.
- kScriptOut: Directory of the last script output directory.
- kExprIn: Directory of the last expression input directory.
- kExprOut: Directory of the last expression output directory.
Automatic Launching of the Browser When Creating a Node
In the ui directory:
nuiToolBoxItem("ProxyFileIn", {{ const char *filename = getFileInName(); filename ? ProxyFileIn(filename,0,2) : (image) 0 }} );In this example, we are calling the browser for the parameter filename in the ProxyFileIn macro. The macro has three parameters, filename, and two numbers (0 and 2). The getFileInName function automatically launches the browser when the user creates this node in the interface. You can use
- getFileInName()
- getFileOutName()
- getScriptInName()
- getScriptOutName()
Automatic Browser File Filters
In the ui directory:
gui.fileBrowser.lastImageRegexp= "*.tif" ; gui.fileBrowser.lastScriptRegexp= "*.shk" ; gui.fileBrowser.lastExprRegexp= "*.txt" ; gui.fileBrowser.lastTrackerRegexp= "*.txt"; gui.fileBrowser.lastAnyRegexp= "*";
You can assign specific filters for the browser for different types of Browser activity. For example, if you only use Cineon files, you might want to use an assignment like:
gui.fileBrowser.lastImageRegexp= "*.cin" ;
Function Tabs |
Setting Number of Node Columns in a Tab
In the <ShakeDir>/include/nrui.h or a startup file:
gui.doBoxColumns = 8;
Sets the number of columns for the nodes in the Tool Tabs, which we also sometimes call the Do Box. Unlike the other ui.h files, this must go in <ShakeDir>/include/nrui.h, placing it right before the call to start building the Image tab. To activate it, uncomment the bold line in the nrui.h file:
//These control the color of text on an inactive tab gui.tabber.tint.red = .65; gui.tabber.tint.green = .65; gui.tabber.tint.blue = .63; //gui.doBoxAltFxIcons = 1; //gui.doBoxColumns = 5; nuiPushMenu("Tools"); nuiPushToolBox("Image"); nuiToolBoxItem("Average", "const char *fileName = blah nuiToolBoxItem("Checker", Checker()); nuiToolBoxItem("Color", Color()); nuiToolBoxItem("ColorWheel", ColorWheel()); ...
Using the Alternative Icons
In startup or the <ShakeDir>/include/nrui.h file:
gui.doBoxAltFxIcons = 1; gui.doBoxColumns = 8;
This calls up the alternative icon set, which concentrates more on the name of the function. They are stored in icons/fxAlt with the same name as the normal icons set, i.e., Image.Average.nri, etc. The dimensions for these icons are 130x26. Because they are wider, you typically limit the columns to 5 in a normal Shake environment. Look in the Cookbook for a macro to generate these icons. You can activate this in two places, either a startup file, or by uncommenting the following two bold lines in the nrui.h file:
//These control the color of text on an inactive tab gui.tabber.tint.red = .65; gui.tabber.tint.green = .65; gui.tabber.tint.blue = .63; //gui.doBoxAltFxIcons = 1; //gui.doBoxColumns = 5; nuiPushMenu("Tools"); nuiPushToolBox("Image"); nuiToolBoxItem("Average", " const char *fileName = blah blah blah nuiToolBoxItem("Checker", Checker()); ...
Attaching a Function to a Button in the Tabs
In the ui directory:
nuiPushToolBox("Image"); nuiToolBoxItem("Flock", Flock(0,0,0)); nuiPopToolBox();This places an icon that you have created into a Tab that you assign. In this example, we have placed it into the Image tab. If you use a custom name, i.e., My_Macros, it creates that tab. The second line first attaches the icon, and then assigns the function with its default arguments to that button. They do not have to be the same name, but both are case sensitive. The icon is either found in <ShakeDirectory>/icons, your <UserDirectory>/icons, or in any directory pointed to with $NR_ICON_PATH. The icons have the following characteristics:
- Although they can be any size, the standard resolution is 75x40 pixels
- No alpha channel. Assign a SetAlpha 0 or Reorder rgbn to remove the alpha channel.
- The filename is TabName.Whatever.nri. Our example would therefore be called Image.Flock.nri.
- The icon border is added automatically by Shake.
The part that says Flock(0,0,0) is the function of what that button actually does. You can assign any function to these - read in scripts, call multiple nodes, etc. If the function does not have default values for its parameters, they must be provided here.
Attaching a Function to a Button Without an Icon
In the ui directory:
nuiPushToolBox("Image"); nuiToolBoxItem("@Flock", Flock(0,0,0)); nuiPopToolBox();Note the @ sign before the icon name. This simply creates a button with whatever text you supply.
Creating Multiple Nodes With One Function
In the ui directory:
nuiToolBoxItem( "QuickShape", Blur(QuickShape()) );You can create multiple nodes with one button click when you call up a function. For example, if you always attach a Blur node to a QuickShape, you can do this by embedding one function within another. The first argument for a function is usually the image input. By substituting the value (usually 0) with a different function, that function feeds into your first function. In the above example, I have fed QuickShape into Blur.
Light Hardware Mode
In the ui directory:
sys.hardwareType = 1;This command opens Shake without any borders on buttons, making the interactivity a little faster for graphically slower machines, like an O2. A value of 0 means the normal mode, a value of 1 gives you the lightweight mode. Note the artwork isn't updated for the darker interface, so it looks a bit odd. This is an old screen-grab.
Node View |
Setting Default Node View Zoom Level
In the ui directory:
gui.nodeView.defaultZoom=1;
Plugs specifically for the Time View. They use the same hex syntax as the other color plugs.
Parameters Tab |
These are commands you typically assign to help lay out your macros by setting slider ranges, assigning buttons, etc. These behaviors are typically assigned to specific parameters. They can be applied either globally (all occurences of those parameters) or to a specific function. For example, if there is a triplet of parameters named red, green, blue, Shake automatically assigns a color picker to it. However, for a parameter like depth, you'd want to specify actions based on if it's a bit depth related function (and therefore assign a button choice of 8, 16, or float bit depth) or a Z-depth related function, in which case you'd probably want some sort of slider. To assign it to a specific function, preface the parameter name with the function name, i.e, MyFunction.depth
All parameters, unless overridden by Shake's factory-installed rules, are assigned a slider with a range of 0 to 1.
Assigning A Color Picker
In the ui directory:
nuiPushControlGroup("Color"); nuiGroupControl("Func.red"); nuiGroupControl("Func.green"); nuiGroupControl("Func.blue"); nuiPopControlGroup(); nuiPushControlWidget( "Color", nuiConnectColorTriplet( kRGBToggle, kCurrentColor, 1 ) );This assigns a button to three sliders so that you can scrub across an image and retrieve color information. You can select the current color, the average color, the minimum color, or the maximum color values. You can also assign a toggle switch to select the input node's color or the current node's color. For example, if you are pulling keys, you probably want to use the input node color since you are scrubbing (usually) blue pixels, rather than the keyed out pixels. You can also choose to return different color spaces other than RGB. Assigning a color picker creates a subtree of those parameters.
Notice that you must first group the parametes into a subtree first (the first 5 lines of the above example).
Color Pickers automatically appear if you name your triplet red, green, blue or red1, green1, blue1 or red2, green2, blue2.
There are three parameters for the nuiConnectColorPCtrl function. The first one is the color space, which can be declared with either a string (for clarity) or an integer:
kRGBToggle 0 kHSVToggle 1 kHLSToggle 2 kCMYToggle 3The second parameter describes the type of value to be scrubbed, either the current, average, minimum or maximum. Again, you can use either the word of the integer.
kCurrentColor 0 kAverageColor 1 kMinColor 2 kMaxColor 3The last parameter is a toggle to declare if you are using the current node's pixel values or the input node's. You use either 0 or 1:
0 = current node
1 = input nodeUsing the current node can possibly cause a feedback loop. Typically for color corrections you use current node, for keyers you use the input node.
Therefore, the above example creates a subtree called Color for the function called MyFunction. The scrubber is returning RGB values, of which it only returns the current value. When the Color Picker is called, the Use Source Buffer is turned on.
Assigning The Old Color Picker
In the ui directory:
nuiPushControlGroup("Func.Color"); nuiGroupControl("Func.red"); nuiGroupControl("Func.green"); nuiGroupControl("Func.blue"); nuiPopControlGroup(); nuiPushControlWidget( "MyFunction.Color", nuiConnectColorPCtrl( kRGBToggle, kCurrentColor, 1 ) );This is an older version of the color picker without the cool extra controls.
Changing Default Values
In the <ShakeDir>/include/nrui.h file:
nuiPushToolBox("Color"); nuiToolBoxItem("Add", Add(0,0,0,0,0,0)); nuiToolBoxItem("AdjustHSV", AdjustHSV(0)); nuiToolBoxItem("Brightness", Brightness(0,1)); nuiToolBoxItem("Clamp", Clamp(0)); nuiToolBoxItem("ColorCorrect", ColorCorrect(0)); ...In the include/nreal.h file, most functions have their default values declared, but not all of them. You can override the default values when you call the function by modifying the line that loads the function into the interface. If every parameter in a function has a default value in a function, you can call the function simply by doing something like:
nuiToolBoxItem("Clamp", Clamp(0));Normally, Clamp has about 8 values. Here, the 0 represents in the first argument, the input image. We use 0 to indicate that no images are expected to be inserted, so you can attach it to the active node. However, you can add additional parameters. For example, the Brightness line above it has (0,1), meaning 0 for the image input (no input) and 1 for the brightness value. Simply change the 1 to a different value to override it. You only need to supply the parameters up to the one you want. For example, here is the call for the Text function:
nuiToolBoxItem("Text", Text());if you want to override the default font for the Text function, you have to supply the width, height, bytes, text and finally the font. The rest you can ignore afterwards:
nuiToolBoxItem("Text", Text( GetDefaultWidth(), GetDefaultHeight(), GetDefaultBytes(), "Yadda Yadda", "Courier" ) );Grouping Parameters Into A Sub-Tree
In the ui directory:
nuiPushControlGroup("Func.timeRange"); nuiGroupControl("Func.inPoint"); nuiGroupControl("Func.outPoint"); nuiGroupControl("Func.timeShift"); nuiGroupControl("Func.inMode"); nuiGroupControl("Func.outMode"); nuiPopControlGroup();This groups parameters into a subtree that can be opened and closed by the user. This example, although it says "Func", is for the FileIn node.
Setting Slider Ranges
In the ui directory:
nuiDefSlider( "Funct.yPan", 0, height ); nuiDefSlider( "Funct.angle", -360, 360 ); nuiDefSlider( "Funct.aspect", 0, 2, .2, .01 );Even though the sliders are relatively in the same position, there are different numbers in the textfields. You can set sliders ranges and precision with this function. The first line assigns a slider range just for the yPan parameter of the Move2D function. Note the nifty use of the height variable so the range adjusts according to the input image. The second line assigns a range for the angle parameter in any node. The third line also has optional precision parameters, which are granularity, and notch spacing.
- granularity represents the truncation point. Shake cuts off all values smaller than your truncation value, that is, if your granularity is .01, a value of .2344 becomes .23. Granularity is a "hard" snap, i.e. if granularity is set to 0.001, you won't be able to get anything but multiples of 0.001 when you slide. Also, granularity can not be anything but a multiple of 10 (+ or -).
- notch spacing represents at what value interval the magnets appear. A value of .1 means the magnets are at .1, .2, .3, etc. .1 is the default value. Notch spacing is a "soft" snap, i.e. the slider tends to stick longer to multiples of notchSpacing, but doesn't prevent you to select other values. Think of it as a tiny notch in a flat line where a ball rolls: the ball tends to get stuck in the notch, but if you keep pushing, it eventually gets out.
nuxDefMultiChoice("Defocus.shape", "fast gaussian|fast box|circle" );
This pop-up menu, from the Defocus function, allows you to use a pop-up menu for strings. Note this only supplies strings and not numbers, so you have to do some tricky math inside the macro itself. See Scripts for more information.
Creating Radio Buttons
In the ui directory:
nuxDefRadioBtnCtrl( "Text.xAlign", 1, 1, 0, "1|ux/radio/radio_left", "2|ux/radio/radio_center", "3|ux/radio/radio_right" );
This example is for the Text node. This code creates a series of radio buttons that are mutually exclusive. The naming convention assumes that you have four icons for each name, with the icon names name.on.nri, name.on.focus.nri, name.off.nri, and name.off.focus.nri. If no icons exist, you can choose to not use icons, which then gives a label with an on/off radio button instead. The code has these parameters:
nuxDefRadioBtnCtrl( const char *name, int useIcon, int useLabel, int animatable, curve string state0, .... );You can place as many icons as you want. The height of Shake's standard parameters icons is 19 pixels, although this can change. The output parameter for Primatte and Keylight is a good example.
You can make your own radio buttons with the RadioButton function found in the the Cookbook (or under doc/cook/macros).
Creating Push-button Toggles
In the ui directory:
nuxDefExprToggle("Func.parameter", "repl.nri|repl.focus.nri", "interp.nri|interp.focus.nri", "blur.nri|blur.focus.nri" );
This assigns a series of buttons to toggle through integers starting at 0. The first line gets assigned a value of 0, the second line gets 1, the third gets 2, etc. You can place as many toggles as you want. There are two buttons for each assignment, the normal button, and a second button for when the cursor passes over the button to signify that you can press it. Note the standard buttons are all in the sub-directory ux, but they don't have to be. Shake comes with a series of pre-created icons which are packed into the icons.pak file, and are inaccessible to the user, but is understood by this code. Your custom icons can be any size, but the default height is 19 pixels. You can't have an alpha channel attached to them. Use SetAlpha 0 or Reorder rgbn to remove the alpha channel. They can be placed in <ShakeDirectory>/icons , the <UserDirectory>/icons, or $NR_ICON_PATH.
Creating On/Off buttons
In the ui directory:
nuxDefExprToggle("Func.param");
This is similar to the Push-Button toggles, but you only have two values, on and off, off being a value of 0, and on being 1. The icon assignment is automatic.
Making a Parameter Non-Animatable
In the ui directory:
nriDefNoKeyPCtrl("DilateErode.soften");
Makes it so no autokey buttons show up.
Placing a Curve Editor into a Parameter Tab
In the ui directory:
nuiPushControlGroup("colorExpr");
nuiGroupControl("Lookup.rExpr");
nuiGroupControl("Lookup.gExpr");
nuiGroupControl("Lookup.bExpr");
nuiGroupControl("Lookup.aExpr");
nuiPopControlGroup(); //Makes all curves invisible by default
registerCurveFunc("colorExpr"); //This makes all curves visible by default
registerCurveFuncVisible("colorExpr"); gui.colorCtrl.curveEditorDirection = 0; //When it is 1, the layout it vertical //When this equals 0, the layout is //horizontal
Viewers |
Settings
Setting Maximum Viewer Resolution in the Interface:
In the ui directory:
gui.viewer.maxWidth = 4096; gui.viewer.maxHeight = 4096;By default, Shake protects the user from test rendering an enormous image by limiting the resolution of the Viewer to 4k. If the user accidently puts a Zoom of 200 on the comp, it won't try to render some astronomically enormous file, but instead only renders the lower-left corner of the image cropped at 4k. To change this behavior, set a higher or lower pixel resolution. These assignments have no effect on files written to disk.
Onscreen
Controls
At the moment, on-screen controls are built automatically according to how you name your parameters in your macro, with one exception to make a cross-hair control. This is the list of parameters it takes to make certain controls. For the illustrations, I have attached the controls to their appropriate functions, i.e., the pan controls are attached to a Pan function, scaling to a Scale function. Simply naming the parameters not necessarily gives you the functionality you are looking for.
Panning Controls
In the startup macro file:
float xPan=0, float yPan=0
This gives you the lattice to pan around. You can grab anywhere on the cross bars.
Scaling Controls
In the startup macro file:
![]() |
float xScale=1, float yScale=1, float xCenter=width/2, float yCenter=height/2 |
This gives you the border and center controls to change the scale center. You can grab on a corner to scale X and Y or on an edge to scale X or Y.
CornerPin Controls
In the startup macro file:
float x0=0, float y0=0, float x1=width, float y1=0, float x2=width, float y2=height, float x3=0, float y3=heightIn UI File:
nuiPushControlGroup( "Func.Corner Controls" ); nuiGroupControl("Func.x0"); nuiGroupControl("Func.y0"); nuiGroupControl("Func.x1"); nuiGroupControl("Func.y1"); nuiGroupControl("Func.x2"); nuiGroupControl("Func.y2"); nuiGroupControl("Func.x3"); nuiGroupControl("Func.y3"); nuiPopControlGroup();
You can grab any corner or the crosshair in the middle to adjust the position of your image. I have also included the grouping code for the UI file so you don't have to look at all eight parameters in your list.
Box Controls
In the startup macro file:
int left = width/3, int right = width*.66, int bottom = height/3, int top = height*.66In UI File:
nuiPushControlGroup( "MyFunction.Box Controls" ); nuiGroupControl("MyFunction.left"); nuiGroupControl("MyFunction.right"); nuiGroupControl("MyFunction.bottom"); nuiGroupControl("MyFunction.top"); nuiPopControlGroup();
This creates a movable box. You can grab corners or edges, or the inside cross hair. This example is applied to a SetDOD function. Layer - Constraint and Transform - Crop also use these controls. In this example, I have used integers for my values assuming we are cutting of pixels, but you could also use float values.
Offset Controls
In the startup macro file:
float xOffset=0, float yOffset=0
This is similar to the Pan controls, except you get a crosshair. The Other - DropShadow function uses this.
Rotate Controls
In the startup macro file:
float angle = 0, float xCenter=width/2, float yCenter =height/2,
Gives you a rotation dial and a center control. This example is plugged into a Rotate function.
Point Controls
In the startup macro file:
float xCenter = width*.33, float yCenter = height*.33, float xPos = width*.66, float yPos = height*.33, float myPointX = width/2, float myPointY = height*.66
UI file:nuiAddPointOsc("Func.myPoint");
These three sets of parameters create a crosshair control. Center and Pos are default names - the Center pair is also associated with the angle and the scale parameters. However, the last point is completely arbitrary, as long as it ends in a capital X and Y. In the ui file, you also have to declare that these are an XY pair.
Radius Controls
In the startup macro file:
float radius = width/6, float falloffRadius = width/6, float xCenter=width/2, float yCenter = height/2
Well, this is basically for RGrad, but maybe you can do some more stuff with it...
Creating
Viewer Scripts - (Jumps to Interface -
Viewers)
Tremor UI Settings |
Layout for Tremor-style Parameters
In the ui directory:
//SetBGColor //Number of Columns nuiDefTweakerNumCol("Func",4); //Column assignment of parameters nuiDefPCtrlLoc("Func.mask",2); nuiDefPCtrlLoc("Func.red",4); nuiDefPCtrlLoc("Func.green",4); nuiDefPCtrlLoc("Func.blue",4); nuiDefPCtrlLoc("Func.alpha",4); nuiDefPCtrlLoc("Func.depth",4); //columns spacing and titling nuiDefTweakerCol("Func",1,"",10,250); nuiDefTweakerCol( "Func",2,"Channels",10,250 ); nuiDefTweakerCol("Func",3,"",10,50); nuiDefTweakerCol("Func",4,"Color",10,400);
This is the code that assigns the Tremor-style layout to the SetBGColor function. If first assigns how many columns there are to be, in this case 4. It then assigns the parameters to a specific column, with the number being the column. Notice no parameters are assigned to columns 1 or 3. The last four lines here title each column and assign optional titles to them. Notice we haven't assigned anything to column 1 or 3, so they are used as spacers. Any unassigned parameters go to the last column. The last 4 lines describe each column, give it a title, give it leading and columns width. In this case, 1 and 3 have no titles and are left blank because no parameters are assinged to them. You can also give an additional argument for the maximum limit it can expand to. This gives you flexibility in a layout between 1600 and 1920 width.
Assigning Favorites to the Tremor Tool Bar
In the ui directory:
nuiPushToolBox("Filter"); nuiToolBoxItem( "ApplyFilter", ApplyFilter(0) ); ... nuiToolBoxItem( "ZDefocus", Defocus(0) ); nuiAddToolboxFav("Blur"); nuiAddToolboxFav("DilateErode"); nuiPopToolBox();
This code goes inside the block to build each tab in the nrui.h file, but you can also add them elsewhere.
Testing for the Tremor-style Interface
In the startup or ui directory:
// In Shake-layout only // if(!gui.trm) { nuiPushControlGroup("Func.fineControl"); nuiPushControlGroup("Func.balance"); nuiGroupControl(Func.shadowBalance"); nuiGroupControl(Func.midtoneBalance"); nuiGroupControl("Func.highlightBalance nuiPopControlGroup(); nuiPushControlGroup("Func.gain"); nuiGroupControl("Func.shadowGain"); nuiGroupControl("Func.midtoneGain"); nuiGroupControl("Func.highlightGain"); nuiPopControlGroup(); nuiGroupControl("Func.midTonesAt"); }This tests to see if it is Tremor-Style:
This code checks to see if you are the Tremor-style interface (although you may be using Shake in that style). For example, Keylight groups up the Balance and Gain parameters into a fineControl subtree in Shake, but does not in Tremor-style. There are two tests you can do. Note both use the curly-brackets to enclose the body of the if statement:
if (gui.trm)This tests to see if it is Shake-Style
{ ...
}
if (!gui.trm) { ... }
Testing for the Tremor Product
In the startup or ui directory:for nreal.h and nrui.h use, #if TREMOR whatever #endif #if SHAKE whatever #endifThis code checks to see if you are actually using the Tremor product. For example, we build VTRIn into Tremor, but not into the Shake product, regardless of its layout style.
Related Links |
Custom Kernels for Filters (jumps to Functions By Class - Filter
- Convolve)
Macro
Tutorial (jumps to Advanced/How to Make a Macro)
More
Scripting information (jumps to the Script section)
template Preference Files |
You can add additional parameters and default settings by adding files into the startup/ui/templates directory. Everytime Shake is launched, it adds these extra parameters. For example, if you always want the Proxy Filter to be "box" instead of "default", and you always want a slider in the Globals tab called switch1, create a .h file under the templates directory with:
SetProxyFilter("box"); curve int switch1=0;
Basically, take a saved script and strip out the lines you want to set as defaults, and save it as a .h file into templates.
Environment Variables for Shake |
To Set Environment Variables in MacOSX:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>MyProject</key>
<string>/Documents/MyBigFilm</string>
<key>NR_INCLUDE_PATH</key>
<string>/Documents/MyBigFilm/macros</string>
<key>NR_ICON_PATH</key>
<string>/Documents/MyBigFilm/icons</string>
</dict>
</plist>
This sets the variable MyProject to /Documents/MyBigFilm, as well as setting the NR_INCLUDE_PATH and NR_ICON_PATH.
Save the file in your .MacOSX as environment.plist
Log Out and back in again.
To add a variable for Terminal commands, enter the following
formatting into $HOME/.cshrc or $HOME/.tcshrc:
setenv NR_INCLUDE_PATH " //Biggo/proj/include;/Documents/shake_settings/include"
Shake recognizes the following variables:
setenv NR_CINEON_TOPDOWN
Cineon frames are written in the slower top-down method for compatibility with other less protocol-observant software.
setenv NR_INCLUDE_PATH /shots/show1/shake_settings
should have /shots/show1/shake_settings/include/startup/ui
Interface Devices and Styles |
In the Global Parameters , turn on the parameter virtualSliderMode so the light is on.
Set the parameter virtualSliderSpeed to 0.
By turning on virtualSliderMode, you make it so the left button
is always using the virtual sliders when clicking in a text port. Normally,
you have to press Ctrl+Left drag. Just drag the mouse
left and right in the text field, and it increases and decreases beyond
the normal slider limits. However, the stylus doesn't allow you use
your desk space the same way as you would with a mouse, so you have
to turn on virtualSliderMode.
If you are left-handed, set the mouse behavior within the OS itself. On IRIX, it's under the Desktop-Customize-Mouse page tab.
With the menu command Spawn Viewer Desktop in the View menu, you can create a new Viewer window that floats above the normal Shake interface. You can therefore move it to a second monitor, clearing up space on the first for node editing operations. This only works when both monitors are being driven by the card. Systems with two X servers running two graphics cards are not yet supported.
This is also a handy ui Directory command to automatically create the second Viewer Desktop:
gui.dualHead= 1; // This is an example of what you can do to open a second // viewer desktop on the other monitor. if(gui.dualHead) spawnViewerDesktop(1290,10,1260,960);
The Tremor-style interface, regardless if it is Shake or Tremor, is designed for a 1600-pixel wide interface, minimum. To set your resolution on an SGI, you can use either xsetmon, which is a graphical interface for setting it, or use the command line setmon. This is SGI's thing, by the way...
To set your resolution, use the command 'setmon' in the command line,
AS ROOT:
/usr/gfx/setmon -x 1600x1024_72
The allowed values depend on your graphics card. If you are using an Octane
with MXI graphics, go to the
/usr/gfx/ucode/MGRAS/vof/2RSS/ directory to see the allowed choices.
In the case of the MXI Octane, you have:
1024x768_60.sdb 1280x1024_72.sdb
1024x768_60p.sdb 1280x1024_76.sdb 1024x768_72.sdb 1280x492_120s.sdb 1024x768_76.sdb 1280x960_30i.sdb 1024x768_96s.sdb 1600x1024_72.sdb 1024x768_96s_vs.sdb 1600x1200_60.sdb 1280x1024_49.sdb 1600x1200_60_32db.sdb 1280x1024_50.sdb 1920x1035_60.sdb 1280x1024_50_2f.sdb 1920x1080_60_32db_gdm24w.sdb 1280x1024_59.sdb 616x492_140os.sdb 1280x1024_60.sdb 640x480_60.sdb 1280x1024_60_2f.sdb 640x486_30i.sdb 1280x1024_60p.sdb 768x576_25i.sdb
So: /usr/gfx/setmon -x [settingFileWithoutExtension]
In both cases, you must log out and log in again. No reboot needed.