Still trying to set a 2nd Poser Dir as a Favorite (Solved)

macleanmaclean Posts: 2,438

A year later, and I'm back to this topic. Rob's script is great, but incomprehensible to me.I have 2 poser installs on the same SSD - P6 and P9. P6 Favorites are no problem, but the P9 script only ever finds the P6.folders.

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

The relevant section comments are kind of vague

// Set the base to the first mapped Poser formats directory
// Set the first value to the id of the top-level container,			// set the second value to the base path within that container

The trouble is I don't know what line any of these refer to. And how would it change for a 2nd Poser install?

It's not anything life-threatening, but surely someone knows how it works?

 

		// Set the base to the first mapped Poser formats directory			var sBase = String("%1/%2")						.arg( oContentMgr.getPoserDirectoryPath( 0 ) )						.arg( sIntermediate ); 			// Set the first value to the id of the top-level container,			// set the second value to the base path within that container			var aIdPath = [ oAssetMgr.getPoserDirID(), sBase ];			// Split the relative path into its individual parts			var aRelativeParts = sPath.split( "/" );			// Iterate over each part in the relative path,			for( var i = 0; i < aRelativeParts.length; i += 1 ){				// Push the full path of the 'current' part onto the id path array				aIdPath.push( String("%1/%2")					.arg( sBase )					.arg( aRelativeParts.slice(0, i + 1).join( "/" ) ) );			}

TIA

Post edited by maclean on

Comments

  • Those comments are telling you what the code immediately below is doing.

  • I looked at the example script you linked to (Set_Content_Library_Poser_Formats_Container.dsa), and if that is the script you are running without any modifications, and you are using a version of DS >= 4.8.1.51, then the code you are showing in this post should all be skipped and this part run instead

    oPane.browseToPoserFolder( String("%1/%2").arg( sIntermediate ).arg( sPath ) );

    The last line of the script sets the folder to select

    })( "Character/DAZ People" );

    When I run the script, it searches my content directories in the order they are defined in the Content Directory Manager (see attached), so:

    • "D:/3D/Auto Adapted" -> No "Character/DAZ People" path found here
    • "D:/3D/DAZ 3D/DAZ 3D" -> "Character/DAZ People" is found, location is set in the content pane
    • No further directories are searched

     

    "contentlibrarypane_dz" appears to be undocumented, so I don't know how to specify a specific content directory with "browseToPoserFolder". To do this, we have to use the old method. The old method does not search through all content directories, you have to specify which one to search in.

    			// Set the base to the first mapped Poser formats directory			var sBase = String("%1/%2")						.arg( oContentMgr.getPoserDirectoryPath( 0 ) )						.arg( sIntermediate );

    Looking at getPoserDirectoryPath on my system:

    • getPoserDirectoryPath (0) -> "D:/3D/Auto Adapted"
    • getPoserDirectoryPath (1) -> "D:/3D/DAZ 3D/ DAZ 3D"
    • getPoserDirectoryPath (2) -> "D:/3D/Purchased/Purchased"
    • getPoserDirectoryPath (3) -> "D:/3D/OLD/Purchased/OLD Purchased"
    • getPoserDirectoryPath (4) -> "D:/3D/OLD/Free/Free"

    So we end up with sBase = "D:/3D/Auto Adapted/Runtime/Libraries"

    and next,

    			// Set the first value to the id of the top-level container,			// set the second value to the base path within that container			var aIdPath = [ oAssetMgr.getPoserDirID(), sBase ];

    This gives us aIdPath = [ "Poser", "D:/3D/Auto Adapted/Runtime/Libraries" ]

    and then

    			// Split the relative path into its individual parts			var aRelativeParts = sPath.split( "/" );			// Iterate over each part in the relative path,			for( var i = 0; i < aRelativeParts.length; i += 1 ){				// Push the full path of the 'current' part onto the id path array				aIdPath.push( String("%1/%2")					.arg( sBase )					.arg( aRelativeParts.slice(0, i + 1).join( "/" ) ) );

    So now aIdPath = [ "Poser", "D:/3D/Auto Adapted/Runtime/Libraries", "D:/3D/Auto Adapted/Runtime/Libraries/Character", "D:/3D/Auto Adapted/Runtime/Libraries/Character/DAZ People" ]

    and finally

    			// Cause the 'current' container to change			oPane.browseToIDPath( aIdPath );

    this causes the pane to work it's way through aIdPath until it ends up where we want it.

     

    So, to use the script to switch to a directory in the second Poser content directory you need to change

    	if( App.version64 >= 0x0005000800010033 ){

    to

    	if( false ){

    and

    						.arg( oContentMgr.getPoserDirectoryPath( 0 ) )

    to

    						.arg( oContentMgr.getPoserDirectoryPath( 1 ) )

     

    ContentDirectoryManager.png
    464 x 485 - 24K
  • macleanmaclean Posts: 2,438

    Well, I'm not sure what I did, but I finally got it working! I can now access all my DS stuff, plus both Poser installs from a toolbar. When you're trying to work, faffing about hunting for folders is an overrated pastime.

    In the early days of DS, there was a free script called Favorites which created a new menu, and with a couple of clicks, added any folder to it. I've never understood why the Dev Team don't add something similar to DS. I suppose they want people to use Smart Content. Treee is good for me.

    Omniflux - Yet again, you've come up with the goods. Thanks! Did you get my PM?

Sign In or Register to comment.