Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    IsInSearchPath weirdness

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 409 Views
    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.
    • H Offline
      Helper
      last edited by

      On 18/05/2017 at 05:52, xxxxxxxx wrote:

      I get a result very weird with IsInSearchPath.

      Take a texture in your content browser, but nowhere esle in our hard drive. Then set the texture path of a bitmapshader to only the texture file( you remove //preset.... and keep MyUniquePictureName.jpg)

      Hit reload button of the bitmap shader. The bitmap is not anymore found (which is logical)

      Use IsInSearchPath with this MyUniquePictureName.jpg. It will return True.
      Use GenerateTexturePath. It will return None.
      Use c4d.documents.GetAllAssets(doc,True,""). Say can't found the texture.

      I can understand it's in search path since this is into the content browser. But I guess other function should be able to found the texture if the texture was really in the searchpath.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 19/05/2017 at 04:09, xxxxxxxx wrote:

        Hi,

        IsInSearchPath() doesn't look into the Content Browser.
        If the function is called with a relative path for the texture file, then it assumes the file is in the search path. But this doesn't mean the file really exists.
        Note if you pass a Content Browser path with "//preset" prefix, IsInSearchPath() returns False.

        I think you'd better rely on the returned texture filename from GenerateTexturePath().

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 19/05/2017 at 04:25, xxxxxxxx wrote:

          The description of the function is bit hard to understand. I guess it should be specified that he doesn't check if the picture exist.

          Because for me when I read 
          > Checks if the texture texfilename is in the search path
          >
          >
          >
          For me that obviously mean the file exist because how a file can be in a search path if it didn't exist?
          While he doesnt (it's ok but is not clear)

          Anyway thanks for the reply and this is just suggestion.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            On 19/05/2017 at 07:42, xxxxxxxx wrote:

            I agree the description for IsInSearchPath() can be improved. The function only performs string comparisons between the texture and the search paths.

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