Export scene property values to DUF
shoei321
Posts: 113
Is there any native support in the scripting environment to generate DUF files from a scene in DAZ? I need to export a specific set of properties values to a DUF file. I can certainly do this using the built-in support asset saving tools, but I need to programatically specify what goes into the DUF file. I don't see this anywhere in the API docs, and I'd certainly like to avoid writing my own DUF file writer if possible.
Also, unrelated -- is it possible for a DUF file to trigger a script execution when it is applied to a scene? And vice versa -- from a Daz Script, can I apply a DUF file to a scene node?
Thanks
Comments
Not sure I completely understand the first part of your post, but you can certainly set property values via script. If you want control over exactly what properties get saved/set, I think a script may be the only way to go, but maybe I'm missing something.
As far as your second question goes, you may want to look into setting up some signals/slots and connecting them so they trigger user defined functions, but it's hard to say given the info you provide. Might be worth having a look at the signals for DzScene. I don't know exactly what it is you want to do, or exactly which DUFs you want to do it for when they are loaded into a scene.
As far as the last part of your post goes, something like this may be helpful:
var oContentMgr = App.getContentMgr();
// clear any selections in the scene
var nodes = Scene.getNodeList();
var n = nodes.length;
for( var i = 0; i < n; i++ )
{
nodes[i].select(false);
}
// select a node by label and merge a .duf to it
var oNode = Scene.findNodeByLabel( "yourNodeLabel" );
if( oNode ){
oNode.select(true);
oContentMgr.openFile( "yourFile.duf", true ); // the boolean specifies merging
}
Hope this helps.
- Greg
Do these help?
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start#save_filters
http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/start#elements
Thanks Fixmypcmike, that is exactly what I was looking for.