From 08a1c4560505e37e9c2c0c7fbc48fb978dbbb60e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 18 Feb 2016 10:04:04 +0000 Subject: [PATCH] From Tony Vasile, "This is a fix for the handling of OpenFlight files with switches whose children have a transformation matrix on them. It may break other things and I have only tested this with one of my models." --- src/osgPlugins/OpenFlight/Record.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/osgPlugins/OpenFlight/Record.cpp b/src/osgPlugins/OpenFlight/Record.cpp index a1e339ac9..0bc1cbc8d 100644 --- a/src/osgPlugins/OpenFlight/Record.cpp +++ b/src/osgPlugins/OpenFlight/Record.cpp @@ -12,7 +12,7 @@ */ // -// OpenFlightŪ loader for OpenSceneGraph +// OpenFlight loader for OpenSceneGraph // // Copyright (C) 2005-2007 Brede Johansen // @@ -84,14 +84,6 @@ void flt::insertMatrixTransform(osg::Node& node, const osg::Matrix& matrix, int osg::ref_ptr ref = &node; osg::Node::ParentList parents = node.getParents(); - // Disconnect node from parents. - for (osg::Node::ParentList::iterator itr=parents.begin(); - itr!=parents.end(); - ++itr) - { - (*itr)->removeChild(&node); - } - // Start without transformation if replication. osg::Matrix accumulatedMatrix = (numberOfReplications > 0)? osg::Matrix::identity() : matrix; @@ -106,7 +98,7 @@ void flt::insertMatrixTransform(osg::Node& node, const osg::Matrix& matrix, int itr!=parents.end(); ++itr) { - (*itr)->addChild(transform.get()); + (*itr)->replaceChild(&node, transform.get()); } // Make primary a child of matrix transform.