DAZ Script | |
---|---|
void | clearAllCallBacks () |
DzCallBack | createCallBack ( String name, String script, Boolean evaluate ) |
DzCallBack | createCallBack ( String name ) |
void | deleteCallBack ( Number index ) |
void | deleteCallBack ( String name ) |
void | deleteCallBack ( DzCallBack callBack ) |
void | deleteCallBackGroup ( String name ) |
DzCallBack | getCallBack ( Number index ) |
DzCallBack | getCallBack ( String name ) |
Number | getCallBackIndex ( String name ) |
Array | getCallBackList () |
Array | getGroup ( String name ) |
Number | getNumCallBacks () |
Array | getSignalSignature ( QObject obj, String signalName=“” ) |
Responsible for the management of objects that are used to execute a script when a signal that the object is connected to is emitted.
There is only one instance of this manager in an application. This instance is created and owned by DzApp. Request the instance via DzApp::getCallBackMgr().
Example:
Dynamically load a script.
var sScript = "support/CallBackExample/HelloWorld.dsa"; var oCallBackMgr = App.getCallBackMgr(); var oCallBack = oCallBackMgr.createCallBack( "Hello World", sScript, false ); oCallBack.setConnection( Scene, "nodeAdded(DzNode*)" );
Example:
Embed a script.
var sPath = String( "%1/support/CallBackExample/HelloWorld.dsa" ).arg( App.getScriptsPath() ); var oScript = new DzScript; oScript.loadFromFile( sPath ); var sScript = oScript.getCode(); var oCallBackMgr = App.getCallBackMgr(); var oCallBack = oCallBackMgr.createCallBack( "Hello World", sScript, true ); oCallBack.setConnection( Scene, "nodeAdded(DzNode*)" );
Example:
CallBack script (./support/CallBackExample/HelloWorld.dsa).
“CallBack” is a global transient variable referring to the DzCallBack that executes the script.
var oSender = CallBack.getSender(); var sMessage = String( "Sender Class: %1\n" + "Sender Name: %2\n\n" + "CallBack Args: %3" ) .arg( oSender.className() ) .arg( oSender.name ) .arg( CallBack.getArgCount() ); var nArgs = CallBack.getArgCount(); if( nArgs > 0 ){ for( var i = 0; i < nArgs; i += 1 ){ sMessage += String( "\nArg %1 : %2" ).arg( i ).arg( CallBack.getArg( i ) ); } } MessageBox.information( sMessage, CallBack.className(), "&OK" );
See Also:
void : clearAllCallBacks()
Deletes all callbacks.
DzCallBack : createCallBack( String name, String script, Boolean evaluate )
Creates a DzCallBack object.
Parameter(s):
script
is the actual code and it should be embedded, set this to true
, otherwise it is assumed that script
is the path of a script file to execute.DzCallBack : createCallBack( String name )
Creates a DzCallBack object.
Parameter(s):
void : deleteCallBack( Number index )
Deletes the callback at the given index.
Parameter(s):
void : deleteCallBack( String name )
Deletes all callbacks with the given name.
Parameter(s):
void : deleteCallBack( DzCallBack callBack )
Deletes the specified callback.
Parameter(s):
void : deleteCallBackGroup( String name )
Deletes all callbacks in a given group.
Parameter(s):
DzCallBack : getCallBack( Number index )
Return Value:
index
if at least one callback exists and index
is within the range [0, getNumCallBacks() - 1], otherwise null.DzCallBack : getCallBack( String name )
Return Value:
Number : getCallBackIndex( String name )
Return Value:
name
.Array : getCallBackList()
Return Value:
Array : getGroup( String name )
Return Value:
name
.Return Value:
Array : getSignalSignature( QObject obj, String signalName=“” )
Return Value: