From f804d7dd8197ab9e0db8f3edb10b5c50fc3f8d6c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 20 Sep 2012 11:27:57 +0000 Subject: [PATCH] From Vladimir Cheaev, " I worked with a osg::Constraint and found strange part of code: class OSGMANIPULATOR_EXPORT Constraint : public osg::Referenced { public: ... virtual bool constrain(ScaleUniformCommand& command) const { return constrain((MotionCommand&)command); } virtual bool constrain(const Rotate3DCommand& command) { return constrain((MotionCommand&)command); } ... If i use osgManipulator::Rotate3DCommand then method Rotate3DCommand::accept(const Constraint& constraint) calls Constraint::constrain(MotionCommand&) instead Constraint:: constrain(const Rotate3DCommand&). If you replace virtual bool constrain(const Rotate3DCommand& command) { return constrain((MotionCommand&)command); } on to virtual bool constrain(Rotate3DCommand& command) const { return constrain((MotionCommand&)command); } then all works correctly. " --- include/osgManipulator/Constraint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osgManipulator/Constraint b/include/osgManipulator/Constraint index d6009a88c..f9cad9e54 100644 --- a/include/osgManipulator/Constraint +++ b/include/osgManipulator/Constraint @@ -66,7 +66,7 @@ class OSGMANIPULATOR_EXPORT Constraint : public osg::Referenced virtual bool constrain(Scale1DCommand& command) const { return constrain((MotionCommand&)command); } virtual bool constrain(Scale2DCommand& command) const { return constrain((MotionCommand&)command); } virtual bool constrain(ScaleUniformCommand& command) const { return constrain((MotionCommand&)command); } - virtual bool constrain(const Rotate3DCommand& command) { return constrain((MotionCommand&)command); } + virtual bool constrain(Rotate3DCommand& command) const { return constrain((MotionCommand&)command); } protected: