diff --git a/src/osgPlugins/osg/MatrixTransform.cpp b/src/osgPlugins/osg/MatrixTransform.cpp index cdd8eceb4..789b3e0cb 100644 --- a/src/osgPlugins/osg/MatrixTransform.cpp +++ b/src/osgPlugins/osg/MatrixTransform.cpp @@ -14,7 +14,7 @@ bool MatrixTransform_writeLocalData(const Object& obj, Output& fw); // register the read and write functions with the osgDB::Registry. RegisterDotOsgWrapperProxy g_MatrixTransformProxy ( - osgNew osg::Transform, + osgNew osg::MatrixTransform, "MatrixTransform", "Object Node Transform MatrixTransform Group", &MatrixTransform_readLocalData, diff --git a/src/osgPlugins/osg/Transform.cpp b/src/osgPlugins/osg/Transform.cpp index da5530fb7..119b41824 100644 --- a/src/osgPlugins/osg/Transform.cpp +++ b/src/osgPlugins/osg/Transform.cpp @@ -1,4 +1,5 @@ #include "osg/Transform" +#include "osg/MatrixTransform" #include "osgDB/Registry" #include "osgDB/Input" @@ -48,25 +49,21 @@ bool Transform_readLocalData(Object& obj, Input& fr) } - static Matrix s_matrix; - - if (Matrix* tmpMatrix = static_cast(fr.readObjectOfType(s_matrix))) + #ifdef USE_DEPRECATED_API + if (!dynamic_cast(&obj)) { + static Matrix s_matrix; - #ifdef USE_DEPRECATED_API - transform.setMatrix(*tmpMatrix); - #else - osg::notify(osg::WARN)<<"Warning: loaded Matrix inside a osg::Transform, "<(fr.readObjectOfType(s_matrix))) + { - osgDelete tmpMatrix; - - iteratorAdvanced = true; + transform.setMatrix(*tmpMatrix); + osgDelete tmpMatrix; + iteratorAdvanced = true; + } } - + #endif + if (fr[0].matchWord("referenceFrame")) { if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE")) { transform.setReferenceFrame(Transform::RELATIVE_TO_ABSOLUTE); @@ -89,7 +86,10 @@ bool Transform_writeLocalData(const Object& obj, Output& fw) const Transform& transform = static_cast(obj); #ifdef USE_DEPRECATED_API - fw.writeObject(transform.getMatrix()); + if (!dynamic_cast(&obj)) + { + fw.writeObject(transform.getMatrix()); + } #endif fw.indent() << "referenceFrame ";