Copy Assets to new Location
-
I would like a script to collect all my assets in a folder. Just like the option "save project with assets". But i do not want to save the project and start copying files around. I just want to collect the textures.
I tried c4d.documents.SaveProject() and c4d.documents.GetAllAssetsNew() but I can´t get it to work. I am pretty sure this is quite a short script. Could someone help me out?
Oh, and would someone explain to me this error:
TypeError: unable to convert builtins.list to @net.maxon.interface.url-CThanks.
-
Hello @cgweasel,
welcome to the forum and thank you for reaching out to us. I would recommend having a look at our Forum Guidelines as they line out important aspects of the support provided by us here.
What is missing here for my understanding is context, the version you are using, and executable code. Let's start with the simple one.
TypeError: unable to convert builtins.list to @net.maxon.interface.url-C
This means that you are passing something a
list
(possibly a list ofmaxon.Url
) that expects an argument of typemaxon.Url
. Or that you did something else incorrectly which causes this error to bubble up somewhere in our wrapper code. Without your code it is not possible to help you more concretely.I would like a script to collect all my assets in a folder.
Which brings us to the major ambiguity: What do you mean by 'assets' here? There are two asset concepts in the Cinema 4D API. Assests in the classic API sense, as reflected in 'Save Project with Assets', and Maxon Asset API assets, as reflected by the Asset Browser.
There is the idea of the classic API and maxon API in our APIs. Save Project with Assets,
c4d.documents.SaveProject()
,c4d.documents.GetAllAssetsNew()
and the project assets related messages are all classic API concepts. The Asset API, the backend of the Asset Browser, andmaxon.Url
are both maxon API concepts.c4d.documents.GetAllAssetsNew()
will yield all assets that are used by a scene as a list of dictionaries. You could iterate over them and copy these files to any location you would like to, as long as you have read and write access to the source and destination location. Showing how to copy files with Python is out of scope of support, I cannot do this for you especially when you have provided no code to start with.SaveProject()
will save a document with all its assets just as the entry in the file menu. But just as for the file menu command, this will not necessarily reflect Asset Browser assets, when they have not been imported asXrefs
, as they are then just things in your scene, and not assets anymore.Cheers,
Ferdinand -
Hi ferdinand,
I am very sorry for my lack of reading the Guidelines properly.
But still, very huge thanks to you for the explanation anyway. This already helped me. I will try things out and will probably come back here with some code.