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_TETRAHEDRAL_SUPPORT 83 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 93 toolboxActive_(false),
97 moveSelectionAction_(0),
102 rotateTranslateAction_(0),
103 rotateManipAction_(0),
105 biggerManipAction_(0),
106 smallerManipAction_(0),
107 fixChildManipAction_(0),
108 transformRefPoseManipAction_(0),
109 currentPoseManipAction_(0),
110 placeAndSnapAction_(0),
111 pickToolBarActions_(0),
113 manip_size_modifier_(1.0),
114 lastActiveManipulator_(-1),
116 selectionType_(VERTEX),
118 contextActionHide_(0),
120 contextMenuManipControl_(0),
121 contextMenuManipControlsAction_(0),
125 transformedSelected_(false)
147 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
167 emit addPickMode(
"Separator");
168 emit addHiddenPickMode(
"Move");
169 emit setPickModeMouseTracking (
"Move",
true);
170 emit addHiddenPickMode(
"MoveSelection");
171 emit setPickModeMouseTracking (
"MoveSelection",
true);
174 emit registerKey (Qt::Key_Shift, Qt::NoModifier, tr(
"Manipulator rotation"),
true);
175 emit registerKey (Qt::Key_Shift, Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
176 emit registerKey (Qt::Key_Shift, Qt::ControlModifier | Qt::ShiftModifier, tr(
"Manipulator rotation"),
true);
177 emit registerKey (Qt::Key_Control, Qt::NoModifier, tr(
"Resize"),
true);
178 emit registerKey (Qt::Key_Control, Qt::ControlModifier, tr(
"Resize"),
true);
179 emit registerKey (Qt::Key_Control, Qt::ShiftModifier | Qt::ControlModifier, tr(
"Resize"),
true);
191 toolbar_ =
new QToolBar(tr(
"Transform and Move"));
192 toolbar_->setObjectName(
"TransformAndMoveToolBar");
197 moveAction_->setStatusTip(tr(
"Move object in 3D."));
198 moveAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-objects.png") );
205 moveSelectionAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-selections.png") );
218 pickToolbar_ =
new QToolBar(tr(
"Transform and Move PickTool bar"));
219 pickToolbar_->setObjectName(
"TransformAndMovePickToolBar");
221 pickToolbar_->setAttribute(Qt::WA_AlwaysShowToolTips,
true);
226 placeAction_->setStatusTip(tr(
"Place manipulator on object. <Doubleclick>"));
227 placeAction_->setToolTip(tr(
"Place manipulator on object. <Doubleclick>"));
228 placeAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-place.png") );
238 rotateTranslateAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-translaterotate.png") );
247 resizeAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-resize.png") );
257 rotateManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-maniprotate.png") );
263 placeAndSnapAction_->setStatusTip(tr(
"Locally translate manipulator. Press and hold <Alt> for snapping."));
265 placeAndSnapAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-placeandsnap.png") );
273 smallerManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-manipsmall.png") );
281 biggerManipAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-manipbig.png") );
288 emit setPickModeToolbar (
"MoveSelection",
pickToolbar_);
293 toAllTargets_ =
new QAction(tr(
"Apply to all targets"),
this);
295 toAllTargets_->setToolTip(tr(
"Apply transformation to all target objects"));
301 contextAction_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-properties.png") );
306 contextActionHide_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-hide.png") );
335 void MovePlugin::initializePlugin()
342 tool_->moveToOrigin->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"moveToCOG.png") );
343 tool_->moveToOrigin->setIconSize(QSize(48,48));
345 tool_->moveToOrigin->setWhatsThis(QString(tr(
"Moves the selected objects such that their center of gravity is at the origin."))
349 tool_->unifyBoundingBoxDiagonal->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB.png") );
350 tool_->unifyBoundingBoxDiagonal->setIconSize(QSize(48,48));
351 tool_->unifyBoundingBoxDiagonal->setWhatsThis(QString(tr(
"Rescale objects such that its bounding box diagonal has length one."))
355 tool_->unifyBoundingBoxLongest->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB_longest.png") );
356 tool_->unifyBoundingBoxLongest->setIconSize(QSize(48,48));
359 tool_->unifyBoundingBoxAll->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() +
"unifyBB_all.png") );
360 tool_->unifyBoundingBoxAll->setIconSize(QSize(48,48));
364 toolIcon_ =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"move-toolBox.png");
373 void MovePlugin::slotMouseWheelEvent(QWheelEvent * _event,
const std::string & )
408 if (_event->type() == QEvent::MouseButtonDblClick || (_event->type() == QEvent::MouseButtonPress
409 && _event->button() == Qt::LeftButton && (
placeAction_->isChecked() || placeMode_))) {
418 manMode_ = QtTranslationManipulatorNode::TranslationRotation;
422 if (o_it->manipPlaced())
423 o_it->manipulatorNode()->setMode(
manMode_);
434 }
else if (placeMode_) {
452 if (_event->buttons() == Qt::LeftButton)
453 emit nodeVisibilityChanged(-1);
462 void MovePlugin::slotKeyEvent (QKeyEvent* _event)
464 if ((_event->key() == Qt::Key_Control) && _event->modifiers() != Qt::ShiftModifier) {
467 }
else if ((_event->key () == Qt::Key_Shift) && _event->modifiers() != Qt::ControlModifier) {
468 setManipMode (QtTranslationManipulatorNode::LocalRotation);
474 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
491 void MovePlugin::slotKeyReleaseEvent (QKeyEvent* _event)
493 if ((_event->key() == Qt::Key_Control &&
manMode_ == QtTranslationManipulatorNode::Resize) ||
494 (_event->key() == Qt::Key_Shift && manMode_ == QtTranslationManipulatorNode::LocalRotation))
495 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
500 if (_pickmode ==
"Move")
502 _pW->objectRadioButton->setChecked(
true);
504 else if (_pickmode ==
"MoveSelection")
506 _pW->selectionRadioButton->setChecked(
true);
511 _pW->objectRadioButton->setAutoExclusive(
false);
512 _pW->selectionRadioButton->setAutoExclusive(
false);
513 _pW->objectRadioButton->setChecked(
false);
514 _pW->selectionRadioButton->setChecked(
false);
515 _pW->objectRadioButton->setAutoExclusive(
true);
516 _pW->selectionRadioButton->setAutoExclusive(
true);
533 hide_ = !(_mode ==
"Move" || _mode ==
"MoveSelection");
541 case QtTranslationManipulatorNode::Rotation:
544 case QtTranslationManipulatorNode::Resize:
547 case QtTranslationManipulatorNode::LocalRotation:
550 case QtTranslationManipulatorNode::Place:
553 case QtTranslationManipulatorNode::TranslationRotation:
589 #ifdef ENABLE_TSPLINEMESH_SUPPORT 590 }
else if ( object->
dataType() == DATA_TSPLINE_MESH ) {
593 #ifdef ENABLE_POLYLINE_SUPPORT 597 #ifdef ENABLE_SKELETON_SUPPORT 601 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 604 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
606 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 607 }
else if ( object->
dataType() == DATA_TETRAHEDRAL_MESH ) {
608 TetrahedralMeshObject* obj = PluginFunctions::tetrahedralMeshObject(
object);
609 transformVolumeMesh(mat , *obj->mesh() , obj->normals() );
611 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 614 transformVolumeMesh(mat , *obj->
mesh() , obj->
normals() );
620 emit log(
LOGERR,tr(
"moveObject called for unsupported Object Type"));
682 if ( o_it->manipPlaced() )
683 o_it->manipulatorNode()->setMode (_mode);
689 case QtTranslationManipulatorNode::Rotation:
693 case QtTranslationManipulatorNode::Resize:
697 case QtTranslationManipulatorNode::LocalRotation:
701 case QtTranslationManipulatorNode::Place:
705 case QtTranslationManipulatorNode::TranslationRotation:
715 case QtTranslationManipulatorNode::Resize:
721 case QtTranslationManipulatorNode::LocalRotation:
727 case QtTranslationManipulatorNode::TranslationRotation:
733 case QtTranslationManipulatorNode::Place:
739 case QtTranslationManipulatorNode::Rotation:
762 if (node->
className() !=
"QtTranslationManipulatorNode") {
783 OpenFlipper::Options::redrawDisabled(
true );
786 if ( !placeMode_ && ((_event->type() == QEvent::MouseButtonRelease) ||
809 if ((o_it->id() != objectId) && !o_it->manipulatorNode()->draw_manipulator()) {
824 OpenFlipper::Options::redrawDisabled(
false );
845 object->manipPlaced(
true );
866 unsigned int node_idx, target_idx;
870 bool successfullyPicked =
false;
884 if(!successfullyPicked) {
894 #ifdef ENABLE_TSPLINEMESH_SUPPORT 895 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
896 hitPoint =
getNearestVertex(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
904 #ifdef ENABLE_TSPLINEMESH_SUPPORT 905 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
906 hitPoint =
getNearestEdge(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
914 #ifdef ENABLE_TSPLINEMESH_SUPPORT 915 }
else if ( object->
dataType(DATA_TSPLINE_MESH) ) {
916 hitPoint =
getNearestFace(PluginFunctions::tsplineMesh(
object), target_idx, hitPoint);
926 if (successfullyPicked) {
928 object->manipPlaced(
true);
933 object->manipulatorNode()->setData( data );
935 object->manipulatorNode()->loadIdentity();
936 object->manipulatorNode()->set_center(hitPoint);
937 object->manipulatorNode()->set_draw_cylinder(
true);
938 object->manipulatorNode()->set_autosize(QtTranslationManipulatorNode::Once);
940 object->manipulatorNode()->setMode(
manMode_);
941 object->manipulatorNode()->show();
1000 emit nodeVisibilityChanged(obj->
id());
1014 emit nodeVisibilityChanged(obj->
id());
1031 if(_but == 0)
return 0;
1032 return dynamic_cast<movePropsWidget*
>((((_but->parentWidget())->parentWidget())->parentWidget()));
1041 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1048 newpos[0] = (pW->nposx->text()).toDouble(&ok);
1049 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1050 newpos[1] = (pW->nposy->text()).toDouble(&ok);
1051 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1052 newpos[2] = (pW->nposz->text()).toDouble(&ok);
1053 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1060 translation -=
object->manipulatorNode()->center();
1061 object->manipulatorNode()->set_center(newpos);
1075 emit createBackup(object->
id(),
"Object Translation");
1092 emit createBackup(object->
id(),
"Translation of selection");
1111 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1121 case 0: pW->axisAButton->setText(tr(
"X Direction"));
break;
1122 case 1: pW->axisAButton->setText(tr(
"Y Direction"));
break;
1123 case 2: pW->axisAButton->setText(tr(
"Z Direction"));
break;
1136 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1146 case 0: pW->axisBButton->setText(tr(
"X Direction"));
break;
1147 case 1: pW->axisBButton->setText(tr(
"Y Direction"));
break;
1148 case 2: pW->axisBButton->setText(tr(
"Z Direction"));
break;
1161 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1170 newdirA[0] = (pW->ndirAx->text()).toDouble(&ok);
1171 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1172 newdirA[1] = (pW->ndirAy->text()).toDouble(&ok);
1173 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1174 newdirA[2] = (pW->ndirAz->text()).toDouble(&ok);
1175 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1177 newdirB[0] = (pW->ndirBx->text()).toDouble(&ok);
1178 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1179 newdirB[1] = (pW->ndirBy->text()).toDouble(&ok);
1180 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1181 newdirB[2] = (pW->ndirBz->text()).toDouble(&ok);
1182 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1188 case 0: dirX = newdirA; xAxis =
true;
break;
1189 case 1: dirY = newdirA; yAxis =
true;
break;
1190 default: dirZ = newdirA;
break;
1194 case 0: dirX = newdirB; xAxis =
true;
break;
1195 case 1: dirY = newdirB; yAxis =
true;
break;
1196 default: dirZ = newdirB;
break;
1206 if ( (dirX | dirY) != 0.0){
1207 emit log(
LOGERR,tr(
"The axes of the new direction have to be orthogonal"));
1223 if (
object != 0 ) {
1226 object->manipulatorNode()->set_direction( dirX, dirY );
1242 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1249 translation[0] = (pW->translationX->text()).toDouble(&ok);
1250 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1251 translation[1] = (pW->translationY->text()).toDouble(&ok);
1252 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1253 translation[2] = (pW->translationZ->text()).toDouble(&ok);
1254 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1262 object->manipulatorNode()->set_center(
1271 emit createBackup(object->
id(),
"Translation of Object");
1286 emit createBackup(object->
id(),
"Translation of selection");
1299 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1305 emit createBackup(o_it->id(),
"Translation of object");
1319 emit createBackup(o_it->id(),
"Translation of selection");
1335 emit scriptInfo(QString(
"slotTranslation()"));
1347 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1351 if ( allTargets_ ) {
1352 emit log(
LOGWARN,tr(
"TODO Project for multiple targets"));
1355 emit log(
LOGWARN,tr(
"TODO Project for one target"));
1369 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1391 if (
object != 0 ) {
1398 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1399 else if ( object->
dataType( DATA_TSPLINE_MESH ) )
1400 object->
manipulatorNode()->set_center( MeshInfo::cog(PluginFunctions::tsplineMesh(
object)) );
1402 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1406 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1407 else if ( object->
dataType( DATA_TETRAHEDRAL_MESH ) )
1408 object->
manipulatorNode()->set_center( cogVolumeMesh(*PluginFunctions::tetrahedralMesh(
object)) );
1410 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1416 object->manipulatorNode()->loadIdentity();
1431 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1439 axis[0] = (pW->rotx->text()).toDouble(&ok);
1440 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for X Coordinate"));
return; }
1441 axis[1] = (pW->roty->text()).toDouble(&ok);
1442 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Y Coordinate"));
return; }
1443 axis[2] = (pW->rotz->text()).toDouble(&ok);
1444 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Z Coordinate"));
return; }
1446 angle = (pW->rotAngle->text()).toDouble(&ok);
1447 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for Angle"));
return; }
1454 object->manipulatorNode()->rotate(angle, axis);
1466 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1467 if (object->
dataType(DATA_TSPLINE_MESH))
1470 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1474 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1475 if (object->
dataType(DATA_TETRAHEDRAL_MESH))
1476 transformVolumeMesh(m, (*PluginFunctions::tetrahedralMesh(
object)), (PluginFunctions::tetrahedralMeshObject(
object)->normals()));
1478 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1484 emit createBackup(object->
id(),
"Rotation of object");
1504 emit createBackup(object->
id(),
"Rotation of selection");
1513 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1522 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1523 if (o_it->dataType(DATA_TSPLINE_MESH))
1526 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1530 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1531 if (object->
dataType(DATA_TETRAHEDRAL_MESH))
1532 transformVolumeMesh(m, (*PluginFunctions::tetrahedralMesh(
object)), (PluginFunctions::tetrahedralMeshObject(
object)->normals()));
1534 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1540 emit createBackup(o_it->id(),
"Rotation of object");
1559 emit createBackup(o_it->id(),
"Rotation of selection");
1575 emit scriptInfo(QString(
"slotRotate()"));
1587 QPushButton* but =
dynamic_cast<QPushButton*
>(QObject::sender());
1595 scale[0] = (pW->scalex->text()).toDouble(&ok);
1596 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 1"));
return; }
1597 scale[1] = (pW->scaley->text()).toDouble(&ok);
1598 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 2"));
return; }
1599 scale[2] = (pW->scalez->text()).toDouble(&ok);
1600 if ( !ok ) { emit log(
LOGERR,tr(
"Wrong Format for factor 3"));
return; }
1608 object->manipulatorNode()->scale(scale);
1618 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1619 if (object->
dataType(DATA_TSPLINE_MESH))
1622 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1626 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1627 if (object->
dataType(DATA_TETRAHEDRAL_MESH))
1628 transformVolumeMesh(m, (*PluginFunctions::tetrahedralMesh(
object)), (PluginFunctions::tetrahedralMeshObject(
object)->normals()));
1630 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1636 emit createBackup(object->
id(),
"Scaling of object");
1655 emit createBackup(object->
id(),
"Scaling of selection");
1663 if ((o_it->id() !=
object->id()) && !o_it->manipulatorNode()->draw_manipulator()) {
1672 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1673 if (o_it->dataType(DATA_TSPLINE_MESH))
1676 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1680 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1681 if (object->
dataType(DATA_TETRAHEDRAL_MESH))
1682 transformVolumeMesh(m, (*PluginFunctions::tetrahedralMesh(
object)), (PluginFunctions::tetrahedralMeshObject(
object)->normals()));
1684 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1690 emit createBackup(o_it->id(),
"Scaling of object");
1709 emit createBackup(o_it->id(),
"Scaling of selection");
1720 emit createBackup(object->
id(),
"Scaling");
1725 emit scriptInfo(QString(
"slotScale()"));
1738 bool useCommonCOG =
false;
1742 if ( OpenFlipper::Options::gui()) {
1743 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);
1746 useCommonCOG = ( button == QMessageBox::Yes );
1749 if ( useCommonCOG ) {
1751 double vertexCount = 0.0;
1757 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1758 vertexCount += double(mesh->n_vertices());
1763 cog += MeshInfo::cog(mesh) * double(mesh->n_vertices());
1764 vertexCount += double(mesh->n_vertices());
1767 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1768 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1769 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(*o_it);
1770 cog += MeshInfo::cog(mesh) * double(mesh.n_vertices());
1771 vertexCount += double(mesh.n_vertices());
1775 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1778 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1779 vertexCount += double(mesh.n_vertices());
1783 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1784 if ( o_it->dataType( DATA_TETRAHEDRAL_MESH )) {
1785 TetrahedralMesh& mesh = *PluginFunctions::tetrahedralMesh(*o_it);
1786 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1787 vertexCount += double(mesh.n_vertices());
1791 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1794 cog += cogVolumeMesh(mesh) * double(mesh.n_vertices());
1795 vertexCount += double(mesh.n_vertices());
1800 cog = cog / vertexCount;
1809 if ( !useCommonCOG )
1810 cog = MeshInfo::cog(mesh);
1812 for ( TriMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1813 mesh->set_point(*v_it , ( mesh->point(*v_it) ) - cog );
1815 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1821 if ( !useCommonCOG )
1822 cog = MeshInfo::cog(mesh);
1824 for ( PolyMesh::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 );
1831 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1832 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1833 TSplineMesh* mesh = PluginFunctions::tsplineMesh(*o_it);
1835 if ( !useCommonCOG )
1836 cog = MeshInfo::cog(mesh);
1838 for ( TSplineMesh::VertexIter v_it = mesh->vertices_begin(); v_it != mesh->vertices_end() ; ++v_it)
1839 mesh->set_point(v_it , ( mesh->point(v_it) ) - cog );
1841 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1846 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1850 if ( !useCommonCOG )
1851 cog = cogVolumeMesh(mesh);
1856 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1861 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1862 if ( o_it->dataType( DATA_TETRAHEDRAL_MESH )) {
1863 TetrahedralMesh& mesh = *PluginFunctions::tetrahedralMesh(*o_it);
1865 if ( !useCommonCOG )
1866 cog = cogVolumeMesh(mesh);
1869 mesh.set_vertex(*v_it , mesh.vertex(*v_it) - cog );
1871 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1876 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1880 if ( !useCommonCOG )
1881 cog = cogVolumeMesh(mesh);
1886 o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() - cog );
1895 o_it->manipulatorNode()->loadIdentity();
1897 emit createBackup(o_it->id(),
"Move to origin");
1926 bool useCommonBB =
false;
1931 if ( OpenFlipper::Options::gui()) {
1932 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);
1935 useCommonBB = ( button == QMessageBox::Yes );
1939 if ( useCommonBB ) {
1948 getBB(mesh,bb_min_tmp,bb_max_tmp);
1955 getBB(mesh,bb_min_tmp,bb_max_tmp);
1960 #ifdef ENABLE_TSPLINEMESH_SUPPORT 1961 if ( o_it->dataType( DATA_TSPLINE_MESH )) {
1962 TSplineMesh& mesh = *PluginFunctions::tsplineMesh(*o_it);
1963 getBB(mesh,bb_min_tmp,bb_max_tmp);
1969 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 1972 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1978 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 1979 if ( o_it->dataType( DATA_TETRAHEDRAL_MESH )) {
1980 TetrahedralMesh& mesh = *PluginFunctions::tetrahedralMesh(*o_it);
1981 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
1987 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 1990 getBBVolumeMesh(mesh,bb_min_tmp,bb_max_tmp);
2001 if ( useCommonBB ) {
2006 #ifdef ENABLE_TSPLINEMESH_SUPPORT 2007 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
2008 unifyBB(*PluginFunctions::tsplineMesh(*o_it),bb_min,bb_max, u);
2010 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 2014 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 2015 else if ( o_it->dataType( DATA_TETRAHEDRAL_MESH ) )
2016 unifyBBVolumeMesh(*PluginFunctions::tetrahedralMesh(*o_it),(PluginFunctions::tetrahedralMeshObject(*o_it)->normals()),bb_min,bb_max, u);
2018 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 2027 #ifdef ENABLE_TSPLINEMESH_SUPPORT 2028 else if ( o_it->dataType( DATA_TSPLINE_MESH ) )
2029 unifyBB(*PluginFunctions::tsplineMesh(*o_it), u);
2031 #ifdef ENABLE_OPENVOLUMEMESH_HEXAHEDRAL_SUPPORT 2035 #ifdef ENABLE_OPENVOLUMEMESH_TETRAHEDRAL_SUPPORT 2036 else if ( o_it->dataType( DATA_TETRAHEDRAL_MESH ) )
2037 unifyBBVolumeMesh(*PluginFunctions::tetrahedralMesh(*o_it),(PluginFunctions::tetrahedralMeshObject(*o_it)->normals()), u);
2039 #ifdef ENABLE_OPENVOLUMEMESH_POLYHEDRAL_SUPPORT 2078 num = QString::number(pos[0]); pW->posx->setText(num);
2079 num = QString::number(pos[1]); pW->posy->setText(num);
2080 num = QString::number(pos[2]); pW->posz->setText(num);
2082 TriMesh::Point direction =
object->manipulatorNode()->directionX();
2083 num = QString::number(direction[0]); pW->dirxx->setText(num);
2084 num = QString::number(direction[1]); pW->dirxy->setText(num);
2085 num = QString::number(direction[2]); pW->dirxz->setText(num);
2087 direction =
object->manipulatorNode()->directionY();
2088 num = QString::number(direction[0]); pW->diryx->setText(num);
2089 num = QString::number(direction[1]); pW->diryy->setText(num);
2090 num = QString::number(direction[2]); pW->diryz->setText(num);
2092 direction =
object->manipulatorNode()->directionZ();
2093 num = QString::number(direction[0]); pW->dirzx->setText(num);
2094 num = QString::number(direction[1]); pW->dirzy->setText(num);
2095 num = QString::number(direction[2]); pW->dirzz->setText(num);
2108 for(QList<movePropsWidget*>::iterator it =
propsWindows_.begin();
2110 if ( (*it)->getBaseObjectDataId() == _obj->
id() )
2151 setManipMode (QtTranslationManipulatorNode::TranslationRotation);
2156 setManipMode (QtTranslationManipulatorNode::LocalRotation);
2174 emit nodeVisibilityChanged (-1);
2182 emit nodeVisibilityChanged (-1);
2201 matrix =
object->manipulatorNode()->matrix();
2203 object->manipulatorNode()->loadIdentity();
2219 template<
typename MeshT >
2228 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2229 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2230 for (; v_it!=v_end; ++v_it) {
2240 _mesh.set_normal(*v_it,n);
2243 typename MeshT::FaceIter f_it = _mesh.faces_begin();
2244 typename MeshT::FaceIter f_end = _mesh.faces_end();
2245 for (; f_it != f_end; ++f_it) {
2252 _mesh.set_normal(*f_it,n);
2259 #ifdef ENABLE_POLYLINE_SUPPORT 2266 template<
class PolyLineT >
2267 void MovePlugin::transformPolyLine(
ACG::Matrix4x4d _mat , PolyLineT& _polyLine ) {
2269 #pragma omp parallel for 2271 for (
int i = 0 ; i < (int)_polyLine.n_vertices(); ++i )
2280 #ifdef ENABLE_SKELETON_SUPPORT 2295 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT 2305 template<
typename VolumeMeshT >
2324 _normalAttrib[*v_it] = invTranspMat.
transform_vector(_normalAttrib[*v_it]).normalized();
2331 _normalAttrib[*f_it] = invTranspMat.
transform_vector(_normalAttrib[*f_it]).normalized();
2340 template<
typename VolumeMeshT >
2341 ACG::Vec3d MovePlugin::cogVolumeMesh( VolumeMeshT& _mesh )
2346 for (; v_it!=v_end; ++v_it)
2347 cog += _mesh.vertex(*v_it);
2349 return cog/(double)_mesh.n_vertices();
2360 template<
typename VolumeMeshT >
2361 void MovePlugin::getBBVolumeMesh( VolumeMeshT& _mesh,
ACG::Vec3d& _bb_min,
ACG::Vec3d& _bb_max)
2367 if( v_it == v_end)
return;
2369 _bb_min = _mesh.vertex(*v_it);
2370 _bb_max = _mesh.vertex(*v_it);
2372 for(; v_it!=v_end; ++v_it)
2374 _bb_min.
minimize( _mesh.vertex(*v_it));
2375 _bb_max.
maximize( _mesh.vertex(*v_it));
2386 template<
typename VolumeMeshT >
2390 if( _mesh.n_vertices() == 0)
return;
2393 getBBVolumeMesh( _mesh, bb_min, bb_max );
2395 unifyBBVolumeMesh( _mesh, _normalAttrib, bb_min, bb_max, u );
2408 template<
typename VolumeMeshT >
2411 ACG::Vec3d bb_center = 0.5 * (_bb_min + _bb_max) ;
2413 double bb_longestAxis = bb_diagonal.
max();
2418 case MovePlugin::DIAGONAL :
2419 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2421 case MovePlugin::LONGEST_AXIS :
2424 case MovePlugin::ALL_AXIS :
2428 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2433 _mesh.set_vertex(*v_it, (_mesh.vertex(*v_it) - bb_center) * scale + bb_center);
2447 template<
typename MeshT >
2450 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2451 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2454 if( v_it == v_end)
return;
2456 typename MeshT::Point bb_min = _mesh.point(*v_it);
2457 typename MeshT::Point bb_max = _mesh.point(*v_it);
2459 for(; v_it!=v_end; ++v_it)
2461 bb_min.minimize( _mesh.point(*v_it));
2462 bb_max.maximize( _mesh.point(*v_it));
2465 typename MeshT::Point bb_center = 0.5 * (bb_min + bb_max) ;
2467 typename MeshT::Scalar bb_longestAxis = bb_diagonal.
max();
2472 case MovePlugin::DIAGONAL :
2473 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2475 case MovePlugin::LONGEST_AXIS :
2478 case MovePlugin::ALL_AXIS :
2482 scale =
ACG::Vec3d(1.0/(bb_max-bb_min).norm());
2485 for( v_it = _mesh.vertices_begin(); v_it!=v_end; ++v_it)
2488 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2491 _mesh.update_normals();
2501 template<
typename MeshT >
2504 typename MeshT::VertexIter v_it = _mesh.vertices_begin();
2505 typename MeshT::VertexIter v_end = _mesh.vertices_end();
2508 if( v_it == v_end)
return;
2510 _bb_min = _mesh.point(*v_it);
2511 _bb_max = _mesh.point(*v_it);
2513 for(; v_it!=v_end; ++v_it)
2515 _bb_min.
minimize( _mesh.point(*v_it));
2516 _bb_max.
maximize( _mesh.point(*v_it));
2529 template<
typename MeshT >
2533 typename MeshT::Point bb_center = 0.5 * (_bb_min + _bb_max) ;
2535 typename MeshT::Scalar bb_longestAxis = bb_diagonal.
max();
2539 case MovePlugin::DIAGONAL :
2540 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2542 case MovePlugin::LONGEST_AXIS :
2545 case MovePlugin::ALL_AXIS :
2549 scale =
ACG::Vec3d(1.0/(_bb_max-_bb_min).norm());
2552 typename MeshT::VertexIter v_it;
2554 for( v_it = _mesh.vertices_begin(); v_it!=_mesh.vertices_end(); ++v_it)
2555 _mesh.point(*v_it) = (_mesh.point(*v_it) - bb_center) * scale + bb_center;
2557 _mesh.update_normals();
2569 bool functionExistsMeshV;
2570 emit functionExists(
"meshobjectselection",
"vertexTypeActive()", functionExistsMeshV);
2571 bool functionExistsMeshE;
2572 emit functionExists(
"meshobjectselection",
"edgeTypeActive()", functionExistsMeshE);
2573 bool functionExistsMeshF;
2574 emit functionExists(
"meshobjectselection",
"faceTypeActive()", functionExistsMeshF);
2576 bool connected =
false;
2579 if(functionExistsMeshV && functionExistsMeshE && functionExistsMeshF) {
2584 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"vertexTypeActive")) {
2587 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"edgeTypeActive")) {
2590 if(RPC::callFunctionValue<bool>(
"meshobjectselection",
"faceTypeActive")) {
2596 #ifdef ENABLE_OPENVOLUMEMESH_SUPPORT 2597 bool functionExistsVolumeMeshV;
2598 emit functionExists(
"volumemeshselection",
"vertexTypeActive()", functionExistsVolumeMeshV);
2599 bool functionExistsVolumeMeshE;
2600 emit functionExists(
"volumemeshselection",
"edgeTypeActive()", functionExistsVolumeMeshE);
2601 bool functionExistsVolumeMeshF;
2602 emit functionExists(
"volumemeshselection",
"faceTypeActive()", functionExistsVolumeMeshF);
2603 bool functionExistsVolumeMeshC;
2604 emit functionExists(
"volumemeshselection",
"cellTypeActive()", functionExistsVolumeMeshC);
2606 if ( functionExistsVolumeMeshV && functionExistsVolumeMeshE && functionExistsVolumeMeshF && functionExistsVolumeMeshC) {
2611 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"vertexTypeActive")) {
2614 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"edgeTypeActive")) {
2617 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"faceTypeActive")) {
2620 if(RPC::callFunctionValue<bool>(
"volumemeshselection",
"cellTypeActive")) {
2627 emit log(
LOGWARN, tr(
"Unable to connect to Selection-Plugin. MoveSelection will work on vertices only."));
2640 allTargets_ = _state;
2648 template<
typename MeshType >
2651 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2653 if ( !fh.is_valid() )
2656 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2657 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2658 typename MeshType::Scalar shortest_distance = (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2659 typename MeshType::VertexHandle vh = *fv_it;
2661 for (; fv_it.is_valid(); ++fv_it) {
2663 typename MeshType::Scalar tmpdist =
2664 (_mesh->point(*fv_it) - hitPointP).sqrnorm();
2666 if(tmpdist < shortest_distance) {
2667 shortest_distance = tmpdist;
2680 template<
typename MeshType >
2683 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2688 typename MeshType::FaceEdgeIter fe_it(*_mesh, fh);
2689 typename MeshType::Point hitPointP = (
typename MeshType::Point) _hitPoint;
2691 typename MeshType::Point center;
2692 typename MeshType::Scalar closest_dist(-1);
2694 for (; fe_it.is_valid(); ++fe_it) {
2696 typename MeshType::HalfedgeHandle heh0 = _mesh->halfedge_handle(*fe_it, 0);
2697 typename MeshType::HalfedgeHandle heh1 = _mesh->halfedge_handle(*fe_it, 1);
2699 typename MeshType::Point lp0 = _mesh->point(_mesh->to_vertex_handle(heh0));
2700 typename MeshType::Point lp1 = _mesh->point(_mesh->to_vertex_handle(heh1));
2709 if (dist_new < closest_dist || closest_dist == -1) {
2711 closest_dist = dist_new;
2712 center = lp0 + (lp1 - lp0) * .5;
2725 template<
typename MeshType >
2728 typename MeshType::FaceHandle fh = _mesh->face_handle(_fh);
2730 if ( !fh.is_valid() )
2733 typename MeshType::FaceVertexIter fv_it(*_mesh, fh);
2735 typename MeshType::Point cog(0.0,0.0,0.0);
2738 for (; fv_it.is_valid(); ++fv_it) {
2740 cog += _mesh->point(*fv_it);
2749 void MovePlugin::slotAllCleared(){
2755 void MovePlugin::objectDeleted(
int _id ){
2766 #if QT_VERSION < 0x050000
void traverse(ACG::SceneGraph::MouseEventAction &_action)
void setDescriptions()
Set Descriptions for scriptable functions.
ViewObjectMarker * defaultViewObjectMarker()
Get the default ViewObjectMarker.
BaseNode * find_node(BaseNode *_root, unsigned int _node_idx)
Find a node in the scene graph.
const VecT & vertex(const VertexHandle &_vh) const
Get point _vh's coordinates.
bool transformEdgeSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
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 transpose()
transpose matrix
QMenu * contextMenuManipControl_
Additional Context Menu replicating the toolbar stuff.
QAction * moveSelectionAction_
Called by Toolbar to enable move mode.
VectorT< T, 3 > transform_point(const VectorT< T, 3 > &_v) const
transform point (x',y',z',1) = M * (x,y,z,1)
void slotMouseEvent(QMouseEvent *_event)
MousePress event occured.
QAction * moveAction_
Called by Toolbar to enable move mode.
bool toolboxActive_
True if the toolbox widget is active.
void slotToggleAxisB()
Toggle the second axis for changing direction in tab.
Add normals to mesh item (vertices/faces)
void translate(Scalar _x, Scalar _y, Scalar _z, MultiplyFrom _mult_from=MULT_FROM_RIGHT)
multiply self with translation matrix (x,y,z)
QList< movePropsWidget * > propsWindows_
List of properties dialogs (each corresponding to one manipulator)
bool transformFaceSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
void moveObject(ACG::Matrix4x4d mat, int _id)
Move an object with given id.
The Menu will be shown when a node was picked.
OpenMesh::Vec3d getNearestEdge(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest edge to hitpoint.
SelectionType selectionType_
Current SelectionType of SelectionPlugin.
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)
bool getObject(int _identifier, BSplineCurveObject *&_object)
QToolBar * toolbar_
Called by Toolbar to enable move mode.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
bool dataType(DataType _type) const
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
bool transformVertexSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
const QStringList TARGET_OBJECTS("target")
Iterable object range.
void slotToggleAxisA()
Toggle the first axis for changing direction in tab.
QIcon * toolIcon_
stores the current axes in the tool
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
void updateSelectionType()
Get current primitive selection.
MovePlugin()
Default Constructor.
bool visible()
Is node visible (status == Active)?
#define DATA_POLYHEDRAL_MESH
void translateEdgeSelection(int _objectId, Vector _vector)
translate current edge selection of an Object by a given vector
QAction * rotateManipAction_
Called by pick Toolbar.
QAction * placeAndSnapAction_
Called by pick Toolbar.
MeshT * mesh()
return a pointer to the mesh
void hideManipulator()
Hide the manipulator( Called via context for picking. Get the picked id from the Qvariant attached to...
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...
Skeleton transformation class.
QAction * smallerManipAction_
Called by pick Toolbar.
int getIdentifier()
Get an identifier for that manipulator.
void slotEnableSelectionMode()
stores the current axes in the tool
const QStringList ALL_OBJECTS
Iterable object range.
void slotUnifyBoundingBoxAllAxis()
Scale all Boundingbox axis to unit size.
void set_vertex(const VertexHandle &_vh, const VecT &_p)
Set the coordinates of point _vh.
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
QtTranslationManipulatorNode * manipulatorNode()
void slotUnifyBoundingBoxLongestAxis()
Scale Boundingbox longest axis to unit size (keeps aspect ratio)
void moveSelection(ACG::Matrix4x4d mat, int _id, QEvent::Type _type)
Move selection on an object with given id.
QToolBar * pickToolbar_
Called by pick Toolbar.
const GLMatrixd & matrix() const
Returns a const reference to the current transformation matrix.
a class which provides an link generator for WhatsThisMessages linking to the user doc If you have an...
bool is_identity() const
check if the matrix is the identity ( up to an epsilon )
void translate(int _objectId, Vector _vector)
translate an Object by a given vector
void slotProjectToTangentPlane()
Project the current manipulator onto the tangent plane of the object.
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
void identity()
setup an identity matrix
const std::string pickMode()
Get the current Picking mode.
vector_type & maximize(const vector_type &_rhs)
maximize values: same as *this = max(*this, _rhs), but faster
bool transformedSelected_
stores if any selected elements where transformed
void slotMoveToOrigin()
Move target Meshes cog to the origin.
void transformMesh(ACG::Matrix4x4d _mat, MeshT &_mesh)
Transform a mesh with the given transformation matrix.
const NormalAttrib & normals() const
return a pointer to the mesh
bool transformCellSelection(int _objectId, Matrix4x4 _matrix)
transform current selection of an Object by a given matrix
#define DATA_HEXAHEDRAL_MESH
HexahedralMeshObject * hexahedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an HexahedralMeshObject if possible.
virtual const std::string & className() const =0
Return class name (implemented by the ACG_CLASSNAME macro)
void manipulatorMoved(QtTranslationManipulatorNode *_node, QMouseEvent *_event)
move the object when its manipulator moves
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
QAction * contextAction_
Context menu entry for showing per manipulator settings.
MoveObjectMarker objectMarker_
Object marker to dimm Objects during manipulator transformation.
movePropsWidget * getDialogWidget(BaseObjectData *_obj)
Get properties dialog widget that is attached to BaseDataObject obj.
void slotRotate()
Rotate Manipulator (with values from Tab)
void slotUnifyBoundingBoxDiagonal()
Scale Boundingbox Diagonal to unit size.
ACG::Matrix4x4d getLastManipulatorMatrix(bool _reset=true)
Get the Matrix of the last active Manipulator ( Identity if not found or hidden Manipulator ) ...
const UpdateType UPDATE_GEOMETRY(UpdateTypeSet(1)<< 2)
Geometry updated.
void setViewObjectMarker(ViewObjectMarker *_marker)
Unificationtype
stores the current axes in the tool
ManipulatorMode
enum to define the manipulator mode
void updateManipulatorDialog()
Update the Dialog with the last clicked manipulator.
const Vec3d & center() const
get center
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
void translateVertexSelection(int _objectId, Vector _vector)
translate current vertex selection of an Object by a given vector
movePropsWidget * getDialogFromButton(QPushButton *_but)
Get parent properties dialog widget of QPushButton but.
void slotUpdateContextMenuNode(int _nodeId)
Hide context menu entry when right clicking on node other than manipulator node.
QAction * toAllTargets_
Checked if transformation should be applied to all target objs.
void setPickModeProps(movePropsWidget *_pW, const std::string &_pickmode)
List of properties dialogs (each corresponding to one manipulator)
void unifyBoundingBox(Unificationtype u)
Size for the manipulators.
void slotTranslation()
perform a translation for Manipulator in tab
QAction * resizeAction_
Called by pick Toolbar.
Plane * plane(BaseObjectData *_object)
Get a Plane from an object.
void getBB(MeshT &_mesh, ACG::Vec3d &_bb_min, ACG::Vec3d &_bb_max)
get bounding box diagonal of a mesh
QAction * placeAction_
Called by pick Toolbar.
OpenMesh::Vec3d getNearestVertex(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest vertex to hitpoint.
Viewer::ActionMode actionMode()
Get the current Action mode.
double manip_size_
Size for the manipulators.
void slotMoveManipToCOG()
Move the current manipulator to the cog of the object.
void ManipulatorPositionChanged(QtTranslationManipulatorNode *_node)
update object when its manipulator changes position
QActionGroup * toolBarActions_
Called by Toolbar to enable move mode.
double manip_size_modifier_
Modifier for the Size (changed by Mousewheel Events)
void unifyBB(MeshT &_mesh, Unificationtype u=MovePlugin::DIAGONAL)
scale mesh to have a boundingboxdiagonal of one
int targetCount()
Get the number of target objects.
PolyhedralMesh * polyhedralMesh(BaseObjectData *_object)
Get an PolyhedralMesh from an object.
void setAllTargets(bool _state)
Sets whether all targets should be affected or not.
bool invert()
matrix inversion (returns true on success)
void transformSkeleton(Matrix4x4 _transformation, Skeleton::Pose *_pose=0)
transform the skeleton
int axisA_
stores the current axes in the tool
int lastActiveManipulator_
Stores the last manipulator which has been clicked ( used for the toolbox dialog) ...
OpenMesh::Vec3d getNearestFace(MeshType *_mesh, uint _fh, OpenMesh::Vec3d &_hitPoint)
Get closest face to hitpoint.
void placeManip(QMouseEvent *_event, bool _snap=false)
Place and show the Manipulator.
void slotSetPosition()
Position of manipulator in tab changed.
Skeleton * skeleton(BaseObjectData *_object)
Get a skeleton from an object.
bool manipPlaced()
Check if the manipulator has been placed.
void translateFaceSelection(int _objectId, Vector _vector)
translate current face selection of an Object by a given vector
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
Kernel::Point Point
Coordinate type.
Scalar max() const
return the maximal component
PolyhedralMeshObject * polyhedralMeshObject(BaseObjectData *_object)
Cast an BaseObject to an PolyhedralMeshObject if possible.
QAction * contextMenuManipControlsAction_
Action holding the context menu for toolbar replication.
QAction * rotateTranslateAction_
Called by pick Toolbar.
void slotPickModeChanged(const std::string &_mode)
slot is called when the pickMode changed
pick any of the prior targets (should be implemented for all nodes)
vector_type & minimize(const vector_type &_rhs)
minimize values: same as *this = min(*this, _rhs), but faster
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
QAction * biggerManipAction_
Called by pick Toolbar.
QAction * contextActionHide_
Context menu entry to hide a manipulator.
int axisB_
stores the current axes in the tool
moveToolbarWidget * tool_
Widget for Toolbox.
void showManipulators()
Checks if the manipulators should be visible or not.
VectorT< double, 3 > Vec3d
void transform(const ACG::Matrix4x4d &_mat)
Transform the plane with given matrix.
#define DATA_TRIANGLE_MESH
picks faces (should be implemented for all nodes)
QString generateLink(const QString &_ref="", const QString &_site="index.html") const
generates a clickable link to the documentation for whatsThis Messages
void slotSetMoveMode(QAction *_action)
Called by Toolbar to enable move mode.
HexahedralMesh * hexahedralMesh(BaseObjectData *_object)
Get an HexahedralMesh from an object.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void slotEnableObjectMode()
stores the current axes in the tool
VectorT< T, 3 > transform_vector(const VectorT< T, 3 > &_v) const
transform vector (x',y',z',0) = A * (x,y,z,0)
void update_vertex_normals()
A simple heuristic to estimate the vertex normals.
void slotScale()
Scale (with values from Tab)
void slotSetDirection()
Set Direction of manipulator in tab changed.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
QtTranslationManipulatorNode::ManipulatorMode manMode_
Holds the current manipulator mode.
std::vector< int > activeManipulators_
Size for the manipulators.