Please use this tool to convert MESH SKEL ANIM bone names.
It works just like Converter.
Place it in the SDK/tools folder and drop mesh+skel+anim files.
Tool is based on following source, you'll be able to compile it in the next SDK release (please don't use the source in current SDK as I've found some bug in some engine method, and it won't work properly)
Code:
/******************************************************************************/
#include "stdafx.h"
#include "../../resource.h"
/******************************************************************************/
Memc<Str> Files;
/******************************************************************************/
static Bool BoneRename(Skeleton &skel, Str src, Str dest)
{
Bool changed=false;
REPA(skel.bones)if(Equal(skel.bones[i].name,src)){Set(skel.bones[i].name,dest); changed=true;}
return changed;
}
static Bool BoneRename(Animation &anim, Str src, Str dest)
{
Bool changed=false;
REPA(anim.bones)if(Equal(anim.bones[i].name,src)){Set(anim.bones[i].name,dest); changed=true;}
return changed;
}
static Bool BoneRename(Mesh &mesh, Str src, Str dest)
{
return mesh.boneRename(src,dest);
}
/******************************************************************************/
struct SrcDest
{
Str src,dest;
}src_dest[]=
{
{"R_Clavicle","ShoulderR"},
{"L_Clavicle","ShoulderL"},
{"R_UpperArm","ArmRU" },
{"L_UpperArm","ArmLU" },
{"R_Forearm" ,"ArmRD" },
{"L_Forearm" ,"ArmLD" },
{"R_Thigh" ,"LegRU" },
{"L_Thigh" ,"LegLU" },
{"R_Calf" ,"LegRD" },
{"L_Calf" ,"LegLD" },
{"R_Hand" ,"HandR" },
{"L_Hand" ,"HandL" },
{"R_Foot" ,"FootR" },
{"L_Foot" ,"FootL" },
{"R_Toe0" ,"FootR0" },
{"L_Toe0" ,"FootL0" },
{"R_Finger0" ,"FingerR00"},
{"L_Finger0" ,"FingerL00"},
{"R_Finger01","FingerR01"},
{"L_Finger01","FingerL01"},
{"R_Finger1" ,"FingerR10"},
{"L_Finger1" ,"FingerL10"},
{"R_Finger11","FingerR11"},
{"L_Finger11","FingerL11"},
{"R_Finger2" ,"FingerR20"},
{"L_Finger2" ,"FingerL20"},
{"R_Finger21","FingerR21"},
{"L_Finger21","FingerL21"},
{"R_Finger3" ,"FingerR30"},
{"L_Finger3" ,"FingerL30"},
{"R_Finger31","FingerR31"},
{"L_Finger31","FingerL31"},
{"R_Finger4" ,"FingerR40"},
{"L_Finger4" ,"FingerL40"},
{"R_Finger41","FingerR41"},
{"L_Finger41","FingerL41"},
};
static Bool BoneRename(Skeleton &skel)
{
Bool changed=false;
REP(10)
{
Str prefix=S+"Bip0"+i+"_";
REPA(src_dest)changed|=BoneRename(skel, prefix+src_dest[i].src, src_dest[i].dest);
}
return changed;
}
static Bool BoneRename(Animation &anim)
{
Bool changed=false;
REP(10)
{
Str prefix=S+"Bip0"+i+"_";
REPA(src_dest)changed|=BoneRename(anim, prefix+src_dest[i].src, src_dest[i].dest);
}
return changed;
}
static Bool BoneRename(Mesh &mesh)
{
Bool changed=false;
REP(10)
{
Str prefix=S+"Bip0"+i+"_";
REPA(src_dest)changed|=BoneRename(mesh, prefix+src_dest[i].src, src_dest[i].dest);
}
return changed;
}
/******************************************************************************/
void AddFile(CChar *name)
{
Files.add(name);
}
void AddFileOrDir(CChar *name)
{
switch(FileInfo(name).type)
{
case FSTD_FILE: AddFile(name); break;
case FSTD_DIR : {for(FileFind ff(name); ff();)AddFileOrDir(ff.pathName()); }break;
}
}
/******************************************************************************/
void Drop()
{
for(;CChar *name=DropName();)AddFileOrDir(name);
}
void InitPre()
{
App.name("Biped Rename");
App.icon=(Char*)IDI_ICON1;
App.flag=APP_MINIMIZABLE|APP_WORK_IN_BACKGROUND|APP_NO_FX;
App.drop=Drop;
D.mode(420,315).sync(false);
#ifndef DEBUG
Paks.add("../data/engine.pak");
#endif
}
Bool Init()
{
Gui.kb_lit.zero();
D.scale(2.7f);
Skeletons.mode(CACHE_ALL_DUMMY);
Materials.mode(CACHE_ALL_DUMMY);
Images .mode(CACHE_ALL_DUMMY);
Enums .mode(CACHE_ALL_DUMMY);
return true;
}
void Shut()
{
}
/******************************************************************************/
// UPDATE
/******************************************************************************/
Bool Update()
{
if(Kb.b(KB_ESC))return false;
if(Files.elms())
{
Str name=Files.last(); Files.removeLast();
Str ext =GetExt(name);
if(Equal(ext,"skel")){Skeleton skel; if(skel.load(name))if(BoneRename(skel))skel.save(name);}else
if(Equal(ext,"anim")){Animation anim; if(anim.load(name))if(BoneRename(anim))anim.save(name);}else
if(Equal(ext,"mesh")){Mesh mesh; if(mesh.load(name))if(BoneRename(mesh))mesh.save(name);}
}
else // no files to process
{
Time.wait(1000/60);
}
return true;
}
/******************************************************************************/
// DRAW
/******************************************************************************/
void Draw()
{
if(Files.elms())
{
D.clear(WHITE);
TextDS tds; tds=Text_ds; tds.scale/=2.7; tds.color=BLACK; tds.shadow=0;
Flt y=D.h(); REPA(Files)
{
y-=0.03f; D.text(tds,0,y,Files[i]);
if(y<-D.h())break;
}
tds.scale*=2; tds.color=WHITE; tds.shadow=255;
Rect_C(0,0,0.75,0.12).drawShaded(ColorAlpha(ColorBrightness(0.35),0.65), ColorAlpha(WHITE,0), 0.02f);
D.text(tds,0,0,S+Files.elms()+" files remaining");
}else
{
D.clear(Color(171,171,171));
D.text(Rect_C(0,0,0),"Drop MESH SKEL ANIM\nfiles here to rename");
}
}
/******************************************************************************/
I want to keep Game::Chr as simple as possible, without any useless functions.
Possibly I'll simplify it even more.
You get full sources of Game::Chr, on request I'll be able to provide older version which had 'ready' functionality.