Go to: Synopsis. Return value. Related. Flags. Python examples.
refresh([currentView=boolean], [fileExtension=string], [filename=string], [force=boolean], [suspend=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
refresh is undoable, NOT queryable, and NOT editable.
This command is used to force a redraw during script execution.
Normally, redraw is suspended while scripts are executing but
sometimes it is useful to show intermediate results for purposes
such as capturing images from the screen.
If the -cv flag is specified, then only the current active view
is redrawn.
None
currentUnit, displayAffected, displayColor, displayCull, displayLevelOfDetail, displayPref, displayRGBColor, displaySmoothness, displayStats, displaySurface, hide, showHidden, toggle
currentView, fileExtension, filename, force, suspend
Long name (short name) |
Argument types |
Properties |
|
currentView(cv)
|
boolean
|
|
|
Redraw only the current view (default redraws all views).
|
|
fileExtension(fe)
|
string
|
|
|
Specify the type of file to save using the filename flag.
|
|
filename(fn)
|
string
|
|
|
Specify the name of a file in which to save a snapshot of the
viewports, or just the current one if the currentView flag is set.
|
|
force(f)
|
boolean
|
|
|
Force the refresh regardless of the state of the model.
|
|
suspend(su)
|
boolean
|
|
|
Suspends or resumes Maya's handling of refresh events. Specify "on" to
suspend refreshing, and "off" to resume refreshing. Note that
resuming refresh does not itself cause a refresh -- the next natural refresh
event in Maya after "refresh -suspend off" is issued will cause the refresh
to occur. Use this flag with caution: although it provides opportunities
to enhance performance, much of Maya's dependency graph evaluation in
interactive mode is refresh driven, thus use of this flag may lead to
slight solve differences when you have a complex dependency graph with
interrelations.
|
|
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.
|
import maya.cmds as cmds
cmds.refresh()
# The refresh command can also be used to take a snapshot of the current scene view and
# save it as an image file. See example below.
import maya.cmds as cmds
# Set up workspace for images in current project
ws = cmds.workspace(q = True, fullName = True)
wsp = ws + "/" + "images"
cmds.sysFile(wsp, makeDir=True)
# Prepare unique image name for snapshot
imageSnapshot = wsp + "/" + "endSnapshot.jpg"
# Take a snapshot of the viewport and save to file
cmds.refresh(cv=True, fe = "jpg", fn = imageSnapshot)