Can I programatically check references to my content from .duf files?

Hi!

I have more than 800 scenes, and I want to check which of my Contents (Clothing, hair, textures, HDRI) are being used by my 800 scenes.

Because I have  a lot of scenes, I can't do it one scene at a time, and need an automated solution.

Comments

  • In principle you could use scripting, at least to an extent - it can open GZFiles, parse the JSON object loaded, and then you could check through the data object for assets (models, morphs, and textures). For Daz items you could use the Content Manager to identify the product, for third party items (or daz items installed without their metadata) you'd have to work out a way to link the files to products, however.

  • I've often thought of doing something similar to parse save files before I load them to ensure all the content referenced is available. When you try to load something with missing content Daz Studio turns to treacle and you can't cancel it even when it comes up and tells you something is missing.
    Steve.

     

  • Later...

    It looks like it should be possible, any text in the save file that starts with '/data/' or '/runtime/' would be a reference to other assets. Daz script would have to be used to obtain the current content library paths and then that could be passed to a external program which did the scanning and then passed a sucess/fail flag back to Daz. Not sure if you can call external programs from within the scripting language, Richard is that something you can help with ?
    Regards
    Steve.

     

  • stephenschoon said:

    Later...

    It looks like it should be possible, any text in the save file that starts with '/data/' or '/runtime/' would be a reference to other assets. Daz script would have to be used to obtain the current content library paths and then that could be passed to a external program which did the scanning and then passed a sucess/fail flag back to Daz. Not sure if you can call external programs from within the scripting language, Richard is that something you can help with ?
    Regards
    Steve.

     

    Can you recommend me a high quality tutorial of Daz Scripting? I have a background in computer science and can learn it quickly with the right material.

  • I don't think there are any DS-specific tutorials, but the sampel scripts cover a lot of gorund http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start

  • NorthOf45NorthOf45 Posts: 5,442

    Dimension3D made a few utilities for this sort of thing. File Reference Editor and Content Gatherer might be of particular interest. 

  • NorthOf45 said:

    Dimension3D made a few utilities for this sort of thing. File Reference Editor and Content Gatherer might be of particular interest.

    It looks like Content Gatherer might do exactly what I was looking for.

    I'm going to test it and let you know if that works.

  • NorthOf45NorthOf45 Posts: 5,442

    oppai-man said:

    NorthOf45 said:

    Dimension3D made a few utilities for this sort of thing. File Reference Editor and Content Gatherer might be of particular interest.

    It looks like Content Gatherer might do exactly what I was looking for.

    I'm going to test it and let you know if that works.

    The User Guides for each are available from the ReadMe pages in the documentation center (you may need to refresh a few times to actually get the page to display)

    File Reference Editor ReadMe
    Content Gatherer ReadMe
     

  • Content Gatherer does do what the OP requested and more. I had something simpler in mind, give it a .duf file and it checks all the assets are available.
    Steve.

     

  • oppai-man said:

    NorthOf45 said:

    Dimension3D made a few utilities for this sort of thing. File Reference Editor and Content Gatherer might be of particular interest.

    It looks like Content Gatherer might do exactly what I was looking for.

    I'm going to test it and let you know if that works.

     

     

    I tested it in one of my scenes. I generated the .zip content file, disabled my content library, and activated the library generated by the program. Everything was almost perfect, except for the face of one of the characters that restored to being a generic Genesis 8 Female. I don't know what happened, but I think this program can solve 95% of my problem.

  • You can definitely do this by parsing the DSON, but you'll have to account for three cases; when a reference is inline/immediate, local to the file, and to an external file that you'll have to parse also, recursively. Depth first is easiest and seems to work fine.

    I've found that it's generally better to just parse the DSON than depending on the SDK because the DSON is much, much better documented and you'll be able to figure out how it works much faster. And also, there's no reason why this tool has to even run in Daz studio; anything can parse a DUF file and all the tools to unzip and everything are actually already part of the Qt libraries. Not having to deal with DS itself while you're developing will greatly speed up the dev cycle, and you can move it into DS at the very end, when everything just-about-works.

    Another thing that I discovered is that not all JSON parsers are equal, and some are orders of magnitude faster that others. I... chose... poorly :) So don't just go with the one that has the cleanest API if speed is important to you.

Sign In or Register to comment.