Completed refactor of osgManipulator, key changes are:

Selection is now just a typedef of osg::MatrixTransform, and is deprecated

   CommandManager is shell class that just sets values directly on Dragger, and is deprecated

   Dragger now has list of DraggerCallback that takes over the roll of tracking changes to the Dragger, and
   allows users to track the dragger in any way they wish.

   Dragger now has a convinience method making MatrixTransforms track a dragger.

   Selection and CommandManager are no longer required for use of osgManipulator and are kept around for backwards compatibility.
This commit is contained in:
Robert Osfield 2009-07-01 14:01:09 +00:00
parent 4e305cf46b
commit 2525bb5d06
16 changed files with 476 additions and 414 deletions

View File

@ -114,7 +114,7 @@ osg::Node* addDraggerToScene(osg::Node* scene, osgManipulator::CommandManager* c
#ifdef USE_COMMAND_MANAGER #ifdef USE_COMMAND_MANAGER
cmdMgr->connect(*dragger, *selection); cmdMgr->connect(*dragger, *selection);
#else #else
dragger->addSelection(selection); dragger->addTransformUpdating(selection);
#endif #endif
return root; return root;
} }

View File

@ -16,7 +16,6 @@
#define OSGMANIPULATOR_COMMAND 1 #define OSGMANIPULATOR_COMMAND 1
#include <osgManipulator/Export> #include <osgManipulator/Export>
#include <osgManipulator/Selection>
#include <osg/LineSegment> #include <osg/LineSegment>
#include <osg/Plane> #include <osg/Plane>
@ -55,7 +54,7 @@ class OSGMANIPULATOR_EXPORT MotionCommand : public osg::Referenced
virtual MotionCommand* createCommandInverse() = 0; virtual MotionCommand* createCommandInverse() = 0;
/** /**
* Gets the matrix for transforming the Selection. This matrix is in the * Gets the matrix for transforming the object being dragged. This matrix is in the
* command's coordinate systems. * command's coordinate systems.
*/ */
virtual osg::Matrix getMotionMatrix() const = 0; virtual osg::Matrix getMotionMatrix() const = 0;

View File

@ -22,29 +22,55 @@
namespace osgManipulator { namespace osgManipulator {
/** /**
* Deprecated. CommandManager class is now no longer required as Dragger now matains all references to Constraints and Selections. * Deprecated.
* CommandManager class is now no longer required as Dragger now matains all references to Constraints and Selections (now just generic MatrixTransforms).
* To replace CommandManager usage simple replace cmdMgr->connect(*dragger, *selection) with dragger->addTransformUpdating(selection) and
* cmdMgr->connect(*dragger, *selection) with dragger->addConstaint(constraint).
*/ */
class OSGMANIPULATOR_EXPORT CommandManager : public osg::Referenced class CommandManager : public osg::Referenced
{ {
public: public:
CommandManager(); CommandManager();
/** bool connect(Dragger& dragger, Selection& selection)
* Connect a dragger to a selection. The selection will begin listening {
* to commands generated by the dragger. This can be called multiple dragger.addTransformUpdating(&selection);
* times to connect many selections to a dragger.
*/
virtual bool connect(Dragger& dragger, Selection& selection);
virtual bool connect(Dragger& dragger, Constraint& constrain); return true;
}
/** Disconnect the selections from a dragger. */ bool connect(Dragger& dragger, Constraint& constraint)
virtual bool disconnect(Dragger& dragger); {
dragger.addConstraint(&constraint);
return true;
}
bool disconnect(Dragger& dragger)
{
dragger.getConstraints().clear();
dragger.getDraggerCallbacks().clear();
return true;
}
typedef std::list< osg::ref_ptr<Selection> > Selections; typedef std::list< osg::ref_ptr<Selection> > Selections;
/** Returns the selections connected to the dragger */ Selections getConnectedSelections(Dragger& dragger)
Selections getConnectedSelections(Dragger& dragger); {
Selections selections;
for(Dragger::DraggerCallbacks::iterator itr = dragger.getDraggerCallbacks().begin();
itr != dragger.getDraggerCallbacks().end();
++itr)
{
DraggerCallback* dc = itr->get();
DraggerTransformCallback* dtc = dynamic_cast<DraggerTransformCallback*>(dc);
if (dtc && dtc->getTransform()) selections.push_back(dtc->getTransform());
}
return selections;
}
protected: protected:

View File

@ -15,11 +15,11 @@
#ifndef OSGMANIPULATOR_DRAGGER #ifndef OSGMANIPULATOR_DRAGGER
#define OSGMANIPULATOR_DRAGGER 1 #define OSGMANIPULATOR_DRAGGER 1
#include <osgManipulator/Selection>
#include <osgManipulator/Constraint> #include <osgManipulator/Constraint>
#include <osgManipulator/Command> #include <osgManipulator/Command>
#include <osg/BoundingSphere> #include <osg/BoundingSphere>
#include <osg/MatrixTransform>
#include <osgUtil/SceneView> #include <osgUtil/SceneView>
#include <osgUtil/IntersectVisitor> #include <osgUtil/IntersectVisitor>
#include <osgGA/GUIEventAdapter> #include <osgGA/GUIEventAdapter>
@ -29,6 +29,57 @@ namespace osgManipulator
{ {
class CompositeDragger; class CompositeDragger;
class MotionCommand;
class TranslateInLineCommand;
class TranslateInPlaneCommand;
class Scale1DCommand;
class Scale2DCommand;
class ScaleUniformCommand;
class Rotate3DCommand;
/** Computes the nodepath from the given node all the way upto the root. */
extern OSGMANIPULATOR_EXPORT void computeNodePathToRoot(osg::Node& node, osg::NodePath& np);
class DraggerCallback : virtual public osg::Object
{
public:
DraggerCallback() {}
DraggerCallback(const DraggerCallback&, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY) {}
META_Object(osgManipulator, DraggerCallback);
/**
* Receive motion commands. Returns true on success.
*/
virtual bool receive(const MotionCommand&) { return false; }
virtual bool receive(const TranslateInLineCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const TranslateInPlaneCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Scale1DCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Scale2DCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const ScaleUniformCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Rotate3DCommand& command) { return receive((MotionCommand&)command); }
};
class OSGMANIPULATOR_EXPORT DraggerTransformCallback : public DraggerCallback
{
public:
DraggerTransformCallback(osg::MatrixTransform* transform);
virtual bool receive(const MotionCommand&);
osg::MatrixTransform* getTransform() { return _transform.get(); }
const osg::MatrixTransform* getTransform() const { return _transform.get(); }
protected:
osg::observer_ptr<osg::MatrixTransform> _transform;
osg::Matrix _startMotionMatrix;
osg::Matrix _localToWorld;
osg::Matrix _worldToLocal;
};
class OSGMANIPULATOR_EXPORT PointerInfo class OSGMANIPULATOR_EXPORT PointerInfo
{ {
@ -137,14 +188,15 @@ class OSGMANIPULATOR_EXPORT PointerInfo
/** /**
* Base class for draggers. Concrete draggers implement the pick event handler * Base class for draggers. Concrete draggers implement the pick event handler
* and generate motion commands (translate, rotate, ...) and sends these * and generate motion commands (translate, rotate, ...) and sends these
* command to all the Selections that are connected to the Dragger that generates the * command to all the DraggerCallbacks & Transforms that are connected to the Dragger that generates the
* commands. * commands.
*/ */
class OSGMANIPULATOR_EXPORT Dragger : public Selection, public osg::Observer class OSGMANIPULATOR_EXPORT Dragger : public osg::MatrixTransform
{ {
public: public:
META_OSGMANIPULATOR_Object(osgManipulator,Dragger)
META_Node(osgManipulator,Dragger)
/** /**
* Set/Get parent dragger. For simple draggers parent points to itself. * Set/Get parent dragger. For simple draggers parent points to itself.
@ -184,20 +236,26 @@ class OSGMANIPULATOR_EXPORT Dragger : public Selection, public osg::Observer
const Constraints& getConstraints() const { return _constraints; } const Constraints& getConstraints() const { return _constraints; }
typedef std::vector< Selection* > Selections; typedef std::vector< osg::ref_ptr<DraggerCallback> > DraggerCallbacks;
void addSelection(Selection* selection);
void removeSelection(Selection* selection);
Selections& getSelections() { return _selections; } void addDraggerCallback(DraggerCallback* dc);
const Selections& getSelections() const { return _selections; } void removeDraggerCallback(DraggerCallback* dc);
DraggerCallbacks& getDraggerCallbacks() { return _draggerCallbacks; }
const DraggerCallbacks& getDraggerCallbacks() const { return _draggerCallbacks; }
void addTransformUpdating(MatrixTransform* transform);
void removeTransformUpdating(MatrixTransform* transform);
protected: protected:
Dragger(); Dragger();
Dragger(const Dragger& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual ~Dragger(); virtual ~Dragger();
virtual bool receive(const MotionCommand& command);
void dispatch(MotionCommand& command); void dispatch(MotionCommand& command);
virtual void objectDeleted(void* object);
bool _handleEvents; bool _handleEvents;
bool _draggerActive; bool _draggerActive;
@ -205,8 +263,9 @@ class OSGMANIPULATOR_EXPORT Dragger : public Selection, public osg::Observer
Dragger* _parentDragger; Dragger* _parentDragger;
osg::ref_ptr<DraggerCallback> _selfUpdater;
Constraints _constraints; Constraints _constraints;
Selections _selections; DraggerCallbacks _draggerCallbacks;
}; };
@ -219,7 +278,7 @@ class OSGMANIPULATOR_EXPORT CompositeDragger : public Dragger
{ {
public: public:
META_OSGMANIPULATOR_Object(osgManipulator,CompositeDragger) META_Node(osgManipulator,CompositeDragger)
typedef std::vector< osg::ref_ptr<Dragger> > DraggerList; typedef std::vector< osg::ref_ptr<Dragger> > DraggerList;
@ -242,6 +301,8 @@ class OSGMANIPULATOR_EXPORT CompositeDragger : public Dragger
protected: protected:
CompositeDragger() {} CompositeDragger() {}
CompositeDragger(const CompositeDragger& rhs, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
virtual ~CompositeDragger() {} virtual ~CompositeDragger() {}
DraggerList _draggerList; DraggerList _draggerList;

View File

@ -27,6 +27,12 @@
# define OSGMANIPULATOR_EXPORT # define OSGMANIPULATOR_EXPORT
#endif #endif
#define META_OSGMANIPULATOR_Object(library,name) \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
/** /**
\namespace osgManipulator \namespace osgManipulator

View File

@ -20,71 +20,8 @@
namespace osgManipulator { namespace osgManipulator {
class MotionCommand;
class TranslateInLineCommand;
class TranslateInPlaneCommand;
class Scale1DCommand;
class Scale2DCommand;
class ScaleUniformCommand;
class Rotate3DCommand;
/** Computes the nodepath from the given node all the way upto the root. */ typedef osg::MatrixTransform Selection;
extern OSGMANIPULATOR_EXPORT void computeNodePathToRoot(osg::Node& node, osg::NodePath& np);
#define META_OSGMANIPULATOR_Object(library,name) \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
class CommandProcessor
{
public:
virtual bool receive(const MotionCommand&) = 0;
virtual bool receive(const TranslateInLineCommand& command) = 0;
virtual bool receive(const TranslateInPlaneCommand& command) = 0;
virtual bool receive(const Scale1DCommand& command) = 0;
virtual bool receive(const Scale2DCommand& command) = 0;
virtual bool receive(const ScaleUniformCommand& command) = 0;
virtual bool receive(const Rotate3DCommand& command) = 0;
};
/**
* Selection listens to motion commands generated by draggers.
*/
class OSGMANIPULATOR_EXPORT Selection : public osg::MatrixTransform
{
public:
Selection();
META_OSGMANIPULATOR_Object(osgManipulator,Selection)
/**
* Receive motion commands and set the MatrixTransform accordingly to
* transform selections. Returns true on success.
*/
virtual bool receive(const MotionCommand&);
virtual bool receive(const TranslateInLineCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const TranslateInPlaneCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Scale1DCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Scale2DCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const ScaleUniformCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Rotate3DCommand& command) { return receive((MotionCommand&)command); }
protected:
virtual ~Selection();
osg::Matrix _startMotionMatrix;
osg::Matrix _localToWorld;
osg::Matrix _worldToLocal;
};
} }

View File

@ -38,7 +38,6 @@ ADD_LIBRARY(${LIB_NAME}
${LIB_PUBLIC_HEADERS} ${LIB_PUBLIC_HEADERS}
AntiSquish.cpp AntiSquish.cpp
Command.cpp Command.cpp
CommandManager.cpp
Constraint.cpp Constraint.cpp
Dragger.cpp Dragger.cpp
Projector.cpp Projector.cpp
@ -47,7 +46,6 @@ ADD_LIBRARY(${LIB_NAME}
Scale1DDragger.cpp Scale1DDragger.cpp
Scale2DDragger.cpp Scale2DDragger.cpp
ScaleAxisDragger.cpp ScaleAxisDragger.cpp
Selection.cpp
TabBoxDragger.cpp TabBoxDragger.cpp
TabPlaneDragger.cpp TabPlaneDragger.cpp
TabPlaneTrackballDragger.cpp TabPlaneTrackballDragger.cpp

View File

@ -13,7 +13,6 @@
//osgManipulator - Copyright (C) 2007 Fugro-Jason B.V. //osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
#include <osgManipulator/Command> #include <osgManipulator/Command>
#include <osgManipulator/Selection>
#include <osgManipulator/Constraint> #include <osgManipulator/Constraint>
#include <algorithm> #include <algorithm>

View File

@ -1,62 +0,0 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
#include <osgManipulator/CommandManager>
#include <osgManipulator/Command>
using namespace osgManipulator;
CommandManager::CommandManager()
{
}
CommandManager::~CommandManager()
{
}
bool CommandManager::connect(Dragger& dragger, Selection& selection)
{
dragger.addSelection(&selection);
return true;
}
bool CommandManager::connect(Dragger& dragger, Constraint& constraint)
{
dragger.addConstraint(&constraint);
return true;
}
bool CommandManager::disconnect(Dragger& dragger)
{
dragger.getConstraints().clear();
dragger.getSelections().clear();
return true;
}
CommandManager::Selections CommandManager::getConnectedSelections(Dragger& dragger)
{
Selections selections;
for(Dragger::Selections::iterator itr = dragger.getSelections().begin();
itr != dragger.getSelections().end();
++itr)
{
selections.push_back(*itr);
}
return selections;
}

View File

@ -14,6 +14,7 @@
#include <osgManipulator/Constraint> #include <osgManipulator/Constraint>
#include <osgManipulator/Command> #include <osgManipulator/Command>
#include <osgManipulator/Dragger>
#include <osg/Vec2d> #include <osg/Vec2d>
#include <math.h> #include <math.h>

View File

@ -20,6 +20,78 @@
using namespace osgManipulator; using namespace osgManipulator;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// computeNodePathToRoot
//
void osgManipulator::computeNodePathToRoot(osg::Node& node, osg::NodePath& np)
{
np.clear();
osg::NodePathList nodePaths = node.getParentalNodePaths();
if (!nodePaths.empty())
{
np = nodePaths.front();
if (nodePaths.size()>1)
{
osg::notify(osg::NOTICE)<<"osgManipulator::computeNodePathToRoot(,) taking first parent path, ignoring others."<<std::endl;
}
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// DraggerTransformCallback
//
DraggerTransformCallback::DraggerTransformCallback(osg::MatrixTransform* transform):
_transform(transform)
{
}
bool DraggerTransformCallback::receive(const MotionCommand& command)
{
if (!_transform) return false;
switch (command.getStage())
{
case MotionCommand::START:
{
// Save the current matrix
_startMotionMatrix = _transform->getMatrix();
// Get the LocalToWorld and WorldToLocal matrix for this node.
osg::NodePath nodePathToRoot;
computeNodePathToRoot(*_transform,nodePathToRoot);
_localToWorld = osg::computeLocalToWorld(nodePathToRoot);
_worldToLocal = osg::Matrix::inverse(_localToWorld);
return true;
}
case MotionCommand::MOVE:
{
// Transform the command's motion matrix into local motion matrix.
osg::Matrix localMotionMatrix = _localToWorld * command.getWorldToLocal()
* command.getMotionMatrix()
* command.getLocalToWorld() * _worldToLocal;
// Transform by the localMotionMatrix
_transform->setMatrix(localMotionMatrix * _startMotionMatrix);
return true;
}
case MotionCommand::FINISH:
{
return true;
}
case MotionCommand::NONE:
default:
return false;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// PointerInfo // PointerInfo
@ -57,6 +129,15 @@ Dragger::Dragger() :
{ {
_parentDragger = this; _parentDragger = this;
getOrCreateStateSet()->setDataVariance(osg::Object::DYNAMIC); getOrCreateStateSet()->setDataVariance(osg::Object::DYNAMIC);
_selfUpdater = new DraggerTransformCallback(this);
}
Dragger::Dragger(const Dragger& rhs, const osg::CopyOp& copyop):
osg::MatrixTransform(rhs, copyop)
{
osg::notify(osg::NOTICE)<<"CompositeDragger::CompositeDragger(const CompositeDragger& rhs, const osg::CopyOp& copyop) not Implemented yet."<<std::endl;
} }
Dragger::~Dragger() Dragger::~Dragger()
@ -101,39 +182,41 @@ void Dragger::removeConstraint(Constraint* constraint)
} }
} }
void Dragger::addTransformUpdating(osg::MatrixTransform* transform)
void Dragger::objectDeleted(void* object)
{ {
removeSelection(reinterpret_cast<Selection*>(object)); addDraggerCallback(new DraggerTransformCallback(transform));
} }
void Dragger::addSelection(Selection* selection) void Dragger::removeTransformUpdating(osg::MatrixTransform* transform)
{ {
// check to make sure constaint hasn't already been attached. for(Dragger::DraggerCallbacks::iterator itr = _draggerCallbacks.begin();
for(Selections::iterator itr = _selections.begin(); itr != _draggerCallbacks.end();
itr != _selections.end();
++itr) ++itr)
{ {
if (*itr == selection) return; DraggerCallback* dc = itr->get();
} DraggerTransformCallback* dtc = dynamic_cast<DraggerTransformCallback*>(dc);
if (dtc && dtc->getTransform()==transform)
selection->addObserver(this);
_selections.push_back(selection);
}
void Dragger::removeSelection(Selection* selection)
{ {
for(Selections::iterator itr = _selections.begin(); _draggerCallbacks.erase(itr);
itr != _selections.end(); }
}
}
void Dragger::addDraggerCallback(DraggerCallback* dc)
{
for(DraggerCallbacks::iterator itr = _draggerCallbacks.begin();
itr != _draggerCallbacks.end();
++itr) ++itr)
{ {
if (*itr == selection) if (*itr == dc) return;
}
_draggerCallbacks.push_back(dc);
}
void Dragger::removeDraggerCallback(DraggerCallback* dc)
{ {
selection->removeObserver(this);
_selections.erase(itr);
return;
}
}
} }
@ -155,7 +238,7 @@ void Dragger::traverse(osg::NodeVisitor& nv)
return; return;
} }
Selection::traverse(nv); MatrixTransform::traverse(nv);
} }
bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
@ -231,6 +314,12 @@ bool Dragger::handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter&
return handled; return handled;
} }
bool Dragger::receive(const MotionCommand& command)
{
if (_selfUpdater.valid()) return _selfUpdater->receive(command);
else return false;
}
void Dragger::dispatch(MotionCommand& command) void Dragger::dispatch(MotionCommand& command)
{ {
// apply any constraints // apply any constraints
@ -244,9 +333,9 @@ void Dragger::dispatch(MotionCommand& command)
// move self // move self
getParentDragger()->receive(command); getParentDragger()->receive(command);
// then run through any selections
for(Selections::iterator itr = getParentDragger()->getSelections().begin(); for(DraggerCallbacks::iterator itr = getParentDragger()->getDraggerCallbacks().begin();
itr != getParentDragger()->getSelections().end(); itr != getParentDragger()->getDraggerCallbacks().end();
++itr) ++itr)
{ {
(*itr)->receive(command); (*itr)->receive(command);
@ -258,6 +347,11 @@ void Dragger::dispatch(MotionCommand& command)
// //
// CompositeDragger // CompositeDragger
// //
CompositeDragger::CompositeDragger(const CompositeDragger& rhs, const osg::CopyOp& copyop):
Dragger(rhs, copyop)
{
osg::notify(osg::NOTICE)<<"CompositeDragger::CompositeDragger(const CompositeDragger& rhs, const osg::CopyOp& copyop) not Implemented yet."<<std::endl;
}
bool CompositeDragger::handle(const PointerInfo& pi, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) bool CompositeDragger::handle(const PointerInfo& pi, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa)
{ {

View File

@ -1,86 +0,0 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
#include <osgManipulator/Selection>
#include <osgManipulator/Command>
#include <osg/Notify>
#include <algorithm>
using namespace osgManipulator;
void osgManipulator::computeNodePathToRoot(osg::Node& node, osg::NodePath& np)
{
np.clear();
osg::NodePathList nodePaths = node.getParentalNodePaths();
if (!nodePaths.empty())
{
np = nodePaths.front();
if (nodePaths.size()>1)
{
osg::notify(osg::NOTICE)<<"osgManipulator::computeNodePathToRoot(,) taking first parent path, ignoring others."<<std::endl;
}
}
}
Selection::Selection()
{
}
Selection::~Selection()
{
}
bool Selection::receive(const MotionCommand& command)
{
switch (command.getStage())
{
case MotionCommand::START:
{
// Save the current matrix
_startMotionMatrix = getMatrix();
// Get the LocalToWorld and WorldToLocal matrix for this node.
osg::NodePath nodePathToRoot;
computeNodePathToRoot(*this,nodePathToRoot);
_localToWorld = osg::computeLocalToWorld(nodePathToRoot);
_worldToLocal = osg::Matrix::inverse(_localToWorld);
return true;
}
case MotionCommand::MOVE:
{
// Transform the command's motion matrix into local motion matrix.
osg::Matrix localMotionMatrix = _localToWorld * command.getWorldToLocal()
* command.getMotionMatrix()
* command.getLocalToWorld() * _worldToLocal;
// Transform by the localMotionMatrix
setMatrix(localMotionMatrix * _startMotionMatrix);
return true;
}
case MotionCommand::FINISH:
{
return true;
}
case MotionCommand::NONE:
default:
return false;
}
}

View File

@ -49,7 +49,7 @@ BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgManipulator::MotionCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::PURE_VIRTUAL, Properties::PURE_VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_Method2(void, setLocalToWorldAndWorldToLocal, IN, const osg::Matrix &, localToWorld, IN, const osg::Matrix &, worldToLocal, I_Method2(void, setLocalToWorldAndWorldToLocal, IN, const osg::Matrix &, localToWorld, IN, const osg::Matrix &, worldToLocal,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
@ -114,7 +114,7 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::Rotate3DCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::VIRTUAL, Properties::VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_SimpleProperty(osg::Matrix, MotionMatrix, I_SimpleProperty(osg::Matrix, MotionMatrix,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
@ -178,7 +178,7 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::Scale1DCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::VIRTUAL, Properties::VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_SimpleProperty(double, MinScale, I_SimpleProperty(double, MinScale,
__double__getMinScale, __double__getMinScale,
@ -251,7 +251,7 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::Scale2DCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::VIRTUAL, Properties::VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_SimpleProperty(const osg::Vec2d &, MinScale, I_SimpleProperty(const osg::Vec2d &, MinScale,
__C5_osg_Vec2d_R1__getMinScale, __C5_osg_Vec2d_R1__getMinScale,
@ -304,7 +304,7 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::ScaleUniformCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::VIRTUAL, Properties::VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_SimpleProperty(osg::Matrix, MotionMatrix, I_SimpleProperty(osg::Matrix, MotionMatrix,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
@ -360,7 +360,7 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::TranslateInLineCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::VIRTUAL, Properties::VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_SimpleProperty(const osg::LineSegment::vec_type &, LineEnd, I_SimpleProperty(const osg::LineSegment::vec_type &, LineEnd,
__C5_osg_LineSegment_vec_type_R1__getLineEnd, __C5_osg_LineSegment_vec_type_R1__getLineEnd,
@ -425,7 +425,7 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::TranslateInPlaneCommand)
I_Method0(osg::Matrix, getMotionMatrix, I_Method0(osg::Matrix, getMotionMatrix,
Properties::VIRTUAL, Properties::VIRTUAL,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,
"Gets the matrix for transforming the Selection. ", "Gets the matrix for transforming the object being dragged. ",
"This matrix is in the command's coordinate systems. "); "This matrix is in the command's coordinate systems. ");
I_SimpleProperty(osg::Matrix, MotionMatrix, I_SimpleProperty(osg::Matrix, MotionMatrix,
__osg_Matrix__getMotionMatrix, __osg_Matrix__getMotionMatrix,

View File

@ -32,24 +32,24 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::CommandManager)
"", "",
""); "");
I_Method2(bool, connect, IN, osgManipulator::Dragger &, dragger, IN, osgManipulator::Selection &, selection, I_Method2(bool, connect, IN, osgManipulator::Dragger &, dragger, IN, osgManipulator::Selection &, selection,
Properties::VIRTUAL, Properties::NON_VIRTUAL,
__bool__connect__Dragger_R1__Selection_R1, __bool__connect__Dragger_R1__Selection_R1,
"Connect a dragger to a selection. ", "",
"The selection will begin listening to commands generated by the dragger. This can be called multiple times to connect many selections to a dragger. "); "");
I_Method2(bool, connect, IN, osgManipulator::Dragger &, dragger, IN, osgManipulator::Constraint &, constrain, I_Method2(bool, connect, IN, osgManipulator::Dragger &, dragger, IN, osgManipulator::Constraint &, constraint,
Properties::VIRTUAL, Properties::NON_VIRTUAL,
__bool__connect__Dragger_R1__Constraint_R1, __bool__connect__Dragger_R1__Constraint_R1,
"", "",
""); "");
I_Method1(bool, disconnect, IN, osgManipulator::Dragger &, dragger, I_Method1(bool, disconnect, IN, osgManipulator::Dragger &, dragger,
Properties::VIRTUAL, Properties::NON_VIRTUAL,
__bool__disconnect__Dragger_R1, __bool__disconnect__Dragger_R1,
"Disconnect the selections from a dragger. ", "",
""); "");
I_Method1(osgManipulator::CommandManager::Selections, getConnectedSelections, IN, osgManipulator::Dragger &, dragger, I_Method1(osgManipulator::CommandManager::Selections, getConnectedSelections, IN, osgManipulator::Dragger &, dragger,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__Selections__getConnectedSelections__Dragger_R1, __Selections__getConnectedSelections__Dragger_R1,
"Returns the selections connected to the dragger. ", "",
""); "");
END_REFLECTOR END_REFLECTOR

View File

@ -11,15 +11,17 @@
#include <osgIntrospection/Attributes> #include <osgIntrospection/Attributes>
#include <osg/Camera> #include <osg/Camera>
#include <osg/CopyOp>
#include <osg/MatrixTransform>
#include <osg/Node> #include <osg/Node>
#include <osg/NodeVisitor> #include <osg/NodeVisitor>
#include <osg/Object> #include <osg/Object>
#include <osg/Vec3d> #include <osg/Vec3d>
#include <osgGA/GUIActionAdapter> #include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventAdapter> #include <osgGA/GUIEventAdapter>
#include <osgManipulator/Command>
#include <osgManipulator/Constraint> #include <osgManipulator/Constraint>
#include <osgManipulator/Dragger> #include <osgManipulator/Dragger>
#include <osgManipulator/Selection>
// Must undefine IN and OUT macros defined in Windows headers // Must undefine IN and OUT macros defined in Windows headers
#ifdef IN #ifdef IN
@ -34,20 +36,35 @@ TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgManipulator::Dragger > >, osgManip
BEGIN_OBJECT_REFLECTOR(osgManipulator::CompositeDragger) BEGIN_OBJECT_REFLECTOR(osgManipulator::CompositeDragger)
I_DeclaringFile("osgManipulator/Dragger"); I_DeclaringFile("osgManipulator/Dragger");
I_BaseType(osgManipulator::Dragger); I_BaseType(osgManipulator::Dragger);
I_Method0(osg::Object *, cloneType,
Properties::VIRTUAL,
__osg_Object_P1__cloneType,
"clone an object of the same type as the node. ",
"");
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop,
Properties::VIRTUAL,
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
"return a clone of a node, with Object* return type. ",
"");
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
Properties::VIRTUAL, Properties::VIRTUAL,
__bool__isSameKindAs__C5_osg_Object_P1, __bool__isSameKindAs__C5_osg_Object_P1,
"return true if this and obj are of the same kind of object. ", "return true if this and obj are of the same kind of object. ",
""); "");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the node's class type. ",
"");
I_Method0(const char *, libraryName, I_Method0(const char *, libraryName,
Properties::VIRTUAL, Properties::VIRTUAL,
__C5_char_P1__libraryName, __C5_char_P1__libraryName,
"return the name of the node's library. ", "return the name of the node's library. ",
""); "");
I_Method0(const char *, className, I_Method1(void, accept, IN, osg::NodeVisitor &, nv,
Properties::VIRTUAL, Properties::VIRTUAL,
__C5_char_P1__className, __void__accept__osg_NodeVisitor_R1,
"return the name of the node's class type. ", "Visitor Pattern : calls the apply method of a NodeVisitor with this node's type. ",
""); "");
I_Method0(const osgManipulator::CompositeDragger *, getComposite, I_Method0(const osgManipulator::CompositeDragger *, getComposite,
Properties::VIRTUAL, Properties::VIRTUAL,
@ -107,6 +124,10 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::CompositeDragger)
I_ProtectedConstructor0(____CompositeDragger, I_ProtectedConstructor0(____CompositeDragger,
"", "",
""); "");
I_ProtectedConstructorWithDefaults2(IN, const osgManipulator::CompositeDragger &, rhs, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
____CompositeDragger__C5_CompositeDragger_R1__C5_osg_CopyOp_R1,
"",
"");
I_SimpleProperty(osgManipulator::CompositeDragger *, Composite, I_SimpleProperty(osgManipulator::CompositeDragger *, Composite,
__CompositeDragger_P1__getComposite, __CompositeDragger_P1__getComposite,
0); 0);
@ -124,26 +145,40 @@ END_REFLECTOR
TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgManipulator::Constraint > >, osgManipulator::Dragger::Constraints) TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgManipulator::Constraint > >, osgManipulator::Dragger::Constraints)
TYPE_NAME_ALIAS(std::vector< osgManipulator::Selection * >, osgManipulator::Dragger::Selections) TYPE_NAME_ALIAS(std::vector< osg::ref_ptr< osgManipulator::DraggerCallback > >, osgManipulator::Dragger::DraggerCallbacks)
BEGIN_OBJECT_REFLECTOR(osgManipulator::Dragger) BEGIN_OBJECT_REFLECTOR(osgManipulator::Dragger)
I_DeclaringFile("osgManipulator/Dragger"); I_DeclaringFile("osgManipulator/Dragger");
I_BaseType(osgManipulator::Selection); I_BaseType(osg::MatrixTransform);
I_BaseType(osg::Observer); I_Method0(osg::Object *, cloneType,
Properties::VIRTUAL,
__osg_Object_P1__cloneType,
"clone an object of the same type as the node. ",
"");
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, copyop,
Properties::VIRTUAL,
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
"return a clone of a node, with Object* return type. ",
"");
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj, I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
Properties::VIRTUAL, Properties::VIRTUAL,
__bool__isSameKindAs__C5_osg_Object_P1, __bool__isSameKindAs__C5_osg_Object_P1,
"return true if this and obj are of the same kind of object. ", "return true if this and obj are of the same kind of object. ",
""); "");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the node's class type. ",
"");
I_Method0(const char *, libraryName, I_Method0(const char *, libraryName,
Properties::VIRTUAL, Properties::VIRTUAL,
__C5_char_P1__libraryName, __C5_char_P1__libraryName,
"return the name of the node's library. ", "return the name of the node's library. ",
""); "");
I_Method0(const char *, className, I_Method1(void, accept, IN, osg::NodeVisitor &, nv,
Properties::VIRTUAL, Properties::VIRTUAL,
__C5_char_P1__className, __void__accept__osg_NodeVisitor_R1,
"return the name of the node's class type. ", "Visitor Pattern : calls the apply method of a NodeVisitor with this node's type. ",
""); "");
I_Method1(void, setParentDragger, IN, osgManipulator::Dragger *, parent, I_Method1(void, setParentDragger, IN, osgManipulator::Dragger *, parent,
Properties::VIRTUAL, Properties::VIRTUAL,
@ -225,41 +260,55 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::Dragger)
__C5_Constraints_R1__getConstraints, __C5_Constraints_R1__getConstraints,
"", "",
""); "");
I_Method1(void, addSelection, IN, osgManipulator::Selection *, selection, I_Method1(void, addDraggerCallback, IN, osgManipulator::DraggerCallback *, dc,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__void__addSelection__Selection_P1, __void__addDraggerCallback__DraggerCallback_P1,
"", "",
""); "");
I_Method1(void, removeSelection, IN, osgManipulator::Selection *, selection, I_Method1(void, removeDraggerCallback, IN, osgManipulator::DraggerCallback *, dc,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__void__removeSelection__Selection_P1, __void__removeDraggerCallback__DraggerCallback_P1,
"", "",
""); "");
I_Method0(osgManipulator::Dragger::Selections &, getSelections, I_Method0(osgManipulator::Dragger::DraggerCallbacks &, getDraggerCallbacks,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__Selections_R1__getSelections, __DraggerCallbacks_R1__getDraggerCallbacks,
"", "",
""); "");
I_Method0(const osgManipulator::Dragger::Selections &, getSelections, I_Method0(const osgManipulator::Dragger::DraggerCallbacks &, getDraggerCallbacks,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__C5_Selections_R1__getSelections, __C5_DraggerCallbacks_R1__getDraggerCallbacks,
"",
"");
I_Method1(void, addTransformUpdating, IN, osg::MatrixTransform *, transform,
Properties::NON_VIRTUAL,
__void__addTransformUpdating__MatrixTransform_P1,
"",
"");
I_Method1(void, removeTransformUpdating, IN, osg::MatrixTransform *, transform,
Properties::NON_VIRTUAL,
__void__removeTransformUpdating__MatrixTransform_P1,
"", "",
""); "");
I_ProtectedConstructor0(____Dragger, I_ProtectedConstructor0(____Dragger,
"", "",
""); "");
I_ProtectedConstructorWithDefaults2(IN, const osgManipulator::Dragger &, rhs, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
____Dragger__C5_Dragger_R1__C5_osg_CopyOp_R1,
"",
"");
I_ProtectedMethod1(bool, receive, IN, const osgManipulator::MotionCommand &, command,
Properties::VIRTUAL,
Properties::NON_CONST,
__bool__receive__C5_MotionCommand_R1,
"",
"");
I_ProtectedMethod1(void, dispatch, IN, osgManipulator::MotionCommand &, command, I_ProtectedMethod1(void, dispatch, IN, osgManipulator::MotionCommand &, command,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
Properties::NON_CONST, Properties::NON_CONST,
__void__dispatch__MotionCommand_R1, __void__dispatch__MotionCommand_R1,
"", "",
""); "");
I_ProtectedMethod1(void, objectDeleted, IN, void *, object,
Properties::VIRTUAL,
Properties::NON_CONST,
__void__objectDeleted__void_P1,
"",
"");
I_SimpleProperty(osgManipulator::CompositeDragger *, Composite, I_SimpleProperty(osgManipulator::CompositeDragger *, Composite,
__CompositeDragger_P1__getComposite, __CompositeDragger_P1__getComposite,
0); 0);
@ -269,14 +318,114 @@ BEGIN_OBJECT_REFLECTOR(osgManipulator::Dragger)
I_SimpleProperty(bool, DraggerActive, I_SimpleProperty(bool, DraggerActive,
__bool__getDraggerActive, __bool__getDraggerActive,
__void__setDraggerActive__bool); __void__setDraggerActive__bool);
I_SimpleProperty(osgManipulator::Dragger::DraggerCallbacks &, DraggerCallbacks,
__DraggerCallbacks_R1__getDraggerCallbacks,
0);
I_SimpleProperty(bool, HandleEvents, I_SimpleProperty(bool, HandleEvents,
__bool__getHandleEvents, __bool__getHandleEvents,
__void__setHandleEvents__bool); __void__setHandleEvents__bool);
I_SimpleProperty(osgManipulator::Dragger *, ParentDragger, I_SimpleProperty(osgManipulator::Dragger *, ParentDragger,
__Dragger_P1__getParentDragger, __Dragger_P1__getParentDragger,
__void__setParentDragger__Dragger_P1); __void__setParentDragger__Dragger_P1);
I_SimpleProperty(osgManipulator::Dragger::Selections &, Selections, END_REFLECTOR
__Selections_R1__getSelections,
BEGIN_OBJECT_REFLECTOR(osgManipulator::DraggerCallback)
I_DeclaringFile("osgManipulator/Dragger");
I_VirtualBaseType(osg::Object);
I_Constructor0(____DraggerCallback,
"",
"");
I_ConstructorWithDefaults2(IN, const osgManipulator::DraggerCallback &, x, , IN, const osg::CopyOp &, copyop, osg::CopyOp::SHALLOW_COPY,
____DraggerCallback__C5_DraggerCallback_R1__C5_osg_CopyOp_R1,
"",
"");
I_Method0(osg::Object *, cloneType,
Properties::VIRTUAL,
__osg_Object_P1__cloneType,
"Clone the type of an object, with Object* return type. ",
"Must be defined by derived classes. ");
I_Method1(osg::Object *, clone, IN, const osg::CopyOp &, x,
Properties::VIRTUAL,
__osg_Object_P1__clone__C5_osg_CopyOp_R1,
"Clone an object, with Object* return type. ",
"Must be defined by derived classes. ");
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
Properties::VIRTUAL,
__bool__isSameKindAs__C5_osg_Object_P1,
"",
"");
I_Method0(const char *, libraryName,
Properties::VIRTUAL,
__C5_char_P1__libraryName,
"return the name of the object's library. ",
"Must be defined by derived classes. The OpenSceneGraph convention is that the namespace of a library is the same as the library name. ");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the object's class type. ",
"Must be defined by derived classes. ");
I_Method1(bool, receive, IN, const osgManipulator::MotionCommand &, x,
Properties::VIRTUAL,
__bool__receive__C5_MotionCommand_R1,
"Receive motion commands. ",
"Returns true on success. ");
I_Method1(bool, receive, IN, const osgManipulator::TranslateInLineCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_TranslateInLineCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::TranslateInPlaneCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_TranslateInPlaneCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Scale1DCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_Scale1DCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Scale2DCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_Scale2DCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::ScaleUniformCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_ScaleUniformCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Rotate3DCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_Rotate3DCommand_R1,
"",
"");
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgManipulator::DraggerTransformCallback)
I_DeclaringFile("osgManipulator/Dragger");
I_BaseType(osgManipulator::DraggerCallback);
I_Constructor1(IN, osg::MatrixTransform *, transform,
Properties::NON_EXPLICIT,
____DraggerTransformCallback__osg_MatrixTransform_P1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::MotionCommand &, x,
Properties::VIRTUAL,
__bool__receive__C5_MotionCommand_R1,
"Receive motion commands. ",
"Returns true on success. ");
I_Method0(osg::MatrixTransform *, getTransform,
Properties::NON_VIRTUAL,
__osg_MatrixTransform_P1__getTransform,
"",
"");
I_Method0(const osg::MatrixTransform *, getTransform,
Properties::NON_VIRTUAL,
__C5_osg_MatrixTransform_P1__getTransform,
"",
"");
I_SimpleProperty(osg::MatrixTransform *, Transform,
__osg_MatrixTransform_P1__getTransform,
0); 0);
END_REFLECTOR END_REFLECTOR
@ -447,6 +596,46 @@ BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgManipulator::Dragger >)
0); 0);
END_REFLECTOR END_REFLECTOR
BEGIN_VALUE_REFLECTOR(osg::ref_ptr< osgManipulator::DraggerCallback >)
I_DeclaringFile("osg/ref_ptr");
I_Constructor0(____ref_ptr,
"",
"");
I_Constructor1(IN, osgManipulator::DraggerCallback *, ptr,
Properties::NON_EXPLICIT,
____ref_ptr__T_P1,
"",
"");
I_Constructor1(IN, const osg::ref_ptr< osgManipulator::DraggerCallback > &, rp,
Properties::NON_EXPLICIT,
____ref_ptr__C5_ref_ptr_R1,
"",
"");
I_Method0(osgManipulator::DraggerCallback *, get,
Properties::NON_VIRTUAL,
__T_P1__get,
"",
"");
I_Method0(bool, valid,
Properties::NON_VIRTUAL,
__bool__valid,
"",
"");
I_Method0(osgManipulator::DraggerCallback *, release,
Properties::NON_VIRTUAL,
__T_P1__release,
"",
"");
I_Method1(void, swap, IN, osg::ref_ptr< osgManipulator::DraggerCallback > &, rp,
Properties::NON_VIRTUAL,
__void__swap__ref_ptr_R1,
"",
"");
I_SimpleProperty(osgManipulator::DraggerCallback *, ,
__T_P1__get,
0);
END_REFLECTOR
STD_LIST_REFLECTOR(std::list< osgManipulator::PointerInfo::NodePathIntersectionPair >) STD_LIST_REFLECTOR(std::list< osgManipulator::PointerInfo::NodePathIntersectionPair >)
STD_PAIR_REFLECTOR(std::pair< osg::NodePath COMMA osg::Vec3d >) STD_PAIR_REFLECTOR(std::pair< osg::NodePath COMMA osg::Vec3d >)
@ -455,5 +644,5 @@ STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osgManipulator::Constraint > >)
STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osgManipulator::Dragger > >) STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osgManipulator::Dragger > >)
STD_VECTOR_REFLECTOR(std::vector< osgManipulator::Selection * >) STD_VECTOR_REFLECTOR(std::vector< osg::ref_ptr< osgManipulator::DraggerCallback > >)

View File

@ -10,8 +10,6 @@
#include <osgIntrospection/StaticMethodInfo> #include <osgIntrospection/StaticMethodInfo>
#include <osgIntrospection/Attributes> #include <osgIntrospection/Attributes>
#include <osg/Object>
#include <osgManipulator/Command>
#include <osgManipulator/Selection> #include <osgManipulator/Selection>
// Must undefine IN and OUT macros defined in Windows headers // Must undefine IN and OUT macros defined in Windows headers
@ -22,103 +20,5 @@
#undef OUT #undef OUT
#endif #endif
BEGIN_ABSTRACT_OBJECT_REFLECTOR(osgManipulator::CommandProcessor) TYPE_NAME_ALIAS(osg::MatrixTransform, osgManipulator::Selection)
I_DeclaringFile("osgManipulator/Selection");
I_Constructor0(____CommandProcessor,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::MotionCommand &, x,
Properties::PURE_VIRTUAL,
__bool__receive__C5_MotionCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::TranslateInLineCommand &, command,
Properties::PURE_VIRTUAL,
__bool__receive__C5_TranslateInLineCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::TranslateInPlaneCommand &, command,
Properties::PURE_VIRTUAL,
__bool__receive__C5_TranslateInPlaneCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Scale1DCommand &, command,
Properties::PURE_VIRTUAL,
__bool__receive__C5_Scale1DCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Scale2DCommand &, command,
Properties::PURE_VIRTUAL,
__bool__receive__C5_Scale2DCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::ScaleUniformCommand &, command,
Properties::PURE_VIRTUAL,
__bool__receive__C5_ScaleUniformCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Rotate3DCommand &, command,
Properties::PURE_VIRTUAL,
__bool__receive__C5_Rotate3DCommand_R1,
"",
"");
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgManipulator::Selection)
I_DeclaringFile("osgManipulator/Selection");
I_BaseType(osg::MatrixTransform);
I_Constructor0(____Selection,
"",
"");
I_Method1(bool, isSameKindAs, IN, const osg::Object *, obj,
Properties::VIRTUAL,
__bool__isSameKindAs__C5_osg_Object_P1,
"return true if this and obj are of the same kind of object. ",
"");
I_Method0(const char *, libraryName,
Properties::VIRTUAL,
__C5_char_P1__libraryName,
"return the name of the node's library. ",
"");
I_Method0(const char *, className,
Properties::VIRTUAL,
__C5_char_P1__className,
"return the name of the node's class type. ",
"");
I_Method1(bool, receive, IN, const osgManipulator::MotionCommand &, x,
Properties::VIRTUAL,
__bool__receive__C5_MotionCommand_R1,
"Receive motion commands and set the MatrixTransform accordingly to transform selections. ",
"Returns true on success. ");
I_Method1(bool, receive, IN, const osgManipulator::TranslateInLineCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_TranslateInLineCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::TranslateInPlaneCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_TranslateInPlaneCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Scale1DCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_Scale1DCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Scale2DCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_Scale2DCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::ScaleUniformCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_ScaleUniformCommand_R1,
"",
"");
I_Method1(bool, receive, IN, const osgManipulator::Rotate3DCommand &, command,
Properties::VIRTUAL,
__bool__receive__C5_Rotate3DCommand_R1,
"",
"");
END_REFLECTOR