Bookmarks for the Content Library

Syrus_DanteSyrus_Dante Posts: 983

Hi,

I just got an idea of writing a script that enables you to create bookmarks for the Content Library in an user frindly way.

In another thread Is it possibe to put certain folders as separate tabs? there was the advice to use the script examples from here

http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/specific_ui/set_content_library_container/start

and change the bottom line in the examples to the desired content path and save it as a new script file. Next create a custom action and run those script from the main menu or a toolbar. By doing this you need to copy the same hundred lines of script code over and over again. Then manualy write in the desired content path to get a decent list of scripts directing the Content Library to jump to the content folder and on top of that you have to deal with different scripts for different Content Directory types like "native" Daz content and "Poser" compatible content and so on.

For the most people like the average user even the instructions to do this are way too complicated. For the advanced user this may be an option but it is still not a practical solution and for me this is not even an option.

I was suggesting to modifiy the example scripts to accept passed arguments with the path you want the Content Library to jump to but still you have to take care of the DirectoryTypes like Daz Content and Poser Content to call the right script for the given directory type. Also the examples will only pick the "first mapped" Content Directory and dosn't handle the situation if you have for example more than one Daz Studio Formats Content Librarys. So there are at least two locations where to find a path like "People/Genesis 3 Female/Pose" for example. By comparing the different example scripts there still is an unnecessary redundancy because only the few lines that actualy set the "active" directory varies from example to example.

So here comes my idea: I write a "installer" script that creates a new main menu entry called "Bookmarks" the first and only menu entry in it for the beginning will be another script called "Create Bookmark from selected Directory".

API Reference » Object Index » DzActionMgr

String guid addCustomAction ( String text, String desc, String script, Boolean isFile=true, String shortcut=“”, String iconFile=“” )

//it seems I don't need to write the generated script that should become a custom action (the Bookmark) to a file, constructing a string that contains the script should be enougth

API Reference » Object Index » DzActionMenu

DzActionMenu : getMenu() Return Value: The Main Menu for the application.

void insertCustomAction ( String guid, Number at=-1 )

If you press on that "Create Bookmark" the script reads in the current selected "active" Content Library folder, detects the DirectoryType (is it native Daz or Poser content), prompts the user to enter a name for the bookmark (the text field automaticly is filled with a string constructed from the relative path) and finaly it creates another script with the given name and adds it to the Bookmark main menu. If you click on that Bookmark the Content Library quickly navigates to the folder.

I am currently inspecting the list of Methods in API Reference » Object Index » DzContentMgr and there a some things listed that can get realy handy for what I want to do.

Number : getNumContentDirectories()

DzContentFolder : getContentDirectory( Number which )

String : getContentDirectoryPath( Number which )

String : getMappedPath( DirectoryTypes dirTypes, String path, Boolean isRelative )

DzContentFolder findBaseDirectory ( DirectoryTypes dirTypes, String path )

Also I want to support to jump to different mapped Daz Studio Formats ond Poser Content Directories not just the first mapped like in the examples.

I don't know how to detect the "mapped" Content Directory Index number from an absolute path. It seems there is no method for doing that so I have to iterate over all mapped Directories and compare the returned string with the BaseDirectory that should be the name of the Content Directory.

What I haven't found yet is how to get the active directory from the Content Library, you know the folder or the file that is currently selected in this pane. I hope someone can help me find this method somewhere this script project needs the ability to do that.

Maybe this is where I have to look for the selected Folder in the Content Library?

API Reference » Object Index » DzContentFolder

String : folderName Holds the name of the folder on disk. (Read Only)

FolderType : folderType Holds the type of this folder. (Read Only)

String : fullPath Holds the full path of the folder on disk. (Read Only)

Post edited by Syrus_Dante on

Comments

Sign In or Register to comment.