Anim8or Community
General Category => ASL Scripts => Topic started by: Jolly Roger on June 09, 2008, 02:56:20 pm
-
The example c export plugin script writes the name of the texture to file but don't include it's extension (jpg, gif, bmp).
How would I go about getting the full filename of a texture?
Thanks.
Roger
-
From the script spec:
Texture Type
struct texture {
string name; // texture’s name
int Marked; // Marked flag, 1 or 0
const int CubeMap; // 1 if a Cube Map, else 0
int InvertImage; // invert image flag, 1 or 0
string GetFileName(void);
string GetCubeMapFileName(int face);
int SetFileName(string name);
int SetCubeMapFileName(string name, int face);
};
He's probably using the name member.
Try the "string GetFileName(void)" one.You should get the extension
and the directory also if my memory doesn't fail me.
-
That's correct. The name field is the testure's name as used within Anim8or. The GetFileName() function returns the file name.
-
Thanks for your help.
Roger
-
I've tried tinkering with the code but I can't seem to get it to work. Although I'm no stranger to programming I know next to nothing about c.
I'd be grateful for a snippet of code to show me how to do this.
Thanks.
Roger
-
I've finally worked it out. :)
This seems to do the trick:
$name[1] = $tex[1].GetFileName();
$name[2] = $tex[1].name +"."+$name[1].GetExt;
$output.print("TextureFilename {\n");
$output.print("\"%s\";\n", $name[2]);