Unable to load Texture
by Chengzhen Chai · in Torque Game Engine Advanced · 04/10/2008 (9:47 am) · 1 replies
Hi All:
I found that when textures' names in a DTS contain Chinese characters,TGEA would
fail to load the textures.It seems that it couldn't find cached file names in
ResourceManager's dictionary since file names in the dictionary has been converted to UTF-8 format,
the different format from those in the DTS.
I can fix this by processing texture names in DTS with MultiByteToWideChar and convertUTF16toUTF8 in
TGEA_1_7_0\engine\source\materials\materialList.cpp,but obviously this is not a neat solution and I
think it's not a bad idea to do the converting things in max2dtsExporter plugins.
I'm looking forward to your better solutions for this.
P.S: We use Chinese characters in file names just because our artists use it and we do not want to impose too much restrictions on them.
I found that when textures' names in a DTS contain Chinese characters,TGEA would
fail to load the textures.It seems that it couldn't find cached file names in
ResourceManager's dictionary since file names in the dictionary has been converted to UTF-8 format,
the different format from those in the DTS.
I can fix this by processing texture names in DTS with MultiByteToWideChar and convertUTF16toUTF8 in
TGEA_1_7_0\engine\source\materials\materialList.cpp,but obviously this is not a neat solution and I
think it's not a bad idea to do the converting things in max2dtsExporter plugins.
I'm looking forward to your better solutions for this.
P.S: We use Chinese characters in file names just because our artists use it and we do not want to impose too much restrictions on them.
Associate Rene Damm
First off, thanks for the really fine reporting. Lots of useful information.
TGEA1.7 had some issues with incorrect file name character set conversion but that's fixed now. However, what you describe means that the file names in the DTS shapes are stored as ANSI strings, i.e. using local code pages.
To properly fix this, all exporters have to be checked and made to encode file names in UTF-8.
Doing the conversion at load-time with MultiByteToWideChar, as you describe, will only work on machines that are using the same codepage as the one on where the file has been saved.
So, in fact, this is a problem of the exporter(s) rather than of TGEA.