Fix two bugs introduced when removing the Geode visitor from the FBX

exporter.

In the Geometry visitor, use getNodePath to check if the Geometry node
is root instead of getNumParents.

Reset the state inside buildFaces to prevent duplication when a
Group is inside of Group.
This commit is contained in:
Derek Quam 2018-11-28 14:21:37 -06:00 committed by Robert Osfield
parent 69ebfecfcc
commit 6767ff540b

View File

@ -598,6 +598,14 @@ void WriterNodeVisitor::buildFaces(const std::string& name,
mesh->EndPolygon(); mesh->EndPolygon();
} }
setControlPointAndNormalsAndUV(geometryList, index_vert, texcoords, mesh); setControlPointAndNormalsAndUV(geometryList, index_vert, texcoords, mesh);
_geometryList.clear();
_listTriangles.clear();
_texcoords = false;
_drawableNum = 0;
for (MaterialMap::iterator it = _materialMap.begin(); it != _materialMap.end(); ++it)
it->second.setIndex(-1);
_lastMaterialIndex = 0;
} }
void WriterNodeVisitor::createListTriangle(const osg::Geometry* geo, void WriterNodeVisitor::createListTriangle(const osg::Geometry* geo,
@ -657,7 +665,7 @@ void WriterNodeVisitor::apply(osg::Geometry& geometry)
osg::NodeVisitor::traverse(geometry); osg::NodeVisitor::traverse(geometry);
if (geometry.getNumParents() == 0) if (getNodePath().size() == 1)
buildFaces(geometry.getName(), _geometryList, _listTriangles, _texcoords); buildFaces(geometry.getName(), _geometryList, _listTriangles, _texcoords);
// return to parent fbx node // return to parent fbx node
@ -672,14 +680,6 @@ void WriterNodeVisitor::apply(osg::Group& node)
_curFbxNode->AddChild(nodeFBX); _curFbxNode->AddChild(nodeFBX);
_curFbxNode = nodeFBX; _curFbxNode = nodeFBX;
_geometryList.clear();
_listTriangles.clear();
_texcoords = false;
_drawableNum = 0;
for (MaterialMap::iterator it = _materialMap.begin(); it != _materialMap.end(); ++it)
it->second.setIndex(-1);
_lastMaterialIndex = 0;
traverse(node); traverse(node);
if (_listTriangles.size() > 0) if (_listTriangles.size() > 0)