From 6767ff540b1090a80bd932edca4db071cd88639a Mon Sep 17 00:00:00 2001 From: Derek Quam Date: Wed, 28 Nov 2018 14:21:37 -0600 Subject: [PATCH] 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. --- src/osgPlugins/fbx/WriterNodeVisitor.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/osgPlugins/fbx/WriterNodeVisitor.cpp b/src/osgPlugins/fbx/WriterNodeVisitor.cpp index eae2a1153..7871d4207 100644 --- a/src/osgPlugins/fbx/WriterNodeVisitor.cpp +++ b/src/osgPlugins/fbx/WriterNodeVisitor.cpp @@ -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)