IsInSearchPath weirdness

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.

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


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().

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.

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.