Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Check if a texture is missing

    Cinema 4D SDK
    python 2024 macos
    3
    2
    568
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • V
      visualride
      last edited by

      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.

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @visualride
        last edited by ferdinand

        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 for GetAllAssetsNew and my user name to find the other threads). In this thread you can see here how to read the exists 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 with MSG_GETALLASSETS). The thread shows also a simpler approach using BaseDocument.GetAllTextures. You can then just check with os.exists if the paths do exist. You might have to deal with relative paths here, depending on the document.

        Cheers,
        Ferdinand

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • First post
          Last post