Tweak IQM tool to cope with longer bone names.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6189 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
dd03b69609
commit
c5daf67332
2 changed files with 25 additions and 6 deletions
|
@ -75,7 +75,7 @@ typedef struct galiasbone_s galiasbone_t;
|
||||||
#ifdef SKELETALMODELS
|
#ifdef SKELETALMODELS
|
||||||
struct galiasbone_s
|
struct galiasbone_s
|
||||||
{
|
{
|
||||||
char name[32];
|
char name[64];
|
||||||
int parent;
|
int parent;
|
||||||
// float radius;
|
// float radius;
|
||||||
float inverse[12];
|
float inverse[12];
|
||||||
|
|
29
iqm/iqm.cpp
29
iqm/iqm.cpp
|
@ -4162,13 +4162,14 @@ namespace fte
|
||||||
{ //import from fte's structs and convert to iqmtool's c++isms
|
{ //import from fte's structs and convert to iqmtool's c++isms
|
||||||
if (mod->type != mod_alias)
|
if (mod->type != mod_alias)
|
||||||
return false; //err...
|
return false; //err...
|
||||||
galiasinfo_t *surf = (galiasinfo_t*)mod->meshinfo;
|
galiasinfo_t *root = (galiasinfo_t*)mod->meshinfo, *surf=root;
|
||||||
if (surf)
|
if (surf)
|
||||||
{
|
{
|
||||||
resetimporter(spec);
|
resetimporter(spec);
|
||||||
|
|
||||||
if (surf->baseframeofs)
|
if (surf->baseframeofs)
|
||||||
{
|
{
|
||||||
|
int b2;
|
||||||
for (int b = 0; b < surf->numbones; b++)
|
for (int b = 0; b < surf->numbones; b++)
|
||||||
{
|
{
|
||||||
transform p(ftetransform(surf->ofsbones[b].inverse, true));
|
transform p(ftetransform(surf->ofsbones[b].inverse, true));
|
||||||
|
@ -4178,6 +4179,17 @@ namespace fte
|
||||||
j.name = surf->ofsbones[b].name;
|
j.name = surf->ofsbones[b].name;
|
||||||
j.parent = surf->ofsbones[b].parent;
|
j.parent = surf->ofsbones[b].parent;
|
||||||
|
|
||||||
|
for (b2 = 0; b2 < b; b2++)
|
||||||
|
{
|
||||||
|
if (!strcmp(surf->ofsbones[b2].name, surf->ofsbones[b].name))
|
||||||
|
{
|
||||||
|
defformatstring(newname, "b#%i %s", b, j.name);
|
||||||
|
conoutf("warning: Bones %i and %i are both called %s", b2, b, j.name);
|
||||||
|
j.name = getnamekey(newname);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//and the base pose
|
//and the base pose
|
||||||
eposes.add(p);
|
eposes.add(p);
|
||||||
}
|
}
|
||||||
|
@ -4190,6 +4202,9 @@ namespace fte
|
||||||
int firstframe = eframes.length();
|
int firstframe = eframes.length();
|
||||||
vector<float[12]> bonebuf;
|
vector<float[12]> bonebuf;
|
||||||
|
|
||||||
|
if (!anim.numposes) //drop any animations that don't have any poses defined...
|
||||||
|
continue;
|
||||||
|
|
||||||
for (int f = 0; f < anim.numposes; f++)
|
for (int f = 0; f < anim.numposes; f++)
|
||||||
{
|
{
|
||||||
skeltype_t sk = anim.skeltype;
|
skeltype_t sk = anim.skeltype;
|
||||||
|
@ -4205,7 +4220,7 @@ namespace fte
|
||||||
if (sk == SKEL_RELATIVE)
|
if (sk == SKEL_RELATIVE)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
printf("Unusable skeletal type for import - %i\n", (int)sk);
|
conoutf("warning: Unusable skeletal type for import - %i", (int)sk);
|
||||||
|
|
||||||
eframes.add(eposes.length());
|
eframes.add(eposes.length());
|
||||||
for (int b = 0; b < surf->numbones; b++, bonedata += 12)
|
for (int b = 0; b < surf->numbones; b++, bonedata += 12)
|
||||||
|
@ -4215,6 +4230,7 @@ namespace fte
|
||||||
|
|
||||||
eanim &a = eanims.add();
|
eanim &a = eanims.add();
|
||||||
if(spec.name) a.name = getnamekey(spec.name);
|
if(spec.name) a.name = getnamekey(spec.name);
|
||||||
|
else if (*anim.name) a.name = getnamekey(anim.name);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string name;
|
string name;
|
||||||
|
@ -4234,8 +4250,11 @@ namespace fte
|
||||||
|
|
||||||
for(; surf; surf = surf->nextsurf)
|
for(; surf; surf = surf->nextsurf)
|
||||||
{
|
{
|
||||||
if (surf->shares_bones != 0)
|
if (surf->shares_bones != root->shares_bones)
|
||||||
|
{
|
||||||
|
conoutf("warning: Ignoring surface %s as it has a different rig", surf->surfacename);
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (surf->numindexes)
|
if (surf->numindexes)
|
||||||
{
|
{
|
||||||
|
@ -4260,7 +4279,7 @@ namespace fte
|
||||||
// if (surf->ofs_skel_tvect)
|
// if (surf->ofs_skel_tvect)
|
||||||
// ebitangents.add(Vec3(surf->ofs_skel_tvect[v][0], surf->ofs_skel_tvect[v][1], surf->ofs_skel_tvect[v][2]));
|
// ebitangents.add(Vec3(surf->ofs_skel_tvect[v][0], surf->ofs_skel_tvect[v][1], surf->ofs_skel_tvect[v][2]));
|
||||||
|
|
||||||
if (surf->shares_bones == 0 && surf->ofs_skel_weight && surf->ofs_skel_idx)
|
if (surf->shares_bones == root->shares_bones && surf->ofs_skel_weight && surf->ofs_skel_idx)
|
||||||
{
|
{
|
||||||
blendcombo b = {};
|
blendcombo b = {};
|
||||||
//Vec3 newpos(0,0,0);
|
//Vec3 newpos(0,0,0);
|
||||||
|
@ -4296,7 +4315,7 @@ namespace fte
|
||||||
materialname = surf->surfacename;
|
materialname = surf->surfacename;
|
||||||
|
|
||||||
if (surf->nummorphs)
|
if (surf->nummorphs)
|
||||||
printf("Morph targets on input surface \"%s\" \"%s\" cannot be supported\n", surf->surfacename, materialname);
|
conoutf("warning: Morph targets on input surface \"%s\" \"%s\" cannot be supported", surf->surfacename, materialname);
|
||||||
|
|
||||||
emesh mesh(surf->surfacename, materialname, etriangles.length());
|
emesh mesh(surf->surfacename, materialname, etriangles.length());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue