Load a .duf preset
djigneo
Posts: 283
How can you load a DUF file, such as a Posing, Shaping, or Materials preset via script?
I've attempted several things:
- Scene.loadScene(sFilename) - seems to attempt merging the file, but doesn't apply the presets (presumably it would work for a content-type DUF)
- DzImportMgr.canImport(sFilename) - returns false for the specified pose preset DUF file (I used oFileInfo to test file existence beforehand)
- DzScript.loadFromFile(sFilename) - DUF files aren't scripts, so this didn't work
Can someone clue me in?
Comments
DzContentMgr.openFile( sFilename , merge );
You can get the Content Manager from
App.getContentMgr();
sFilename is the full path and file name, merge is true if you want to merge into the existing scene (presumably yes for a preset, in which case you don't need to explicitly set the value) or load as a new scene. The return is true or false depending on success.
Confirmed success. Thanks, Richard!
Basic proof of concept code for others wondering:
You can use / as the folder separator, which will save you from having to escape the \ character.
Not just can, but is considered best practice.
-Rob
Good to know, thanks for the tips!
Windows is about the only thing on the planet that thinks '\' is still a good idea...