DAZ Script reference for DS4.5?

cridgitcridgit Posts: 823

Hi all

The DAZ Script reference in DS3/4 was invaluable to me when developing my scripts. While the scripts work in DS4.5, I would like to update to the DUF format (currently the scripts save out as DSA's) among some other changes.

Is there a script reference or SDK documentation for the new 4.5 API? I'm specifically interested in the DAZ Script side of things - not the plugin API.

Thanks in advance

Comments

  • JimmyC_2009JimmyC_2009 Posts: 8,254
    edited December 1969

    Well, if it is not in the new SDK for DS 4.5, I have no idea where it would be.

    http://www.daz3d.com/shop/daz-studio-4-5-sdk

  • cridgitcridgit Posts: 823
    edited December 1969

    Hi Jimmy

    Thank you. I have the SDK installed but it doesn't contain any information (that I can find) on the new API's or objects - all I've got is my DS3 DAZ Script Reference guide, and the wiki reference guide is still like a desert landscape with the water squeezed out.

    Just looking for a way to find out what new objects are available in DS4.5, specifically for saving out a pose preset in DUF format.

  • rbtwhizrbtwhiz Posts: 436
    edited December 1969

    Perhaps you'll remember your "How can I enumerate DzFileIOSettings?" thread in the old Developer Discussion forum. If you re-read my posts in that thread, you'll notice in the latter two I mention posting samples using DzAssetIOFilter subclasses. Those samples have been posted for a while (since at least May 7, 2012 according to the log)... in the "desert landscape with the water squeezed out" you refer to. Perhaps you'll find this post of use as well.

    -Rob

  • cridgitcridgit Posts: 823
    edited December 1969

    rbtwhiz said:
    Perhaps you'll remember your "How can I enumerate DzFileIOSettings?" thread in the old Developer Discussion forum. If you re-read my posts in that thread, you'll notice in the latter two I mention posting samples using DzAssetIOFilter subclasses. Those samples have been posted for a while (since at least May 7, 2012 according to the log)... in the "desert landscape with the water squeezed out" you refer to. Perhaps you'll find this post of use as well.

    -Rob



    Hi Rob, yes I remember the post but I didn't think to look back there for links. I found my way to the Scripting reference and looked through but the only thing that looked usable was what looked to be the "old" DS3 object index (I suspect this is being ported over). I'll admit I didn't venture as far as the samples, given I was looking for reference documentation (object index, member variables and functions etc.). So thank you for the link - at a glance those sample look to be exactly what I was looking for.

    On a side note: my comment about the desert landscape was intended to be humorous tongue-in-cheek. I'm fully aware there's a one-man army behind the scripting documentation, so I hadn't meant any offence. Hope you don't take it the wrong way.

    I'll shout in here if I get stuck on the samples.

    Thanks

  • cridgitcridgit Posts: 823
    edited December 1969

    Thanks to Rob's samples I've managed to fully automatically save out a DUF pose preset.

    There's only 1 issue - I want to save out only the modified node transform controls. When I use the dialog, I can choose Uncheck All and Check Modified to do this, but when automating the process (without dialog), I need to run through all the nodes and check which have been modified. Only I don't know how to do that.

    In the DAZ Script 3 reference, I've found something that might help. If I do the following, will that tell me if the node's control has been modified?

    if (node.getXPosControl().getValue() != node.getXPosControl().getDefault())
                         // node modified - add to DzPoseAssetIO properties

    Is that what the getDefaut() will do for me? (Of course I'd need to do the above check for every transform control: Pos, Rot, Scale).

    Thanks

  • Richard HaseltineRichard Haseltine Posts: 19,404
    edited December 1969

    getDefaultValue() is the function, but it seems to work yes.

  • cridgitcridgit Posts: 823
    edited October 2012

    Hi Richard

    Indeed, getDefaultValue() it is. Sorry about the typo. Thank you for confirming.

    Next question for the eleven wise men (we're going to need them for this one) :

    When saving out a pose preset in DUF format (DS 4.5), the root node (i.e. the figure) is not named, whereas all the bones are. See below.

    {
     "url" : "name://@selection/lToe:?rotation/x/value",
     "keys" : [ [ 0, -74 ] ]
    },
    {
     "url" : "name://@selection:?translation/x/value",
     "keys" : [ [ 0, -88.68524 ] ]
    },


    As you can see above, lToe is named but Genesis is not (there is no node name). Is this an intentional part of the DUF spec or is it a bug?

    Post edited by cridgit on
  • rbtwhizrbtwhiz Posts: 436
    edited December 1969

    @selection will resolve to the root node (skeleton/prop) of the selected object(s) in the scene... Selecting a bone of a figure resolves to the root node (skeleton) of that figure. Selecting a non-figure owned node resolves to that node - regardless of whether it is parented to something else. @selection/lToe will resolve to the first node in the hierarchy of the selected object(s) in the scene that is named lToe... including any parented objects - the exception being nodes belonging to a figure that is parented to a node belonging to a figure. It is also important to understand that the first node in the hierarchy of a selected object is itself.

    -Rob

  • cridgitcridgit Posts: 823
    edited December 1969

    Rob, Richard

    Thank you both for your inputs above. With that you've helped me successfully save out pose presets fully automatically without the popup dialog box. All's working fine now so thanks to your help.

    There remains one final question which I haven't been able to answer from the samples page, and unfortunately the API documentation for DzAssetIOMgr is not available yet. After I've saved out a DUF pose preset, how do I load this with DAZ Script? I have been using DzScript.loadFromFile to load DS scripts, but it doesn't work for DUF files, and neither does App.getImportMgr().readFile().

    Which method should I used to load/import a DUF pose preset?

    Thanks

  • rbtwhizrbtwhiz Posts: 436
    edited December 1969

    App.getContentMgr().openFile( sPathToFile, bMerge );

    -Rob

  • cridgitcridgit Posts: 823
    edited December 1969

    rbtwhiz said:
    App.getContentMgr().openFile( sPathToFile, bMerge );

    -Rob



    Awesome, thanks Rob. In fact that line is so smart it loads everything. I had a nasty hacky if then else if then else statement going on up to now. My code has come out quite a bit cleaner from this one.

    Thanks

Sign In or Register to comment.
Rocket Fuel