diff --git a/Icons/move-hide.png b/Icons/move-hide.png new file mode 100644 index 0000000000000000000000000000000000000000..774e98a59ef0fd5799fbf1b4e6008e7c3a621d62 Binary files /dev/null and b/Icons/move-hide.png differ diff --git a/MoveContextMenu.cc b/MoveContextMenu.cc index 91a6e0b87b36597a3bf03a62a0dffac52d06d067..1588060e7b1f5d2b753415e5b9a771e96a447a2c 100644 --- a/MoveContextMenu.cc +++ b/MoveContextMenu.cc @@ -48,19 +48,54 @@ //*********************************************************************************** void MovePlugin::hideManipulator() { -// contextActionHide_ + + QVariant contextObject = contextActionHide_->data(); + int nodeId = contextObject.toInt(); + + if ( nodeId == -1) + return; + + // Get Node + ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), nodeId ); + + ACG::SceneGraph::QtTranslationManipulatorNode* mNode; + mNode = dynamic_cast(node); + + if(mNode == 0) { + // Not a manipulator node + return; + } + + int objectId = mNode->getIdentifier(); + + BaseObjectData* obj; + if ( ! PluginFunctions::getObject(objectId,obj) ) + return; + + // Disconnect its signals to the plugin + disconnect(obj->manipulatorNode() , SIGNAL(manipulatorMoved(QtTranslationManipulatorNode*,QMouseEvent*)), + this , SLOT( manipulatorMoved(QtTranslationManipulatorNode*,QMouseEvent*))); + + disconnect(obj->manipulatorNode() , SIGNAL(positionChanged(QtTranslationManipulatorNode*)), + this , SLOT( ManipulatorPositionChanged(QtTranslationManipulatorNode*))); + + obj->manipPlaced(false); + mNode->hide(); + + emit nodeVisibilityChanged(obj->id()); + } void MovePlugin::showProps(){ QVariant contextObject = contextAction_->data(); - int objectId = contextObject.toInt(); + int nodeId = contextObject.toInt(); - if ( objectId == -1) + if ( nodeId == -1) return; // Get Node - ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), objectId ); + ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), nodeId ); ACG::SceneGraph::QtTranslationManipulatorNode* mNode; mNode = dynamic_cast(node); @@ -70,13 +105,20 @@ void MovePlugin::showProps(){ return; } - int meshID = mNode->getIdentifier(); + int objectId = mNode->getIdentifier(); BaseObjectData* obj; - if ( ! PluginFunctions::getObject(meshID,obj) ) + if ( ! PluginFunctions::getObject(objectId,obj) ) return; - movePropsWidget* pW = new movePropsWidget(obj->id()); + // Check if the widget has been created and show it. + movePropsWidget* pW = getDialogWidget(obj); + if ( pW != 0 ) { + pW->show(); + return; + } + + pW = new movePropsWidget(obj->id()); pW->setWindowTitle(QString((mNode->name()).c_str())); connect(pW->posButton,SIGNAL(clicked() ),this,SLOT(slotSetPosition())); diff --git a/MovePlugin.cc b/MovePlugin.cc index b5b94991dcfd803bc2a84c2b12eff4c4ca97c350..c143291ce0c9957532c56664d8600179db0d2972 100644 --- a/MovePlugin.cc +++ b/MovePlugin.cc @@ -146,17 +146,18 @@ void MovePlugin::pluginsInitialized() { contextAction_->setToolTip(tr("Set properties")); contextAction_->setStatusTip( contextAction_->toolTip() ); -// contextActionHide_ = new QAction(tr("Hide Manipulator"), this); -// contextActionHide_->setToolTip(tr("Hide Manipulator")); -// contextActionHide_->setStatusTip( contextActionHide_->toolTip() ); + contextActionHide_ = new QAction(tr("Hide Manipulator"), this); + contextActionHide_->setToolTip(tr("Hide Manipulator")); + contextActionHide_->setStatusTip( contextActionHide_->toolTip() ); + contextActionHide_->setIcon(QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"move-hide.png") ); emit addContextMenuItem(toAllTargets_ , CONTEXTNODEMENU ); emit addContextMenuItem(contextAction_ , CONTEXTNODEMENU ); -// emit addContextMenuItem(contextActionHide_ , CONTEXTNODEMENU ); + emit addContextMenuItem(contextActionHide_ , CONTEXTNODEMENU ); connect( toAllTargets_ , SIGNAL(toggled(bool) ), this, SLOT(setAllTargets(bool))); connect( contextAction_ , SIGNAL( triggered() ), this, SLOT(showProps()) ); -// connect( contextActionHide_ , SIGNAL( triggered() ), this, SLOT(hideManipulator()) ); + connect( contextActionHide_ , SIGNAL( triggered() ), this, SLOT(hideManipulator()) ); //TOOLBAR toolbar_ = new QToolBar(tr("Transform and Move"));