Automating Daz3d

v-manv-man Posts: 0
edited December 1969 in Technical Help (nuts n bolts)

From what I've read around it seems that Daz3D has some sort of scripting functionality. Does this script has the ability to access files on the disk , load them , etc. Basically is it possible to have this script do the following:

1. Feed it a list of daz filenames (maybe just a simple comma-delimited textfile)
2. For each file in the list do the following:
2a. Open the file set a certain camera and certain rotation.
2b. Set the sequence filename. Render images in sequence X-Y
2c. Rotate the image.
2d. Change the sequnce filename. Render the image in sequence X-Y
2e. Repeat steps 2c and 2d for a fixed number of times.
2f. Open the next file and repeat from 2b.


Does anyone know if this is something Daz scripting supports ?

Thanks

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,833
    edited December 1969

    yes, you would use DzContentMgr to load the files and DzRenderMgr to do the rendering.

  • v-manv-man Posts: 0
    edited December 1969

    yes, you would use DzContentMgr to load the files and DzRenderMgr to do the rendering.

    Where do I find reference about these various API calls. I went to some script documentation page, but there's mostly just guide to the language, but can't see what API there is. I thougth it would be under Object Index , but if I click there there's nothing there - just says WIP.

  • Richard HaseltineRichard Haseltine Posts: 100,833
    edited December 1969

    The DAZ Studio 3 scripting documentation should be available from the area you are looking in -there have been additions, and even removals, but it's a good foundation and I think would give all you need for this project.

  • v-manv-man Posts: 0
    edited December 1969

    The DAZ Studio 3 scripting documentation should be available from the area you are looking in -there have been additions, and even removals, but it's a good foundation and I think would give all you need for this project.

    Thanks - yup, that's available and has the class info. Now I m at the point where I can load, rotate and render. But there's just one thing I can't seem to figure out. I can't figure out how to apply changes to rendermanager. I thought it'd be a simple matter of changing the props and passing them to render function but always picks from what's in the window. Here's what i m doing:

    var renderMg = App.getRenderMgr();
    var renderOptions = renderMg.getRenderOptions(); // get the defaults - the idea is not to change anything else, just the image name
    renderOptions.renderMovToId = 1;
    renderOptions.renderSerFileName = "some generated filename";
    renderOptions.applyChanges();
    renderMg.doRender(renderOptions);

    It will render but It doesn't seem to take options I just set in the account. It just does whatever is in the render dialog. And also how does one set the image type ? (png, jpg, etc)

    Any ideas ?

  • v-manv-man Posts: 0
    edited December 1969

    Update to the above:

    I figured it out. I used renderSerFileName instead of renderSerFilename (note the N capitalization)

  • Richard HaseltineRichard Haseltine Posts: 100,833
    edited December 1969

    Glad you solved it.

  • v-manv-man Posts: 0
    edited August 2013

    Ugh... a new problem. So after some automated changes to the scene I wanted to save the scene. I looked around the class index and didn't see anything there on content manger, but I did see a method called saveScene on DzScene object. But when I try to save it and pass it filename it just bombs with a very vague "operation failed" error.

    How does one save the existing scene (this is .duf file, in case it matters) ? I m not trying to do anything special just literally overwrite the scene that's currently loaded.

    Post edited by v-man on
  • v-manv-man Posts: 0
    edited August 2013

    So it looks like to save a DUF scene I need DzAssetIOMgr . I saw some examples on using this with doSaveWithOptions, but unforunately since script documentation for version 4 is broken, and this object doesn't seem to exist in version 3, I have no idea which parameter in function does what and I don't want to randomly pass parameters out of fear that something might get screwed up.

    Does anyone know what the parameters in this call are :

    oAssetIOMgr.doSaveWithOptions( oAssetIOFilter, oSettings, false, String("%1/%2 Test").arg( sBasePath ).arg( sClassName ), sBasePath, "" );

    The first and second one are simple enough and can be deduced from the sample - but what is the third one where "false" is being passed in. And also, why is there what seems to be filename with full base path followed again by basepath parameter ? Finally ,what is the last parameter (the blank one).

    Anyone ?

    Post edited by v-man on
  • rbtwhizrbtwhiz Posts: 2,250
    edited December 1969

    ... DAZ Studio » v4.x » Reference Guide » Scripting » API Reference » Samples » File Input/Output » Save a Scene

    DzError DzAssetIOMgr::doSaveWithOptions( DzAssetIOFilter filter, DzFileIOSettings options, Boolean saveOnly=false, String filePath="", String startingDir="", String category="" )

    filter = Filter to save with.
    options = File IO options.
    saveOnly = Whether to only save the file, or to also create an associated icon and assign metadata.
    filePath = The full path of the file to save to.
    startingDir = The path of the directory to start the save dialog in.
    category = The category to assign the saved file to.

    returns DZ_NO_ERROR if the file save was successful.


    -Rob

  • v-manv-man Posts: 0
    edited December 1969

    rbtwhiz said:
    ... DAZ Studio » v4.x » Reference Guide » Scripting » API Reference » Samples » File Input/Output » Save a Scene

    DzError DzAssetIOMgr::doSaveWithOptions( DzAssetIOFilter filter, DzFileIOSettings options, Boolean saveOnly=false, String filePath="", String startingDir="", String category="" )

    filter = Filter to save with.
    options = File IO options.
    saveOnly = Whether to only save the file, or to also create an associated icon and assign metadata.
    filePath = The full path of the file to save to.
    startingDir = The path of the directory to start the save dialog in.
    category = The category to assign the saved file to.

    returns DZ_NO_ERROR if the file save was successful.


    -Rob

    Perfect ! Thanks !

    Yeah, that's the sample I saw and referred to in my post, but I wasn't sure what all the parameters to the call were (if I click on DzAssetIOMgr it just returns "WIP" page). In any case - this is exactly what i needed. Thanks again.

  • MetaGanic DesignsMetaGanic Designs Posts: 51
    edited December 1969

    Sounds like you got it? It is absolutely do-able, and frankly, MUCH easier to do in Scripting than in C++. Easier to write, and no Win vs Mac compiling...

    Those exact steps are something I wrote to UnitTest some plugins we were/are working on. Make sure the latest, greatest DS4 doesn't have any unexpexted side-effects.

    Very true that the Script Doc's are pretty much a Work in Progress, especially the Web version. That is as-intended (so I have been told anyways,) as they move from a file-based system to the globally-accesible Web version. The samples that are there are absolutely sterling though, They are 100% what I used. There are samples for both ContentMgr access and Rendering. A little verbose, but then I take that to mean Rob was writting those to illustrate capabilities rather than be succinct. Copy/Paste, and then start cutting. ;)

    The second "trick" is to also have the C++ Docs handy. Not that they also aren't a Work in Progress, but the Studio SDK Docs are some of the best I have seen. Not that that is saying much, considering the sorry state of the Docs for "big" products like the SDK's for FBX, Maya, 3DS or LightWave, but mostly, they do say something. Not always, but mostly.

    So from the C++ Docs, find the same Function. It may say more. Basically, anything listed in the C++ headers as a "public slot" is something you can call from Scripting. Documented or not! ;) The C++ Docs do always list the params and what they mean though. So I always look at both. After all, it's just Doxygen stuff, and some times they forget (don't have time,) to duplicate stuff over to the Scripting section.

Sign In or Register to comment.