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 & )
404 if (_event->type() == QEvent::MouseButtonDblClick || (_event->type() == QEvent::MouseButtonPress
405 && _event->button() == Qt::LeftButton && (
placeAction_->isChecked() || placeMode_))) {
414 manMode_ = QtTranslationManipulatorNode::TranslationRotation;
417 if (o_it->manipPlaced())
418 o_it->manipulatorNode()->setMode(
manMode_);
429 }
else if (placeMode_) {
447 if (_event->buttons() == Qt::LeftButton)
448 emit nodeVisibilityChanged(-1);
457 void MovePlugin::slotKeyEvent (QKeyEvent* _event)
459 if ((_event->key() == Qt::Key_Control) && _event->modifiers() != Qt::ShiftModifier) {
462 }
else if ((_event->key () == Qt::Key_Shift) && _event->modifiers() != Qt::ControlModifier) {
463 setManipMode (QtTranslationManipulatorNode::LocalRotation);
469 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
486 void MovePlugin::slotKeyReleaseEvent (QKeyEvent* _event)
488 if ((_event->key() == Qt::Key_Control &&
manMode_ == QtTranslationManipulatorNode::Resize) ||
489 (_event->key() == Qt::Key_Shift && manMode_ == QtTranslationManipulatorNode::LocalRotation))
490 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
495 if (_pickmode ==
"Move")
497 _pW->objectRadioButton->setChecked(
true);
499 else if (_pickmode ==
"MoveSelection")
501 _pW->selectionRadioButton->setChecked(
true);
506 _pW->objectRadioButton->setAutoExclusive(
false);
507 _pW->selectionRadioButton->setAutoExclusive(
false);
508 _pW->objectRadioButton->setChecked(
false);
509 _pW->selectionRadioButton->setChecked(
false);
510 _pW->objectRadioButton->setAutoExclusive(
true);
511 _pW->selectionRadioButton->setAutoExclusive(
true);
528 hide_ = !(_mode ==
"Move" || _mode ==
"MoveSelection");
536 case QtTranslationManipulatorNode::Rotation:
539 case QtTranslationManipulatorNode::Resize:
542 case QtTranslationManipulatorNode::LocalRotation:
545 case QtTranslationManipulatorNode::Place:
548 case QtTranslationManipulatorNode::TranslationRotation:
584 #ifdef ENABLE_TSPLINEMESH_SUPPORT 585 }
else if ( object->
dataType() == DATA_TSPLINE_MESH ) {
588 #ifdef ENABLE_POLYLINE_SUPPORT 592 #ifdef ENABLE_SKELETON_SUPPORT 596 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 599 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
601 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 604 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
606 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 609 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
615 emit log(
LOGERR,tr(
"moveObject called for unsupported Object Type"));
677 if ( o_it->manipPlaced() )
678 o_it->manipulatorNode()->setMode (_mode);
684 case QtTranslationManipulatorNode::Rotation:
688 case QtTranslationManipulatorNode::Resize:
692 case QtTranslationManipulatorNode::LocalRotation:
696 case QtTranslationManipulatorNode::Place:
700 case QtTranslationManipulatorNode::TranslationRotation:
710 case QtTranslationManipulatorNode::Resize:
716 case QtTranslationManipulatorNode::LocalRotation:
722 case QtTranslationManipulatorNode::TranslationRotation:
728 case QtTranslationManipulatorNode::Place:
734 case QtTranslationManipulatorNode::Rotation:
758 if (node->
className() !=
"QtTranslationManipulatorNode") {
779 OpenFlipper::Options::redrawDisabled(
true );
782 if ( !placeMode_ && ((_event->type() == QEvent::MouseButtonRelease) ||
804 if ((o_it->id() != objectId) && !o_it->manipulatorNode()->draw_manipulator()) {
819 OpenFlipper::Options::redrawDisabled(
false );
840 object->manipPlaced(
true );
861 size_t node_idx, target_idx;
865 bool successfullyPicked =
false;
879 if(!successfullyPicked) {
889 #ifdef ENABLE_TSPLINEMESH_SUPPORT 890 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
891 hitPoint =
getNearestVertex(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
899 #ifdef ENABLE_TSPLINEMESH_SUPPORT 900 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
901 hitPoint =
getNearestEdge(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
909 #ifdef ENABLE_TSPLINEMESH_SUPPORT 910 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
911 hitPoint =
getNearestFace(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
921 if (successfullyPicked) {
923 object->manipPlaced(
true);
925 object->manipulatorNode()->loadIdentity();
926 object->manipulatorNode()->set_center(hitPoint);
927 object->manipulatorNode()->set_draw_cylinder(
true);
928 object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
930 object->manipulatorNode()->setMode(
manMode_);
931 object->manipulatorNode()->show();
990 emit nodeVisibilityChanged(obj->
id());
1004 emit nodeVisibilityChanged(obj->
id());
1021 if(_but == 0)
return 0;
1022 return dynamic_cast<movePropsWidget*
>((((_but->parentWidget())->parentWidget())->parentWidget()));
1031 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1038 newpos[0] = (pW->nposx->text()).toDouble(&ok);
1039 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1040 newpos[1] = (pW->nposy->text()).toDouble(&ok);
1041 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1042 newpos[2] = (pW->nposz->text()).toDouble(&ok);
1043 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1050 translation -=
object->manipulatorNode()->center();
1051 object->manipulatorNode()->set_center(newpos);
1065 emit createBackup(object->
id(),
"Object Translation");
1082 emit createBackup(object->
id(),
"Translation of selection");
1101 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1111 case 0: pW->axisAButton->setText(tr(
"X Direction"));
break;
1112 case 1: pW->axisAButton->setText(tr(
"Y Direction"));
break;
1113 case 2: pW->axisAButton->setText(tr(
"Z Direction"));
break;
1126 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1136 case 0: pW->axisBButton->setText(tr(
"X Direction"));
break;
1137 case 1: pW->axisBButton->setText(tr(
"Y Direction"));
break;
1138 case 2: pW->axisBButton->setText(tr(
"Z Direction"));
break;
1151 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1160 newdirA[0] = (pW->ndirAx->text()).toDouble(&ok);
1161 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1162 newdirA[1] = (pW->ndirAy->text()).toDouble(&ok);
1163 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1164 newdirA[2] = (pW->ndirAz->text()).toDouble(&ok);
1165 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1167 newdirB[0] = (pW->ndirBx->text()).toDouble(&ok);
1168 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1169 newdirB[1] = (pW->ndirBy->text()).toDouble(&ok);
1170 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1171 newdirB[2] = (pW->ndirBz->text()).toDouble(&ok);
1172 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1178 case 0: dirX = newdirA; xAxis =
true;
break;
1179 case 1: dirY = newdirA; yAxis =
true;
break;
1180 default: dirZ = newdirA;
break;
1184 case 0: dirX = newdirB; xAxis =
true;
break;
1185 case 1: dirY = newdirB; yAxis =
true;
break;
1186 default: dirZ = newdirB;
break;
1196 if ( (dirX | dirY) != 0.0){
1197 emit log(
LOGERR,tr(
"The axes of the new direction have to be orthogonal"));
1211 if (
object != 0 ) {
1214 object->manipulatorNode()->set_direction( dirX, dirY );
1230 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1237 translation[0] = (pW->translationX->text()).toDouble(&ok);
1238 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1239 translation[1] = (pW->translationY->text()).toDouble(&ok);
1240 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1241 translation[2] = (pW->translationZ->text()).toDouble(&ok);
1242 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1250 object->manipulatorNode()->set_center(
1259 emit createBackup(object->
id(),
"Translation of Object");
1274 emit createBackup(object->
id(),
"Translation of selection");
1286 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1292 emit createBackup(o_it->id(),
"Translation of object");
1306 emit createBackup(o_it->id(),
"Translation of selection");
1322 emit scriptInfo(QString(
"slotTranslation()"));
1334 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1338 if ( allTargets_ ) {
1339 emit log(
LOGWARN,tr(
"TODO Project for multiple targets"));
1342 emit log(
LOGWARN,tr(
"TODO Project for one target"));
1356 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1378 if (
object != 0 ) {
1385 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1386 else if ( object->
dataType( DATA_TSPLINE_MESH ) )
1387 object->
manipulatorNode()->set_center( MeshInfo::cog(PluginFunctions::tsplineMesh(
object)) );
1389 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1393 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1397 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1403 object->manipulatorNode()->loadIdentity();
1418 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
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_HEXAHEDRALMESH_SUPPORT 1461 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1465 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1471 emit createBackup(object->
id(),
"Rotation of object");
1491 emit createBackup(object->
id(),
"Rotation of selection");
1500 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1509 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1510 if (o_it->dataType(DATA_TSPLINE_MESH))
1513 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1517 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1521 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1527 emit createBackup(o_it->id(),
"Rotation of object");
1546 emit createBackup(o_it->id(),
"Rotation of selection");
1562 emit scriptInfo(QString(
"slotRotate()"));
1574 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1582 scale[0] = (pW->scalex->text()).toDouble(&ok);
1583 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 1"));
return; }
1584 scale[1] = (pW->scaley->text()).toDouble(&ok);
1585 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 2"));
return; }
1586 scale[2] = (pW->scalez->text()).toDouble(&ok);
1587 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 3"));
return; }
1595 object->manipulatorNode()->scale(scale);
1605 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1606 if (object->
dataType(DATA_TSPLINE_MESH))
1609 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1613 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1617 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1623 emit createBackup(object->
id(),
"Scaling of object");
1642 emit createBackup(object->
id(),
"Scaling of selection");
1649 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1658 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1659 if (o_it->dataType(DATA_TSPLINE_MESH))
1662 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1666 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1670 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1676 emit createBackup(o_it->id(),
"Scaling of object");
1695 emit createBackup(o_it->id(),
"Scaling of selection");
1706 emit createBackup(object->
id(),
"Scaling");
1711 emit scriptInfo(QString(
"slotScale()"));
1724 bool useCommonCOG =
false;
1728 if ( OpenFlipper::Options::gui()) {
1729 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);
1732 useCommonCOG = ( button == QMessageBox::Yes );
1735 if ( useCommonCOG ) {
1737 double vertexCount = 0.0;
1743 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1744 vertexCount += double(mesh->n_vertices());
1749 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1750 vertexCount += double(mesh->n_vertices());
1753 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1754 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1755 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(o_it);
1756 cog += MeshInfo::cog(mesh) * double(mesh.n_vertices());
1757 vertexCount += double(mesh.n_vertices());
1761 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1764 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1765 vertexCount += double(mesh.n_vertices());
1769 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1772 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1773 vertexCount += double(mesh.n_vertices());
1777 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1780 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1781 vertexCount += double(mesh.n_vertices());
1786 cog = cog / vertexCount;
1795 if ( !useCommonCOG )
1796 cog = MeshInfo::cog(mesh);
1798 for ( TriMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1799 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1801 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1807 if ( !useCommonCOG )
1808 cog = MeshInfo::cog(mesh);
1810 for ( PolyMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1811 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1813 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1817 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1818 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1819 TSplineMesh* mesh = PluginFunctions::tsplineMesh(o_it);
1821 if ( !useCommonCOG )
1822 cog = MeshInfo::cog(mesh);
1824 for ( TSplineMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1825 mesh->set_point(v_it , ( mesh->point(v_it) ) - cog );
1827 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1832 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1836 if ( !useCommonCOG )
1837 cog = cogVolumeMesh(mesh);
1842 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1847 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1851 if ( !useCommonCOG )
1852 cog = cogVolumeMesh(mesh);
1857 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1862 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1866 if ( !useCommonCOG )
1867 cog = cogVolumeMesh(mesh);
1872 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1881 o_it->manipulatorNode()->loadIdentity();
1883 emit createBackup(o_it->id(),
"Move to origin");
1912 bool useCommonBB =
false;
1917 if ( OpenFlipper::Options::gui()) {
1918 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);
1921 useCommonBB = ( button == QMessageBox::Yes );
1925 if ( useCommonBB ) {
1934 getBB(mesh,bb_min_tmp,bb_max_tmp);
1941 getBB(mesh,bb_min_tmp,bb_max_tmp);
1946 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1947 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1948 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(o_it);
1949 getBB(mesh,bb_min_tmp,bb_max_tmp);
1955 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 1958 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1964 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 1967 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1973 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 1976 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1987 if ( useCommonBB ) {
1992 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1993 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
1994 unifyBB(*PluginFunctions::tsplineMesh(o_it),bb_min,bb_max, u);
1996 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 2000 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 2004 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 2013 #ifdef ENABLE_TSPLINEMESH_SUPPORT 2014 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
2015 unifyBB(*PluginFunctions::tsplineMesh(o_it), u);
2017 #ifdef ENABLE_HEXAHEDRALMESH_SUPPORT 2021 #ifdef ENABLE_TETRAHEDRALMESH_SUPPORT 2025 #ifdef ENABLE_POLYHEDRALMESH_SUPPORT 2064 num = QString::number(pos[0]); pW->posx->setText(num);
2065 num = QString::number(pos[1]); pW->posy->setText(num);
2066 num = QString::number(pos[2]); pW->posz->setText(num);
2068 TriMesh::Point direction =
object->manipulatorNode()->directionX();
2069 num = QString::number(direction[0]); pW->dirxx->setText(num);
2070 num = QString::number(direction[1]); pW->dirxy->setText(num);
2071 num = QString::number(direction[2]); pW->dirxz->setText(num);
2073 direction =
object->manipulatorNode()->directionY();
2074 num = QString::number(direction[0]); pW->diryx->setText(num);
2075 num = QString::number(direction[1]); pW->diryy->setText(num);
2076 num = QString::number(direction[2]); pW->diryz->setText(num);
2078 direction =
object->manipulatorNode()->directionZ();
2079 num = QString::number(direction[0]); pW->dirzx->setText(num);
2080 num = QString::number(direction[1]); pW->dirzy->setText(num);
2081 num = QString::number(direction[2]); pW->dirzz->setText(num);
2094 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
2096 if ( (*it)->getBaseObjectDataId() == _obj->
id() )
2137 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
2142 setManipMode (QtTranslationManipulatorNode::LocalRotation);
2160 emit nodeVisibilityChanged (-1);
2168 emit nodeVisibilityChanged (-1);
2187 matrix =
object->manipulatorNode()->matrix();
2189 object->manipulatorNode()->loadIdentity();
2205 template<
typename MeshT >
2214 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2215 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2216 for (; v_it!=v_end; ++v_it) {
2222 typename MeshT::Normal n = invTranspMat.
transform_vector(_mesh.normal(*v_it));
2226 _mesh.set_normal(*v_it,n);
2229 typename MeshT::FaceIter f_it = _mesh.faces_begin();
2230 typename MeshT::FaceIter f_end = _mesh.faces_end();
2231 for (; f_it != f_end; ++f_it) {
2234 typename MeshT::Normal n = invTranspMat.
transform_vector(_mesh.normal(*f_it));
2238 _mesh.set_normal(*f_it,n);
2245 #ifdef ENABLE_POLYLINE_SUPPORT 2252 template<
class PolyLineT >
2253 void MovePlugin::transformPolyLine(
ACG::Matrix4x4d _mat , PolyLineT& _polyLine ) {
2255 #pragma omp parallel for 2257 for (
int i = 0 ; i < (int)_polyLine.n_vertices(); ++i )
2266 #ifdef ENABLE_SKELETON_SUPPORT 2281 #if defined(ENABLE_HEXAHEDRALMESH_SUPPORT) || defined(ENABLE_POLYHEDRALMESH_SUPPORT) || defined(ENABLE_TETRAHEDRALMESH_SUPPORT) 2291 template<
typename VolumeMeshT >
2310 _normalAttrib[*v_it] = invTranspMat.
transform_vector(_normalAttrib[*v_it]).normalized();
2317 _normalAttrib[*f_it] = invTranspMat.
transform_vector(_normalAttrib[*f_it]).normalized();
2326 template<
typename VolumeMeshT >
2327 ACG::Vec3d MovePlugin::cogVolumeMesh( VolumeMeshT& _mesh )
2332 for (; v_it!=v_end; ++v_it)
2333 cog += _mesh.vertex(*v_it);
2335 return cog/(double)_mesh.n_vertices();
2346 template<
typename VolumeMeshT >
2347 void MovePlugin::getBBVolumeMesh( VolumeMeshT& _mesh,
ACG::Vec3d& _bb_min,
ACG::Vec3d& _bb_max)
2353 if( v_it == v_end)
return;
2355 _bb_min = _mesh.vertex(*v_it);
2356 _bb_max = _mesh.vertex(*v_it);
2358 for(; v_it!=v_end; ++v_it)
2360 _bb_min.
minimize( _mesh.vertex(*v_it));
2361 _bb_max.
maximize( _mesh.vertex(*v_it));
2372 template<
typename VolumeMeshT >
2376 if( _mesh.n_vertices() == 0)
return;
2379 getBBVolumeMesh( _mesh, bb_min, bb_max );
2381 unifyBBVolumeMesh( _mesh, _normalAttrib, bb_min, bb_max, u );
2394 template<
typename VolumeMeshT >
2397 ACG::Vec3d bb_center = 0.5 * (_bb_min + _bb_max) ;
2399 double bb_longestAxis = bb_diagonal.
max();
2404 case MovePlugin::DIAGONAL :
2405 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2407 case MovePlugin::LONGEST_AXIS :
2410 case MovePlugin::ALL_AXIS :
2414 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2419 _mesh.set_vertex(*v_it, (_mesh.vertex(*v_it) - bb_center) * scale + bb_center);
2433 template<
typename MeshT >
2436 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2437 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2440 if( v_it == v_end)
return;
2442 typename MeshT::Point bb_min = _mesh.point(*v_it);
2443 typename MeshT::Point bb_max = _mesh.point(*v_it);
2445 for(; v_it!=v_end; ++v_it)
2447 bb_min.minimize( _mesh.point(*v_it));
2448 bb_max.maximize( _mesh.point(*v_it));
2451 typename MeshT::Point bb_center = 0.5 * (bb_min + bb_max) ;
2453 typename MeshT::Scalar bb_longestAxis = bb_diagonal.
max();
2458 case MovePlugin::DIAGONAL :
2459 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2461 case MovePlugin::LONGEST_AXIS :
2464 case MovePlugin::ALL_AXIS :
2468 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2471 for( v_it = _mesh.vertices_begin(); v_it!=v_end; ++v_it)
2474 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2477 _mesh.update_normals();
2487 template<
typename MeshT >
2490 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2491 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2494 if( v_it == v_end)
return;
2496 _bb_min = _mesh.point(*v_it);
2497 _bb_max = _mesh.point(*v_it);
2499 for(; v_it!=v_end; ++v_it)
2501 _bb_min.
minimize( _mesh.point(*v_it));
2502 _bb_max.
maximize( _mesh.point(*v_it));
2515 template<
typename MeshT >
2519 typename MeshT::Point bb_center = 0.5 * (_bb_min + _bb_max) ;
2521 typename MeshT::Scalar bb_longestAxis = bb_diagonal.
max();
2525 case MovePlugin::DIAGONAL :
2526 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2528 case MovePlugin::LONGEST_AXIS :
2531 case MovePlugin::ALL_AXIS :
2535 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2538 typename MeshT::VertexIter v_it;
2540 for( v_it = _mesh.vertices_begin(); v_it!=_mesh.vertices_end(); ++v_it)
2541 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2543 _mesh.update_normals();
2555 bool functionExistsMeshV;
2556 emit functionExists(
"meshobjectselection",
"vertexTypeActive()", functionExistsMeshV);
2557 bool functionExistsMeshE;
2558 emit functionExists(
"meshobjectselection",
"edgeTypeActive()", functionExistsMeshE);
2559 bool functionExistsMeshF;
2560 emit functionExists(
"meshobjectselection",
"faceTypeActive()", functionExistsMeshF);
2562 bool connected =
false;
2565 if(functionExistsMeshV && functionExistsMeshE && functionExistsMeshF) {
2570 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"vertexTypeActive")) {
2573 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"edgeTypeActive")) {
2576 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"faceTypeActive")) {
2582 #if defined(ENABLE_HEXAHEDRALMESH_SUPPORT) || defined(ENABLE_POLYHEDRALMESH_SUPPORT) || defined(ENABLE_TETRAHEDRALMESH_SUPPORT) 2583 bool functionExistsVolumeMeshV;
2584 emit functionExists(
"volumemeshselection",
"vertexTypeActive()", functionExistsVolumeMeshV);
2585 bool functionExistsVolumeMeshE;
2586 emit functionExists(
"volumemeshselection",
"edgeTypeActive()", functionExistsVolumeMeshE);
2587 bool functionExistsVolumeMeshF;
2588 emit functionExists(
"volumemeshselection",
"faceTypeActive()", functionExistsVolumeMeshF);
2589 bool functionExistsVolumeMeshC;
2590 emit functionExists(
"volumemeshselection",
"cellTypeActive()", functionExistsVolumeMeshC);
2592 if ( functionExistsVolumeMeshV && functionExistsVolumeMeshE && functionExistsVolumeMeshF && functionExistsVolumeMeshC) {
2597 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"vertexTypeActive")) {
2600 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"edgeTypeActive")) {
2603 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"faceTypeActive")) {
2606 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"cellTypeActive")) {
2613 emit log(
LOGWARN, tr(
"Unable to connect to Selection-Plugin. MoveSelection will work on vertices only."));
2626 allTargets_ = _state;
2634 template<
typename MeshType >
2637 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2639 if ( !fh.is_valid() )
2642 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2643 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2644 typename MeshType::Scalar shortest_distance = (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2645 typename MeshType::VertexHandle vh = *fv_it;
2647 for (; fv_it.is_valid(); ++fv_it) {
2649 typename MeshType::Scalar tmpdist =
2650 (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2652 if(tmpdist < shortest_distance) {
2653 shortest_distance = tmpdist;
2666 template<
typename MeshType >
2669 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2674 typename MeshType::FaceEdgeIter fe_it(*_mesh, fh);
2675 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2677 typename MeshType::Point center;
2678 typename MeshType::Scalar closest_dist(-1);
2680 for (; fe_it.is_valid(); ++fe_it) {
2682 typename MeshType::HalfedgeHandle heh0 = _mesh->halfedge_handle(*fe_it, 0);
2683 typename MeshType::HalfedgeHandle heh1 = _mesh->halfedge_handle(*fe_it, 1);
2685 typename MeshType::Point lp0 = _mesh->point(_mesh->to_vertex_handle(heh0));
2686 typename MeshType::Point lp1 = _mesh->point(_mesh->to_vertex_handle(heh1));
2695 if (dist_new < closest_dist || closest_dist == -1) {
2697 closest_dist = dist_new;
2698 center = lp0 + (lp1 - lp0) * .5;
2711 template<
typename MeshType >
2714 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2716 if ( !fh.is_valid() )
2719 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2721 typename MeshType::Point cog(0.0,0.0,0.0);
2724 for (; fv_it.is_valid(); ++fv_it) {
2726 cog += _mesh->point(*fv_it);
2735 void MovePlugin::slotAllCleared(){
2741 void MovePlugin::objectDeleted(
int _id ){
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, size_t &_nodeIdx, size_t &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
a class which provides an link generator for WhatsThisMessages linking to the user doc If you have an...
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)
SelectionType selectionType_
Current SelectionType of SelectionPlugin.
#define DATA_POLYHEDRAL_MESH
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
TetrahedralMeshObject * tetrahedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an TetrahedralMeshObject if possible.
QMenu * contextMenuManipControl_
Additional Context Menu replicating the toolbar stuff.
QAction * toAllTargets_
Checked if transformation should be applied to all target objs.
#define DATA_TRIANGLE_MESH
double manip_size_modifier_
Modifier for the Size (changed by Mousewheel Events)
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
QAction * contextMenuManipControlsAction_
Action holding the context menu for toolbar replication.
void translate(int _objectId, Vector _vector)
translate an Object by a given vector
void slotToggleAxisB()
Toggle the second axis for changing direction in tab.
void translateEdgeSelection(int _objectId, Vector _vector)
translate current edge selection of an Object by a given vector
PolyhedralMeshObject * polyhedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an PolyhedralMeshObject if possible.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
int lastActiveManipulator_
Stores the last manipulator which has been clicked ( used for the toolbox dialog) ...
picks faces (should be implemented for all nodes)
void slotUnifyBoundingBoxDiagonal()
Scale Boundingbox Diagonal to unit size.
void moveObject(ACG::Matrix4x4d mat, int _id)
Move an object with given id.
void transpose()
transpose matrix
bool is_identity() const
check if the matrix is the identity ( up to an epsilon )
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
Kernel::Point Point
Coordinate type.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
HexahedralMesh * hexahedralMesh(BaseObjectData *_object)
Get an HexahedralMesh from an object.
QToolBar * pickToolbar_
Called by pick Toolbar.
#define DATA_TETRAHEDRAL_MESH
void slotTranslation()
perform a translation for Manipulator in tab
#define DATA_HEXAHEDRAL_MESH
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void setPickModeProps(movePropsWidget *_pW, const std::string &_pickmode)
List of properties dialogs (each corresponding to one manipulator)
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
void unifyBB(MeshT &_mesh, Unificationtype u=MovePlugin::DIAGONAL)
scale mesh to have a boundingboxdiagonal of one
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
void identity()
setup an identity matrix
void translateVertexSelection(int _objectId, Vector _vector)
translate current vertex selection of an Object by a given vector
const QStringList ALL_OBJECTS
Iterable object range.
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
void showManipulators()
Checks if the manipulators should be visible or not.
void slotUpdateContextMenuNode(int _nodeId)
Hide context menu entry when right clicking on node other than manipulator node.
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
QAction * rotateManipAction_
Called by pick Toolbar.
void transform(const ACG::Matrix4x4d &_mat)
Transform the plane with given matrix.
QAction * moveAction_
Called by Toolbar to enable move mode.
QAction * resizeAction_
Called by pick Toolbar.
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(4))
Geometry updated.
bool dataType(DataType _type) const
Unificationtype
stores the current axes in the tool
void slotMoveManipToCOG()
Move the current manipulator to the cog of the object.
void slotSetPosition()
Position of manipulator in tab changed.
QtTranslationManipulatorNode * manipulatorNode()
std::vector< int > activeManipulators_
Size for the manipulators.
bool invert()
matrix inversion (returns true on success)
QToolBar * toolbar_
Called by Toolbar to enable move mode.
Scalar max() const
return the maximal component
void slotUnifyBoundingBoxLongestAxis()
Scale Boundingbox longest axis to unit size (keeps aspect ratio)
OpenMesh::Vec3d getNearestFace(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest face to hitpoint.
moveToolbarWidget * tool_
Widget for Toolbox.
void setAllTargets(bool _state)
Sets whether all targets should be affected or not.
Viewer::ActionMode actionMode()
Get the current Action mode.
void setViewObjectMarker(ViewObjectMarker *_marker)
pick any of the prior targets (should be implemented for all nodes)
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
void slotMoveToOrigin()
Move target Meshes cog to the origin.
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
void slotEnableObjectMode()
stores the current axes in the tool
void slotToggleAxisA()
Toggle the first axis for changing direction in tab.
int targetCount()
Get the number of target objects.
BaseNode * find_node(BaseNode *_root, unsigned int _node_idx)
Find a node in the scene graph.
void hideManipulator()
Hide the manipulator( Called via context for picking. Get the picked id from the Qvariant attached to...
double manip_size_
Size for the manipulators.
bool transformVertexSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QAction * rotateTranslateAction_
Called by pick Toolbar.
void placeManip(QMouseEvent *_event, bool _snap=false)
Place and show the Manipulator.
bool transformCellSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QAction * moveSelectionAction_
Called by Toolbar to enable move mode.
QAction * smallerManipAction_
Called by pick Toolbar.
void traverse(ACG::SceneGraph::MouseEventAction &_action)
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
TetrahedralMesh * tetrahedralMesh(BaseObjectData *_object)
Get an TetrahedralMesh from an object.
const std::string pickMode()
Get the current Picking mode.
QActionGroup * toolBarActions_
Called by Toolbar to enable move mode.
void update_vertex_normals()
A simple heuristic to estimate the vertex normals.
int getIdentifier()
Get an identifier for that manipulator.
int axisA_
stores the current axes in the tool
void set_vertex(const VertexHandle &_vh, const VecT &_p)
Set the coordinates of point _vh.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
QAction * contextAction_
Context menu entry for showing per manipulator settings.
bool transformedSelected_
stores if any selected elements where transformed
void unifyBoundingBox(Unificationtype u)
Size for the manipulators.
MoveObjectMarker objectMarker_
Object marker to dimm Objects during manipulator transformation.
ObjectRange objects(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
void showProps()
Show properties of move manipulator in a dialog ( Called via context for picking. Get the picked id f...
void slotProjectToTangentPlane()
Project the current manipulator onto the tangent plane of the object.
virtual const std::string & className() const =0
Return class name (implemented by the ACG_CLASSNAME macro)
void transformMesh(ACG::Matrix4x4d _mat, MeshT &_mesh)
Transform a mesh with the given transformation matrix.
bool toolboxActive_
True if the toolbox widget is active.
QtTranslationManipulatorNode::ManipulatorMode manMode_
Holds the current manipulator mode.
QAction * biggerManipAction_
Called by pick Toolbar.
bool manipPlaced()
Check if the manipulator has been placed.
Plane * plane(BaseObjectData *_object)
Get a Plane from an object.
const VecT & vertex(const VertexHandle &_vh) const
Get point _vh's coordinates.
ACG::Matrix4x4d getLastManipulatorMatrix(bool _reset=true)
Get the Matrix of the last active Manipulator ( Identity if not found or hidden Manipulator ) ...
void slotRotate()
Rotate Manipulator (with values from Tab)
ManipulatorMode
enum to define the manipulator mode
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
bool visible()
Is node visible (status == Active)?
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
QIcon * toolIcon_
stores the current axes in the tool
const NormalAttrib & normals() const
return a pointer to the mesh
PolyhedralMesh * polyhedralMesh(BaseObjectData *_object)
Get an PolyhedralMesh from an object.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
QList< movePropsWidget * > propsWindows_
List of properties dialogs (each corresponding to one manipulator)
QString generateLink(const QString &_ref="", const QString &_site="index.html") const
generates a clickable link to the documentation for whatsThis Messages
HexahedralMeshObject * hexahedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an HexahedralMeshObject if possible.
void slotEnableSelectionMode()
stores the current axes in the tool
MeshT * mesh()
return a pointer to the mesh
MovePlugin()
Default Constructor.
bool transformFaceSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
QAction * placeAndSnapAction_
Called by pick Toolbar.
void slotScale()
Scale (with values from Tab)
void updateManipulatorDialog()
Update the Dialog with the last clicked manipulator.
void translateFaceSelection(int _objectId, Vector _vector)
translate current face selection of an Object by a given vector
void updateSelectionType()
Get current primitive selection.
void setDescriptions()
Set Descriptions for scriptable functions.
movePropsWidget * getDialogWidget(BaseObjectData *_obj)
Get properties dialog widget that is attached to BaseDataObject obj.
void setManipMode(QtTranslationManipulatorNode::ManipulatorMode _mode)
Set the manipulator manipulation mode.
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 slotUnifyBoundingBoxAllAxis()
Scale all Boundingbox axis to unit size.
OpenMesh::Vec3d getNearestEdge(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest edge to hitpoint.
bool getPickedObject(const size_t _node_idx, BaseObjectData *&_object)
Get the picked mesh.
QAction * contextActionHide_
Context menu entry to hide a manipulator.
int axisB_
stores the current axes in the tool
QAction * placeAction_
Called by pick Toolbar.
void slotSetMoveMode(QAction *_action)
Called by Toolbar to enable move mode.
void moveSelection(ACG::Matrix4x4d mat, int _id, QEvent::Type _type)
Move selection on an object with given id.
OpenMesh::Vec3d getNearestVertex(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest vertex to hitpoint.
void getBB(MeshT &_mesh, ACG::Vec3d &_bb_min, ACG::Vec3d &_bb_max)
get bounding box diagonal of a mesh
bool transformEdgeSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
VectorT< double, 3 > Vec3d
void slotSetDirection()
Set Direction of manipulator in tab changed.
movePropsWidget * getDialogFromButton(QPushButton *_but)
Get parent properties dialog widget of QPushButton but.