Check if a texture is missing
-
This is just a basic question that I haven't found an answer for after searching here for "missing texture".
Is there a way to find out if a material cannot find one of it's assigned textures?
I'm writing a script that will remove these materials if a missing texture is found.
-
Hello @visualride,
Thank you for reaching out to us. I would recommend having a look at c4d.documents.GetAllAssetsNew .
Helpful might also be the thread Get all Textures for a Material. It is one of the multiple threads where I showcased the usage of
GetAllAssetsNew
(search forGetAllAssetsNew
and my user name to find the other threads). In this thread you can see here how to read theexists
field in asset data to know if Cinema 4D can find that asset. But asset handling can get complex when node materials are involved as shown here (also a good place to better understand the data associated withMSG_GETALLASSETS
). The thread shows also a simpler approach using BaseDocument.GetAllTextures. You can then just check withos.exists
if the paths do exist. You might have to deal with relative paths here, depending on the document.Cheers,
Ferdinand