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

Synopsis

ghosting([action=string], [allGhostedObjects=boolean], [allInRange=boolean], [customFrames=int], [enable=boolean], [farOpacity=float], [frames=boolean], [geometryFilter=boolean], [ghostedObjects=boolean], [ghostsStep=int], [hierarchy=boolean], [jointFilter=boolean], [locatorFilter=boolean], [mode=string], [nearOpacity=float], [postColor=[float, float, float]], [postFrames=int], [preColor=[float, float, float]], [preFrames=int], [preset=string], [resetAll=boolean], [useDriver=boolean])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

ghosting is undoable, queryable, and editable.

Provides an aggregated interface to all of the node-base ghosting parameters, as well as the global preferences used by this command for ghosting actions. Query the 'enable' flag to check if ghost drawing is currently enabled. If you run in create mode with no 'action' set then you will be modifying the current values of the ghosting parameters. If you have 'action=ghost' set then you will be modifying the current values of the ghosting parameters and then applying them to selected objects.

Return value

booleanthe previous global state of ghost visibility (after setting 'enable' flag)
booleanthe global state of ghost visibility (query 'enabled' flag)
booleanthe global state of the default ghost all-in-range value (query 'allInRange' flag)
booleanthe global state of the default ghost hierarchy (query 'hierarchy' flag)
booleanthe global state of the default ghost geometry filter (query 'geometryFilter' flag)
booleanthe global state of the default ghost joint filter (query 'jointFilter' flag)
booleanthe global state of the default ghost locator filter (query 'locatorFilter' flag)
booleanthe global state of the default post frame count (query 'postFrames' flag)
booleanthe global state of the default pre frame count (query 'preFrames' flag)
booleanthe global state of the default ghost frames step count (query 'ghostsStep' flag)
string[]List of all objects for which ghosting was enabled ('action="ghost"' in create mode)
string[]List of all objects for which ghosting was disabled ('action="unghost"' or 'action="unghostAll"' in create mode)
string[]List of all objects for which ghosting is currently enabled (query 'ghostedObjects' flag)
string[]List of affected objects (any flag in edit mode)
float[]List of (frame1, frame2, ...) that is the union of ghosted frames on all selected objects (query 'frames' flag)
floatCurrent opacity value for ghosts farthest from the current time (query 'farOpacity' flag)
floatCurrent opacity value for ghosts closest to the current time (query 'nearOpacity' flag)
floatThe previous opacity value for ghosts farthest from the current time (set 'farOpacity' flag)
floatThe previous opacity value for ghosts closest to the current time (set 'nearOpacity' flag)
stringCurrent ghosting mode (query 'mode' flag)
stringThe previous ghosting mode (set 'mode' flag)
float[]Color as [red, green, blue] used for ghosts after the current time (query 'postColor' flag)
float[]Previous color as [red, green, blue] used for ghosts after the current time (set 'postColor' flag)
float[]Color as [red, green, blue] used for ghosts before the current time (query 'preColor' flag)
float[]Previous color as [red, green, blue] used for ghosts before the current time (set 'preColor' flag)
int[]Custom frame list for the 'frames' mode (query 'customFrames' flag)
int[]Previous custom frame list (set 'customFrames' flag)

In query mode, return type is based on queried flag.

Keywords

OGS, ghosting

Flags

action, allGhostedObjects, allInRange, customFrames, enable, farOpacity, frames, geometryFilter, ghostedObjects, ghostsStep, hierarchy, jointFilter, locatorFilter, mode, nearOpacity, postColor, postFrames, preColor, preFrames, preset, resetAll, useDriver
Long name (short name) Argument types Properties
action(act) string create
Define the actions to be performed by the command. Legal values are "ghost", "unghost", and "unghostAll". The "ghost" will try to enable ghosting on all _visible_ DAG objects in the selection list. Imtermediate transform nodes will only be ghosted if axis display are active.
allGhostedObjects(ago) boolean edit
Only works in edit mode, specifying that the edits are to be applied to all ghosted objects instead of just the selected ones.
allInRange(a) boolean createqueryedit
In create mode, define the default value for whether keyframe mode should use every keyframe in the playback range or use the specified values. In edit mode, modify the all-in-range value for all ghosts. In create mode with the "ghost" action, also set the custom ghost all-in-range value for the selected objects.
customFrames(cf) int createqueryeditmultiuse
In create mode, define the default value for the list of custom ghost frames. In edit mode, modify the custom ghost frames for all ghosts. The special frame number "-9999999" is used to remove all custom frames, circumventing a quirk in the command engine that does not allow passing an empty list. In create mode with the "ghost" action, also set the custom ghost frames for the selected objects.
enable(en) boolean createquery
Enables or disables ghost visibility on the entire scene. This does not modify any of the node ghosting attributes, it only globally enables or disables the drawing of any ghosts that have been defined on nodes. This is a preference-based flag so its value will persist between sessions, even if you load a new file with different ghost attribute settings.
farOpacity(fo) float createqueryedit
In create mode, define the default value for the opacity value for ghosts farthest away from the current time. In edit mode, modify the opacity value of ghosts farthest away from the current time for all ghosts. In create mode with the "ghost" action, also set the opacity value of ghosts farthest away from the current time for the selected objects.
frames(f) boolean query
Queries the current set of ghost frames on the selected objects based on the ghosting mode, parameters set on the object, and the current time when relevant. Ignores the state of the ghosting enabled flag.
geometryFilter(gf) boolean createqueryedit
In create mode, enable or disable the default ghost geometry filter. In create mode with the "ghost" action set, also filter the selection to omit geometry nodes if this flag is false.
ghostedObjects(go) boolean query
Only works in query mode to find the names of all currently ghosted DAG nodes.
ghostsStep(gs) int createqueryedit
In create mode, define the default value for the number of steps (keyframes or frames) between ghosts. In edit mode, modify the number of steps (keyframes or frames) between ghosts. In create mode with the "ghost" action, also set the default number of steps (keyframes or frames) between ghosts for the selected objects.
hierarchy(h) boolean createqueryedit
Enables or disables the ghost hierarchy default value. When no ghosting action is set it does not modify any of the node ghosting attributes, it only sets the preference for how future commands will filter the list of affected nodes. When used in conjunction with a ghosting action it will fist set the preference value and then use that new value as a filter on the ghosting action. If a ghosting action is specified without this flag then the current value of the preference is used in its place. This is a preference-based flag so its value will persist between sessions, even if you load a new file with different ghost attribute settings.
jointFilter(jf) boolean createqueryedit
In create mode, enable or disable the default ghost joint filter. In create mode with the "ghost" action set, also filter the selection to omit joint nodes if this flag is false.
locatorFilter(lf) boolean createqueryedit
In create mode, enable or disable the default ghost locator filter. In create mode with the "ghost" action set, also filter the selection to omit locator nodes if this flag is false.
mode(m) string createqueryedit
Define the default mode for ghosting actions. Legal values are "preAndPost", "pre", "post", "custom", and "keyframes".
nearOpacity(no) float createqueryedit
In create mode, define the default value for the opacity value for ghosts nearest to the current time. In edit mode, modify the opacity value of ghosts nearest to the current time for all ghosts. In create mode with the "ghost" action, also set the opacity value of ghosts nearest to the current time for the selected objects.
postColor(poc) [float, float, float] createqueryedit
In create mode, define the default value for the color of ghosts after the current time. In edit mode, modify the color of ghosts after the current time for all ghosts. In create mode with the "ghost" action, also set the color of ghosts after the current time for the selected objects.
postFrames(pof) int createqueryedit
In create mode, define the default value for the number of ghosted frames after the current time. In edit mode, modify the number of ghosted frames after the current time for all ghosts. In create mode with the "ghost" action, also set the default number of ghosted frames after the current time for the selected objects.
preColor(prc) [float, float, float] createqueryedit
In create mode, define the default value for the color of ghosts before the current time. In edit mode, modify the color of ghosts before the current time for all ghosts. In create mode with the "ghost" action, also set the color of ghosts before the current time for the selected objects.
preFrames(prf) int createqueryedit
In create mode, define the default value for the number of ghosted frames before the current time. In edit mode, modify the number of ghosted frames before the current time for all ghosts. In create mode with the "ghost" action, also set the default number of ghosted frames before the current time for the selected objects.
preset(p) string createqueryedit
Define the default mode for ghosting presets. Legal values are "1s", "2s", "4s", "5s", "10s", and "Custom". Setting anything other than "Custom" fixes ghosts at 3 pre frames, 3 post frames, with a step value of the preset (e.g. "2s" means show ghosts at every second frame or keyframe)
resetAll(r) boolean createedit
Reset all ghosting options to their default values. Use with caution!
useDriver(ud) boolean createqueryedit
In create mode, enable or disable the default ghost use driver value. In edit mode, modify the use driver value of all existing ghosts. In create mode with the "ghost" action, also set the use driver value for the selected objects.

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 have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds


import maya.cmds as cmds

# Turn off all ghost drawing
cmds.ghosting( enable=False )

# Change the default actions to prevent walking down the DAG hierarchies when finding objects to ghost/unghost
cmds.ghosting( hierarchy=False )

# Ghost the selected objects
cmds.ghosting( action='ghost' )
# Result: "OBJECT1" #

# Unghost the selected objects
cmds.ghosting( action='unghost' )
# Result: "OBJECT1" #

# Unghost all objects
cmds.ghosting( action='unghostAll' )
# Result: "OBJECT1" #

# Set the mode to use only keyframes as specified, rather than every one in the playback range for ghosts
cmds.ghosting( mode='keyframes' )
cmds.ghosting( allInRange=False )

# Set three custom ghost frames
cmds.ghosting( mode='custom' )
cmds.ghosting( customFrames=-9999999 )
cmds.ghosting( query=True, customFrames=True )
# Return: [] #
cmds.ghosting( customFrames=[1,2,50] )

# Set the opacity of the ghost farthest from the current frame
cmds.ghosting( farOpacity=0.01 )

# Query the current list of ghost frames using the ghost parameters on OBJECT1
cmds.ghosting( OBJECT1, query=True, frames=True )
# Return: [1.0, 2.0, 50.0] #

# Make future ghosting actions skip geometry objects (e.g. meshes)
cmds.ghosting( geometryFilter=True )

# Get the list of currently ghosted objects
cmds.ghosting( query=True, ghostedObjects=True )
# Return: OBJECT1 #

# Change the number of ghosted frames after the current time to 2
cmds.ghosting( postFrames=2 )

# Change the number of ghosted frames before the current time to 5
cmds.ghosting( preFrames=5 )

# Change the step between ghosts to be 2
cmds.ghosting( ghostsStep=2 )

# Make future ghosting actions skip joints
cmds.ghosting( jointFilter=True )

# Make future ghosting actions skip locators
cmds.ghosting( locatorFilter=True )

# Change the ghosting mode to only have ghosts before the current frame
cmds.ghosting( mode='pre' )

# Set the opacity of the ghost closest to the current frame
cmds.ghosting( nearOpacity=0.1 )

# Set the color of ghosts after the current time to be green
cmds.ghosting( postColor=[0.0, 1.0, 0.0] )

# Set the color of ghosts before the current frame to red and modify all existing ghosts to use that color
cmds.ghosting( edit=True, allGhostedObjects=True, preColor=[1.0, 0.0, 0.0] )
# Return: OBJECT1 #

# Set the preset to show every other ghost
cmds.ghosting( preset='2s' )

# Set the preset to show 5 pre frames, 2 post frames, at every 5th frame
cmds.ghosting( preset='Custom' )
cmds.ghosting( preFrames=5 )
cmds.ghosting( postFrames=2 )
cmds.ghosting( ghostsStep=5 )
cmds.ghosting( mode='preAndPost' )

# Reset all cmds.ghosting(  parameters to their default values
cmds.ghosting( resetAll=True )
# Return: True #

# Set the use-driver default for the ghosts
cmds.ghosting( useDriver=True )