User Tools

Site Tools


DzScriptContext

Encapsulates a DAZ Script script context.

More...

Inherits :

Methods

DAZ Script
voidacceptUndo ( String caption )
BooleanbackgroundProgressIsActive ()
BooleanbackgroundProgressIsCancelled ()
voidbeginNodeSelectionHold ()
voidbeginUndo ()
voidcancelBackgroundProgress ()
voidcancelProgress ()
voidcancelUndo ()
voidclearBusyCursor ()
voidclearNodeSelectionHolds ()
voidclearOverrideCursor ()
voidclearUndoStack ()
voiddropNodeSelectionHold ()
voiddropUndo ()
voidfinishBackgroundProgress ()
ObjectfinishBackgroundProgressWithDetail ()
voidfinishProgress ()
ObjectfinishProgressWithDetail ()
ArraygetArguments ()
StringgetErrorMessage ( Number errCode )
QObjectgetObjectParent ( QObject obj )
DzAuthorgetScriptAuthor ()
StringgetScriptFileName ()
StringgetScriptType ()
StringgetScriptVersionString ()
BooleanpointersAreEqual ( QObject ptr1, QObject ptr2 )
voidprocessEvents ()
BooleanprogressIsActive ()
BooleanprogressIsCancelled ()
voidrestoreNodeSelectionHold ()
voidsetBackgroundProgressInfo ( String info )
voidsetBusyCursor ()
voidsetProgressInfo ( String info )
voidsleep ( Number milliseconds )
voidstartBackgroundProgress ( String info, Number totalSteps=0, Boolean isCancellable=false )
voidstartProgress ( String info, Number totalSteps=0, Boolean isCancellable=false, Boolean showTimeElapsed=false )
voidstepBackgroundProgress ( Number numSteps=1 )
voidstepProgress ( Number numSteps=1 )
voidupdateBackgroundProgress ( Number position )
voidupdateProgress ( Number position )
Deprecated
BooleanshiftPressed ()
BooleanctrlPressed ()
QDesktopWidget (deprecated)getDesktop ()

Detailed Description

All DzScripts are executed in the context of a DzScriptContext instance - therefore, all the properties and methods on DzScriptContext are accessible to a script as global functions and variables. It will usually not be necessary for a script to create or use this class directly.

Methods


void : acceptUndo( String caption )

Accepts and finishes a hold on the undo stack started by calling beginUndo().

Parameter(s):

  • caption - The brief description for the action that will be displayed to the user.

See Also:


Boolean : backgroundProgressIsActive()

Return Value:

  • true if one or more background progress operations are currently being tracked, otherwise false.

See Also:


Boolean : backgroundProgressIsCancelled()

Return Value:

  • true if the user has cancelled the current operation by pressing the 'Cancel' button on the background progress, otherwise false.

See Also:


void : beginNodeSelectionHold()

Captures a view of scene selection.

See Also:

Since:

  • 4.9.4.109

void : beginUndo()

Starts a hold on the undo stack.

See Also:


void : cancelBackgroundProgress()

Cancels the current background progress tracking operation and closes the background progress if no other progress tracking operations are active. If the current operation can not be cancelled, this has no effect.

Attention:

  • A call to this function does not cause the current background progress tracking operation to be popped off the stack. Follow a call to this function with a call to finishBackgroundProgress() in order to pop the current background progress from the stack.

See Also:

Since:

  • 4.22.1.110

void : cancelProgress()

Cancels the current script progress tracking operation and closes the progress dialog if no other progress tracking operations are active. If the current operation can not be cancelled, this has no effect.

Attention:

  • A call to this function does not cause the current progress tracking operation to be popped off the stack. Follow a call to this function with a call to finishProgress() in order to pop the current progress from the stack.

See Also:

Since:

  • 4.22.1.110

void : cancelUndo()

Accepts the hold on the undo stack but immediately calls undo to restore the state of the stack to what it was before the matching beginUndo() call.

See Also:


void : clearBusyCursor()

Clears the application-standard busy cursor and returns the mouse cursor to the previous cursor. Match every call to setBusyCursor() with a call to this function.

See Also:


void : clearNodeSelectionHolds()

Clears all selection holds without restoring the selection.

See Also:

Since:

  • 4.9.4.109

void : clearOverrideCursor()

Clears the override cursor stack.

See Also:

  • Global::clearOverrideCursor()

Since:

  • 4.6.4.30

void : clearUndoStack()

Clears the undo stack.

See Also:


void : dropNodeSelectionHold()

Removes a scene node selection hold on scene selection without restoring the selection.

See Also:

Since:

  • 4.9.4.109

void : dropUndo()

Accepts the actions performed since calling beginUndo() and removes the current hold on the undo stack without adding the items to the undo stack - the memory associated with the items is freed.

See Also:


void : finishBackgroundProgress()

Ends the current background progress tracking operation and closes the background progress if no other background progress tracking operations are active.

See Also:


Object : finishBackgroundProgressWithDetail()

Ends the current background progress tracking operation and closes the background progress if no other background progress tracking operations are active.

Return Value:

  • A map providing information about the background progress tracking operation (if any), otherwise an empty map.

See Also:

Since:

  • 4.22.1.110

void : finishProgress()

Ends the current script progress tracking operation and closes the progress dialog if no other progress tracking operations are active.

See Also:


Object : finishProgressWithDetail()

Ends the current script progress tracking operation and closes the progress dialog if no other progress tracking operations are active.

Return Value:

  • A map providing information about the progress tracking operation (if any), otherwise an empty map.

See Also:

Since:

  • 4.22.1.110

Array : getArguments()

Return Value:

  • The list of arguments passed (if any) to the script upon execution, otherwise an empty list.

See Also:


String : getErrorMessage( Number errCode )

This function converts an error code into a string message.

Parameter(s):

  • errCode - The error code to convert.

Return Value:

  • A user-readable message that describes the error represented by the error code.

See Also:


QObject : getObjectParent( QObject obj )

Parameter(s):

  • obj - The object to get the object parent of.

Return Value:

See Also:


DzAuthor : getScriptAuthor()

Return Value:

  • The author of the current script (if any), otherwise and empty string.

See Also:


String : getScriptFileName()

Return Value:

  • The file name of the current script (if any), otherwise an empty string.

See Also:


String : getScriptType()

Return Value:

  • The file type that this script was saved out as.

See Also:


String : getScriptVersionString()

Return Value:

  • The version of the current script (if any), otherwise and empty string.

See Also:


Boolean : pointersAreEqual( QObject ptr1, QObject ptr2 )

This function allows a script to test if two QObject-derived variables point to the same instance.

Return Value:

  • true if the pointers point to the same object, otherwise false.

See Also:


void : processEvents()

Pauses execution of the script and allows the GUI thread time to process events.

See Also:


Boolean : progressIsActive()

Return Value:

  • true if one or more script progress operations are currently being tracked, otherwise false.

See Also:


Boolean : progressIsCancelled()

Return Value:

  • true if the user has cancelled the current operation by pressing the 'Cancel' button on the script progress dialog, otherwise false.

See Also:


void : restoreNodeSelectionHold()

Restores the scene selection to the view at last call to beginNodeSelectionHold().

See Also:

Since:

  • 4.9.4.109

void : setBackgroundProgressInfo( String info )

Sets the string to display in the status bar.

Parameter(s):

  • info - The string to display in the status bar as the current description of the operation.

See Also:

Since:

  • 4.22.1.110

void : setBusyCursor()

Sets the application-standard busy cursor - increments the count of busy cursors set in the context of the current script execution. Match every call to this function with a call to clearBusyCursor() to restore the previous cursor.

Attention:

  • Since a logic error in a script may result in a busy cursor being left applied, this function ensures that all busy cursors applied by this function are cleared at the end of script execution.

See Also:


void : setProgressInfo( String info )

Sets the string to display in the progress dialog.

Parameter(s):

  • info - The string to display in the progress dialog as the current description of the operation.

See Also:

Since:

  • 4.22.1.110

void : sleep( Number milliseconds )

Pauses the script for the specified number of milliseconds without blocking the application event loop.

Parameter(s):

  • milliseconds - The duration, in milliseconds, to sleep.

See Also:

Since:

  • 4.8.0.45

void : startBackgroundProgress( String info, Number totalSteps=0, Boolean isCancellable=false )

Displays a background progress bar to the user if one is not already being displayed and starts a progress tracking operation.

Parameter(s):

  • info - The string to display in the status bar as the current description of the operation.
  • totalSteps - The number of progress steps for the operation to be complete.
  • isCancellable - If true, the user is given the option to cancel the operation.

See Also:


void : startProgress( String info, Number totalSteps=0, Boolean isCancellable=false, Boolean showTimeElapsed=false )

Displays a script progress dialog to the user if one is not already being displayed and starts a progress tracking operation.

Parameter(s):

  • info - The string to display in the progress dialog as the current description of the operation.
  • totalSteps - The number of progress steps for the operation to be complete.
  • isCancellable - If true, the user is given the option to cancel the operation.
  • showTimeElapsed - If true, the amount of time since the progress operation was started will be displayed in the dialog.

See Also:


void : stepBackgroundProgress( Number numSteps=1 )

Steps the current background progress forward the specified number of steps.

Parameter(s):

  • numSteps - The number of steps to move the progress indicator forward.

See Also:


void : stepProgress( Number numSteps=1 )

Steps the current script progress dialog forward the specified number of steps.

Parameter(s):

  • numSteps - The number of steps to move the progress indicator forward.

See Also:


void : updateBackgroundProgress( Number position )

Sets the current background progress to the specified number of steps.

Parameter(s):

  • position - The number of steps to set as the current position for the progress indicator.

See Also:


void : updateProgress( Number position )

Sets the current script progress dialog to the specified number of steps.

Parameter(s):

  • position - The number of steps to set as the current position for the progress indicator.

See Also:


Boolean : shiftPressed()

Deprecated

Exists only to keep old code working. Do not use in new code. Use DzApp::modifierKeyState() instead.

var bShiftPressed = App.modifierKeyState() & 0x02000000;

Boolean : ctrlPressed()

Deprecated

Exists only to keep old code working. Do not use in new code. Use DzApp::modifierKeyState() instead.

var bControlPressed = App.modifierKeyState() & 0x04000000;

QDesktopWidget (deprecated) : getDesktop()

Deprecated

Exists only to keep old code working. Do not use in new code. Use DzDesktopWidget instead.

var wDesktop = new DzDesktopWidget();