fill list by Library file

On 17/04/2013 at 03:29, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   14 
Platform:      Mac OSX  ; 
Language(s) :     C++  ;

---------
hey 
Im just start with plugin coding and now cant find a start for my problem

i want fill a list with the files - witch are in a library file.

thanks for any tip

On 17/04/2013 at 06:27, xxxxxxxx wrote:

What library file, what list? Please be a little more specific.

Best,
-Niklas

On 17/04/2013 at 07:48, xxxxxxxx wrote:

Hi Niklas ,

sorry i try my best

i like to fill a drop down list in the interface with all files in my xx.lib4d library that is in maxon/library/browser)

On 18/04/2013 at 02:21, xxxxxxxx wrote:

I actually would have thought of something else if I wouldn't have asked for clarification. 🙂

So, I didn't need to interact with the Content Browser, yet. But there's the lib_browser.h header file
(see the SDK documentation) which seems to exactly allow you that kind of interaction. Whether you
can load your own *.lib4d or only libraries already loaded in the Content Browser.. I don't know. It'd
be great if you could show an example when you reached the expected result.

As for the drop-down list: You can open an interface like the right-click context-menu using the
ShowPopupMenu() function. It expects a BaseContainer as input that is used to display the items
in the menu.

BaseContainer bc;
void* handle = SDKBrowserInitBrowsing();
BaseContainer data;
  
LONG i = 1000;
while (SDKBrowserGetNext(handle, data)) {
    bc.SetString(i, data.GetString(SDK_BROWSER_ITEM_NAME));
    i += 1;
}
  
SDKBrowserFreeBrowsing(handle);
  
LONG selected_item = ShowPopupMenu(NULL, MOUSEPOS, MOUSEPOS, bc);
LONG item_index = selected_item - 1000;
  
// ...

Note : This is just some untested code that should give you a hint for a possible way to solve this.
The functions SDKBrowserInitBrowsing(), SDKBrowserFreeBrowsing() and SDKBrowserGetNext() and the
constant SDK_BROWSER_ITEM_NAME are invented and the way of iteration over items in the browser
**is  ** assumed  since I do not have time to go more deeply into the lib_browser library.

Best,
-Niklas

On 18/04/2013 at 11:04, xxxxxxxx wrote:

thanks

i switch from c++ to python for some reasons  and now need a solution for python 🙂

i don`t found something in the sdk documents - is there also a solution ?

On 18/04/2013 at 12:18, xxxxxxxx wrote:

lib_browser is not wrapped for python, so no there is not a way. but i think the lib4d format is 
just an extension to the gzip format so it might be possible to unzip the files without the lib.

for python check the standard z-lib module http://docs.python.org/2/library/zlib.html
general description of the zlib format - http://zlib.net/

edit : it is just a more or less wild guess, i have never tried it, nor it is confirmed or official, it
just might be a possible work arround.