Contentbrowser Python API
-
Hello,
I have updated my Scripts to R25. But I am shocked to find that the Contentbrowser seems to be gone. My Functions to merge Objects/Materials/Presets to the Scene with Python dont work anymore. I used this in S24 for example:c4d.documents.MergeDocument(doc,"preset://HB_RealtimeUtilityShaders.lib4d/HB_OVERWRITEMATERIAL",2):
Now with R25 I cant find a way to load stuff from the Assetbrowser which makes it impossible to me to ship some of my Scripts with R25 compatibilty. Is there any solution or will this be possible in future?
I think it is not a good Idea to get rid of the Contentbrowser with missing features in the assetbrowser. -
Hi @HolgerBiebrach, you are right, the content browser is gone, and it is completely replaced by the Asset Browser. The correct way would be to provide a Database (the equivalent of the lib4d but for the Asset Browser) to your user, so if they are before R25 they should use lib4d, if they are in R25 they should use the database.
To do the conversion follow the next step:
- Create a new DataBase.
Open the Asset Browser, and click in the top menu in the 3 lines.
Then left click in a Databases this will open a contextual menu, selectCreate Databases...
, select a folder (an empty one) where the Database will be created. - Import the lib4d file.
Go to the the Asset Browser Create menu, and click the Import Legacy Library entry, and select your lib4d file. A popup should open to select the destination Database, select the one you just created. - Share this Database to the user.
zip the database folder you selected when you created the database and share it to the user. - (User) Load the database.
Extract the zip file, go in the Cinema 4D Preferences, in theAsset Browser
and add the extracted zip folder. Restart Cinema 4D or open the Asset Browser and go to the Edit menu -> Reload Databases. The content will be in the Converted folder.
The C++ API for the Asset Browser is available in C++, in R25 but not the Python API. The main issue is that the Asset Browser UI does not expose the URL of an Asset, but if you have an
maxon.Url
of an asset, you can load it the same way you did withc4d.documents.MergeDocument
.You can find an example in C++ how to load a Material within the Loading Materials from AssetDescriptions into a Scene.
Finally if you want to learn more about the Asset API I advice you to read the Asset API HandBook, to have a good overview of main classes and how things works together.Cheers,
Maxime. - Create a new DataBase.
-
Thanks Maxime. I will try to solve this differently for now. And update my Scripts again when the Python API is ready. Thanks again.