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> 61 skeletonEditingAction_(0),
63 pickToolBarActions_(0),
64 selectJointAction_(0),
65 insertJointAction_(0),
67 deleteJointAction_(0),
69 transformChildManipAction_(0),
70 transformAllManipAction_(0),
71 rotateManipAction_(0),
72 inverseKinematicAction_(0),
77 transformChildJoints_(false),
78 transformAllFrames_(true),
79 inverseKinematic_(false),
82 rendererChanged_(false),
84 manip_size_modifier_(1.0)
109 emit addHiddenPickMode(
"MoveJoints");
110 emit addHiddenPickMode(
"DeleteJoints");
111 emit addHiddenPickMode(
"InsertJoints");
112 emit addHiddenPickMode(
"SplitJoints");
113 emit addHiddenPickMode(
"SelectJoints");
114 emit setPickModeMouseTracking (
"MoveJoints",
true);
115 emit setPickModeMouseTracking (
"InsertJoints",
true);
118 emit registerKey (Qt::Key_Shift, Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
119 emit registerKey (Qt::Key_Shift, Qt::NoModifier, tr(
"Manipulator rotation"),
true);
122 toolbar_ =
new QToolBar(tr(
"Skeleton Editing"));
123 toolbar_->setObjectName(
"Skeleton_Editing_Toolbar");
126 toolBarActions_ =
new QActionGroup(toolbar_);
129 skeletonEditingAction_ =
new QAction(tr(
"<B>Skeleton Editing</B><br>Modify the structure of a skeleton"), toolBarActions_);
130 skeletonEditingAction_->setStatusTip(tr(
"Modify the structure of a skeleton."));
131 skeletonEditingAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_editing.png") );
132 whatsThisGen.
setWhatsThis(skeletonEditingAction_,tr(
"Skeleton Editing"));
133 skeletonEditingAction_->setCheckable(
true);
134 toolbar_->addAction(skeletonEditingAction_);
136 connect(toolBarActions_, SIGNAL(triggered(QAction*)),
this, SLOT(slotSetEditingMode(QAction*)) );
138 emit addToolbar(toolbar_);
140 pickToolbar_ =
new QToolBar(tr(
"Skeleton Editing"));
141 pickToolbar_->setAttribute(Qt::WA_AlwaysShowToolTips,
true);
142 pickToolbar_->setObjectName(
"Skeleton_Editing_Picking_Toolbar");
143 pickToolBarActions_ =
new QActionGroup(pickToolbar_);
144 pickToolBarActions_->setExclusive (
false);
146 selectJointAction_ =
new QAction(tr(
"<B>Select Joint</B><br>Toggle joint selection"), pickToolBarActions_);
147 selectJointAction_->setStatusTip(tr(
"Toggle the selection state of a joint."));
148 selectJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_selectJoint.png") );
149 selectJointAction_->setCheckable(
true);
150 whatsThisGen.
setWhatsThis(selectJointAction_,tr(
"Select single joints of the skeleton. You can select multiple joints at once."),
"manipulate_joint");
151 pickToolbar_->addAction(selectJointAction_);
153 insertJointAction_ =
new QAction(tr(
"<B>Insert Joint</B><br>Add a joint to the skeleton"), pickToolBarActions_);
154 insertJointAction_->setStatusTip(tr(
"<DoubleClick> to start a new skeleton and end joint path. <Click> to select parent and position for new joints."));
155 insertJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_insertJoint.png") );
156 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."));
157 insertJointAction_->setCheckable(
true);
158 pickToolbar_->addAction(insertJointAction_);
160 splitJointAction_ =
new QAction(tr(
"<B>Split Joint</B><br>Add a Joint between two other Joints"), pickToolBarActions_);
161 splitJointAction_->setStatusTip(tr(
"Click on a joint which will be the new child Joint."));
162 splitJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_splitJoint.png") );
163 whatsThisGen.
setWhatsThis(splitJointAction_,tr(
"Click on a joint to split it in the middle."),
"manipulate_joint");
164 splitJointAction_->setCheckable(
true);
165 pickToolbar_->addAction(splitJointAction_);
167 deleteJointAction_ =
new QAction(tr(
"<B>Delete Joint</B><br>Remove a joint from the skeleton"), pickToolBarActions_);
168 deleteJointAction_->setStatusTip(tr(
"<Press> to select a joint. <Release> to delete it."));
169 deleteJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_deleteJoint.png") );
170 whatsThisGen.
setWhatsThis(deleteJointAction_,tr(
"Delete a joint by clicking on it."),
"manipulate_joint");
171 deleteJointAction_->setCheckable(
true);
172 pickToolbar_->addAction(deleteJointAction_);
174 moveJointAction_ =
new QAction(tr(
"<B>Transform Joint</B><br>Transform a joint from the skeleton"), pickToolBarActions_);
175 moveJointAction_->setStatusTip(tr(
"Transform a joint from the skeleton."));
176 moveJointAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_moveJoint.png") );
177 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");
178 moveJointAction_->setCheckable(
true);
179 pickToolbar_->addAction(moveJointAction_);
181 pickToolbar_->addSeparator();
183 rotateManipAction_ =
new QAction(tr(
"Rotate manipulator"), pickToolBarActions_);
184 rotateManipAction_->setStatusTip(tr(
"Rotate manipulator. <Shift>"));
185 rotateManipAction_->setToolTip(tr(
"<B>Rotate manipulator</B><br> Rotates only the manipulator, not the joints. <B>Shift</B>"));
186 rotateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_maniprotate.png") );
187 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");
188 rotateManipAction_->setCheckable(
true);
189 pickToolbar_->addAction(rotateManipAction_);
190 connect(rotateManipAction_, SIGNAL(toggled(
bool)),
this, SLOT(slotRotateManipulator(
bool)) );
192 pickToolbar_->addSeparator();
194 transformAllManipAction_ =
new QAction(tr(
""), pickToolBarActions_);
195 transformAllManipAction_->setStatusTip(tr(
"Apply the relative transformation to all frames of the animation."));
196 transformAllManipAction_->setToolTip(tr(
"<B>Transform whole animation</B><br>Transform all frames of the animation simultaneously."));
197 transformAllManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_manipAllFrames.png") );
198 whatsThisGen.
setWhatsThis(transformAllManipAction_,tr(
"Transform whole animation. Changing will be applied to all frames of the current animation"),
"transformation_modi");
199 transformAllManipAction_->setCheckable(
true);
200 transformAllManipAction_->setChecked(transformAllFrames_);
201 pickToolbar_->addAction(transformAllManipAction_);
203 transformChildManipAction_ =
new QAction(tr(
"Transform Child Joints"), pickToolBarActions_);
204 transformChildManipAction_->setStatusTip(tr(
"Apply joint transformation to child joints as well and thereby rigidly move the whole subtree."));
205 transformChildManipAction_->setToolTip(tr(
"<B>Transform child joints</B><br>Apply joint transformation to all child joints as well."));
206 transformChildManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_manipChildTransform.png") );
207 whatsThisGen.
setWhatsThis(transformChildManipAction_,tr(
"Apply your transformation to all child joints."),
"transformation_modi");
208 transformChildManipAction_->setCheckable(
true);
209 transformChildManipAction_->setChecked(transformChildJoints_);
210 pickToolbar_->addAction(transformChildManipAction_);
212 inverseKinematicAction_ =
new QAction(tr(
"Inverse kinematic"), pickToolBarActions_);
213 inverseKinematicAction_->setStatusTip(tr(
"Move selected joint using inverse kinematic."));
214 inverseKinematicAction_->setToolTip(tr(
"<B>Inverse kinematic</B><br>Move selected joint using inverse kinematic."));
215 inverseKinematicAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"skeleton_inverseKinematic.png") );
216 whatsThisGen.
setWhatsThis(inverseKinematicAction_,tr(
"Move a joint to the position only with rotation of the previous joints."),
"transformation_modi");
217 inverseKinematicAction_->setCheckable(
true);
218 inverseKinematicAction_->setChecked(inverseKinematic_);
219 pickToolbar_->addAction(inverseKinematicAction_);
221 connect(pickToolBarActions_, SIGNAL(triggered(QAction*)),
this, SLOT(slotPickToolbarAction(QAction*)) );
223 emit setPickModeToolbar(
"MoveJoints", pickToolbar_);
224 emit setPickModeToolbar(
"DeleteJoints", pickToolbar_);
225 emit setPickModeToolbar(
"InsertJoints", pickToolbar_);
226 emit setPickModeToolbar(
"SplitJoints", pickToolbar_);
227 emit setPickModeToolbar(
"SelectJoints", pickToolbar_);
234 void SkeletonEditingPlugin::slotObjectUpdated(
int _id,
const UpdateType& _type){
239 for (uint i=0; i < activeManipulators_.size(); i++){
241 if ( activeManipulators_[i] != _id )
257 void SkeletonEditingPlugin::initializePlugin()
267 void SkeletonEditingPlugin::slotMouseWheelEvent(QWheelEvent * _event,
const std::string & )
274 manip_size_modifier_ = manip_size_modifier_ - (float)_event->delta() / 120.0 * 0.1;
278 o_it->manipulatorNode()->set_size(manip_size_ * manip_size_modifier_);
298 size_t node_idx, target_idx;
312 o_it->enablePicking(
true );
314 if ( successfullyPicked )
366 void SkeletonEditingPlugin::slotKeyEvent (QKeyEvent* _event)
368 if (_event->key() == Qt::Key_Shift)
369 rotateManipAction_->setChecked(
true);
374 void SkeletonEditingPlugin::slotKeyReleaseEvent (QKeyEvent* _event)
376 if ( _event->key() == Qt::Key_Shift)
377 rotateManipAction_->setChecked(
false);
390 if (_mode !=
"InsertJoints" )
391 if ( insertJointAction_->isChecked() )
392 cancelJointInsertion();
394 moveJointAction_->setChecked( _mode ==
"MoveJoints" );
395 insertJointAction_->setChecked( _mode ==
"InsertJoints" );
396 deleteJointAction_->setChecked( _mode ==
"DeleteJoints" );
397 selectJointAction_->setChecked( _mode ==
"SelectJoints" );
398 splitJointAction_->setChecked( _mode ==
"SplitJoints" );
400 skeletonEditingAction_->setChecked( (_mode ==
"MoveJoints") ||(_mode ==
"InsertJoints")
401 ||(_mode ==
"DeleteJoints")||(_mode ==
"SelectJoints")
402 || (_mode ==
"SplitJoints"));
407 if ( (_mode !=
"") &&
408 (_mode !=
"MoveJoints") &&
409 (_mode !=
"InsertJoints") &&
410 (_mode !=
"DeleteJoints") &&
411 (_mode !=
"SelectJoints") &&
412 (_mode !=
"SplitJoints")) {
415 QString currentRenderer;
436 void SkeletonEditingPlugin::slotPickToolbarAction(QAction* _action)
438 if (_action == rotateManipAction_)
441 if (_action != insertJointAction_)
442 if ( insertJointAction_->isChecked() )
443 cancelJointInsertion();
445 if (_action == insertJointAction_){
449 }
else if (_action == splitJointAction_){
453 }
else if (_action == deleteJointAction_){
457 }
else if (_action == moveJointAction_) {
460 }
else if (_action == selectJointAction_) {
464 }
else if (_action == transformAllManipAction_)
465 transformAllFrames_ = transformAllManipAction_->isChecked();
466 else if (_action == transformChildManipAction_)
467 transformChildJoints_ = transformChildManipAction_->isChecked();
468 else if (_action == inverseKinematicAction_)
469 inverseKinematic_ = inverseKinematicAction_->isChecked();
471 moveJointAction_->setChecked( _action == moveJointAction_ );
472 insertJointAction_->setChecked( _action == insertJointAction_ );
473 deleteJointAction_->setChecked( _action == deleteJointAction_ );
474 selectJointAction_->setChecked( _action == selectJointAction_ );
475 splitJointAction_->setChecked( _action == splitJointAction_ );
480 void SkeletonEditingPlugin::slotSetEditingMode(QAction* )
500 void SkeletonEditingPlugin::slotRotateManipulator(
bool _toggled)
511 if (_toggled && ourPickMode){
512 mode = QtTranslationManipulatorNode::LocalRotation;
515 mode = QtTranslationManipulatorNode::TranslationRotation;
519 for (uint i=0; i < activeManipulators_.size(); i++){
537 size_t node_idx, target_idx;
541 bool successfullyPicked =
false;
555 o_it->enablePicking(
true );
564 if (successfullyPicked) {
566 object->manipPlaced(
true);
569 object->manipulatorNode()->setData( data );
571 object->manipulatorNode()->loadIdentity();
572 object->manipulatorNode()->set_center(hitPoint);
573 object->manipulatorNode()->set_draw_cylinder(
true);
574 object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
575 object->manipulatorNode()->set_size(manip_size_ * manip_size_modifier_);
576 object->manipulatorNode()->setMode( QtTranslationManipulatorNode::TranslationRotation );
577 object->manipulatorNode()->show();
589 object->manipulatorNode()->set_direction(x_axis,y_axis);
590 object->manipulatorNode()->enable_rotations(QtTranslationManipulatorNode::ALL_AXIS);
592 object->manipulatorNode()->apply_transformation(
false);
613 for (uint i=0; i < activeManipulators_.size(); i++)
614 if ( activeManipulators_[i] == object->
id() ){
620 activeManipulators_.push_back( object->
id() );
636 for(std::size_t i = 5; i && pickedJointPos != dest; --i )
640 for (std::vector<Skeleton::Joint*>::iterator iter = rotatableJoints.begin() ; iter != rotatableJoints.end(); ++iter)
642 const unsigned int currentId = (*iter)->id();
648 bool rightRotation =
true;
649 unsigned int tries = 0;
660 ACG::Vec3d toPickedJoint = currentJointPos - pickedJointPos;
663 double theta = (double)angleFac*acos(dot(toPickedJoint ,toDest) / sqrt( toDest.
sqrnorm() * toPickedJoint.
sqrnorm()));
665 if(theta != theta || theta == 0)
669 ACG::Vec3d rotationAxis = cross(toDest,toPickedJoint);
680 ACG::Vec3d pickedJointPosOld = pickedJointPos;
683 bool rightRotation = !( (pickedJointPos -dest).sqrnorm() > (pickedJointPosOld -dest).sqrnorm());
685 if ( !rightRotation )
692 changingMatrix = currentGlobalMatrix * quaternionBack.
rotation_matrix();
701 }
while( rightRotation && tries <= 5);
719 OpenFlipper::Options::redrawDisabled(
true );
731 if(inverseKinematic_)
736 if (!skeleton || !skeletonObj)
751 if (pickedJoint->isRoot())
759 std::vector<Skeleton::Joint*> rotatableJoints;
764 for (;iter && !iter->
selected() && !iter->isRoot(); iter = iter->
parent())
765 rotatableJoints.push_back(*iter);
768 rotatableJoints.push_back(*iter);
774 if (transformAllFrames_ && _event->type() == QEvent::MouseButtonRelease)
775 for (std::vector<Skeleton::Joint*>::iterator iter = rotatableJoints.begin() ; iter != rotatableJoints.end(); ++iter)
778 setJointPosition(skeletonObj,*iter,position);
792 if (_event->type() == QEvent::MouseButtonPress)
798 if ( (_event->type() == QEvent::MouseButtonRelease) && !accumMatrix_.
is_identity() )
809 for (
unsigned int i=0; i < skeletonData->
skinCount(); i++){
811 int meshId = skeletonData->
skin(i);
823 skin->deformSkin( hAni, Blending::M_LBS );
829 if (_event->type() == QEvent::MouseButtonRelease)
832 OpenFlipper::Options::redrawDisabled(
false );
853 object->manipPlaced(
true );
866 for (uint i=0; i < activeManipulators_.size(); i++){
874 emit nodeVisibilityChanged(obj->
id());
880 for (uint i=0; i < activeManipulators_.size(); i++){
888 emit nodeVisibilityChanged(obj->
id());
898 void SkeletonEditingPlugin::deleteJoint(QMouseEvent* _event)
900 if ( (_event->type() == QEvent::MouseButtonPress) || (_event->type() == QEvent::MouseButtonRelease) ){
902 size_t node_idx, target_idx;
916 o_it->enablePicking(
true );
918 if ( successfullyPicked ){
924 currentSkeleton_ =
object->id();
930 bool wasSelected = joint->
selected();
934 (*it)->setSelected(
false);
936 currentJoint_ = joint->
id();
938 if ( _event->type() == QEvent::MouseButtonPress )
950 emit deleteObject( object->
id() );
958 if (_event->type() == QEvent::MouseButtonRelease){
976 currentSkeleton_ = -1;
988 if ( _event->type() == QEvent::MouseButtonPress )
994 size_t node_idx, target_idx;
1008 o_it->enablePicking(
true );
1010 if ( successfullyPicked )
1026 void SkeletonEditingPlugin::insertJoint(QMouseEvent* _event)
1032 if ( _event->type() == QEvent::MouseButtonPress ){
1034 if ( jointPreview_ )
1039 size_t node_idx, target_idx;
1053 o_it->enablePicking(
true );
1055 if ( successfullyPicked ){
1061 currentSkeleton_ =
object->id();
1062 jointPreview_ =
false;
1067 currentJoint_ = joint->
id();
1075 else if ( _event->type() == QEvent::MouseButtonDblClick ){
1080 if (currentSkeleton_ != -1){
1081 cancelJointInsertion();
1086 size_t node_idx, target_idx;
1097 int newSkeletonID = -1;
1103 if (baseObject == 0)
1117 emit createBackup(baseObject->
id(),
"Add Joints",
UPDATE_ALL);
1121 skeleton->
addJoint(rootJoint, tmpJoint);
1126 currentSkeleton_ = baseObject->
id();
1127 currentJoint_ = tmpJoint->id();
1128 jointPreview_ =
true;
1133 }
else if ( _event->type() == QEvent::MouseMove ){
1135 if ( jointPreview_ ){
1140 if (baseObject == 0)
1166 }
else if ( _event->type() == QEvent::MouseButtonRelease){
1171 if ( !jointPreview_ ){
1173 size_t node_idx, target_idx;
1187 o_it->enablePicking(
true );
1189 if ( successfullyPicked ){
1195 currentSkeleton_ =
object->id();
1202 skeleton->
addJoint(joint, tmpJoint);
1204 currentJoint_ = tmpJoint->
id();
1205 jointPreview_ =
true;
1215 if (baseObject == 0)
1238 skeleton->
addJoint(joint, tmpJoint);
1241 currentJoint_ = tmpJoint->id();
1252 if ( (_event->type() != QEvent::MouseButtonPress) ){
1256 if (baseObject == 0)
1272 if(!skeleton)
return NULL;
1282 return animation->pose( handle.
frame() );
1307 if ( animation != 0){
1310 for (
int iFrame=0; iFrame < (int)animation->frameCount(); iFrame++) {
1314 if (pose != currentPose)
1326 void SkeletonEditingPlugin::cancelJointInsertion(){
1328 int cSkeleton = currentSkeleton_;
1329 int cJoint = currentJoint_;
1331 currentSkeleton_ = -1;
1333 jointPreview_ =
false;
1338 if (baseObject == 0)
1352 emit createBackup(baseObject->
id(),
"Add Joints",
UPDATE_ALL);
1357 void SkeletonEditingPlugin::moveJoint(QMouseEvent* _event)
1360 if (_event->type() == QEvent::MouseButtonDblClick && _event->button() == Qt::LeftButton){
1372 void SkeletonEditingPlugin::selectJoint(QMouseEvent* _event)
1375 if ( _event->type() == QEvent::MouseButtonRelease ){
1377 size_t node_idx, target_idx;
1391 o_it->enablePicking(
true );
1393 if ( successfullyPicked ){
1417 double bestDistance = DBL_MAX;
1426 for (
unsigned int joint = 0; joint < skeleton->
jointCount(); joint++){
1430 if (dist < bestDistance){
1432 _bestJointID = joint;
1433 bestDistance = dist;
1454 if (skeleton->
joint(jointID) == 0)
DrawMode SOLID_SMOOTH_SHADED
draw smooth shaded (Gouraud shaded) faces (requires halfedge normals)
Abstract base class for the skin template, wrapping all template versions of the skin.
bool is_identity() const
check if the matrix is the identity ( up to an epsilon )
ACG::SceneGraph::SkeletonNodeT< Skeleton > * skeletonNode()
Returns the skeleton scenegraph node.
DrawMode WIREFRAME
draw wireframe
void setLocalMatrix(unsigned int _joint, const Matrix &_local, bool _keepLocalChildPositions=true)
Sets the local coordinate system.
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
Vector globalTranslation(unsigned int _joint)
Returns the global translation vector.
void placeManip(QMouseEvent *_event)
Place and show the Manipulator.
bool selected() const
Returns the joint's selection state.
const Matrix & globalMatrix(unsigned int _joint) const
Returns the global matrix for the given joint.
Matrix4x4 localMatrix(int _objectId, int _jointId)
get local matrix of a joint in the active pose
Matrix rotation_matrix() const
cast to rotation matrix
QString lastRenderer_
Stores the last active renderer before we switched to skeleton editing mode.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void setSelected(bool _selected)
Set the joint's selction state.
pick any of the prior targets (should be implemented for all nodes)
const Matrix & localMatrix(unsigned int _joint) const
Returns the local matrix for the given joint.
SkeletonEditingPlugin()
Default Constructor.
decltype(std::declval< S >() *std::declval< S >()) sqrnorm() const
compute squared euclidean norm
void setGlobalTranslation(unsigned int _joint, const Vector &_position, bool _keepGlobalChildPositions=true)
Sets the global translation vector.
bool manipPlaced()
Check if the manipulator has been placed.
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
int skin(unsigned int _index)
Get the skin with given index (0 <= _index < skinCount())
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
int context_height() const
get gl context height
ManipulatorMode
enum to define the manipulator mode
void setGlobalMatrix(unsigned int _joint, const Matrix &_global, bool _keepGlobalChildPositions=true)
Sets the global coordinate system.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
QVariant getData()
Get additional data for the node.
void setMode(ManipulatorMode _mode)
set current operation mode
bool canModify(QMouseEvent *_event)
checks, if the skeleton can be modified. a skeleton can be modified, if the active pose is the refere...
bool dataType(DataType _type) const
size_t frame() const
Returns the selected frame (zero based)
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
SkeletonObject * skeletonObject(BaseObjectData *_object)
Cast an BaseObject to a SkeletonObject if possible.
A general pose, used to store the frames of the animation.
~SkeletonEditingPlugin()
Destructor.
unsigned int skinCount()
Get the number of associated skins.
void setDrawMode(const ACG::SceneGraph::DrawModes::DrawMode &_mode, int _viewer)
Set the draw Mode of a Viewer. .
const QStringList ALL_OBJECTS
Iterable object range.
size_t animationCount()
Returns the number of animations stored in this skeleton.
Iterator class for the skeleton.
Iterator end()
Compare an iterator with the return value of this method to test if it is done.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
void showManipulators()
Show/Hide active manipulators.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
A handle used to refer to an animation or to a specific frame in an animation.
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
OpenMesh::Vec3d getNearestJoint(SkeletonObject *_skeletonObj, OpenMesh::Vec3d &_hitPoint, int &_bestJointID)
Get nearest joint to hitPoint (used for snapping)
Joint * parent()
Returns the parent joint.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
VectorT< double, 3 > Vec3d
Pose * referencePose()
Returns a pointer to the reference pose.
void updateManipulatorPosition(BaseObjectData *_skeletonObj)
make sure the manipulator is positioned on a joint
const GLMatrixd & matrix() const
Returns a const reference to the current transformation matrix.
void setDescriptions()
Set Descriptions for Scripting Slots.
Iterator begin()
Iterator over joints of the skeletal tree in TOP-DOWN order (from root to leafs)
bool contains(const UpdateType &_type) const
Check if this update contains the given UpdateType.
Pose * pose(const AnimationHandle &_hAni)
Returns a pointer to the pose with the given animation handle.
Represents a single joint in the skeleton.
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
virtual void enablePicking(bool _enable)
int getIdentifier()
Get an identifier for that manipulator.
void transformJoint(int _objectId, int _jointId, Matrix4x4 _matrix)
transform joint with given matrix
Data object attached to the skeleton.
void splitJoint(QMouseEvent *_event)
split selected Joint
void splitBone(int _objectId, int _tailJoint)
insert a joint in the middle of a bone given by its (unique) tailJoint
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void identity()
setup an identity matrix
bool hasObjectData(QString _dataName)
Checks if object data with given name is available.
a class which provides an link generator for WhatsThisMessages linking to the user doc If you have an...
void setViewObjectMarker(ViewObjectMarker *_marker)
ACG::GLState & glState()
Get the glState of the Viewer.
size_t jointCount()
Returns the number of joints.
Stores a single animation.
Animation * animation(std::string _name)
Returns a pointer to the animation to the given name.
picks faces (should be implemented for all nodes)
const UpdateType UPDATE_TOPOLOGY(UpdateTypeSet(1)<< 3)
Topology updated.
Viewer::ActionMode actionMode()
Get the current Action mode.
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
ACG::Vec3d Vector
Standard Type for 3d Vector used for scripting.
PerObjectData * objectData(QString _dataName)
Returns the object data pointer.
Joint * joint(const size_t &_index)
Returns the joint with the given index.
bool isValid() const
Returns true if the handle is valid.
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
picks verices (may not be implemented for all nodes)
void addJoint(typename SkeletonT< PointT >::Joint *_pParent, typename SkeletonT< PointT >::Joint *_pJoint)
Adds a joint as child of a given parent joint.
const Vec3d & center() const
get center
void traverse(ACG::SceneGraph::MouseEventAction &_action)
size_t id() const
returns the joint id
bool rendererChanged_
Remembers, if we changed the renderer.
QtTranslationManipulatorNode * manipulatorNode()
const std::string pickMode()
Get the current Picking mode.
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
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
void removeJoint(typename SkeletonT< PointT >::Joint *_pJoint)
Remove the given joint from the tree.
void updateIndices()
Updates the joint index text node positions.