From 380fb17fa940c27e25de04a192bcbe2428a6785b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 31 Jan 2010 18:24:01 +0000 Subject: [PATCH] Build fixes for build without ref_ptr<> automatic type conversion --- include/osgDB/Serializer | 2 +- src/osgAnimation/StackedTransform.cpp | 6 +++--- src/osgAnimation/UpdateMatrixTransform.cpp | 2 +- .../Inventor/ConvertFromInventor.cpp | 19 ++++--------------- .../osgAnimation/UpdateMatrixTransform.cpp | 2 +- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/include/osgDB/Serializer b/include/osgDB/Serializer index eda6c6b3b..7ae9d896b 100644 --- a/include/osgDB/Serializer +++ b/include/osgDB/Serializer @@ -866,7 +866,7 @@ public: serializer->add(#VALUE, MyClass::VALUE) #define END_ENUM_SERIALIZER() \ - wrapper->addSerializer(serializer); } + wrapper->addSerializer(serializer.get()); } } diff --git a/src/osgAnimation/StackedTransform.cpp b/src/osgAnimation/StackedTransform.cpp index e8e36bf0b..eda4d7d5c 100644 --- a/src/osgAnimation/StackedTransform.cpp +++ b/src/osgAnimation/StackedTransform.cpp @@ -23,7 +23,7 @@ StackedTransform::StackedTransform(const StackedTransform& rhs, const osg::CopyO reserve(rhs.size()); for (StackedTransform::const_iterator it = rhs.begin(); it != rhs.end(); ++it) { - const StackedTransformElement* element = *it; + const StackedTransformElement* element = it->get(); if (element) push_back(osg::clone(element,co)); } @@ -36,7 +36,7 @@ void StackedTransform::update() for (StackedTransform::iterator it = begin(); it != end(); ++it) { - StackedTransformElement* element = *it; + StackedTransformElement* element = it->get(); if (!element) continue; // update and check if there are changes @@ -53,7 +53,7 @@ void StackedTransform::update() _matrix.makeIdentity(); for (StackedTransform::iterator it = begin(); it != end(); ++it) { - StackedTransformElement* element = *it; + StackedTransformElement* element = it->get(); if (!element || element->isIdentity()) continue; element->applyToMatrix(_matrix); diff --git a/src/osgAnimation/UpdateMatrixTransform.cpp b/src/osgAnimation/UpdateMatrixTransform.cpp index d770da830..64a4bc99c 100644 --- a/src/osgAnimation/UpdateMatrixTransform.cpp +++ b/src/osgAnimation/UpdateMatrixTransform.cpp @@ -52,7 +52,7 @@ bool UpdateMatrixTransform::link(osgAnimation::Channel* channel) // check if we can link a StackedTransformElement to the current Channel for (StackedTransform::iterator it = _transforms.begin(); it != _transforms.end(); ++it) { - StackedTransformElement* element = *it; + StackedTransformElement* element = it->get(); if (element && !element->getName().empty() && channelName == element->getName()) { Target* target = element->getOrCreateTarget(); diff --git a/src/osgPlugins/Inventor/ConvertFromInventor.cpp b/src/osgPlugins/Inventor/ConvertFromInventor.cpp index 1e9f57f10..93a97decc 100644 --- a/src/osgPlugins/Inventor/ConvertFromInventor.cpp +++ b/src/osgPlugins/Inventor/ConvertFromInventor.cpp @@ -280,7 +280,7 @@ ConvertFromInventor::convert(SoNode* ivRootNode) // Initialize Inventor state stack // (ivStateStack is used to track the state that is not accessible by // SoCallbackAction functions) - ivStateStack.push(IvStateItem(ivRootNode, osgRootNode)); + ivStateStack.push(IvStateItem(ivRootNode, osgRootNode.get())); // Create callback actions for the inventor nodes // These callback functions perform the conversion @@ -511,18 +511,7 @@ ConvertFromInventor::ivPopState(const SoCallbackAction *action, "ivStateStack push was initiated by different node."); // Get osgStateRoot (note: we HAVE TO reference it) - osg::Group *stateRoot = ivState.osgStateRoot; - osg::ref_ptr r = stateRoot; -/* assert(strcmp(stateRoot->className(), "Group") == 0 && - "IvStateStack osg graph is expected to be " - "headed by osg::Group"); - if (stateRoot->getNumChildren() == 1) { - r = stateRoot->getChild(0)->asGroup(); - osg::notify(osg::FATAL) << stateRoot->className() << std::endl; - osg::notify(osg::FATAL) << stateRoot->getChild(0)->className() << std::endl; - exit(0); - assert(r != NULL && "Node must be group."); - }*/ + osg::ref_ptr r = ivState.osgStateRoot; // Pop state ivStateStack.pop(); @@ -538,7 +527,7 @@ ConvertFromInventor::ivPopState(const SoCallbackAction *action, // APPEND_AT_PUSH if (!(ivState.flags & IvStateItem::APPEND_AT_PUSH)) - appendNode(r, action); + appendNode(r.get(), action); } while (multipop); @@ -1228,7 +1217,7 @@ convertShader(osg::Shader::Type osgShaderType, return false; } - return osgProgram->addShader(osgShader); + return osgProgram->addShader(osgShader.get()); } #endif // INVENTOR_SHADERS_AVAILABLE /////////////////////////////////////////////////////////////////// diff --git a/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp index e538c0010..2f8879197 100644 --- a/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp +++ b/src/osgWrappers/deprecated-dotosg/osgAnimation/UpdateMatrixTransform.cpp @@ -50,7 +50,7 @@ bool UpdateMatrixTransform_writeLocalData(const Object& obj, Output& fw) const osgAnimation::StackedTransform& transforms = uc->getStackedTransforms(); for (osgAnimation::StackedTransform::const_iterator it = transforms.begin(); it != transforms.end(); ++it) { - osgAnimation::StackedTransformElement* element = *it; + osgAnimation::StackedTransformElement* element = it->get(); if (element) fw.writeObject(*element); }