Guidance on using scriptFinished( String filename ) signal from ContentMgr

Hi Everyone, 

I have a script that needs to load several .duf files into the scene, and I wanted to take advantage of the ContentMgr::scriptFinished signal to learn when the first script completes (successfully) to load the subsequent script. It's my first time using signals, but I understand the concept. I wondered if anyone had a working example unrelated to a UI event that uses a signal-to-function connection. I have reviewed http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/language_reference/signals_slots/start, and while informative, it could use some example snippets to illustrate the uses further. As an alternative, I will see if I can use the DzScene::isLoading() method, but I would still like to educate myself further on using signals (outside the use of UI event handlers). 

I appreciate any help you can provide.

Comments

  • sidcarton1587sidcarton1587 Posts: 23
    edited December 2024

    I'm not sure I understand what you're trying to do exactly. 

    If you're loading multiple duf files, you would just use Scene.loadScene() on the first one, and Scene.loadScene() with a MergeFile open method for the subsequent ones? 

    Something like:

    for (var m = 0; m < aFiles.length; m++) {        sInputFile = aFiles[m];        // Load the given scene file        mode=DzScene.OpenNew        if (m > 0) {           mode=DzScene.MergeFile;        }        var oError = Scene.loadScene(sInputFile, mode);        while (Scene.isLoading()) {            processEvents();        }}

     

    You can catch signals as the loading process is happening, which gives you the opportunity do something specific based on the event. 

    For example:

    function handleSceneLoaded() {   App.verbose ("The scene was loaded");}connect (Scene, "sceneLoaded()", handleSceneLoaded)
    <img src="data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==" style="font-family:sans-serif,arial,verdana,trebuchet ms; height:15px; width:15px" title="Click and drag to move" />

     

    You could potentially call another script from the handleSceneLoaded() method.

     

     

    Post edited by sidcarton1587 on
Sign In or Register to comment.