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:
parent
69ebfecfcc
commit
6767ff540b
@ -598,6 +598,14 @@ void WriterNodeVisitor::buildFaces(const std::string& name,
|
||||
mesh->EndPolygon();
|
||||
}
|
||||
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,
|
||||
@ -657,7 +665,7 @@ void WriterNodeVisitor::apply(osg::Geometry& geometry)
|
||||
|
||||
osg::NodeVisitor::traverse(geometry);
|
||||
|
||||
if (geometry.getNumParents() == 0)
|
||||
if (getNodePath().size() == 1)
|
||||
buildFaces(geometry.getName(), _geometryList, _listTriangles, _texcoords);
|
||||
|
||||
// return to parent fbx node
|
||||
@ -672,14 +680,6 @@ void WriterNodeVisitor::apply(osg::Group& node)
|
||||
_curFbxNode->AddChild(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);
|
||||
|
||||
if (_listTriangles.size() > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user