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
A global variable that provides script access to the ECMAScript JSON object.
A global variable that provides script 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 that provides script access to the application object.
A global variable that provides script access to public static members on QColorDialog.
A global variable that provides script access to the file dialog object.
A global variable that provides script access to the geometry object.
A global variable that provides script access to the interface object.
A global variable that provides script access to public static members on QMessageBox.
A global variable that provides script access to the OpenGL object.
A global variable that provides script access to the scene object.
A global variable that provides script access to the system object.
A global variable that provides script access to the undo stack object.
See Also:
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 discretely request garbage collection.
void : print( String expression )
Prints the expression to the console (if executed from within the Script IDE pane) or to the log.
Parameter(s):
Attention:
Example:
print( "Hello, World!" );
String : qsTr( String sourceText, String disambiguation=“”, Number n=-1 )
Parameter(s):
sourceText
the translation is for.sourceText
is replaced with n's value.Return Value:
sourceText
if a translated version of sourceText
is available for the loaded language, otherwise sourceText
itself.Example:
(function(){ var sSource = "Source Text"; var sComment = "Disambiguation"; print( qsTr( sSource, sComment, 0 ) ); })();
See Also:
String : qsTranslate( String context, String sourceText, String disambiguation=“” )
Parameter(s):
sourceText
is meant.Return Value:
sourceText
if a translated version of sourceText
is available for the loaded language, otherwise sourceText
itself.Example:
(function(){ var sContext = "Context"; var sSource = "Source Text"; var sComment = "Disambiguation"; print( qsTranslate( sContext, sSource, sComment ) ); })();
See Also:
String : qsTrId( String id, Number n=-1 )
Parameter(s):
id
is replaced with n's value.Return Value:
id
. If no matching string is found, id
itself is returned.Example:
(function(){ print( qsTrId( "Id", 0 ) ); })();
See Also:
String : QT_TR_NOOP( String sourceText )
Parameter(s):
Return Value:
sourceText
if a translated version of sourceText
is available for the loaded language, otherwise sourceText
itself.Attention:
lupdate
to allow strings to be extracted from source.Example:
(function(){ print( QT_TR_NOOP( "Source Text" ) ); })();
See Also:
String : QT_TRANSLATE_NOOP( String context, String sourceText )
Parameter(s):
Return Value:
sourceText
if a translated version of sourceText
is available for the loaded language, otherwise sourceText
itself.Attention:
lupdate
to allow strings to be extracted from source.Example:
(function(){ print( QT_TRANSLATE_NOOP( "Context", "Source Text" ) ); })();
See Also:
void : acceptUndo( String caption )
Accepts and finishes a hold on the undo stack started by calling beginUndo().
Parameter(s):
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
.void : beginNodeSelectionHold()
Captures the current state of node selection in the scene, on a node selection stack. Match every call to this function with a call to dropNodeSelectionHold() to restore the previous node selection state.
Attention:
See Also:
Since:
void : beginUndo()
Starts a hold on the undo stack.
Attention:
void : beginViewportRedrawLock()
Locks redrawing of the viewports - increments the count of viewport redraw locks applied in the context of the current script execution.
After this is called, viewports will not redraw themselves until a matching call to dropViewportRedrawLock() is made or execution of the script has completed, whichever occurs first.
Attention:
See Also:
Since:
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 cannot be cancelled, this has no effect.
Attention:
Since:
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:
Since:
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.
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()
Clears the undo stack of all undo/redo items.
void : clearViewportRedrawLocks()
Clears all viewport redraw locks created by the current script execution.
See Also:
Since:
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, Function functionRef )
Disconnects a signal from an object to a function.
Parameter(s):
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, 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 : dropNodeSelectionHold()
Removes the current hold on the state of node selection in the scene without restoring the selection.
See Also:
Since:
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.
void : dropViewportRedrawLock()
Removes a viewport redraw lock - decrements the count of viewport redraw locks applied in the context of the current script execution.
See Also:
Since:
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:
See Also:
Since:
void : finishProgress()
Ends the current 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:
See Also:
Since:
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 main/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, otherwise false
.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 : setBackgroundProgressInfo( String info )
Sets the string to display in the status bar.
Parameter(s):
See Also:
Since:
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:
Example:
setBusyCursor(); // ... do something ... clearBusyCursor();
void : setProgressInfo( String info )
Sets the string to display in the progress dialog.
Parameter(s):
Since:
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 specified number of steps.
Parameter(s):
void : stepProgress( Number numSteps=1 )
Steps the current progress dialog forward the specified number of steps.
Parameter(s):
See Also:
void : updateBackgroundProgress( Number position )
Sets the current background progress to the specified number of steps.
Parameter(s):
See Also:
void : updateProgress( Number position )
Sets the current progress dialog to the specified 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();