refactor: remove totally VertexInfluence (renamed BoneInfluenceList) everywhere

This commit is contained in:
Julien Valentin
2017-08-30 11:12:17 +02:00
parent fae9729560
commit fe99b568a0
9 changed files with 53 additions and 72 deletions

View File

@@ -804,17 +804,16 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr)
for (int i = 0; i < nbGroups; i++)
{
int nbVertexes = 0;
std::string name;
std::string bonename;
if (fr.matchSequence("osgAnimation::VertexInfluence %s %i {"))
{
name = fr[1].getStr();
bonename = fr[1].getStr();
fr[2].getInt(nbVertexes);
fr += 4;
iteratorAdvanced = true;
}
osgAnimation::BoneInfluenceList vi;
vi.setBoneName(name);
osgAnimation::IndexWeightList vi;
vi.reserve(nbVertexes);
for (int j = 0; j < nbVertexes; j++)
{
@@ -833,7 +832,7 @@ bool RigGeometry_readLocalData(Object& obj, Input& fr)
{
fr+=1;
}
(*vmap)[name] = vi;
(*vmap)[bonename] = vi;
}
if (!vmap->empty())
geom.setInfluenceMap(vmap.get());
@@ -863,8 +862,8 @@ bool RigGeometry_writeLocalData(const Object& obj, Output& fw)
name = "Empty";
fw.indent() << "osgAnimation::VertexInfluence \"" << name << "\" " << it->second.size() << " {" << std::endl;
fw.moveIn();
const osgAnimation::BoneInfluenceList& vi = it->second;
for (osgAnimation::BoneInfluenceList::const_iterator itv = vi.begin(); itv != vi.end(); itv++)
const osgAnimation::IndexWeightList& vi = it->second;
for (osgAnimation::IndexWeightList::const_iterator itv = vi.begin(); itv != vi.end(); itv++)
{
fw.indent() << itv->first << " " << itv->second << std::endl;
}

View File

@@ -14,14 +14,13 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry&
unsigned int size = is.readSize(); is >> is.BEGIN_BRACKET;
for ( unsigned int i=0; i<size; ++i )
{
std::string name;
std::string bonename;
unsigned int viSize = 0;
is >> is.PROPERTY("VertexInfluence");
is.readWrappedString(name);
is.readWrappedString(bonename);
viSize = is.readSize(); is >> is.BEGIN_BRACKET;
osgAnimation::BoneInfluenceList vi;
vi.setBoneName( name );
osgAnimation::IndexWeightList vi;
vi.reserve( viSize );
for ( unsigned int j=0; j<viSize; ++j )
{
@@ -30,7 +29,7 @@ static bool readInfluenceMap( osgDB::InputStream& is, osgAnimation::RigGeometry&
is >> index >> weight;
vi.push_back( osgAnimation::IndexWeight(index, weight) );
}
(*map)[name] = vi;
(*map)[bonename] = vi;
is >> is.END_BRACKET;
}
is >> is.END_BRACKET;
@@ -47,14 +46,14 @@ static bool writeInfluenceMap( osgDB::OutputStream& os, const osgAnimation::RigG
itr!=map->end(); ++itr )
{
std::string name = itr->first;
const osgAnimation::BoneInfluenceList& vi = itr->second;
const osgAnimation::IndexWeightList& vi = itr->second;
if ( name.empty() ) name = "Empty";
os << os.PROPERTY("VertexInfluence");
os.writeWrappedString(name);
os.writeSize(vi.size()) ; os << os.BEGIN_BRACKET << std::endl;
for ( osgAnimation::BoneInfluenceList::const_iterator vitr=vi.begin();
for ( osgAnimation::IndexWeightList::const_iterator vitr=vi.begin();
vitr != vi.end(); ++vitr )
{
os << vitr->first << vitr->second << std::endl;