Commit fbb317b5 authored by Jan Möbius's avatar Jan Möbius

Added function to hide manipulator

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8032 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f2cbe272
......@@ -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<ACG::SceneGraph::QtTranslationManipulatorNode*>(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<ACG::SceneGraph::QtTranslationManipulatorNode*>(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()));
......
......@@ -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"));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment