43 #include "MovePlugin.hh" 45 #include <MeshTools/MeshInfoT.hh> 46 #include <OpenFlipper/BasePlugin/WhatsThisGenerator.hh> 52 #ifdef ENABLE_POLYLINE_SUPPORT 56 #ifdef ENABLE_TSPLINEMESH_SUPPORT 57 #include <ObjectTypes/TSplineMesh/TSplineMesh.hh> 60 #ifdef ENABLE_SKELETON_SUPPORT 61 #include <ObjectTypes/Skeleton/Helper/SkeletonTransform.hh> 64 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 68 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 72 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 76 #include <QMessageBox> 85 toolboxActive_(false),
89 moveSelectionAction_(0),
94 rotateTranslateAction_(0),
95 rotateManipAction_(0),
97 biggerManipAction_(0),
98 smallerManipAction_(0),
99 fixChildManipAction_(0),
100 transformRefPoseManipAction_(0),
101 currentPoseManipAction_(0),
102 placeAndSnapAction_(0),
103 pickToolBarActions_(0),
105 manip_size_modifier_(1.0),
106 lastActiveManipulator_(-1),
108 selectionType_(VERTEX),
110 contextActionHide_(0),
112 contextMenuManipControl_(0),
113 contextMenuManipControlsAction_(0),
117 transformedSelected_(false)
139 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
159 emit addPickMode(
"Separator");
160 emit addHiddenPickMode(
"Move");
161 emit setPickModeMouseTracking (
"Move",
true);
162 emit addHiddenPickMode(
"MoveSelection");
163 emit setPickModeMouseTracking (
"MoveSelection",
true);
166 emit registerKey (Qt::Key_Shift, Qt::NoModifier, tr(
"Manipulator rotation"),
true);
167 emit registerKey (Qt::Key_Shift, Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
168 emit registerKey (Qt::Key_Shift, Qt::ControlModifier | Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
169 emit registerKey (Qt::Key_Control, Qt::NoModifier, tr(
"Resize"),
true);
170 emit registerKey (Qt::Key_Control, Qt::ControlModifier, tr(
"Resize"),
true);
171 emit registerKey (Qt::Key_Control, Qt::ShiftModifier | Qt::ControlModifier, tr(
"Resize"),
true);
183 toolbar_ =
new QToolBar(tr(
"Transform and Move"));
184 toolbar_->setObjectName(
"TransformAndMoveToolBar");
189 moveAction_->setStatusTip(tr(
"Move object in 3D."));
190 moveAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-objects.png") );
197 moveSelectionAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-selections.png") );
210 pickToolbar_ =
new QToolBar(tr(
"Transform and Move PickTool bar"));
211 pickToolbar_->setObjectName(
"TransformAndMovePickToolBar");
213 pickToolbar_->setAttribute(Qt::WA_AlwaysShowToolTips,
true);
218 placeAction_->setStatusTip(tr(
"Place manipulator on object. <Doubleclick>"));
219 placeAction_->setToolTip(tr(
"Place manipulator on object. <Doubleclick>"));
220 placeAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-place.png") );
230 rotateTranslateAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-translaterotate.png") );
239 resizeAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-resize.png") );
249 rotateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-maniprotate.png") );
255 placeAndSnapAction_->setStatusTip(tr(
"Locally translate manipulator. Press and hold <Alt> for snapping."));
257 placeAndSnapAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-placeandsnap.png") );
265 smallerManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-manipsmall.png") );
273 biggerManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-manipbig.png") );
278 #if defined(ARCH_DARWIN) 285 emit setPickModeToolbar (
"MoveSelection",
pickToolbar_);
290 toAllTargets_ =
new QAction(tr(
"Apply to all targets"),
this);
292 toAllTargets_->setToolTip(tr(
"Apply transformation to all target objects"));
298 contextAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-properties.png") );
303 contextActionHide_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-hide.png") );
332 void MovePlugin::initializePlugin()
339 tool_->moveToOrigin->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"moveToCOG.png") );
340 tool_->moveToOrigin->setIconSize(QSize(48,48));
342 tool_->moveToOrigin->setWhatsThis(QString(tr(
"Moves the selected objects such that their center of gravity is at the origin."))
346 tool_->unifyBoundingBoxDiagonal->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB.png") );
347 tool_->unifyBoundingBoxDiagonal->setIconSize(QSize(48,48));
348 tool_->unifyBoundingBoxDiagonal->setWhatsThis(QString(tr(
"Rescale objects such that its bounding box diagonal has length one."))
352 tool_->unifyBoundingBoxLongest->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB_longest.png") );
353 tool_->unifyBoundingBoxLongest->setIconSize(QSize(48,48));
356 tool_->unifyBoundingBoxAll->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB_all.png") );
357 tool_->unifyBoundingBoxAll->setIconSize(QSize(48,48));
361 toolIcon_ =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-toolBox.png");
370 void MovePlugin::slotMouseWheelEvent(QWheelEvent * _event,
const std::string & )
405 if (_event->type() == QEvent::MouseButtonDblClick || (_event->type() == QEvent::MouseButtonPress
406 && _event->button() == Qt::LeftButton && (
placeAction_->isChecked() || placeMode_))) {
415 manMode_ = QtTranslationManipulatorNode::TranslationRotation;
419 if (o_it->manipPlaced())
420 o_it->manipulatorNode()->setMode(
manMode_);
431 }
else if (placeMode_) {
449 if (_event->buttons() == Qt::LeftButton)
450 emit nodeVisibilityChanged(-1);
459 void MovePlugin::slotKeyEvent (QKeyEvent* _event)
461 if ((_event->key() == Qt::Key_Control) && _event->modifiers() != Qt::ShiftModifier) {
464 }
else if ((_event->key () == Qt::Key_Shift) && _event->modifiers() != Qt::ControlModifier) {
465 setManipMode (QtTranslationManipulatorNode::LocalRotation);
471 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
488 void MovePlugin::slotKeyReleaseEvent (QKeyEvent* _event)
490 if ((_event->key() == Qt::Key_Control &&
manMode_ == QtTranslationManipulatorNode::Resize) ||
491 (_event->key() == Qt::Key_Shift && manMode_ == QtTranslationManipulatorNode::LocalRotation))
492 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
497 if (_pickmode ==
"Move")
499 _pW->objectRadioButton->setChecked(
true);
501 else if (_pickmode ==
"MoveSelection")
503 _pW->selectionRadioButton->setChecked(
true);
508 _pW->objectRadioButton->setAutoExclusive(
false);
509 _pW->selectionRadioButton->setAutoExclusive(
false);
510 _pW->objectRadioButton->setChecked(
false);
511 _pW->selectionRadioButton->setChecked(
false);
512 _pW->objectRadioButton->setAutoExclusive(
true);
513 _pW->selectionRadioButton->setAutoExclusive(
true);
530 hide_ = !(_mode ==
"Move" || _mode ==
"MoveSelection");
538 case QtTranslationManipulatorNode::Rotation:
541 case QtTranslationManipulatorNode::Resize:
544 case QtTranslationManipulatorNode::LocalRotation:
547 case QtTranslationManipulatorNode::Place:
550 case QtTranslationManipulatorNode::TranslationRotation:
586 #ifdef ENABLE_TSPLINEMESH_SUPPORT 587 }
else if ( object->
dataType() == DATA_TSPLINE_MESH ) {
590 #ifdef ENABLE_POLYLINE_SUPPORT 594 #ifdef ENABLE_SKELETON_SUPPORT 598 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 601 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
603 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 606 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
608 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 611 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
617 emit log(
LOGERR,tr(
"moveObject called for unsupported Object Type"));
679 if ( o_it->manipPlaced() )
680 o_it->manipulatorNode()->setMode (_mode);
686 case QtTranslationManipulatorNode::Rotation:
690 case QtTranslationManipulatorNode::Resize:
694 case QtTranslationManipulatorNode::LocalRotation:
698 case QtTranslationManipulatorNode::Place:
702 case QtTranslationManipulatorNode::TranslationRotation:
712 case QtTranslationManipulatorNode::Resize:
718 case QtTranslationManipulatorNode::LocalRotation:
724 case QtTranslationManipulatorNode::TranslationRotation:
730 case QtTranslationManipulatorNode::Place:
736 case QtTranslationManipulatorNode::Rotation:
760 if (node->
className() !=
"QtTranslationManipulatorNode") {
781 OpenFlipper::Options::redrawDisabled(
true );
784 if ( !placeMode_ && ((_event->type() == QEvent::MouseButtonRelease) ||
807 if ((o_it->id() != objectId) && !o_it->manipulatorNode()->draw_manipulator()) {
822 OpenFlipper::Options::redrawDisabled(
false );
843 object->manipPlaced(
true );
864 size_t node_idx, target_idx;
868 bool successfullyPicked =
false;
882 if(!successfullyPicked) {
892 #ifdef ENABLE_TSPLINEMESH_SUPPORT 893 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
894 hitPoint =
getNearestVertex(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
902 #ifdef ENABLE_TSPLINEMESH_SUPPORT 903 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
904 hitPoint =
getNearestEdge(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
912 #ifdef ENABLE_TSPLINEMESH_SUPPORT 913 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
914 hitPoint =
getNearestFace(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
924 if (successfullyPicked) {
926 object->manipPlaced(
true);
928 object->manipulatorNode()->loadIdentity();
929 object->manipulatorNode()->set_center(hitPoint);
930 object->manipulatorNode()->set_draw_cylinder(
true);
931 object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
933 object->manipulatorNode()->setMode(
manMode_);
934 object->manipulatorNode()->show();
993 emit nodeVisibilityChanged(obj->
id());
1007 emit nodeVisibilityChanged(obj->
id());
1024 if(_but == 0)
return 0;
1025 return dynamic_cast<movePropsWidget*
>((((_but->parentWidget())->parentWidget())->parentWidget()));
1034 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1041 newpos[0] = (pW->nposx->text()).toDouble(&ok);
1042 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1043 newpos[1] = (pW->nposy->text()).toDouble(&ok);
1044 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1045 newpos[2] = (pW->nposz->text()).toDouble(&ok);
1046 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1053 translation -=
object->manipulatorNode()->center();
1054 object->manipulatorNode()->set_center(newpos);
1068 emit createBackup(object->
id(),
"Object Translation");
1085 emit createBackup(object->
id(),
"Translation of selection");
1104 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1114 case 0: pW->axisAButton->setText(tr(
"X Direction"));
break;
1115 case 1: pW->axisAButton->setText(tr(
"Y Direction"));
break;
1116 case 2: pW->axisAButton->setText(tr(
"Z Direction"));
break;
1129 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1139 case 0: pW->axisBButton->setText(tr(
"X Direction"));
break;
1140 case 1: pW->axisBButton->setText(tr(
"Y Direction"));
break;
1141 case 2: pW->axisBButton->setText(tr(
"Z Direction"));
break;
1154 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1163 newdirA[0] = (pW->ndirAx->text()).toDouble(&ok);
1164 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1165 newdirA[1] = (pW->ndirAy->text()).toDouble(&ok);
1166 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1167 newdirA[2] = (pW->ndirAz->text()).toDouble(&ok);
1168 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1170 newdirB[0] = (pW->ndirBx->text()).toDouble(&ok);
1171 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1172 newdirB[1] = (pW->ndirBy->text()).toDouble(&ok);
1173 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1174 newdirB[2] = (pW->ndirBz->text()).toDouble(&ok);
1175 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1181 case 0: dirX = newdirA; xAxis =
true;
break;
1182 case 1: dirY = newdirA; yAxis =
true;
break;
1183 default: dirZ = newdirA;
break;
1187 case 0: dirX = newdirB; xAxis =
true;
break;
1188 case 1: dirY = newdirB; yAxis =
true;
break;
1189 default: dirZ = newdirB;
break;
1199 if ( (dirX | dirY) != 0.0){
1200 emit log(
LOGERR,tr(
"The axes of the new direction have to be orthogonal"));
1216 if (
object != 0 ) {
1219 object->manipulatorNode()->set_direction( dirX, dirY );
1235 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1242 translation[0] = (pW->translationX->text()).toDouble(&ok);
1243 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1244 translation[1] = (pW->translationY->text()).toDouble(&ok);
1245 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1246 translation[2] = (pW->translationZ->text()).toDouble(&ok);
1247 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1255 object->manipulatorNode()->set_center(
1264 emit createBackup(object->
id(),
"Translation of Object");
1279 emit createBackup(object->
id(),
"Translation of selection");
1292 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1298 emit createBackup(o_it->id(),
"Translation of object");
1312 emit createBackup(o_it->id(),
"Translation of selection");
1328 emit scriptInfo(QString(
"slotTranslation()"));
1340 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1344 if ( allTargets_ ) {
1345 emit log(
LOGWARN,tr(
"TODO Project for multiple targets"));
1348 emit log(
LOGWARN,tr(
"TODO Project for one target"));
1362 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1384 if (
object != 0 ) {
1391 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1392 else if ( object->
dataType( DATA_TSPLINE_MESH ) )
1393 object->
manipulatorNode()->set_center( MeshInfo::cog(PluginFunctions::tsplineMesh(
object)) );
1395 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1399 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1403 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1409 object->manipulatorNode()->loadIdentity();
1424 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1432 axis[0] = (pW->rotx->text()).toDouble(&ok);
1433 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1434 axis[1] = (pW->roty->text()).toDouble(&ok);
1435 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1436 axis[2] = (pW->rotz->text()).toDouble(&ok);
1437 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1439 angle = (pW->rotAngle->text()).toDouble(&ok);
1440 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Angle"));
return; }
1447 object->manipulatorNode()->rotate(angle, axis);
1459 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1460 if (object->
dataType(DATA_TSPLINE_MESH))
1463 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1467 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1471 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1477 emit createBackup(object->
id(),
"Rotation of object");
1497 emit createBackup(object->
id(),
"Rotation of selection");
1506 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1515 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1516 if (o_it->dataType(DATA_TSPLINE_MESH))
1519 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1523 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1527 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1533 emit createBackup(o_it->id(),
"Rotation of object");
1552 emit createBackup(o_it->id(),
"Rotation of selection");
1568 emit scriptInfo(QString(
"slotRotate()"));
1580 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1588 scale[0] = (pW->scalex->text()).toDouble(&ok);
1589 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 1"));
return; }
1590 scale[1] = (pW->scaley->text()).toDouble(&ok);
1591 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 2"));
return; }
1592 scale[2] = (pW->scalez->text()).toDouble(&ok);
1593 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 3"));
return; }
1601 object->manipulatorNode()->scale(scale);
1611 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1612 if (object->
dataType(DATA_TSPLINE_MESH))
1615 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1619 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1623 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1629 emit createBackup(object->
id(),
"Scaling of object");
1648 emit createBackup(object->
id(),
"Scaling of selection");
1656 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1665 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1666 if (o_it->dataType(DATA_TSPLINE_MESH))
1669 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1673 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1677 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1683 emit createBackup(o_it->id(),
"Scaling of object");
1702 emit createBackup(o_it->id(),
"Scaling of selection");
1713 emit createBackup(object->
id(),
"Scaling");
1718 emit scriptInfo(QString(
"slotScale()"));
1731 bool useCommonCOG =
false;
1735 if ( OpenFlipper::Options::gui()) {
1736 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);
1739 useCommonCOG = ( button == QMessageBox::Yes );
1742 if ( useCommonCOG ) {
1744 double vertexCount = 0.0;
1750 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1751 vertexCount += double(mesh->n_vertices());
1756 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1757 vertexCount += double(mesh->n_vertices());
1760 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1761 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1762 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(*o_it);
1763 cog += MeshInfo::cog(mesh) * double(mesh.n_vertices());
1764 vertexCount += double(mesh.n_vertices());
1768 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1771 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1772 vertexCount += double(mesh.n_vertices());
1776 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1779 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1780 vertexCount += double(mesh.n_vertices());
1784 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1787 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1788 vertexCount += double(mesh.n_vertices());
1793 cog = cog / vertexCount;
1802 if ( !useCommonCOG )
1803 cog = MeshInfo::cog(mesh);
1805 for ( TriMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1806 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1808 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1814 if ( !useCommonCOG )
1815 cog = MeshInfo::cog(mesh);
1817 for ( PolyMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1818 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1820 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1824 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1825 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1826 TSplineMesh* mesh = PluginFunctions::tsplineMesh(*o_it);
1828 if ( !useCommonCOG )
1829 cog = MeshInfo::cog(mesh);
1831 for ( TSplineMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1832 mesh->set_point(v_it , ( mesh->point(v_it) ) - cog );
1834 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1839 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1843 if ( !useCommonCOG )
1844 cog = cogVolumeMesh(mesh);
1849 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1854 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1858 if ( !useCommonCOG )
1859 cog = cogVolumeMesh(mesh);
1864 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1869 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1873 if ( !useCommonCOG )
1874 cog = cogVolumeMesh(mesh);
1879 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1888 o_it->manipulatorNode()->loadIdentity();
1890 emit createBackup(o_it->id(),
"Move to origin");
1919 bool useCommonBB =
false;
1924 if ( OpenFlipper::Options::gui()) {
1925 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);
1928 useCommonBB = ( button == QMessageBox::Yes );
1932 if ( useCommonBB ) {
1941 getBB(mesh,bb_min_tmp,bb_max_tmp);
1948 getBB(mesh,bb_min_tmp,bb_max_tmp);
1953 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1954 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1955 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(*o_it);
1956 getBB(mesh,bb_min_tmp,bb_max_tmp);
1962 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1965 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1971 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1974 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1980 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1983 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1994 if ( useCommonBB ) {
1999 #ifdef ENABLE_TSPLINEMESH_SUPPORT 2000 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
2001 unifyBB(*PluginFunctions::tsplineMesh(*o_it),bb_min,bb_max, u);
2003 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 2007 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 2011 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 2020 #ifdef ENABLE_TSPLINEMESH_SUPPORT 2021 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
2022 unifyBB(*PluginFunctions::tsplineMesh(*o_it), u);
2024 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 2028 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 2032 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 2071 num = QString::number(pos[0]); pW->posx->setText(num);
2072 num = QString::number(pos[1]); pW->posy->setText(num);
2073 num = QString::number(pos[2]); pW->posz->setText(num);
2075 TriMesh::Point direction =
object->manipulatorNode()->directionX();
2076 num = QString::number(direction[0]); pW->dirxx->setText(num);
2077 num = QString::number(direction[1]); pW->dirxy->setText(num);
2078 num = QString::number(direction[2]); pW->dirxz->setText(num);
2080 direction =
object->manipulatorNode()->directionY();
2081 num = QString::number(direction[0]); pW->diryx->setText(num);
2082 num = QString::number(direction[1]); pW->diryy->setText(num);
2083 num = QString::number(direction[2]); pW->diryz->setText(num);
2085 direction =
object->manipulatorNode()->directionZ();
2086 num = QString::number(direction[0]); pW->dirzx->setText(num);
2087 num = QString::number(direction[1]); pW->dirzy->setText(num);
2088 num = QString::number(direction[2]); pW->dirzz->setText(num);
2101 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
2103 if ( (*it)->getBaseObjectDataId() == _obj->
id() )
2144 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
2149 setManipMode (QtTranslationManipulatorNode::LocalRotation);
2167 emit nodeVisibilityChanged (-1);
2175 emit nodeVisibilityChanged (-1);
2194 matrix =
object->manipulatorNode()->matrix();
2196 object->manipulatorNode()->loadIdentity();
2212 template<
typename MeshT >
2221 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2222 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2223 for (; v_it!=v_end; ++v_it) {
2229 typename MeshT::Normal n = invTranspMat.
transform_vector(_mesh.normal(*v_it));
2233 _mesh.set_normal(*v_it,n);
2236 typename MeshT::FaceIter f_it = _mesh.faces_begin();
2237 typename MeshT::FaceIter f_end = _mesh.faces_end();
2238 for (; f_it != f_end; ++f_it) {
2241 typename MeshT::Normal n = invTranspMat.
transform_vector(_mesh.normal(*f_it));
2245 _mesh.set_normal(*f_it,n);
2252 #ifdef ENABLE_POLYLINE_SUPPORT 2259 template<
class PolyLineT >
2260 void MovePlugin::transformPolyLine(
ACG::Matrix4x4d _mat , PolyLineT& _polyLine ) {
2262 #pragma omp parallel for 2264 for (
int i = 0 ; i < (int)_polyLine.n_vertices(); ++i )
2273 #ifdef ENABLE_SKELETON_SUPPORT 2288 #if defined(ENABLE_HEXAHEDRALMESH_SUPPORT) || defined(ENABLE_POLYHEDRALMESH_SUPPORT) || defined(ENABLE_TETRAHEDRALMESH_SUPPORT) 2298 template<
typename VolumeMeshT >
2317 _normalAttrib[*v_it] = invTranspMat.
transform_vector(_normalAttrib[*v_it]).normalized();
2324 _normalAttrib[*f_it] = invTranspMat.
transform_vector(_normalAttrib[*f_it]).normalized();
2333 template<
typename VolumeMeshT >
2334 ACG::Vec3d MovePlugin::cogVolumeMesh( VolumeMeshT& _mesh )
2339 for (; v_it!=v_end; ++v_it)
2340 cog += _mesh.vertex(*v_it);
2342 return cog/(double)_mesh.n_vertices();
2353 template<
typename VolumeMeshT >
2354 void MovePlugin::getBBVolumeMesh( VolumeMeshT& _mesh,
ACG::Vec3d& _bb_min,
ACG::Vec3d& _bb_max)
2360 if( v_it == v_end)
return;
2362 _bb_min = _mesh.vertex(*v_it);
2363 _bb_max = _mesh.vertex(*v_it);
2365 for(; v_it!=v_end; ++v_it)
2367 _bb_min.
minimize( _mesh.vertex(*v_it));
2368 _bb_max.
maximize( _mesh.vertex(*v_it));
2379 template<
typename VolumeMeshT >
2383 if( _mesh.n_vertices() == 0)
return;
2386 getBBVolumeMesh( _mesh, bb_min, bb_max );
2388 unifyBBVolumeMesh( _mesh, _normalAttrib, bb_min, bb_max, u );
2401 template<
typename VolumeMeshT >
2404 ACG::Vec3d bb_center = 0.5 * (_bb_min + _bb_max) ;
2406 double bb_longestAxis = bb_diagonal.
max();
2411 case MovePlugin::DIAGONAL :
2412 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2414 case MovePlugin::LONGEST_AXIS :
2417 case MovePlugin::ALL_AXIS :
2421 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2426 _mesh.set_vertex(*v_it, (_mesh.vertex(*v_it) - bb_center) * scale + bb_center);
2440 template<
typename MeshT >
2443 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2444 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2447 if( v_it == v_end)
return;
2449 typename MeshT::Point bb_min = _mesh.point(*v_it);
2450 typename MeshT::Point bb_max = _mesh.point(*v_it);
2452 for(; v_it!=v_end; ++v_it)
2454 bb_min.minimize( _mesh.point(*v_it));
2455 bb_max.maximize( _mesh.point(*v_it));
2458 typename MeshT::Point bb_center = 0.5 * (bb_min + bb_max) ;
2460 typename MeshT::Scalar bb_longestAxis = bb_diagonal.
max();
2465 case MovePlugin::DIAGONAL :
2466 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2468 case MovePlugin::LONGEST_AXIS :
2471 case MovePlugin::ALL_AXIS :
2475 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2478 for( v_it = _mesh.vertices_begin(); v_it!=v_end; ++v_it)
2481 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2484 _mesh.update_normals();
2494 template<
typename MeshT >
2497 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2498 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2501 if( v_it == v_end)
return;
2503 _bb_min = _mesh.point(*v_it);
2504 _bb_max = _mesh.point(*v_it);
2506 for(; v_it!=v_end; ++v_it)
2508 _bb_min.
minimize( _mesh.point(*v_it));
2509 _bb_max.
maximize( _mesh.point(*v_it));
2522 template<
typename MeshT >
2526 typename MeshT::Point bb_center = 0.5 * (_bb_min + _bb_max) ;
2528 typename MeshT::Scalar bb_longestAxis = bb_diagonal.
max();
2532 case MovePlugin::DIAGONAL :
2533 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2535 case MovePlugin::LONGEST_AXIS :
2538 case MovePlugin::ALL_AXIS :
2542 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2545 typename MeshT::VertexIter v_it;
2547 for( v_it = _mesh.vertices_begin(); v_it!=_mesh.vertices_end(); ++v_it)
2548 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2550 _mesh.update_normals();
2562 bool functionExistsMeshV;
2563 emit functionExists(
"meshobjectselection",
"vertexTypeActive()", functionExistsMeshV);
2564 bool functionExistsMeshE;
2565 emit functionExists(
"meshobjectselection",
"edgeTypeActive()", functionExistsMeshE);
2566 bool functionExistsMeshF;
2567 emit functionExists(
"meshobjectselection",
"faceTypeActive()", functionExistsMeshF);
2569 bool connected =
false;
2572 if(functionExistsMeshV && functionExistsMeshE && functionExistsMeshF) {
2577 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"vertexTypeActive")) {
2580 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"edgeTypeActive")) {
2583 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"faceTypeActive")) {
2589 #if defined(ENABLE_HEXAHEDRALMESH_SUPPORT) || defined(ENABLE_POLYHEDRALMESH_SUPPORT) || defined(ENABLE_TETRAHEDRALMESH_SUPPORT) 2590 bool functionExistsVolumeMeshV;
2591 emit functionExists(
"volumemeshselection",
"vertexTypeActive()", functionExistsVolumeMeshV);
2592 bool functionExistsVolumeMeshE;
2593 emit functionExists(
"volumemeshselection",
"edgeTypeActive()", functionExistsVolumeMeshE);
2594 bool functionExistsVolumeMeshF;
2595 emit functionExists(
"volumemeshselection",
"faceTypeActive()", functionExistsVolumeMeshF);
2596 bool functionExistsVolumeMeshC;
2597 emit functionExists(
"volumemeshselection",
"cellTypeActive()", functionExistsVolumeMeshC);
2599 if ( functionExistsVolumeMeshV && functionExistsVolumeMeshE && functionExistsVolumeMeshF && functionExistsVolumeMeshC) {
2604 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"vertexTypeActive")) {
2607 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"edgeTypeActive")) {
2610 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"faceTypeActive")) {
2613 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"cellTypeActive")) {
2620 emit log(
LOGWARN, tr(
"Unable to connect to Selection-Plugin. MoveSelection will work on vertices only."));
2633 allTargets_ = _state;
2641 template<
typename MeshType >
2644 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2646 if ( !fh.is_valid() )
2649 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2650 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2651 typename MeshType::Scalar shortest_distance = (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2652 typename MeshType::VertexHandle vh = *fv_it;
2654 for (; fv_it.is_valid(); ++fv_it) {
2656 typename MeshType::Scalar tmpdist =
2657 (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2659 if(tmpdist < shortest_distance) {
2660 shortest_distance = tmpdist;
2673 template<
typename MeshType >
2676 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2681 typename MeshType::FaceEdgeIter fe_it(*_mesh, fh);
2682 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2684 typename MeshType::Point center;
2685 typename MeshType::Scalar closest_dist(-1);
2687 for (; fe_it.is_valid(); ++fe_it) {
2689 typename MeshType::HalfedgeHandle heh0 = _mesh->halfedge_handle(*fe_it, 0);
2690 typename MeshType::HalfedgeHandle heh1 = _mesh->halfedge_handle(*fe_it, 1);
2692 typename MeshType::Point lp0 = _mesh->point(_mesh->to_vertex_handle(heh0));
2693 typename MeshType::Point lp1 = _mesh->point(_mesh->to_vertex_handle(heh1));
2702 if (dist_new < closest_dist || closest_dist == -1) {
2704 closest_dist = dist_new;
2705 center = lp0 + (lp1 - lp0) * .5;
2718 template<
typename MeshType >
2721 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2723 if ( !fh.is_valid() )
2726 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2728 typename MeshType::Point cog(0.0,0.0,0.0);
2731 for (; fv_it.is_valid(); ++fv_it) {
2733 cog += _mesh->point(*fv_it);
2742 void MovePlugin::slotAllCleared(){
2748 void MovePlugin::objectDeleted(
int _id ){
bool invert()
matrix inversion (returns true on success)
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
bool toolboxActive_
True if the toolbox widget is active.
bool is_identity() const
check if the matrix is the identity ( up to an epsilon )
void placeManip(QMouseEvent *_event, bool _snap=false)
Place and show the Manipulator.
Plane * plane(BaseObjectData *_object)
Get a Plane from an object.
bool transformCellSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
bool transformFaceSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
QAction * resizeAction_
Called by pick Toolbar.
void slotEnableSelectionMode()
stores the current axes in the tool
int axisB_
stores the current axes in the tool
QAction * biggerManipAction_
Called by pick Toolbar.
QString generateLink(const QString &_ref="", const QString &_site="index.html") const
generates a clickable link to the documentation for whatsThis Messages
void slotToggleAxisB()
Toggle the second axis for changing direction in tab.
void setDescriptions()
Set Descriptions for scriptable functions.
virtual const std::string & className() const =0
Return class name (implemented by the ACG_CLASSNAME macro)
void updateSelectionType()
Get current primitive selection.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
pick any of the prior targets (should be implemented for all nodes)
Kernel::Point Point
Coordinate type.
bool visible()
Is node visible (status == Active)?
QAction * placeAction_
Called by pick Toolbar.
QAction * contextMenuManipControlsAction_
Action holding the context menu for toolbar replication.
bool manipPlaced()
Check if the manipulator has been placed.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
void transformSkeleton(Matrix4x4 _transformation, Skeleton::Pose *_pose=0)
transform the skeleton
void updateManipulatorDialog()
Update the Dialog with the last clicked manipulator.
ManipulatorMode
enum to define the manipulator mode
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
void setPickModeProps(movePropsWidget *_pW, const std::string &_pickmode)
List of properties dialogs (each corresponding to one manipulator)
void moveSelection(ACG::Matrix4x4d mat, int _id, QEvent::Type _type)
Move selection on an object with given id.
moveToolbarWidget * tool_
Widget for Toolbox.
void slotSetPosition()
Position of manipulator in tab changed.
MovePlugin()
Default Constructor.
void slotToggleAxisA()
Toggle the first axis for changing direction in tab.
Unificationtype
stores the current axes in the tool
bool dataType(DataType _type) const
TetrahedralMeshObject * tetrahedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an TetrahedralMeshObject if possible.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
movePropsWidget * getDialogWidget(BaseObjectData *_obj)
Get properties dialog widget that is attached to BaseDataObject obj.
QtTranslationManipulatorNode::ManipulatorMode manMode_
Holds the current manipulator mode.
void translate(int _objectId, Vector _vector)
translate an Object by a given vector
PolyhedralMeshObject * polyhedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an PolyhedralMeshObject if possible.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
void transpose()
transpose matrix
const QStringList ALL_OBJECTS
Iterable object range.
void showManipulators()
Checks if the manipulators should be visible or not.
void setManipMode(QtTranslationManipulatorNode::ManipulatorMode _mode)
Set the manipulator manipulation mode.
void showProps()
Show properties of move manipulator in a dialog ( Called via context for picking. Get the picked id f...
void slotSetDirection()
Set Direction of manipulator in tab changed.
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)
double manip_size_
Size for the manipulators.
QToolBar * pickToolbar_
Called by pick Toolbar.
bool transformedSelected_
stores if any selected elements where transformed
#define DATA_TETRAHEDRAL_MESH
QList< movePropsWidget * > propsWindows_
List of properties dialogs (each corresponding to one manipulator)
QAction * moveAction_
Called by Toolbar to enable move mode.
OpenMesh::Vec3d getNearestFace(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest face to hitpoint.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
PolyhedralMesh * polyhedralMesh(BaseObjectData *_object)
Get an PolyhedralMesh from an object.
int axisA_
stores the current axes in the tool
void slotMoveToOrigin()
Move target Meshes cog to the origin.
MoveObjectMarker objectMarker_
Object marker to dimm Objects during manipulator transformation.
HexahedralMesh * hexahedralMesh(BaseObjectData *_object)
Get an HexahedralMesh from an object.
void transformMesh(ACG::Matrix4x4d _mat, MeshT &_mesh)
Transform a mesh with the given transformation matrix.
Skeleton transformation class.
HexahedralMeshObject * hexahedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an HexahedralMeshObject if possible.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
void getBB(MeshT &_mesh, ACG::Vec3d &_bb_min, ACG::Vec3d &_bb_max)
get bounding box diagonal of a mesh
void update_vertex_normals()
A simple heuristic to estimate the vertex normals.
QActionGroup * toolBarActions_
Called by Toolbar to enable move mode.
const NormalAttrib & normals() const
return a pointer to the mesh
void slotScale()
Scale (with values from Tab)
void transform(const ACG::Matrix4x4d &_mat)
Transform the plane with given matrix.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
QAction * toAllTargets_
Checked if transformation should be applied to all target objs.
VectorT< double, 3 > Vec3d
void slotProjectToTangentPlane()
Project the current manipulator onto the tangent plane of the object.
QAction * placeAndSnapAction_
Called by pick Toolbar.
void slotEnableObjectMode()
stores the current axes in the tool
QAction * contextAction_
Context menu entry for showing per manipulator settings.
const GLMatrixd & matrix() const
Returns a const reference to the current transformation matrix.
void unifyBB(MeshT &_mesh, Unificationtype u=MovePlugin::DIAGONAL)
scale mesh to have a boundingboxdiagonal of one
void moveObject(ACG::Matrix4x4d mat, int _id)
Move an object with given id.
QAction * rotateTranslateAction_
Called by pick Toolbar.
#define DATA_HEXAHEDRAL_MESH
bool transformVertexSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QAction * smallerManipAction_
Called by pick Toolbar.
void slotUnifyBoundingBoxLongestAxis()
Scale Boundingbox longest axis to unit size (keeps aspect ratio)
QAction * contextActionHide_
Context menu entry to hide a manipulator.
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
The Menu will be shown when a node was picked.
void slotTranslation()
perform a translation for Manipulator in tab
QAction * rotateManipAction_
Called by pick Toolbar.
bool transformEdgeSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QIcon * toolIcon_
stores the current axes in the tool
const VecT & vertex(const VertexHandle &_vh) const
Get point _vh's coordinates.
int getIdentifier()
Get an identifier for that manipulator.
void translateFaceSelection(int _objectId, Vector _vector)
translate current face selection of an Object by a given vector
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
void slotMoveManipToCOG()
Move the current manipulator to the cog of the object.
movePropsWidget * getDialogFromButton(QPushButton *_but)
Get parent properties dialog widget of QPushButton but.
QToolBar * toolbar_
Called by Toolbar to enable move mode.
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
double manip_size_modifier_
Modifier for the Size (changed by Mousewheel Events)
void identity()
setup an identity matrix
BaseNode * find_node(BaseNode *_root, unsigned int _node_idx)
Find a node in the scene graph.
a class which provides an link generator for WhatsThisMessages linking to the user doc If you have an...
#define DATA_POLYHEDRAL_MESH
void hideManipulator()
Hide the manipulator( Called via context for picking. Get the picked id from the Qvariant attached to...
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
void setViewObjectMarker(ViewObjectMarker *_marker)
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
void setAllTargets(bool _state)
Sets whether all targets should be affected or not.
OpenMesh::Vec3d getNearestEdge(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest edge to hitpoint.
picks faces (should be implemented for all nodes)
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
void slotUnifyBoundingBoxDiagonal()
Scale Boundingbox Diagonal to unit size.
Viewer::ActionMode actionMode()
Get the current Action mode.
SelectionType selectionType_
Current SelectionType of SelectionPlugin.
ACG::Matrix4x4d getLastManipulatorMatrix(bool _reset=true)
Get the Matrix of the last active Manipulator ( Identity if not found or hidden Manipulator ) ...
OpenMesh::Vec3d getNearestVertex(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest vertex to hitpoint.
#define DATA_TRIANGLE_MESH
void slotUpdateContextMenuNode(int _nodeId)
Hide context menu entry when right clicking on node other than manipulator node.
std::vector< int > activeManipulators_
Size for the manipulators.
void translateEdgeSelection(int _objectId, Vector _vector)
translate current edge selection of an Object by a given vector
int lastActiveManipulator_
Stores the last manipulator which has been clicked ( used for the toolbox dialog) ...
int targetCount()
Get the number of target objects.
void slotSetMoveMode(QAction *_action)
Called by Toolbar to enable move mode.
MeshT * mesh()
return a pointer to the mesh
void slotRotate()
Rotate Manipulator (with values from Tab)
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
void set_vertex(const VertexHandle &_vh, const VecT &_p)
Set the coordinates of point _vh.
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
const Vec3d & center() const
get center
void traverse(ACG::SceneGraph::MouseEventAction &_action)
void unifyBoundingBox(Unificationtype u)
Size for the manipulators.
void translateVertexSelection(int _objectId, Vector _vector)
translate current vertex selection of an Object by a given vector
TetrahedralMesh * tetrahedralMesh(BaseObjectData *_object)
Get an TetrahedralMesh from an object.
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
QtTranslationManipulatorNode * manipulatorNode()
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
QMenu * contextMenuManipControl_
Additional Context Menu replicating the toolbar stuff.
const std::string pickMode()
Get the current Picking mode.
void slotUnifyBoundingBoxAllAxis()
Scale all Boundingbox axis to unit size.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
Scalar max() const
return the maximal component
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
QAction * moveSelectionAction_
Called by Toolbar to enable move mode.