43#include "SkeletonEditingPlugin.hh"
46#include <OpenFlipper/BasePlugin/WhatsThisGenerator.hh>
47#include <ObjectTypes/Skeleton/BaseSkin.hh>
48#include <ObjectTypes/Skeleton/SkeletonObjectData.hh>
49#include <ACG/Geometry/Algorithms.hh>
51#include <ACG/QtScenegraph/QtTranslationManipulatorNode.hh>
54#include <QActionGroup>
64 skeletonEditingAction_(0),
66 pickToolBarActions_(0),
67 selectJointAction_(0),
68 insertJointAction_(0),
70 deleteJointAction_(0),
72 transformChildManipAction_(0),
73 transformAllManipAction_(0),
74 rotateManipAction_(0),
75 inverseKinematicAction_(0),
80 transformChildJoints_(false),
81 transformAllFrames_(true),
82 inverseKinematic_(false),
85 rendererChanged_(false),
87 manip_size_modifier_(1.0)
112 emit addHiddenPickMode(
"MoveJoints");
113 emit addHiddenPickMode(
"DeleteJoints");
114 emit addHiddenPickMode(
"InsertJoints");
115 emit addHiddenPickMode(
"SplitJoints");
116 emit addHiddenPickMode(
"SelectJoints");
117 emit setPickModeMouseTracking (
"MoveJoints",
true);
118 emit setPickModeMouseTracking (
"InsertJoints",
true);
121 emit registerKey (Qt::Key_Shift, Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
122 emit registerKey (Qt::Key_Shift, Qt::NoModifier, tr(
"Manipulator rotation"),
true);
125 toolbar_ =
new QToolBar(tr(
"Skeleton Editing"));
126 toolbar_->setObjectName(
"Skeleton_Editing_Toolbar");
129 toolBarActions_ =
new QActionGroup(toolbar_);
132 skeletonEditingAction_ =
new QAction(tr(
"<B>Skeleton Editing</B><br>Modify the structure of a skeleton"), toolBarActions_);
133 skeletonEditingAction_->setStatusTip(tr(
"Modify the structure of a skeleton."));
134 skeletonEditingAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_editing.png") );
135 whatsThisGen.
setWhatsThis(skeletonEditingAction_,tr(
"Skeleton Editing"));
136 skeletonEditingAction_->setCheckable(
true);
137 toolbar_->addAction(skeletonEditingAction_);
139 connect(toolBarActions_, SIGNAL(triggered(QAction*)),
this, SLOT(slotSetEditingMode(QAction*)) );
141 emit addToolbar(toolbar_);
143 pickToolbar_ =
new QToolBar(tr(
"Skeleton Editing"));
144 pickToolbar_->setAttribute(Qt::WA_AlwaysShowToolTips,
true);
145 pickToolbar_->setObjectName(
"Skeleton_Editing_Picking_Toolbar");
146 pickToolBarActions_ =
new QActionGroup(pickToolbar_);
147 pickToolBarActions_->setExclusive (
false);
149 selectJointAction_ =
new QAction(tr(
"<B>Select Joint</B><br>Toggle joint selection"), pickToolBarActions_);
150 selectJointAction_->setStatusTip(tr(
"Toggle the selection state of a joint."));
151 selectJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_selectJoint.png") );
152 selectJointAction_->setCheckable(
true);
153 whatsThisGen.
setWhatsThis(selectJointAction_,tr(
"Select single joints of the skeleton. You can select multiple joints at once."),
"manipulate_joint");
154 pickToolbar_->addAction(selectJointAction_);
156 insertJointAction_ =
new QAction(tr(
"<B>Insert Joint</B><br>Add a joint to the skeleton"), pickToolBarActions_);
157 insertJointAction_->setStatusTip(tr(
"<DoubleClick> to start a new skeleton and end joint path. <Click> to select parent and position for new joints."));
158 insertJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_insertJoint.png") );
159 whatsThisGen.
setWhatsThis(insertJointAction_,tr(
"Insert new joints. Click on a joint first and then click somewhere else, to add a new joint at the mouseposition. Double-click to finish adding joints."));
160 insertJointAction_->setCheckable(
true);
161 pickToolbar_->addAction(insertJointAction_);
163 splitJointAction_ =
new QAction(tr(
"<B>Split Joint</B><br>Add a Joint between two other Joints"), pickToolBarActions_);
164 splitJointAction_->setStatusTip(tr(
"Click on a joint which will be the new child Joint."));
165 splitJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_splitJoint.png") );
166 whatsThisGen.
setWhatsThis(splitJointAction_,tr(
"Click on a joint to split it in the middle."),
"manipulate_joint");
167 splitJointAction_->setCheckable(
true);
168 pickToolbar_->addAction(splitJointAction_);
170 deleteJointAction_ =
new QAction(tr(
"<B>Delete Joint</B><br>Remove a joint from the skeleton"), pickToolBarActions_);
171 deleteJointAction_->setStatusTip(tr(
"<Press> to select a joint. <Release> to delete it."));
172 deleteJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_deleteJoint.png") );
173 whatsThisGen.
setWhatsThis(deleteJointAction_,tr(
"Delete a joint by clicking on it."),
"manipulate_joint");
174 deleteJointAction_->setCheckable(
true);
175 pickToolbar_->addAction(deleteJointAction_);
177 moveJointAction_ =
new QAction(tr(
"<B>Transform Joint</B><br>Transform a joint from the skeleton"), pickToolBarActions_);
178 moveJointAction_->setStatusTip(tr(
"Transform a joint from the skeleton."));
179 moveJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_moveJoint.png") );
180 whatsThisGen.
setWhatsThis(moveJointAction_,tr(
"Transform a joint (only possible in an animation). Click on a joint and transform his position and orientation with help of the manipulator"),
"manipulate_joint");
181 moveJointAction_->setCheckable(
true);
182 pickToolbar_->addAction(moveJointAction_);
184 pickToolbar_->addSeparator();
186 rotateManipAction_ =
new QAction(tr(
"Rotate manipulator"), pickToolBarActions_);
187 rotateManipAction_->setStatusTip(tr(
"Rotate manipulator. <Shift>"));
188 rotateManipAction_->setToolTip(tr(
"<B>Rotate manipulator</B><br> Rotates only the manipulator, not the joints. <B>Shift</B>"));
189 rotateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_maniprotate.png") );
190 whatsThisGen.
setWhatsThis(rotateManipAction_,tr(
"Rotate a joint (possible in an animation). Click on a joint and transform his orientation with help of the manipulator."),
"manipulator");
191 rotateManipAction_->setCheckable(
true);
192 pickToolbar_->addAction(rotateManipAction_);
193 connect(rotateManipAction_, SIGNAL(toggled(
bool)),
this, SLOT(slotRotateManipulator(
bool)) );
195 pickToolbar_->addSeparator();
197 transformAllManipAction_ =
new QAction(tr(
""), pickToolBarActions_);
198 transformAllManipAction_->setStatusTip(tr(
"Apply the relative transformation to all frames of the animation."));
199 transformAllManipAction_->setToolTip(tr(
"<B>Transform whole animation</B><br>Transform all frames of the animation simultaneously."));
200 transformAllManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_manipAllFrames.png") );
201 whatsThisGen.
setWhatsThis(transformAllManipAction_,tr(
"Transform whole animation. Changing will be applied to all frames of the current animation"),
"transformation_modi");
202 transformAllManipAction_->setCheckable(
true);
203 transformAllManipAction_->setChecked(transformAllFrames_);
204 pickToolbar_->addAction(transformAllManipAction_);
206 transformChildManipAction_ =
new QAction(tr(
"Transform Child Joints"), pickToolBarActions_);
207 transformChildManipAction_->setStatusTip(tr(
"Apply joint transformation to child joints as well and thereby rigidly move the whole subtree."));
208 transformChildManipAction_->setToolTip(tr(
"<B>Transform child joints</B><br>Apply joint transformation to all child joints as well."));
209 transformChildManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_manipChildTransform.png") );
210 whatsThisGen.
setWhatsThis(transformChildManipAction_,tr(
"Apply your transformation to all child joints."),
"transformation_modi");
211 transformChildManipAction_->setCheckable(
true);
212 transformChildManipAction_->setChecked(transformChildJoints_);
213 pickToolbar_->addAction(transformChildManipAction_);
215 inverseKinematicAction_ =
new QAction(tr(
"Inverse kinematic"), pickToolBarActions_);
216 inverseKinematicAction_->setStatusTip(tr(
"Move selected joint using inverse kinematic."));
217 inverseKinematicAction_->setToolTip(tr(
"<B>Inverse kinematic</B><br>Move selected joint using inverse kinematic."));
218 inverseKinematicAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_inverseKinematic.png") );
219 whatsThisGen.
setWhatsThis(inverseKinematicAction_,tr(
"Move a joint to the position only with rotation of the previous joints."),
"transformation_modi");
220 inverseKinematicAction_->setCheckable(
true);
221 inverseKinematicAction_->setChecked(inverseKinematic_);
222 pickToolbar_->addAction(inverseKinematicAction_);
224 connect(pickToolBarActions_, SIGNAL(triggered(QAction*)),
this, SLOT(slotPickToolbarAction(QAction*)) );
226 emit setPickModeToolbar(
"MoveJoints", pickToolbar_);
227 emit setPickModeToolbar(
"DeleteJoints", pickToolbar_);
228 emit setPickModeToolbar(
"InsertJoints", pickToolbar_);
229 emit setPickModeToolbar(
"SplitJoints", pickToolbar_);
230 emit setPickModeToolbar(
"SelectJoints", pickToolbar_);
237void SkeletonEditingPlugin::slotObjectUpdated(
int _id,
const UpdateType& _type){
242 for (uint i=0; i < activeManipulators_.size(); i++){
244 if ( activeManipulators_[i] != _id )
260void SkeletonEditingPlugin::initializePlugin()
270void SkeletonEditingPlugin::slotMouseWheelEvent(QWheelEvent * _event,
const std::string & )
277 manip_size_modifier_ = manip_size_modifier_ - (float)_event->angleDelta().y() / 120.0 * 0.1;
281 o_it->manipulatorNode()->set_size(manip_size_ * manip_size_modifier_);
301 size_t node_idx, target_idx;
315 o_it->enablePicking(
true );
317 if ( successfullyPicked )
369void SkeletonEditingPlugin::slotKeyEvent (QKeyEvent* _event)
371 if (_event->key() == Qt::Key_Shift)
372 rotateManipAction_->setChecked(
true);
377void SkeletonEditingPlugin::slotKeyReleaseEvent (QKeyEvent* _event)
379 if ( _event->key() == Qt::Key_Shift)
380 rotateManipAction_->setChecked(
false);
393 if (_mode !=
"InsertJoints" )
394 if ( insertJointAction_->isChecked() )
395 cancelJointInsertion();
397 moveJointAction_->setChecked( _mode ==
"MoveJoints" );
398 insertJointAction_->setChecked( _mode ==
"InsertJoints" );
399 deleteJointAction_->setChecked( _mode ==
"DeleteJoints" );
400 selectJointAction_->setChecked( _mode ==
"SelectJoints" );
401 splitJointAction_->setChecked( _mode ==
"SplitJoints" );
403 skeletonEditingAction_->setChecked( (_mode ==
"MoveJoints") ||(_mode ==
"InsertJoints")
404 ||(_mode ==
"DeleteJoints")||(_mode ==
"SelectJoints")
405 || (_mode ==
"SplitJoints"));
410 if ( (_mode !=
"") &&
411 (_mode !=
"MoveJoints") &&
412 (_mode !=
"InsertJoints") &&
413 (_mode !=
"DeleteJoints") &&
414 (_mode !=
"SelectJoints") &&
415 (_mode !=
"SplitJoints")) {
418 QString currentRenderer;
439void SkeletonEditingPlugin::slotPickToolbarAction(QAction* _action)
441 if (_action == rotateManipAction_)
444 if (_action != insertJointAction_)
445 if ( insertJointAction_->isChecked() )
446 cancelJointInsertion();
448 if (_action == insertJointAction_){
452 }
else if (_action == splitJointAction_){
456 }
else if (_action == deleteJointAction_){
460 }
else if (_action == moveJointAction_) {
463 }
else if (_action == selectJointAction_) {
467 }
else if (_action == transformAllManipAction_)
468 transformAllFrames_ = transformAllManipAction_->isChecked();
469 else if (_action == transformChildManipAction_)
470 transformChildJoints_ = transformChildManipAction_->isChecked();
471 else if (_action == inverseKinematicAction_)
472 inverseKinematic_ = inverseKinematicAction_->isChecked();
474 moveJointAction_->setChecked( _action == moveJointAction_ );
475 insertJointAction_->setChecked( _action == insertJointAction_ );
476 deleteJointAction_->setChecked( _action == deleteJointAction_ );
477 selectJointAction_->setChecked( _action == selectJointAction_ );
478 splitJointAction_->setChecked( _action == splitJointAction_ );
483void SkeletonEditingPlugin::slotSetEditingMode(QAction* )
503void SkeletonEditingPlugin::slotRotateManipulator(
bool _toggled)
514 if (_toggled && ourPickMode){
515 mode = QtTranslationManipulatorNode::LocalRotation;
518 mode = QtTranslationManipulatorNode::TranslationRotation;
522 for (uint i=0; i < activeManipulators_.size(); i++){
540 size_t node_idx, target_idx;
544 bool successfullyPicked =
false;
558 o_it->enablePicking(
true );
567 if (successfullyPicked) {
569 object->manipPlaced(
true);
572 object->manipulatorNode()->setData( data );
574 object->manipulatorNode()->loadIdentity();
575 object->manipulatorNode()->set_center(hitPoint);
576 object->manipulatorNode()->set_draw_cylinder(
true);
577 object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
578 object->manipulatorNode()->set_size(manip_size_ * manip_size_modifier_);
579 object->manipulatorNode()->setMode( QtTranslationManipulatorNode::TranslationRotation );
580 object->manipulatorNode()->show();
592 object->manipulatorNode()->set_direction(x_axis,y_axis);
593 object->manipulatorNode()->enable_rotations(QtTranslationManipulatorNode::ALL_AXIS);
595 object->manipulatorNode()->apply_transformation(
false);
616 for (uint i=0; i < activeManipulators_.size(); i++)
617 if ( activeManipulators_[i] == object->
id() ){
623 activeManipulators_.push_back( object->
id() );
639 for(std::size_t i = 5; i && pickedJointPos != dest; --i )
643 for (std::vector<Skeleton::Joint*>::iterator iter = rotatableJoints.begin() ; iter != rotatableJoints.end(); ++iter)
645 const unsigned int currentId = (*iter)->id();
651 bool rightRotation =
true;
652 unsigned int tries = 0;
663 ACG::Vec3d toPickedJoint = currentJointPos - pickedJointPos;
666 double theta = (double)angleFac*acos(dot(toPickedJoint ,toDest) / sqrt( toDest.
sqrnorm() * toPickedJoint.
sqrnorm()));
668 if(theta != theta || theta == 0)
672 ACG::Vec3d rotationAxis = cross(toDest,toPickedJoint);
683 ACG::Vec3d pickedJointPosOld = pickedJointPos;
686 bool rightRotation = !( (pickedJointPos -dest).sqrnorm() > (pickedJointPosOld -dest).sqrnorm());
688 if ( !rightRotation )
695 changingMatrix = currentGlobalMatrix * quaternionBack.
rotation_matrix();
704 }
while( rightRotation && tries <= 5);
722 OpenFlipper::Options::redrawDisabled(
true );
734 if(inverseKinematic_)
739 if (!skeleton || !skeletonObj)
754 if (pickedJoint->isRoot())
762 std::vector<Skeleton::Joint*> rotatableJoints;
767 for (;iter && !iter->
selected() && !iter->isRoot(); iter = iter->
parent())
768 rotatableJoints.push_back(*iter);
771 rotatableJoints.push_back(*iter);
777 if (transformAllFrames_ && _event->type() == QEvent::MouseButtonRelease)
778 for (std::vector<Skeleton::Joint*>::iterator iter = rotatableJoints.begin() ; iter != rotatableJoints.end(); ++iter)
781 setJointPosition(skeletonObj,*iter,position);
795 if (_event->type() == QEvent::MouseButtonPress)
801 if ( (_event->type() == QEvent::MouseButtonRelease) && !accumMatrix_.
is_identity() )
812 for (
unsigned int i=0; i < skeletonData->
skinCount(); i++){
814 int meshId = skeletonData->
skin(i);
826 skin->deformSkin( hAni, Blending::M_LBS );
832 if (_event->type() == QEvent::MouseButtonRelease)
835 OpenFlipper::Options::redrawDisabled(
false );
856 object->manipPlaced(
true );
869 for (uint i=0; i < activeManipulators_.size(); i++){
877 emit nodeVisibilityChanged(obj->
id());
883 for (uint i=0; i < activeManipulators_.size(); i++){
891 emit nodeVisibilityChanged(obj->
id());
901void SkeletonEditingPlugin::deleteJoint(QMouseEvent* _event)
903 if ( (_event->type() == QEvent::MouseButtonPress) || (_event->type() == QEvent::MouseButtonRelease) ){
905 size_t node_idx, target_idx;
919 o_it->enablePicking(
true );
921 if ( successfullyPicked ){
927 currentSkeleton_ =
object->id();
933 bool wasSelected = joint->
selected();
937 (*it)->setSelected(
false);
939 currentJoint_ = joint->
id();
941 if ( _event->type() == QEvent::MouseButtonPress )
953 emit deleteObject( object->
id() );
961 if (_event->type() == QEvent::MouseButtonRelease){
979 currentSkeleton_ = -1;
991 if ( _event->type() == QEvent::MouseButtonPress )
997 size_t node_idx, target_idx;
1011 o_it->enablePicking(
true );
1013 if ( successfullyPicked )
1029void SkeletonEditingPlugin::insertJoint(QMouseEvent* _event)
1035 if ( _event->type() == QEvent::MouseButtonPress ){
1037 if ( jointPreview_ )
1042 size_t node_idx, target_idx;
1056 o_it->enablePicking(
true );
1058 if ( successfullyPicked ){
1064 currentSkeleton_ =
object->id();
1065 jointPreview_ =
false;
1070 currentJoint_ = joint->
id();
1078 else if ( _event->type() == QEvent::MouseButtonDblClick ){
1083 if (currentSkeleton_ != -1){
1084 cancelJointInsertion();
1089 size_t node_idx, target_idx;
1100 int newSkeletonID = -1;
1106 if (baseObject == 0)
1120 emit createBackup(baseObject->
id(),
"Add Joints",
UPDATE_ALL);
1129 currentSkeleton_ = baseObject->
id();
1130 currentJoint_ = tmpJoint->
id();
1131 jointPreview_ =
true;
1136 }
else if ( _event->type() == QEvent::MouseMove ){
1138 if ( jointPreview_ ){
1143 if (baseObject == 0)
1169 }
else if ( _event->type() == QEvent::MouseButtonRelease){
1174 if ( !jointPreview_ ){
1176 size_t node_idx, target_idx;
1190 o_it->enablePicking(
true );
1192 if ( successfullyPicked ){
1198 currentSkeleton_ =
object->id();
1207 currentJoint_ = tmpJoint->
id();
1208 jointPreview_ =
true;
1218 if (baseObject == 0)
1244 currentJoint_ = tmpJoint->
id();
1255 if ( (_event->type() != QEvent::MouseButtonPress) ){
1259 if (baseObject == 0)
1275 if(!skeleton)
return NULL;
1285 return animation->pose( handle.
frame() );
1310 if ( animation != 0){
1313 for (
int iFrame=0; iFrame < (int)animation->frameCount(); iFrame++) {
1317 if (pose != currentPose)
1329void SkeletonEditingPlugin::cancelJointInsertion(){
1331 int cSkeleton = currentSkeleton_;
1332 int cJoint = currentJoint_;
1334 currentSkeleton_ = -1;
1336 jointPreview_ =
false;
1341 if (baseObject == 0)
1355 emit createBackup(baseObject->
id(),
"Add Joints",
UPDATE_ALL);
1360void SkeletonEditingPlugin::moveJoint(QMouseEvent* _event)
1363 if (_event->type() == QEvent::MouseButtonDblClick && _event->button() == Qt::LeftButton){
1375void SkeletonEditingPlugin::selectJoint(QMouseEvent* _event)
1378 if ( _event->type() == QEvent::MouseButtonRelease ){
1380 size_t node_idx, target_idx;
1394 o_it->enablePicking(
true );
1396 if ( successfullyPicked ){
1420 double bestDistance = DBL_MAX;
1429 for (
unsigned int joint = 0; joint < skeleton->
jointCount(); joint++){
1433 if (dist < bestDistance){
1435 _bestJointID = joint;
1436 bestDistance = dist;
1457 if (skeleton->
joint(jointID) == 0)
ACG::Vec3d Vector
Standard Type for 3d Vector used for scripting.
@ PickingMode
Picking Mode.
int context_height() const
get gl context height
Vec3d unproject(const Vec3d &_winPoint) const
unproject point in window coordinates _winPoint to world coordinates
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
void identity()
setup an identity matrix
bool is_identity() const
check if the matrix is the identity ( up to an epsilon )
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
Matrix rotation_matrix() const
cast to rotation matrix
int getIdentifier()
Get an identifier for that manipulator.
QVariant getData()
Get additional data for the node.
void setMode(ManipulatorMode _mode)
set current operation mode
ManipulatorMode
enum to define the manipulator mode
A handle used to refer to an animation or to a specific frame in an animation.
bool isValid() const
Returns true if the handle is valid.
size_t frame() const
Returns the selected frame (zero based)
Stores a single animation.
virtual void enablePicking(bool _enable)
QtTranslationManipulatorNode * manipulatorNode()
bool manipPlaced()
Check if the manipulator has been placed.
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
bool dataType(DataType _type) const
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
Abstract base class for the skin template, wrapping all template versions of the skin.
Represents a single joint in the skeleton.
size_t id() const
returns the joint id
bool selected() const
Returns the joint's selection state.
Joint * parent()
Returns the parent joint.
void setSelected(bool _selected)
Set the joint's selction state.
decltype(std::declval< S >() *std::declval< S >()) sqrnorm() const
compute squared euclidean norm
A general pose, used to store the frames of the animation.
void setLocalMatrix(unsigned int _joint, const Matrix &_local, bool _keepLocalChildPositions=true)
Sets the local coordinate system.
const Matrix & localMatrix(unsigned int _joint) const
Returns the local matrix for the given joint.
void setGlobalTranslation(unsigned int _joint, const Vector &_position, bool _keepGlobalChildPositions=true)
Sets the global translation vector.
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
void setGlobalMatrix(unsigned int _joint, const Matrix &_global, bool _keepGlobalChildPositions=true)
Sets the global coordinate system.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
void placeManip(QMouseEvent *_event)
Place and show the Manipulator.
void transformJoint(int _objectId, int _jointId, Matrix4x4 _matrix)
transform joint with given matrix
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
void showManipulators()
Show/Hide active manipulators.
bool canModify(QMouseEvent *_event)
checks, if the skeleton can be modified. a skeleton can be modified, if the active pose is the refere...
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
void splitBone(int _objectId, int _tailJoint)
insert a joint in the middle of a bone given by its (unique) tailJoint
void splitJoint(QMouseEvent *_event)
split selected Joint
Matrix4x4 localMatrix(int _objectId, int _jointId)
get local matrix of a joint in the active pose
void updateManipulatorPosition(BaseObjectData *_skeletonObj)
make sure the manipulator is positioned on a joint
bool rendererChanged_
Remembers, if we changed the renderer.
QString lastRenderer_
Stores the last active renderer before we switched to skeleton editing mode.
void inverseKinematic(ACG::Vec3d dest, Skeleton::Pose *currentPose, Skeleton::Joint *pickedJoint, std::vector< Skeleton::Joint * > rotatableJoints)
function for computing the position of our joints using inverse Kinematic
void setDescriptions()
Set Descriptions for Scripting Slots.
OpenMesh::Vec3d getNearestJoint(SkeletonObject *_skeletonObj, OpenMesh::Vec3d &_hitPoint, int &_bestJointID)
Get nearest joint to hitPoint (used for snapping)
SkeletonEditingPlugin()
Default Constructor.
~SkeletonEditingPlugin()
Destructor.
Data object attached to the skeleton.
unsigned int skinCount()
Get the number of associated skins.
int skin(unsigned int _index)
Get the skin with given index (0 <= _index < skinCount())
AnimationHandle activePose()
Returns true if the picked node given by _node_idx is this objects scenegraph node.
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
void updateIndices()
Updates the joint index text node positions.
Iterator class for the skeleton.
Pose * referencePose()
Returns a pointer to the reference pose.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
size_t jointCount()
Returns the number of joints.
void addJoint(typename SkeletonT< PointT >::Joint *_pParent, typename SkeletonT< PointT >::Joint *_pJoint)
Adds a joint as child of a given parent joint.
size_t animationCount()
Returns the number of animations stored in this skeleton.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
Pose * pose(const AnimationHandle &_hAni)
Returns a pointer to the pose with the given animation handle.
Joint * joint(const size_t &_index)
Returns the joint with the given index.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
void removeJoint(typename SkeletonT< PointT >::Joint *_pJoint)
Remove the given joint from the tree.
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
ACG::GLState & glState()
Get the glState of the Viewer.
a class which provides an link generator for WhatsThisMessages linking to the user doc If you have an...
void setWhatsThis(QAction *_action, const QString &_msg, const QString &_ref="", const QString &_site="index.html") const
sets a whatsThis Message plus link to the doc for the given QAction
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(8))
Topology updated.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(16))
Selection updated.
DrawMode SOLID_SMOOTH_SHADED
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
DrawMode WIREFRAME
draw wireframe
@ PICK_ANYTHING
pick any of the prior targets (should be implemented for all nodes)
@ PICK_FACE
picks faces (should be implemented for all nodes)
@ PICK_VERTEX
picks verices (may not be implemented for all nodes)
VectorT< double, 3 > Vec3d
SkeletonObject * skeletonObject(BaseObjectData *_object)
Cast an BaseObject to a SkeletonObject if possible.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
const std::string pickMode()
Get the current Picking mode.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
void traverse(ACG::SceneGraph::MouseEventAction &_action)
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
Viewer::ActionMode actionMode()
Get the current Action mode.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
void setViewObjectMarker(ViewObjectMarker *_marker)
const QStringList ALL_OBJECTS
Iterable object range.