mgGetFirstTexture is returning something like "../../../some/other/dir/file.rgb" and in the List textures window the path to texture 0 is simply "./file.rgb". How do I get that path shown in the list window.
Just like your other question... there are many factors that could influence the path returned by mgGetFirstTexture and mgGetNextTexture... Like whether or not the file was located, etc.
But certainly mgGetFirstTexture is intended to tell you where it thinks the file is. There may be some reasons why Creator thinks it is one location and your app thinks it is in another. Env vars, all sorts of factors.
To help you get to the bottom of this, we'd need the specifics like we asked on your other question...
Where is the db? what is the name stored in the palette? where is the texture located? etc.
The db and texture file are located in the same directory. The texture list in creator shows the correct location of ./texture.rgb. The call to mgGetFirstTexture on the other hand returns a relative location that doesn't even exist. It looks like it may have been a directory on the computer where this particular model was created but it is not a valid location on my system.
Does creator look for the texture files in the same directory as the database if it doesn't find it at the specified location?
I created the directory that mgGetFirstTexture was returning and moved all the texture files to there and creator was still able to load them properly and showed the new location. So I'm thinking it falls back to look at the directory containing the model if it does not locate the textures in the first place.
The db and texture file are located in the same directory. The texture list in creator shows the correct location of ./texture.rgb. The call to mgGetFirstTexture on the other hand returns a relative location that doesnÃ¢â¬â¢t even exist. It looks like it may have been a directory on the computer where this particular model was created but it is not a valid location on my system.
This does suggest this db was created on another computer and that the "folder names" are part of the texture save name in the db. This can happen if the db texture palette was set to "store absolute paths" or "store relative paths" but the db was "very far" away from the texture path.
Note that the "path" displayed by mgGetFirstTexture has all to do with the name of the texture and path stored in the file and less to do with the current folder structure. That is exactly why "relative" texture names exist.
You need to figure out what the "real" names stored in the file are. You can use mgGetTextureSaveName to tell you this. Then you should be able to sort out the "paths" on your current computer.
Does creator look for the texture files in the same directory as the database if it doesnÃ¢â¬â¢t find it at the specified location?
Well, it depends... Creator 13 does not explicitly look in the directory of the db unless the path is set to NO PATH or is set to relative like this ./name.rgb. So it could happen to look in the db folder but not necessarily. Note that older versions of Creator used to look in the db folder.
Here is how Creator 13 (and the API) looks up a texture file:
1) If the name is relative (starts with ./), it takes the db folder and merges it with the relative name to get a complete file path (folder + file name). Note that this merging may not always yield a valid folder on your current computer. If the texture is found in this "merged" folder location, use it and stop looking
2) If PRESAGIS_CREATOR_TXTPATH env var is set, look for the texture there.
3) If TXTPATH env var is set, look there
This may be related to my previous post on mgGetTextureIndex.
When I call mgGetFirstTexture on a model I am getting back a path that is not correct. If I open the file in creator and look where the first texture is, it is located somewhere else. Is the name returned by mgGetFirstTexture not the actual file path to the texture? If not, what is the proper way to get the texture location?