Added DraggerTransformCallback::HandleCommandMask to DraggerTransformCallback to allow applications to select which

commands they want the dragger callback to respond to why updating the transform.
This commit is contained in:
Robert Osfield
2012-02-01 13:55:38 +00:00
parent 7664d90504
commit 487ee0f8e7
2 changed files with 61 additions and 5 deletions

View File

@@ -45,7 +45,8 @@ void osgManipulator::computeNodePathToRoot(osg::Node& node, osg::NodePath& np)
//
// DraggerTransformCallback
//
DraggerTransformCallback::DraggerTransformCallback(osg::MatrixTransform* transform):
DraggerTransformCallback::DraggerTransformCallback(osg::MatrixTransform* transform,int handleCommandMask):
_handleCommandMask(handleCommandMask),
_transform(transform)
{
}
@@ -93,6 +94,42 @@ bool DraggerTransformCallback::receive(const MotionCommand& command)
}
}
bool DraggerTransformCallback::receive(const TranslateInLineCommand& command)
{
if ((_handleCommandMask&HANDLE_TRANSLATE_IN_LINE)!=0) return receive(static_cast<const MotionCommand&>(command));
return false;
}
bool DraggerTransformCallback::receive(const TranslateInPlaneCommand& command)
{
if ((_handleCommandMask&HANDLE_TRANSLATE_IN_PLANE)!=0) return receive(static_cast<const MotionCommand&>(command));
return false;
}
bool DraggerTransformCallback::receive(const Scale1DCommand& command)
{
if ((_handleCommandMask&HANDLE_SCALED_1D)!=0) return receive(static_cast<const MotionCommand&>(command));
return false;
}
bool DraggerTransformCallback::receive(const Scale2DCommand& command)
{
if ((_handleCommandMask&HANDLE_SCALED_2D)!=0) return receive(static_cast<const MotionCommand&>(command));
return false;
}
bool DraggerTransformCallback::receive(const ScaleUniformCommand& command)
{
if ((_handleCommandMask&HANDLE_SCALED_UNIFORM)!=0) return receive(static_cast<const MotionCommand&>(command));
return false;
}
bool DraggerTransformCallback::receive(const Rotate3DCommand& command)
{
if ((_handleCommandMask&HANDLE_ROTATE_3D)!=0) return receive(static_cast<const MotionCommand&>(command));
return false;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
@@ -199,9 +236,9 @@ void Dragger::removeConstraint(Constraint* constraint)
}
}
void Dragger::addTransformUpdating(osg::MatrixTransform* transform)
void Dragger::addTransformUpdating(osg::MatrixTransform* transform, int handleCommandMask)
{
addDraggerCallback(new DraggerTransformCallback(transform));
addDraggerCallback(new DraggerTransformCallback(transform, handleCommandMask));
}
void Dragger::removeTransformUpdating(osg::MatrixTransform* transform)