51 #include "MovePlugin.hh"
53 #include <MeshTools/MeshInfoT.hh>
58 #if QT_VERSION >= 0x050000
63 #ifdef ENABLE_POLYLINE_SUPPORT
67 #ifdef ENABLE_TSPLINEMESH_SUPPORT
68 #include <ObjectTypes/TSplineMesh/TSplineMesh.hh>
71 #ifdef ENABLE_SKELETON_SUPPORT
72 #include <ObjectTypes/Skeleton/Helper/SkeletonTransform.hh>
75 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
79 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
89 toolboxActive_(false),
93 moveSelectionAction_(0),
98 rotateTranslateAction_(0),
99 rotateManipAction_(0),
101 biggerManipAction_(0),
102 smallerManipAction_(0),
103 fixChildManipAction_(0),
104 transformRefPoseManipAction_(0),
105 currentPoseManipAction_(0),
106 placeAndSnapAction_(0),
107 pickToolBarActions_(0),
109 manip_size_modifier_(1.0),
110 lastActiveManipulator_(-1),
112 selectionType_(VERTEX),
114 contextActionHide_(0),
116 contextMenuManipControl_(0),
117 contextMenuManipControlsAction_(0),
121 transformedSelected_(false)
143 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
163 emit addPickMode(
"Separator");
164 emit addHiddenPickMode(
"Move");
165 emit setPickModeMouseTracking (
"Move",
true);
166 emit addHiddenPickMode(
"MoveSelection");
167 emit setPickModeMouseTracking (
"MoveSelection",
true);
170 emit registerKey (Qt::Key_Shift, Qt::NoModifier, tr(
"Manipulator rotation"),
true);
171 emit registerKey (Qt::Key_Shift, Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
172 emit registerKey (Qt::Key_Shift, Qt::ControlModifier | Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
173 emit registerKey (Qt::Key_Control, Qt::NoModifier, tr(
"Resize"),
true);
174 emit registerKey (Qt::Key_Control, Qt::ControlModifier, tr(
"Resize"),
true);
175 emit registerKey (Qt::Key_Control, Qt::ShiftModifier | Qt::ControlModifier, tr(
"Resize"),
true);
187 toolbar_ =
new QToolBar(tr(
"Transform and Move"));
188 toolbar_->setObjectName(
"TransformAndMoveToolBar");
193 moveAction_->setStatusTip(tr(
"Move object in 3D."));
194 moveAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-objects.png") );
201 moveSelectionAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-selections.png") );
214 pickToolbar_ =
new QToolBar(tr(
"Transform and Move PickTool bar"));
215 pickToolbar_->setObjectName(
"TransformAndMovePickToolBar");
217 pickToolbar_->setAttribute(Qt::WA_AlwaysShowToolTips,
true);
222 placeAction_->setStatusTip(tr(
"Place manipulator on object. <Doubleclick>"));
223 placeAction_->setToolTip(tr(
"Place manipulator on object. <Doubleclick>"));
224 placeAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-place.png") );
234 rotateTranslateAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-translaterotate.png") );
243 resizeAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-resize.png") );
253 rotateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-maniprotate.png") );
259 placeAndSnapAction_->setStatusTip(tr(
"Locally translate manipulator. Press and hold <Alt> for snapping."));
261 placeAndSnapAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-placeandsnap.png") );
269 smallerManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-manipsmall.png") );
277 biggerManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-manipbig.png") );
284 emit setPickModeToolbar (
"MoveSelection",
pickToolbar_);
289 toAllTargets_ =
new QAction(tr(
"Apply to all targets"),
this);
291 toAllTargets_->setToolTip(tr(
"Apply transformation to all target objects"));
297 contextAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-properties.png") );
302 contextActionHide_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-hide.png") );
331 void MovePlugin::initializePlugin()
338 tool_->moveToOrigin->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"moveToCOG.png") );
339 tool_->moveToOrigin->setIconSize(QSize(48,48));
341 tool_->moveToOrigin->setWhatsThis(QString(tr(
"Moves the selected objects such that their center of gravity is at the origin."))
342 +whatsThis.generateLink(
"move_cog"));
345 tool_->unifyBoundingBoxDiagonal->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB.png") );
346 tool_->unifyBoundingBoxDiagonal->setIconSize(QSize(48,48));
347 tool_->unifyBoundingBoxDiagonal->setWhatsThis(QString(tr(
"Rescale objects such that its bounding box diagonal has length one."))
348 +whatsThis.generateLink(
"unifyBB"));
351 tool_->unifyBoundingBoxLongest->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB_longest.png") );
352 tool_->unifyBoundingBoxLongest->setIconSize(QSize(48,48));
355 tool_->unifyBoundingBoxAll->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB_all.png") );
356 tool_->unifyBoundingBoxAll->setIconSize(QSize(48,48));
360 toolIcon_ =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-toolBox.png");
369 void MovePlugin::slotMouseWheelEvent(QWheelEvent * _event,
const std::string & )
404 if (_event->type() == QEvent::MouseButtonDblClick || (_event->type() == QEvent::MouseButtonPress
405 && _event->button() == Qt::LeftButton && (
placeAction_->isChecked() || placeMode_))) {
414 manMode_ = QtTranslationManipulatorNode::TranslationRotation;
418 if (o_it->manipPlaced())
419 o_it->manipulatorNode()->setMode(
manMode_);
430 }
else if (placeMode_) {
448 if (_event->buttons() == Qt::LeftButton)
449 emit nodeVisibilityChanged(-1);
458 void MovePlugin::slotKeyEvent (QKeyEvent* _event)
460 if ((_event->key() == Qt::Key_Control) && _event->modifiers() != Qt::ShiftModifier) {
463 }
else if ((_event->key () == Qt::Key_Shift) && _event->modifiers() != Qt::ControlModifier) {
464 setManipMode (QtTranslationManipulatorNode::LocalRotation);
470 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
487 void MovePlugin::slotKeyReleaseEvent (QKeyEvent* _event)
489 if ((_event->key() == Qt::Key_Control &&
manMode_ == QtTranslationManipulatorNode::Resize) ||
490 (_event->key() == Qt::Key_Shift && manMode_ == QtTranslationManipulatorNode::LocalRotation))
491 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
496 if (_pickmode ==
"Move")
498 _pW->objectRadioButton->setChecked(
true);
500 else if (_pickmode ==
"MoveSelection")
502 _pW->selectionRadioButton->setChecked(
true);
507 _pW->objectRadioButton->setAutoExclusive(
false);
508 _pW->selectionRadioButton->setAutoExclusive(
false);
509 _pW->objectRadioButton->setChecked(
false);
510 _pW->selectionRadioButton->setChecked(
false);
511 _pW->objectRadioButton->setAutoExclusive(
true);
512 _pW->selectionRadioButton->setAutoExclusive(
true);
529 hide_ = !(_mode ==
"Move" || _mode ==
"MoveSelection");
537 case QtTranslationManipulatorNode::Rotation:
540 case QtTranslationManipulatorNode::Resize:
543 case QtTranslationManipulatorNode::LocalRotation:
546 case QtTranslationManipulatorNode::Place:
549 case QtTranslationManipulatorNode::TranslationRotation:
585 #ifdef ENABLE_TSPLINEMESH_SUPPORT
586 }
else if ( object->
dataType() == DATA_TSPLINE_MESH ) {
589 #ifdef ENABLE_POLYLINE_SUPPORT
593 #ifdef ENABLE_SKELETON_SUPPORT
597 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
600 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
602 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
605 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
611 emit log(
LOGERR,tr(
"moveObject called for unsupported Object Type"));
667 if (_mode != manMode_)
673 if ( o_it->manipPlaced() )
674 o_it->manipulatorNode()->setMode (_mode);
680 case QtTranslationManipulatorNode::Rotation:
684 case QtTranslationManipulatorNode::Resize:
688 case QtTranslationManipulatorNode::LocalRotation:
692 case QtTranslationManipulatorNode::Place:
696 case QtTranslationManipulatorNode::TranslationRotation:
706 case QtTranslationManipulatorNode::Resize:
712 case QtTranslationManipulatorNode::LocalRotation:
718 case QtTranslationManipulatorNode::TranslationRotation:
724 case QtTranslationManipulatorNode::Place:
730 case QtTranslationManipulatorNode::Rotation:
753 if (node->
className() !=
"QtTranslationManipulatorNode") {
774 OpenFlipper::Options::redrawDisabled(
true );
777 if ( !placeMode_ && ((_event->type() == QEvent::MouseButtonRelease) ||
800 if ((o_it->id() != objectId) && !o_it->manipulatorNode()->draw_manipulator()) {
815 OpenFlipper::Options::redrawDisabled(
false );
836 object->manipPlaced(
true );
857 unsigned int node_idx, target_idx;
861 bool successfullyPicked =
false;
875 if(!successfullyPicked) {
885 #ifdef ENABLE_TSPLINEMESH_SUPPORT
886 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
887 hitPoint =
getNearestVertex(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
895 #ifdef ENABLE_TSPLINEMESH_SUPPORT
896 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
897 hitPoint =
getNearestEdge(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
905 #ifdef ENABLE_TSPLINEMESH_SUPPORT
906 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
907 hitPoint =
getNearestFace(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
917 if (successfullyPicked) {
919 object->manipPlaced(
true);
924 object->manipulatorNode()->setData( data );
926 object->manipulatorNode()->loadIdentity();
927 object->manipulatorNode()->set_center(hitPoint);
928 object->manipulatorNode()->set_draw_cylinder(
true);
929 object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
931 object->manipulatorNode()->setMode(manMode_);
932 object->manipulatorNode()->show();
991 emit nodeVisibilityChanged(obj->
id());
1005 emit nodeVisibilityChanged(obj->
id());
1022 if(_but == 0)
return 0;
1023 return dynamic_cast<movePropsWidget*
>((((_but->parentWidget())->parentWidget())->parentWidget()));
1032 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1036 TriMesh::Point newpos;
1039 newpos[0] = (pW->nposx->text()).toDouble(&ok);
1040 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1041 newpos[1] = (pW->nposy->text()).toDouble(&ok);
1042 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1043 newpos[2] = (pW->nposz->text()).toDouble(&ok);
1044 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1051 translation -=
object->manipulatorNode()->center();
1052 object->manipulatorNode()->set_center(newpos);
1066 emit createBackup(object->
id(),
"Object Translation");
1083 emit createBackup(object->
id(),
"Translation of selection");
1102 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1112 case 0: pW->axisAButton->setText(tr(
"X Direction"));
break;
1113 case 1: pW->axisAButton->setText(tr(
"Y Direction"));
break;
1114 case 2: pW->axisAButton->setText(tr(
"Z Direction"));
break;
1127 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1137 case 0: pW->axisBButton->setText(tr(
"X Direction"));
break;
1138 case 1: pW->axisBButton->setText(tr(
"Y Direction"));
break;
1139 case 2: pW->axisBButton->setText(tr(
"Z Direction"));
break;
1152 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1161 newdirA[0] = (pW->ndirAx->text()).toDouble(&ok);
1162 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1163 newdirA[1] = (pW->ndirAy->text()).toDouble(&ok);
1164 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1165 newdirA[2] = (pW->ndirAz->text()).toDouble(&ok);
1166 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1168 newdirB[0] = (pW->ndirBx->text()).toDouble(&ok);
1169 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1170 newdirB[1] = (pW->ndirBy->text()).toDouble(&ok);
1171 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1172 newdirB[2] = (pW->ndirBz->text()).toDouble(&ok);
1173 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1179 case 0: dirX = newdirA; xAxis =
true;
break;
1180 case 1: dirY = newdirA; yAxis =
true;
break;
1181 default: dirZ = newdirA;
break;
1185 case 0: dirX = newdirB; xAxis =
true;
break;
1186 case 1: dirY = newdirB; yAxis =
true;
break;
1187 default: dirZ = newdirB;
break;
1197 if ( (dirX | dirY) != 0.0){
1198 emit log(
LOGERR,tr(
"The axes of the new direction have to be orthogonal"));
1214 if (
object != 0 ) {
1217 object->manipulatorNode()->set_direction( dirX, dirY );
1233 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1240 translation[0] = (pW->translationX->text()).toDouble(&ok);
1241 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1242 translation[1] = (pW->translationY->text()).toDouble(&ok);
1243 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1244 translation[2] = (pW->translationZ->text()).toDouble(&ok);
1245 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1253 object->manipulatorNode()->set_center(
1262 emit createBackup(object->
id(),
"Translation of Object");
1277 emit createBackup(object->
id(),
"Translation of selection");
1290 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1296 emit createBackup(o_it->id(),
"Translation of object");
1310 emit createBackup(o_it->id(),
"Translation of selection");
1326 emit scriptInfo(QString(
"slotTranslation()"));
1338 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1342 if ( allTargets_ ) {
1343 emit log(
LOGWARN,tr(
"TODO Project for multiple targets"));
1346 emit log(
LOGWARN,tr(
"TODO Project for one target"));
1360 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1382 if (
object != 0 ) {
1389 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1390 else if ( object->
dataType( DATA_TSPLINE_MESH ) )
1391 object->
manipulatorNode()->set_center( MeshInfo::cog(PluginFunctions::tsplineMesh(
object)) );
1393 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1397 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1403 object->manipulatorNode()->loadIdentity();
1418 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1422 TriMesh::Point axis;
1426 axis[0] = (pW->rotx->text()).toDouble(&ok);
1427 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1428 axis[1] = (pW->roty->text()).toDouble(&ok);
1429 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1430 axis[2] = (pW->rotz->text()).toDouble(&ok);
1431 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1433 angle = (pW->rotAngle->text()).toDouble(&ok);
1434 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Angle"));
return; }
1441 object->manipulatorNode()->rotate(angle, axis);
1453 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1454 if (object->
dataType(DATA_TSPLINE_MESH))
1457 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1461 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1467 emit createBackup(object->
id(),
"Rotation of object");
1487 emit createBackup(object->
id(),
"Rotation of selection");
1496 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1505 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1506 if (o_it->dataType(DATA_TSPLINE_MESH))
1509 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1513 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1519 emit createBackup(o_it->id(),
"Rotation of object");
1538 emit createBackup(o_it->id(),
"Rotation of selection");
1554 emit scriptInfo(QString(
"slotRotate()"));
1566 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1571 TriMesh::Point scale;
1574 scale[0] = (pW->scalex->text()).toDouble(&ok);
1575 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 1"));
return; }
1576 scale[1] = (pW->scaley->text()).toDouble(&ok);
1577 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 2"));
return; }
1578 scale[2] = (pW->scalez->text()).toDouble(&ok);
1579 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 3"));
return; }
1587 object->manipulatorNode()->scale(scale);
1597 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1598 if (object->
dataType(DATA_TSPLINE_MESH))
1601 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1605 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1611 emit createBackup(object->
id(),
"Scaling of object");
1630 emit createBackup(object->
id(),
"Scaling of selection");
1638 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1647 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1648 if (o_it->dataType(DATA_TSPLINE_MESH))
1651 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1655 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1661 emit createBackup(o_it->id(),
"Scaling of object");
1680 emit createBackup(o_it->id(),
"Scaling of selection");
1691 emit createBackup(object->
id(),
"Scaling");
1696 emit scriptInfo(QString(
"slotScale()"));
1709 bool useCommonCOG =
false;
1713 if ( OpenFlipper::Options::gui()) {
1714 QMessageBox::StandardButton button = QMessageBox::question( 0, tr(
"Use common COG?"), tr(
"Should the targets be moved depending on their common cog?"),QMessageBox::Yes|QMessageBox::No);
1717 useCommonCOG = ( button == QMessageBox::Yes );
1720 if ( useCommonCOG ) {
1722 double vertexCount = 0.0;
1728 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1729 vertexCount += double(mesh->n_vertices());
1734 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1735 vertexCount += double(mesh->n_vertices());
1738 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1739 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1740 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(*o_it);
1741 cog += MeshInfo::cog(mesh) * double(mesh.n_vertices());
1742 vertexCount += double(mesh.n_vertices());
1746 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1749 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1750 vertexCount += double(mesh.n_vertices());
1754 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1757 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1758 vertexCount += double(mesh.n_vertices());
1763 cog = cog / vertexCount;
1772 if ( !useCommonCOG )
1773 cog = MeshInfo::cog(mesh);
1775 for ( TriMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1776 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1778 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1784 if ( !useCommonCOG )
1785 cog = MeshInfo::cog(mesh);
1787 for ( PolyMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1788 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1790 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1794 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1795 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1796 TSplineMesh* mesh = PluginFunctions::tsplineMesh(*o_it);
1798 if ( !useCommonCOG )
1799 cog = MeshInfo::cog(mesh);
1801 for ( TSplineMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1802 mesh->set_point(v_it , ( mesh->point(v_it) ) - cog );
1804 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1809 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1813 if ( !useCommonCOG )
1814 cog = cogVolumeMesh(mesh);
1819 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1824 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1828 if ( !useCommonCOG )
1829 cog = cogVolumeMesh(mesh);
1834 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1843 o_it->manipulatorNode()->loadIdentity();
1845 emit createBackup(o_it->id(),
"Move to origin");
1874 bool useCommonBB =
false;
1879 if ( OpenFlipper::Options::gui()) {
1880 QMessageBox::StandardButton button = QMessageBox::question( 0, tr(
"Use common BB?"), tr(
"Should the targets be scaled depending on their common Bounding Box?"),QMessageBox::Yes|QMessageBox::No);
1883 useCommonBB = ( button == QMessageBox::Yes );
1887 if ( useCommonBB ) {
1896 getBB(mesh,bb_min_tmp,bb_max_tmp);
1897 bb_min.minimize(bb_min_tmp);
1898 bb_max.maximize(bb_max_tmp);
1903 getBB(mesh,bb_min_tmp,bb_max_tmp);
1904 bb_min.minimize(bb_min_tmp);
1905 bb_max.maximize(bb_max_tmp);
1908 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1909 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1910 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(*o_it);
1911 getBB(mesh,bb_min_tmp,bb_max_tmp);
1912 bb_min.minimize(bb_min_tmp);
1913 bb_max.maximize(bb_max_tmp);
1917 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1920 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1921 bb_min.minimize(bb_min_tmp);
1922 bb_max.maximize(bb_max_tmp);
1926 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1929 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1930 bb_min.minimize(bb_min_tmp);
1931 bb_max.maximize(bb_max_tmp);
1940 if ( useCommonBB ) {
1945 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1946 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
1947 unifyBB(*PluginFunctions::tsplineMesh(*o_it),bb_min,bb_max, u);
1949 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1953 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
1962 #ifdef ENABLE_TSPLINEMESH_SUPPORT
1963 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
1964 unifyBB(*PluginFunctions::tsplineMesh(*o_it), u);
1966 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT
1970 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT
2005 const TriMesh::Point pos =
object->manipulatorNode()->center();
2009 num = QString::number(pos[0]); pW->posx->setText(num);
2010 num = QString::number(pos[1]); pW->posy->setText(num);
2011 num = QString::number(pos[2]); pW->posz->setText(num);
2013 TriMesh::Point direction =
object->manipulatorNode()->directionX();
2014 num = QString::number(direction[0]); pW->dirxx->setText(num);
2015 num = QString::number(direction[1]); pW->dirxy->setText(num);
2016 num = QString::number(direction[2]); pW->dirxz->setText(num);
2018 direction =
object->manipulatorNode()->directionY();
2019 num = QString::number(direction[0]); pW->diryx->setText(num);
2020 num = QString::number(direction[1]); pW->diryy->setText(num);
2021 num = QString::number(direction[2]); pW->diryz->setText(num);
2023 direction =
object->manipulatorNode()->directionZ();
2024 num = QString::number(direction[0]); pW->dirzx->setText(num);
2025 num = QString::number(direction[1]); pW->dirzy->setText(num);
2026 num = QString::number(direction[2]); pW->dirzz->setText(num);
2039 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
2041 if ( (*it)->getBaseObjectDataId() == _obj->
id() )
2082 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
2087 setManipMode (QtTranslationManipulatorNode::LocalRotation);
2105 emit nodeVisibilityChanged (-1);
2113 emit nodeVisibilityChanged (-1);
2132 matrix =
object->manipulatorNode()->matrix();
2134 object->manipulatorNode()->loadIdentity();
2150 template<
typename MeshT >
2159 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2160 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2161 for (; v_it!=v_end; ++v_it) {
2171 _mesh.set_normal(*v_it,n);
2174 typename MeshT::FaceIter f_it = _mesh.faces_begin();
2175 typename MeshT::FaceIter f_end = _mesh.faces_end();
2176 for (; f_it != f_end; ++f_it) {
2183 _mesh.set_normal(*f_it,n);
2190 #ifdef ENABLE_POLYLINE_SUPPORT
2197 template<
class PolyLineT >
2198 void MovePlugin::transformPolyLine(
ACG::Matrix4x4d _mat , PolyLineT& _polyLine ) {
2200 #pragma omp parallel for
2202 for (
int i = 0 ; i < (int)_polyLine.n_vertices(); ++i )
2211 #ifdef ENABLE_SKELETON_SUPPORT
2221 transformer.transformSkeleton(_mat);
2226 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
2236 template<
typename VolumeMeshT >
2255 _normalAttrib[*v_it] = invTranspMat.
transform_vector(_normalAttrib[*v_it]).normalized();
2262 _normalAttrib[*f_it] = invTranspMat.
transform_vector(_normalAttrib[*f_it]).normalized();
2271 template<
typename VolumeMeshT >
2272 ACG::Vec3d MovePlugin::cogVolumeMesh( VolumeMeshT& _mesh )
2277 for (; v_it!=v_end; ++v_it)
2278 cog += _mesh.vertex(*v_it);
2280 return cog/(double)_mesh.n_vertices();
2291 template<
typename VolumeMeshT >
2292 void MovePlugin::getBBVolumeMesh( VolumeMeshT& _mesh,
ACG::Vec3d& _bb_min,
ACG::Vec3d& _bb_max)
2298 if( v_it == v_end)
return;
2300 _bb_min = _mesh.vertex(*v_it);
2301 _bb_max = _mesh.vertex(*v_it);
2303 for(; v_it!=v_end; ++v_it)
2305 _bb_min.minimize( _mesh.vertex(*v_it));
2306 _bb_max.maximize( _mesh.vertex(*v_it));
2317 template<
typename VolumeMeshT >
2321 if( _mesh.n_vertices() == 0)
return;
2324 getBBVolumeMesh( _mesh, bb_min, bb_max );
2326 unifyBBVolumeMesh( _mesh, _normalAttrib, bb_min, bb_max, u );
2339 template<
typename VolumeMeshT >
2342 ACG::Vec3d bb_center = 0.5 * (_bb_min + _bb_max) ;
2344 double bb_longestAxis = bb_diagonal.max();
2349 case MovePlugin::DIAGONAL :
2350 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2352 case MovePlugin::LONGEST_AXIS :
2355 case MovePlugin::ALL_AXIS :
2359 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2364 _mesh.set_vertex(*v_it, (_mesh.vertex(*v_it) - bb_center) * scale + bb_center);
2378 template<
typename MeshT >
2381 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2382 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2385 if( v_it == v_end)
return;
2387 typename MeshT::Point bb_min = _mesh.point(*v_it);
2388 typename MeshT::Point bb_max = _mesh.point(*v_it);
2390 for(; v_it!=v_end; ++v_it)
2392 bb_min.minimize( _mesh.point(*v_it));
2393 bb_max.maximize( _mesh.point(*v_it));
2396 typename MeshT::Point bb_center = 0.5 * (bb_min + bb_max) ;
2398 typename MeshT::Scalar bb_longestAxis = bb_diagonal.max();
2403 case MovePlugin::DIAGONAL :
2404 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2406 case MovePlugin::LONGEST_AXIS :
2409 case MovePlugin::ALL_AXIS :
2413 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2416 for( v_it = _mesh.vertices_begin(); v_it!=v_end; ++v_it)
2419 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2422 _mesh.update_normals();
2432 template<
typename MeshT >
2435 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2436 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2439 if( v_it == v_end)
return;
2441 _bb_min = _mesh.point(*v_it);
2442 _bb_max = _mesh.point(*v_it);
2444 for(; v_it!=v_end; ++v_it)
2446 _bb_min.minimize( _mesh.point(*v_it));
2447 _bb_max.maximize( _mesh.point(*v_it));
2460 template<
typename MeshT >
2464 typename MeshT::Point bb_center = 0.5 * (_bb_min + _bb_max) ;
2466 typename MeshT::Scalar bb_longestAxis = bb_diagonal.max();
2470 case MovePlugin::DIAGONAL :
2471 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2473 case MovePlugin::LONGEST_AXIS :
2476 case MovePlugin::ALL_AXIS :
2480 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2483 typename MeshT::VertexIter v_it;
2485 for( v_it = _mesh.vertices_begin(); v_it!=_mesh.vertices_end(); ++v_it)
2486 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2488 _mesh.update_normals();
2500 bool functionExistsMeshV;
2501 emit functionExists(
"meshobjectselection",
"vertexTypeActive()", functionExistsMeshV);
2502 bool functionExistsMeshE;
2503 emit functionExists(
"meshobjectselection",
"edgeTypeActive()", functionExistsMeshE);
2504 bool functionExistsMeshF;
2505 emit functionExists(
"meshobjectselection",
"faceTypeActive()", functionExistsMeshF);
2507 bool connected =
false;
2510 if(functionExistsMeshV && functionExistsMeshE && functionExistsMeshF) {
2515 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"vertexTypeActive")) {
2518 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"edgeTypeActive")) {
2521 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"faceTypeActive")) {
2527 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT
2528 bool functionExistsVolumeMeshV;
2529 emit functionExists(
"volumemeshselection",
"vertexTypeActive()", functionExistsVolumeMeshV);
2530 bool functionExistsVolumeMeshE;
2531 emit functionExists(
"volumemeshselection",
"edgeTypeActive()", functionExistsVolumeMeshE);
2532 bool functionExistsVolumeMeshF;
2533 emit functionExists(
"volumemeshselection",
"faceTypeActive()", functionExistsVolumeMeshF);
2534 bool functionExistsVolumeMeshC;
2535 emit functionExists(
"volumemeshselection",
"cellTypeActive()", functionExistsVolumeMeshC);
2537 if ( functionExistsVolumeMeshV && functionExistsVolumeMeshE && functionExistsVolumeMeshF && functionExistsVolumeMeshC) {
2542 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"vertexTypeActive")) {
2545 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"edgeTypeActive")) {
2548 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"faceTypeActive")) {
2551 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"cellTypeActive")) {
2558 emit log(
LOGWARN, tr(
"Unable to connect to Selection-Plugin. MoveSelection will work on vertices only."));
2571 allTargets_ = _state;
2579 template<
typename MeshType >
2582 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2584 if ( !fh.is_valid() )
2587 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2588 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2589 typename MeshType::Scalar shortest_distance = (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2590 typename MeshType::VertexHandle vh = *fv_it;
2592 for (; fv_it.is_valid(); ++fv_it) {
2594 typename MeshType::Scalar tmpdist =
2595 (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2597 if(tmpdist < shortest_distance) {
2598 shortest_distance = tmpdist;
2611 template<
typename MeshType >
2614 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2619 typename MeshType::FaceEdgeIter fe_it(*_mesh, fh);
2620 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2622 typename MeshType::Point center;
2623 typename MeshType::Scalar closest_dist(-1);
2625 for (; fe_it.is_valid(); ++fe_it) {
2627 typename MeshType::HalfedgeHandle heh0 = _mesh->halfedge_handle(*fe_it, 0);
2628 typename MeshType::HalfedgeHandle heh1 = _mesh->halfedge_handle(*fe_it, 1);
2630 typename MeshType::Point lp0 = _mesh->point(_mesh->to_vertex_handle(heh0));
2631 typename MeshType::Point lp1 = _mesh->point(_mesh->to_vertex_handle(heh1));
2640 if (dist_new < closest_dist || closest_dist == -1) {
2642 closest_dist = dist_new;
2643 center = lp0 + (lp1 - lp0) * .5;
2656 template<
typename MeshType >
2659 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2661 if ( !fh.is_valid() )
2664 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2666 typename MeshType::Point cog(0.0,0.0,0.0);
2669 for (; fv_it.is_valid(); ++fv_it) {
2671 cog += _mesh->point(*fv_it);
2680 void MovePlugin::slotAllCleared(){
2686 void MovePlugin::objectDeleted(
int _id ){
2697 #if QT_VERSION < 0x050000
QAction * moveSelectionAction_
Called by Toolbar to enable move mode.
QAction * placeAndSnapAction_
Called by pick Toolbar.
void transform(const ACG::Matrix4x4d &_mat)
Transform the plane with given matrix.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
bool is_identity() const
check if the matrix is the identity ( up to an epsilon )
MeshT * mesh()
return a pointer to the mesh
const QStringList ALL_OBJECTS
Iterable object range.
void setViewObjectMarker(ViewObjectMarker *_marker)
void slotSetDirection()
Set Direction of manipulator in tab changed.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
void slotMoveToOrigin()
Move target Meshes cog to the origin.
SelectionType selectionType_
Current SelectionType of SelectionPlugin.
QActionGroup * toolBarActions_
Called by Toolbar to enable move mode.
QToolBar * pickToolbar_
Called by pick Toolbar.
bool manipPlaced()
Check if the manipulator has been placed.
void slotMoveManipToCOG()
Move the current manipulator to the cog of the object.
void translateEdgeSelection(int _objectId, Vector _vector)
translate current edge selection of an Object by a given vector
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
bool visible()
Is node visible (status == Active)?
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
int targetCount()
Get the number of target objects.
picks faces (should be implemented for all nodes)
bool transformFaceSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
pick any of the prior targets (should be implemented for all nodes)
QtTranslationManipulatorNode * manipulatorNode()
#define DATA_POLYHEDRAL_MESH
void slotUnifyBoundingBoxAllAxis()
Scale all Boundingbox axis to unit size.
bool getObject(int _identifier, BSplineCurveObject *&_object)
Skeleton transformation class.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
void slotTranslation()
perform a translation for Manipulator in tab
void updateManipulatorDialog()
Update the Dialog with the last clicked manipulator.
void placeManip(QMouseEvent *_event, bool _snap=false)
Place and show the Manipulator.
bool transformEdgeSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
VectorT< double, 3 > Vec3d
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
void setPickModeProps(movePropsWidget *_pW, const std::string &_pickmode)
List of properties dialogs (each corresponding to one manipulator)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
const QStringList TARGET_OBJECTS("target")
Iterable object range.
bool dataType(DataType _type) const
QList< movePropsWidget * > propsWindows_
List of properties dialogs (each corresponding to one manipulator)
bool transformedSelected_
stores if any selected elements where transformed
PolyhedralMeshObject * polyhedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an PolyhedralMeshObject if possible.
QAction * rotateManipAction_
Called by pick Toolbar.
const Vec3d & center() const
get center
QAction * contextActionHide_
Context menu entry to hide a manipulator.
QAction * placeAction_
Called by pick Toolbar.
MovePlugin()
Default Constructor.
QAction * contextAction_
Context menu entry for showing per manipulator settings.
virtual const std::string & className() const =0
Return class name (implemented by the ACG_CLASSNAME macro)
QAction * moveAction_
Called by Toolbar to enable move mode.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
movePropsWidget * getDialogWidget(BaseObjectData *_obj)
Get properties dialog widget that is attached to BaseDataObject obj.
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
const std::string pickMode()
Get the current Picking mode.
int axisA_
stores the current axes in the tool
void slotUnifyBoundingBoxLongestAxis()
Scale Boundingbox longest axis to unit size (keeps aspect ratio)
void setAllTargets(bool _state)
Sets whether all targets should be affected or not.
QAction * toAllTargets_
Checked if transformation should be applied to all target objs.
int lastActiveManipulator_
Stores the last manipulator which has been clicked ( used for the toolbox dialog) ...
HexahedralMeshObject * hexahedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an HexahedralMeshObject if possible.
int axisB_
stores the current axes in the tool
OpenMesh::Vec3d getNearestFace(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest face to hitpoint.
OpenMesh::Vec3d getNearestEdge(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest edge to hitpoint.
const VecT & vertex(const VertexHandle &_vh) const
Get point _vh's coordinates.
void translateFaceSelection(int _objectId, Vector _vector)
translate current face selection of an Object by a given vector
QAction * rotateTranslateAction_
Called by pick Toolbar.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
QToolBar * toolbar_
Called by Toolbar to enable move mode.
QMenu * contextMenuManipControl_
Additional Context Menu replicating the toolbar stuff.
bool transformVertexSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QAction * resizeAction_
Called by pick Toolbar.
void updateSelectionType()
Get current primitive selection.
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
void setManipMode(QtTranslationManipulatorNode::ManipulatorMode _mode)
Set the manipulator manipulation mode.
QAction * biggerManipAction_
Called by pick Toolbar.
void slotEnableSelectionMode()
stores the current axes in the tool
void showManipulators()
Checks if the manipulators should be visible or not.
const GLMatrixd & matrix() const
Returns a const reference to the current transformation matrix.
void moveObject(ACG::Matrix4x4d mat, int _id)
Move an object with given id.
void slotScale()
Scale (with values from Tab)
void slotToggleAxisB()
Toggle the second axis for changing direction in tab.
OpenMesh::Vec3d getNearestVertex(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest vertex to hitpoint.
void slotUnifyBoundingBoxDiagonal()
Scale Boundingbox Diagonal to unit size.
void update_vertex_normals()
A simple heuristic to estimate the vertex normals.
void showProps()
Show properties of move manipulator in a dialog ( Called via context for picking. Get the picked id f...
void slotSetPosition()
Position of manipulator in tab changed.
void slotSetMoveMode(QAction *_action)
Called by Toolbar to enable move mode.
ACG::Matrix4x4d getLastManipulatorMatrix(bool _reset=true)
Get the Matrix of the last active Manipulator ( Identity if not found or hidden Manipulator ) ...
a class which provides an link generator for WhatsThisMessages linking to the user doc If you have an...
void translateVertexSelection(int _objectId, Vector _vector)
translate current vertex selection of an Object by a given vector
moveToolbarWidget * tool_
Widget for Toolbox.
void identity()
setup an identity matrix
const NormalAttrib & normals() const
return a pointer to the mesh
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
Add normals to mesh item (vertices/faces)
Plane * plane(BaseObjectData *_object)
Get a Plane from an object.
BaseNode * find_node(BaseNode *_root, unsigned int _node_idx)
Find a node in the scene graph.
void slotProjectToTangentPlane()
Project the current manipulator onto the tangent plane of the object.
The Menu will be shown when a node was picked.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
#define DATA_HEXAHEDRAL_MESH
double manip_size_modifier_
Modifier for the Size (changed by Mousewheel Events)
void transpose()
transpose matrix
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
bool toolboxActive_
True if the toolbox widget is active.
void slotEnableObjectMode()
stores the current axes in the tool
double manip_size_
Size for the manipulators.
Viewer::ActionMode actionMode()
Get the current Action mode.
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
void moveSelection(ACG::Matrix4x4d mat, int _id, QEvent::Type _type)
Move selection on an object with given id.
void slotRotate()
Rotate Manipulator (with values from Tab)
std::vector< int > activeManipulators_
Size for the manipulators.
void slotUpdateContextMenuNode(int _nodeId)
Hide context menu entry when right clicking on node other than manipulator node.
void hideManipulator()
Hide the manipulator( Called via context for picking. Get the picked id from the Qvariant attached to...
void getBB(MeshT &_mesh, ACG::Vec3d &_bb_min, ACG::Vec3d &_bb_max)
get bounding box diagonal of a mesh
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
QAction * contextMenuManipControlsAction_
Action holding the context menu for toolbar replication.
bool transformCellSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
void setDescriptions()
Set Descriptions for scriptable functions.
bool invert()
matrix inversion (returns true on success)
#define DATA_TRIANGLE_MESH
void slotToggleAxisA()
Toggle the first axis for changing direction in tab.
QtTranslationManipulatorNode::ManipulatorMode manMode_
Holds the current manipulator mode.
movePropsWidget * getDialogFromButton(QPushButton *_but)
Get parent properties dialog widget of QPushButton but.
ManipulatorMode
enum to define the manipulator mode
MoveObjectMarker objectMarker_
Object marker to dimm Objects during manipulator transformation.
int getIdentifier()
Get an identifier for that manipulator.
HexahedralMesh * hexahedralMesh(BaseObjectData *_object)
Get an HexahedralMesh from an object.
void unifyBB(MeshT &_mesh, Unificationtype u=MovePlugin::DIAGONAL)
scale mesh to have a boundingboxdiagonal of one
QIcon * toolIcon_
stores the current axes in the tool
Vec::value_type distPointLineSquared(const Vec &_p, const Vec &_v0, const Vec &_v1, Vec *_min_v)
squared distance from point _p to line segment (_v0,_v1)
void translate(int _objectId, Vector _vector)
translate an Object by a given vector
void unifyBoundingBox(Unificationtype u)
Size for the manipulators.
void transformMesh(ACG::Matrix4x4d _mat, MeshT &_mesh)
Transform a mesh with the given transformation matrix.
QAction * smallerManipAction_
Called by pick Toolbar.
void traverse(ACG::SceneGraph::MouseEventAction &_action)
PolyhedralMesh * polyhedralMesh(BaseObjectData *_object)
Get an PolyhedralMesh from an object.
Unificationtype
stores the current axes in the tool
void set_vertex(const VertexHandle &_vh, const VecT &_p)
Set the coordinates of point _vh.