Launch the ContentBrowser at the User folder

On 31/10/2013 at 10:58, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   13 
Platform:   Windows  ;   
Language(s) :     C++  ;

I can't get the Content Browser to launch with the .lib4d/User/ folder selected by default.
I can successfully launch the CB to any other folder if it's a regular folder. But this .lib4d stuff is different.
The docs seem to indicate that I'm supposed to use URLs. But I can't get it to work:

  Filename user_dir = "preset://user.lib4d/Objects/Cube";  
  SDKBrowserURL myUrl = SDKBrowserURL(user_dir);   
  GePrint(myUrl.GetString());                       // prints file://localhost/preset://user.lib4d/Objects/Cube  
  SDKBrowser *cb = NULL;                         //Create a Content Browser instance  
  Bool exists = cb->ExistsPreset(myUrl);         //Returns 0...It doesn't find the objects directory even though it exists!!  
  cb->OpenNewBrowser(myUrl, 0);                 //Supposed to open the Content Browser window at specific directory..But fails!!

What am I doing wrong?


On 31/10/2013 at 14:35, xxxxxxxx wrote:

Never mind. I managed figure it out.
I guess we must use the GetString() function on the presets locations.

This code will launch the Content Browser at the User Folder (if it exists)

    Filename user_dir = "preset://user.lib4d/Objects";      
  SDKBrowser *cb = NULL;                            //Create a Content Browser instance  
  cb->OpenNewBrowser(user_dir.GetString(), 0);


On 01/11/2013 at 08:25, xxxxxxxx wrote:

Thanks for sharing the solution.
I tried to solve this in python too, but did not manage?
Is it also possible in Python?

On 01/11/2013 at 09:37, xxxxxxxx wrote:

The content browser class is not wrapped in Python. You can however add a C++ function to your plugin

as you started to do here which
will open the SDK Browser for you.


On 01/11/2013 at 11:34, xxxxxxxx wrote:

Yes, this opens great opportunities.