Writing a function for "Timechanging"

Hello,

I wrote a function which modifies the scene when the time changes in Daz Studio.

If I start the script, nothing happens.

I have to add an infinite loop after the definition of the callback to see my function working correctly.

This method works fine, but I have to kill this loop before to close The Daz Studio application. Otherwise, it stays in memory.

My question is :

Is there a way to make this function integrated in the Daz Studio global loop?

I thank you for your replies.

     Gérald

Comments

  • You may want to look at callbacks - several sample scripts here, and in the preceding section http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start#post-load_callbacks

  • Hello Richard,

    Thank you for your reply.

    I tried to use a callback and this works fine.

    I define the script name, I define the CallbackMgr, I define the Callback using

    "oCallBack = oCallBackMgr.createCallBack( "Update Time", sScript, false );"

    Then I define the connection using

    "oCallBack.setConnection(Scene, "TimeChanging(DzTime)" );"

    In these lines, I do not find how to have a relation between this connection and the DzTime used in the signal.

    I needed to use "TimeChanged(DzTime)" signal to do my node update at the right frame because I did not find a way to reach the newTime defined in the signal.

    I just have a question.

    How is it possible to define a relation between the signal parameter(s) and the connection?

    Thank you very much for your help.

         Gérald

  • I'm not sure what you mean by defining a relation.

  • Hello Richard,

    you are right this word is a bad choice, a link, if you prefer.

    I will give you a example using one of your samples.

    var sScript = "support/CallBackExample/HelloWorld.dsa";
    var oCallBackMgr = App.getCallBackMgr();
    var oCallBack = oCallBackMgr.createCallBack( "Hello World", sScript, false );
     
    oCallBack.setConnection( Scene, "nodeAdded(DzNode*)" );

     - sScript is the filename of a script.

     - oCallBack is a callback defined with the previous script.

     - setConnection works a little bit like the "Connect" function for a signal, but the signal define a function with a parameter, not a file.

    Now, I want to use just created node in the "HelloWorld.dsa" script, my question is how can I get it?

    I certainly do something wrong, but I do not understand what.

    Thank you for your help.

  • Heh, those are Rob's samples. I'm not at all sure of the answer to your question - or if there is one. Sorry not to be of more help.

  • Hello Richard,

    no problem, do you know I would have the ability to contact Rob here.

    I could reply to my other thread in the SDK but I am not sure he will read the thread again.

    Personally, Have you a way to contact him?

    Thank you for your help.

          Gérald

  • Thank you Chohole,

    I will try this sample and I will tell you if I managed to get arguments of the callback.

        Gérald

Sign In or Register to comment.