How to automate navigation to the "M" Products folder?
I'm trying to create some scripts to navigate around in my DAZ Studio's Content Library pane (like bookmarks into the Content folders). I'm mostly able to do this, except for being able to navigate to the "M" folder in the Products folder.
The closest example I found for navigating in the Products folder is this:
MainWindow.getPaneMgr().findPane( "DzContentLibraryPane" ).browseToProduct( "The Girl 7", "d4073ebf-4915-48dc-ad9d-802f34cad36a" );
But that's navigating to a specific product. I just want to navigate to the "M" folder of products.
I'm trying to adapt the code I used to navigate to a folder in a non-primary repository:
// example 1, for DAZ Studio format folders in 2nd repository
var oPane = MainWindow.getPaneMgr().findPane( "DzContentLibraryPane" );
var aIdPath = [ App.getAssetMgr().getStudioDirID(),
"P:/Content/Repos2",
"P:/Content/Repos2/People",
"P:/Content/Repos2/People/Genesis 8 Female",
"P:/Content/Repos2/People/Genesis 8 Female/Poses",
"P:/Content/Repos2/People/Genesis 8 Female/Poses/Godin"
];
oPane.browseToIDPath( aIdPath );
oPane.updateContainer( aIdPath );
// example 2, for Poser format folders in 2nd repository
var oPane = MainWindow.getPaneMgr().findPane( "DzContentLibraryPane" );
var aIdPath = [ App.getAssetMgr().getPoserDirID(),
"P:/Content/Repos2/Runtime/Libraries",
"P:/Content/Repos2/Runtime/Libraries/Hand" // NOT Hands
];
oPane.browseToIDPath( aIdPath );
oPane.updateContainer( aIdPath );
However, I don't think there is an equivalent getProductsDirID method on the AssetMgr.
How can I automate DS to navigate to the "M" folder in the "Products" area of the "Content Library" tab?
Thank you much for any assistance!
--John
Comments
Moved to scripting forum, where it is less likely to be lost.
Rob says:
On the page with the samples you derive from (http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/specific_ui/set_content_library_container/start), the Products sample (http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/specific_ui/set_content_library_container/start#example_products) contains a code path for versions older than 4.8.1.51. This code path manually constructs the ID path to a product container and passes that in to DzContentLibraryPane::browseToIDPath(). The comment above line 66 ("var aIdPath = [ oAssetMgr.getProductsID(), sFirst, sGuid ];") states:
---
// Set the first value to the id of the top-level container,
// set the second value to the first character of the product name,
// set the third value to the product GUID
---
If you drop the last item (the product GUID) from the array, and manually set the second item to the character you want to select (i.e., var aIdPath = [ oAssetMgr.getProductsID(), "M" ];), the Content Library pane will navigate to the "M" intermediate container under the Products top level container.
Perfect, Richard. Exactly what I needed!
And just a thanks to you, Rob and the whole DAZ team for being so prompt and responsive and accurate in your replies on these forums. DAZ products are already outstanding, and your support just makes them even more so.
--John