Start a new topic

mgGetTextureIndex

Original Post by: perezucf Fri Nov 15 17:27:27 2013


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?


Original Post by: perezucf Fri Nov 15 23:06:19 2013


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!

Original Post by: SteveThompson Fri Nov 15 22:29:24 2013


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.


Thanks!

Original Post by: perezucf Fri Nov 15 21:47:53 2013


Yes, I am processing existing models. They are all named.

Original Post by: SteveThompson Fri Nov 15 21:46:04 2013


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.

Original Post by: perezucf Fri Nov 15 21:42:14 2013


Yes, this is for a stand alone app. What do you mean by "named?"

Original Post by: SteveThompson Fri Nov 15 21:34:22 2013


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"?

Original Post by: perezucf Fri Nov 15 19:12:57 2013


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.

Login to post a comment