I am getting -1 when I call mgGetTextureIndex(db, "test.rgb")
when I call mgGetTextureName(db, 0), it returns "./test.rgb"
From the documentation it seems that this should work but maybe I am confused.
I have the full path available but I only send in the file name. Most of the models I am running this on have relative paths for textures but some can be absolute. What is the best way for me to get the index if I have the full path?
So I tried checking the save type path by calling mgTextureGetSavePathType(db) so I can send the appropriate string to mgGetTextureIndex but this doesn't seem to work. According to the documentation if the save path is relative the save name will begin with the character sequence "./" This is not the case for many of my models. Many of them return relative but do not start with "./" and just have the file name without any path information. It seems like they should be returning MSPT_NOPATH instead of relative but they are not.
I am getting -1 when I call mgGetTextureIndex(db, Ã¢â¬Åtest.rgbÃ¢â¬Â)
when I call mgGetTextureName(db, 0), it returns Ã¢â¬Å./test.rgbÃ¢â¬Â
Hmmm... just tried that here (in Creator) and it seems to work. I suspect you are in a stand alone app so may be different. Is your db "named"?
Yes, this is for a stand alone app. What do you mean by "named?"
A "named" database has been opened by mgOpenDb (where you supply a name) or has been saved using mgSaveAsDb (where you provide a name for it but may leave it open).
An "unnamed" database has been opened by mgNewDb and as such does not have a file/path associated to it yet.
I ask because "relative" texture names only work on "named" dbs. If we know your db is "named" then we can rule that out and look elsewhere for the source of your problem.
Yes, I am processing existing models. They are all named.
Ok, thanks... The next thing would be for you to describe your environment to us so we can try to reproduce here. What would be useful is:
1) the folder structure of the model you are opening and processing
2) the working folder you set when you run your app (if command line, the current directory, if MSVS, the setting in the debug properties)
3) some actual code so we can see exactly the way you are calling the function.
I was not able to get this working so I ended up rewriting my function to avoid making that call. When I have time I will revisit this and give you more info and some code. Thanks!