Go to: Synopsis. Return value. Keywords. Flags. MEL examples.

Synopsis

nodePreset [-attributes string] [-custom string] [-delete name string] [-exists name string] [-isValidName string] [-list name] [-load name string] [-save name string]

nodePreset is NOT undoable, NOT queryable, and NOT editable.

Command to save and load preset settings for a node. This command allows you to take a snapshot of the values of all attributes of a node and save it to disk as a preset with user specified name. Later the saved preset can be loaded and applied onto a different node of the same type. The end result is that the node to which the preset is applied takes on the same values as the node from which the preset was generated had at the time of the snapshot.

Return value

booleanif isValidName or exists is used.

Keywords

preset, render, globals

Flags

attributes, custom, delete, exists, isValidName, list, load, save
Long name (short name) Argument types Properties
-attributes(-atr) string create
A white space separated string of the named attributes to save to the preset file. If not specified, all attributes will be stored.
-custom(-ctm) string create
Specifies a MEL script for custom handling of node attributes that are not handled by the general save preset mechanism (ie. multis, dynamic attributes, or connections). The identifiers #presetName and #nodeName will be expanded before the script is run. The script must return an array of strings which will be saved to the preset file and issued as commands when the preset is applied to another node. The custom script can query #nodeName in determining what should be saved to the preset, or issue commands to query the selected node in deciding how the preset should be applied.
-delete(-del) name string create
Deletes the existing preset for the node specified by the first argument with the name specified by the second argument.
-exists(-ex) name string create
Returns true if the node specified by the first argument already has a preset with a name specified by the second argument. This flag can be used to check if the user is about to overwrite an existing preset and thereby provide the user with an opportunity to choose a different name.
-isValidName(-ivn) string create
Returns true if the name consists entirely of valid characters for a preset name. Returns false if not. Because the preset name will become part of a file name and part of a MEL procedure name, some characters must be disallowed. Only alphanumeric characters and underscore are valid characters for the preset name.
-list(-ls) name create
Lists the names of all presets which can be loaded onto the specified node.
-load(-ld) name string create
Sets the settings of the node specified by the first argument according to the preset specified by the second argument. Any attributes on the node which are the destinations of connections or whose children (multi children or compound children) are destinations of connections will not be changed by the preset.
-save(-sv) name string create
Saves the current settings of the node specified by the first argument to a preset of the name specified by the second argument. If a preset for that node with that name already exists, it will be overwritten with no warning. You can use the -exists flag to check if the preset already exists. If an attribute of the node is the destination of a connection, the value of the attribute will not be written as part of the preset.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// To determine if "My Special Settings" is a valid name for a preset (it
// isn't because it contains spaces):
//
nodePreset -isValidName "My Special Settings";
// Result: 0 //

// To save the settings of nurbsSphereShape1 as a preset called "smithers":
//
nodePreset -save nurbsSphereShape1 "smithers";

// To get a list of all presets available that could be applied to
// nurbsSphereShape1:
//
nodePreset -list nurbsSphereShape1;
// Result: smithers smoothSphere roughSphere atmoSphere //

// To load the preset named "smoothSphere" onto nurbsSphereShape1:
//
nodePreset -load nurbsSphereShape1 "smoothSphere";

// To delete the preset named "smithers" which was formerly available for the
// node nurbsSphereShape1 (and other nodes of the same type):
//
nodePreset -delete nurbsSphereShape1 "smithers";

// To determine if a preset named "smithers" exists for the node
// nurbsSphereShape1 (it doesn't because it has been deleted):
//
nodePreset -exists nurbsSphereShape1 "smithers";
// Result: 0 //

// Create a preset containing only the color and diffuse attributes:
//
nodePreset -attributes "color diffuse" -save lambert1 "colorAndDiffuse";

// Create a preset to map a checker texture to the applied node:
//
global proc string[] customChecker() {
    string $cmds[];
    // Get the name of the node to apply the checker to.
    $cmds[0] = "string $selection[] = `ls -selection`;";
    $cmds[1] = "string $nodeName = $selection[0];";
    // Create a checker texture.
    $cmds[2] = "string $checkerName = `shadingNode -asTexture checker`;";
    // Connect the checker to the node the preset is applied to.
    $cmds[3] = "connectAttr ($checkerName+\".outColor\") ($nodeName+\".color\");";
    return $cmds;
}
nodePreset -custom "customChecker" -save lambert1 "checkered";