Getting a list of Scripted renderers

djigneodjigneo Posts: 283

Is there a "good" way to determine what Scripted 3Delight Render Scripts are available for use from within the DAZ Studio client?

 

My current implementation is iterating the subdirectories of

String("%1/Scripted Renderer/").arg(App.getResourcesPath());

and assuming each folder contains a registered script of the same name, which seems to make a lot of assumptions that the folders and names match. So, is there a "right" way to know what scripts are available?

var sScriptedRendererBasePath = String("%1/Scripted Renderer/").arg(App.getResourcesPath());var oDir = new DzDir(sScriptedRendererBasePath);var aEntryList = oDir.entryList("");var aScriptedRendererScriptNames = new Array();for (var i = 0; i < aEntryList.length; i++) {        if (aEntryList[i] === "." || aEntryList[i] === "..")            continue;        aScriptedRendererScriptNames[aScriptedRendererScriptNames.length] = aEntryList[i];    }

 

Post edited by djigneo on

Comments

  • rbtwhizrbtwhiz Posts: 2,179

    Take a look at the File Listing sample.

    Replace the following statement...

    var aFiles = g_oFileLister.execute( App.getShadersPath(), "*.sdl" );

    ... with the following statement...

    var aFiles = g_oFileLister.execute( String("%1/Scripted Renderer").arg( App.getResourcesPath() ), "*.dsa" );

    -Rob

  • djigneodjigneo Posts: 283

    Thanks for the reply!

    ...but I'm not sure my original inquiry was completely clear. I'm trying to ascertain what scripts (currently) are selectable (by the user) from within DAZ Studio. 

    I get that DAZ Studio will always attempt to load scripts from that directory, but is there any way to know if script loading failed or is not selectable from the UI?

    Does DAZ Studio load any and all DSA files from that directory structure (not just ones that match up with the directory names)?

     

    The implication of your answer seems to be "the best one can do is just find all DSA files within that directory (and any of it's subdirectories) and consider each of them a selectable script". If that's the case, I can roll with that (improving my script to search subdirectories as well for the explicit DSA files), but I'm mainly asking for a sanity check as to how DAZ works in that regard.

  • rbtwhizrbtwhiz Posts: 2,179

    I've added the Scripted Renderer Definition File List sample to show how to get just the paths of definition scripts that can be accessed from the Render Script property menu(s) of the Scripted 3Delight renderer; rather than all files of a given extension in a given path.

    -Rob

  • djigneodjigneo Posts: 283
    edited July 2016

    Wow, you are the man! The description on the article is exactly what I was after. And the syntax for DzDir.entryList() is great too! I was fiddling with that with little success which is why I have those gnarly if statements (since I couldn't figure it out). =)

    Thank you very much!

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