Global objects, methods, variables and constants available to all scripts via the global namespace.
The global object is never used directly, and cannot be created using the new operator. It is automatically created when the scripting engine is initialized, and its functions and properties are available immediately. The global object has no syntax. Its functions and properties are accessed directly.
A special value corresponding to the primitive value, false
. (Read Only)
Example:
var nTest = 0 > 1; print( typeof nTest ); // boolean print( nTest ); // false
A special value used to indicate a division by zero occurrence. In Daz Script, division by zero does not raise an error, instead it assigns the Infinity
value. Use isFinite() to test if a value is finite or not. (Read Only)
Example:
var nNum = 1/0; print( typeof nNum ); // number print( nNum ); // Infinity
Global variable giving all DAZ Scripts access to the ECMAScript JSON object.
Global variable giving all DAZ Scripts access to the ECMAScript Math object.
A special value used to indicate that the value of a Number, is “Not a Number”. (Read Only)
Example:
var nNum = 1/"six"; print( typeof nNum ); // number print( nNum ); // NaN
A special value used to indicate a variable does not have a value. (Read Only)
Example:
var nNum = null; print( typeof nNum ); // object print( nNum ); // null
A special value corresponding to the primitive value, true
. (Read Only)
Example:
var nTest = 0 < 1; print( typeof nTest ); // boolean print( nTest ); // true
Undefined : undefined
A special value used to indicate a variable does not have a defined value (e.g., has not yet been assigned). (Read Only)
Example:
var nNum; print( typeof nNum ); // undefined print( nNum ); // undefined
A global variable giving all DAZ Scripts access to the application object.
A global variable giving all DAZ Scripts access to public static members on QColorDialog.
A global variable giving all DAZ Scripts access to the file dialog object.
A global variable giving all DAZ Scripts access to the geometry object.
A global variable giving all DAZ Scripts access to the interface object.
A global variable giving all DAZ Scripts access to public static members on QMessageBox.
A global variable giving all DAZ Scripts access to the OpenGL object.
A global variable giving all DAZ Scripts access to the scene object.
A global variable giving all DAZ Scripts access to the system object.
A global variable giving all DAZ Scripts access to the undo stack object.
String : decodeURI( String encodedURI )
Parameter(s):
Return Value:
encodedURI
in which each escape sequence and UTF-8 encoding of the kind that might be introduced by encodeURI() is replaced with the character that it represents. Escape sequences that could not have been introduced by encodeURI() are not replaced.String : decodeURIComponent( String encodedURIComponent )
Return Value:
encodedURIComponent
in which each escape sequence and UTF-8 encoding of the kind that might be introduced by encodeURIComponent() is replaced with the character that it represents.String : encodeURI( String uri )
Parameter(s):
Return Value:
uri
in which each instance of certain characters is replaced by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.String : encodeURIComponent( String uriComponent )
Return Value:
uri
in which each instance of certain characters is replaced by one, two, three, or four escape sequences representing the UTF-8 encoding of the character.
Parses and executes str
, and returns the result.
Parameter(s):
Example:
var sTmp = "x"; var nTmp = 5; sTmp = eval( "sTmp + nTmp" ); // sTmp: "x5"
Example:
var nTmp = 2; var nTmp2 = 5; nTmp = eval( "nTmp + nTmp2" ); // nTmp: 7
Boolean : isFinite( Object expression )
Parameter(s):
Return Value:
false
if expression
coerces to NaN or Infinity, otherwise true
.Example:
print( "isFinite( NaN ) //", isFinite( NaN ) ); print( "isFinite( undefined ) //", isFinite( undefined ) ); print( "isFinite( {} ) //", isFinite( {} ) ); print( "isFinite( true ) //", isFinite( true ), ":", Number( true ) ); print( "isFinite( true ) //", isFinite( false ), ":", Number( false ) ); print( "isFinite( null ) //", isFinite( null ), ":", Number( null ) ); print( "isFinite( 5 ) //", isFinite( 5 ) ); print( "isFinite( \"5\" ) //", isFinite( "5" ), ":", Number( "5" ) ); print( "isFinite( \"5.5\" ) //", isFinite( "5.5" ), ":", Number( "5.5" ) ); print( "isFinite( \"5,5\" ) //", isFinite( "5,5" ), ":", Number( "5,5" ) ); print( "isFinite( \"ABC123\" ) //", isFinite( "ABC123" ), ":", Number( "ABC123" ) ); print( "isFinite( \"\" ) //", isFinite( "" ), ":", Number( "" ) ); print( "isFinite( \" \" ) //", isFinite( " " ), ":", Number( " " ) ); var dateNow = new Date(); print( "isFinite( new Date() ) //", isFinite( dateNow ), ":", Number( dateNow ) ); var sDate = dateNow.toString(); print( "isFinite( (new Date()).toString() ) //", isFinite( sDate ), ":", Number( sDate ) );
Boolean : isNaN( Object expression )
Parameter(s):
Return Value:
true
if expression
is NaN (Not a Number), otherwise false
.Example:
print( "isNaN( NaN ) //", isNaN( NaN ) ); print( "isNaN( undefined ) //", isNaN( undefined ) ); print( "isNaN( {} ) //", isNaN( {} ) ); print( "isNaN( true ) //", isNaN( true ), ":", Number( true ) ); print( "isNaN( true ) //", isNaN( false ), ":", Number( false ) ); print( "isNaN( null ) //", isNaN( null ), ":", Number( null ) ); print( "isNaN( 5 ) //", isNaN( 5 ) ); print( "isNaN( \"5\" ) //", isNaN( "5" ), ":", Number( "5" ) ); print( "isNaN( \"5.5\" ) //", isNaN( "5.5" ), ":", Number( "5.5" ) ); print( "isNaN( \"5,5\" ) //", isNaN( "5,5" ), ":", Number( "5,5" ) ); print( "isNaN( \"ABC123\" ) //", isNaN( "ABC123" ), ":", Number( "ABC123" ) ); print( "isNaN( \"\" ) //", isNaN( "" ), ":", Number( "" ) ); print( "isNaN( \" \" ) //", isNaN( " " ), ":", Number( " " ) ); var dateNow = new Date(); print( "isNaN( new Date() ) //", isNaN( dateNow ), ":", Number( dateNow ) ); var sDate = dateNow.toString(); print( "isNaN( (new Date()).toString() ) //", isNaN( sDate ), ":", Number( sDate ) );
Number : parseFloat( String str )
Parses str
and returns the floating point number that it represents or NaN if the parse fails. Leading and trailing whitespace is ignored, and if the string contains a number followed by non-numeric characters, the value of the number is returned and the remainder of the string is ignored.
Parameter(s):
Return Value:
Example:
print( "parseFloat( \"5\" ) //", parseFloat( "5" ) ); print( "parseFloat( \"5.5\" ) //", parseFloat( "5.5" ) ); print( "parseFloat( \"5,5\" ) //", parseFloat( "5,5" ) ); print( "parseFloat( \"5ABC\" ) //", parseFloat( "5ABC" ) ); print( "parseFloat( \"ABC5\" ) //", parseFloat( "ABC5" ) );
Number : parseInt( String str, Number radix )
Parses the string and returns the integer that it represents or NaN if the parse fails. Leading and trailing whitespace is ignored, and if the string contains a number followed by non-numeric characters, the value of the number is returned and the remainder of the string is ignored.
Parameter(s):
Return Value:
Example:
print( "parseInt( \"5\" ) //", parseInt( "5" ) ); print( "parseInt( \"5.5\" ) //", parseInt( "5.5" ) ); print( "parseInt( \"5,5\" ) //", parseInt( "5,5" ) ); print( "parseInt( \"5ABC\" ) //", parseInt( "5ABC" ) ); print( "parseInt( \"ABC5\" ) //", parseInt( "ABC5" ) ); print( "parseInt( \"0x0123456789abcdef\" ) //", parseInt( "0x0123456789abcdef" ) ); print( "parseInt( \"0123456789abcdef\", 16 ) //", parseInt( "0123456789abcdef", 16 ) ); print( "parseInt( \"01234567\" ) //", parseInt( "01234567" ) ); print( "parseInt( \"01234567\", 8 ) //", parseInt( "01234567", 8 ) ); print( "parseInt( \"10001110101\", 2 ) //", parseInt( "10001110101", 2 ) );
void : gc()
While the garbage collector is automatically run for script objects that are no longer referenced, there is no guarantee on when it will take place. This function can be used to explicitly request garbage collection.
void : print( String expression )
Prints the expression to the console (if executed from within the Script Editor) or to the log.
Parameter(s):
Example:
print( "Hello, World!" );
String : qsTr( String sourceText )
Return Value:
sourceText
if an appropriate translated string is available, otherwise returns sourceText
itself.String : qsTranslate( String sourceText )
Return Value:
sourceText
, by querying the installed translation files. Translation files are searched from the most recently installed file back to the first installed file.Return Value:
id
. If no matching string is found, id
itself is returned.void : acceptUndo( String caption )
Scripts can call this function to accept and finish a hold on the undo stack started by calling beginUndo().
Parameter(s):
Boolean : backgroundProgressIsActive()
Return Value:
true
if one or more background progress operations are currently being tracked.See Also:
Boolean : backgroundProgressIsCancelled()
Return Value:
true
if the user has cancelled the current operation by pressing the 'Cancel' button on the background progress.void : beginNodeSelectionHold()
Captures the current state of node selection in the scene, on a node selection stack.
See Also:
Since:
void : beginUndo()
Starts a hold on the undo stack. It is recommended that scripts use this function rather than accessing DzUndoStack directly, since if the script crashes or a logic error results in leaving the undo stack open, calling this function insures that the undo stack will be closed at the end of script execution.
void : cancelUndo()
Scripts can call this function to cancel a hold on the undo stack started by calling beginUndo().
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.
Example:
setBusyCursor(); // ... do something ... clearBusyCursor();
void : clearNodeSelectionHolds()
Clears all selection holds without restoring the selection.
See Also:
Since:
void : clearUndoStack()
Scripts can call this function to clear the undo stack.
void : connect( Object sender, String signal, Object receiver, String function )
Connects a signal from one object to a function (slot) on another object.
Parameter(s):
receiver
to execute when sender
emits signal
. If receiver
is a script defined Function, the 'this' object within the context of the function will be the Global object.See Also:
void : connect( Object sender, String signal, Object thisObject, Function functionRef )
Connects a signal from an object to a function.
Parameter(s):
sender
emits signal
.See Also:
Since:
void : connect( Object sender, String signal, Function functionRef )
Connects a signal from an object to a function.
Parameter(s):
sender
emits signal
.See Also:
void : debug( expression )
Prints expression
to the output console (stderr), followed by a newline.
Example:
debug( "Um... Houston?" );
void : disconnect( Object sender, String signal, Object receiver, String function )
Disconnects a signal from one object to a function (slot) on another object.
Parameter(s):
receiver
to disconnect from signal
.See Also:
void : disconnect( Object sender, String signal, Object thisObject, Function functionRef )
Disconnects a signal from an object to a function.
Parameter(s):
signal
.See Also:
Since:
void : disconnect( Object sender, String signal, Function functionRef )
Disconnects a signal from an object to a function.
Parameter(s):
signal
.See Also:
void : dropNodeSelectionHold()
Removes the current hold on the state of node selection in the scene without restoring the selection.
See Also:
Since:
void : dropUndo()
Scripts can call this function to drop a hold on the undo stack started by calling beginUndo().
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:
void : finishProgress()
Ends the current progress tracking operation, and closes the progress dialog if no other progress tracking operations are active.
See Also:
Array : getArguments()
Return Value:
See Also:
String : getErrorMessage( DzError errCode )
This function converts an error code into a string message.
Parameter(s):
Return Value:
QObject : getObjectParent( QObject obj )
This function allows a script to get the object-parent of a QObject.
Parameter(s):
Return Value:
obj
.Return Value:
Return Value:
String : getScriptType()
Return Value:
String : getScriptVersionString()
Return Value:
void : include( String scriptPath )
Includes the contents of scriptPath
in the same context as the calling script. This function should only be called within the global scope of the script; it should not be called within a nested scope and it should not be called inline. As a safeguard against circular references, the script engine keeps an internal list of unique paths for included scripts; per script context, per execution. Each time the function is called, scriptPath
is checked against the list to ensure that the path has only been included once within the context of the script.
Parameter(s):
Example:
include( "MyFolder/MyScript.dse" ); oMyObject.myFunction();
Boolean : pointersAreEqual( QObject ptr1, QObject ptr2 )
This function allows a script to test if two QObject derived variables point to the same instance.
Parameter(s):
Return Value:
true
if the pointers point to the same object, otherwise false
.void : processEvents()
Pauses execution of the script and allows the GUI thread time to process events.
Return Value:
true
if one or more progress operations are currently being tracked, otherwise false
.Boolean : progressIsCancelled()
Return Value:
true
if the user has cancelled the current operation by pressing the 'Cancel' button on the progress dialog.void : restoreNodeSelectionHold()
Restores node selection in the scene to the state it was in when the last call to beginNodeSelectionHold() was made.
See Also:
Since:
void : setBusyCursor()
Sets the application-standard busy cursor. Match every call to this function with a call to clearBusyCursor() to restore the previous cursor.
Example:
setBusyCursor(); // ... do something ... clearBusyCursor();
void : sleep( Number milliseconds )
Pauses the script for the specified number of milliseconds
without blocking the application event loop.
Parameter(s):
Example:
print( new Date ); sleep( 6000 ); // 0.1 min print( new Date );
Since:
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):
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 progress dialog to the user if one is not already being displayed and starts a progress tracking operation.
Parameter(s):
true
, the user is given the option to cancel the operation.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 given number of steps.
Parameter(s):
void : stepProgress( Number numSteps=1 )
Steps the current progress dialog forward the given number of steps.
Parameter(s):
See Also:
void : updateBackgroundProgress( Number position )
Sets the current background progress to the given number of steps.
Parameter(s):
See Also:
void : updateProgress( Number position )
Sets the current progress dialog to the given number of steps.
Parameter(s):
String : unescape( String text )
Deprecated
Exists only to keep old code working. Do not use in new code. Use decodeURI() or decodeURIComponent() instead.
String : escape( String text )
Deprecated
Exists only to keep old code working. Do not use in new code. Use encodeURI() or encodeURIComponent() instead.
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();