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

Always bring property widget to front when Set Properties is clicked. refs #485 part 2

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14161 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 75689de2
...@@ -88,81 +88,94 @@ void MovePlugin::hideManipulator() { ...@@ -88,81 +88,94 @@ void MovePlugin::hideManipulator() {
void MovePlugin::showProps(){ void MovePlugin::showProps(){
QVariant contextObject = contextAction_->data(); QVariant contextObject = contextAction_->data();
int nodeId = contextObject.toInt(); int nodeId = contextObject.toInt();
if ( nodeId == -1) if (nodeId == -1)
return; return;
// Get Node // Get Node
ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), nodeId ); ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node(PluginFunctions::getSceneGraphRootNode(), nodeId);
ACG::SceneGraph::QtTranslationManipulatorNode* mNode; ACG::SceneGraph::QtTranslationManipulatorNode* mNode;
mNode = dynamic_cast<ACG::SceneGraph::QtTranslationManipulatorNode*>(node); mNode = dynamic_cast<ACG::SceneGraph::QtTranslationManipulatorNode*>(node);
if(mNode == 0) { if (mNode == 0) {
// Not a manipulator node // Not a manipulator node
return; return;
} }
int objectId = mNode->getIdentifier(); int objectId = mNode->getIdentifier();
BaseObjectData* obj; BaseObjectData* obj;
if ( ! PluginFunctions::getObject(objectId,obj) ) if (!PluginFunctions::getObject(objectId, obj))
return; return;
// Check if the widget has been created and show it. // Check if the widget has been created and show it.
movePropsWidget* pW = getDialogWidget(obj); movePropsWidget* pW = getDialogWidget(obj);
if ( pW != 0 ) { if (pW != 0) {
pW->show(); pW->show();
return; pW->raise();
} return;
}
pW = new movePropsWidget(obj->id()); pW = new movePropsWidget(obj->id());
pW->setWindowTitle(QString((mNode->name()).c_str())); pW->setWindowTitle(QString((mNode->name()).c_str()));
connect(pW->posButton,SIGNAL(clicked() ),this,SLOT(slotSetPosition())); connect(pW->posButton, SIGNAL(clicked() ), this, SLOT(slotSetPosition()));
connect(pW->axisAButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisA())); connect(pW->axisAButton, SIGNAL(clicked() ), this, SLOT(slotToggleAxisA()));
connect(pW->axisBButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisB())); connect(pW->axisBButton, SIGNAL(clicked() ), this, SLOT(slotToggleAxisB()));
connect(pW->dirButton,SIGNAL(clicked() ),this,SLOT(slotSetDirection())); connect(pW->dirButton, SIGNAL(clicked() ), this, SLOT(slotSetDirection()));
connect(pW->transButton,SIGNAL(clicked() ),this,SLOT(slotTranslation())); connect(pW->transButton, SIGNAL(clicked() ), this, SLOT(slotTranslation()));
connect(pW->rotButton,SIGNAL(clicked() ),this,SLOT(slotRotate())); connect(pW->rotButton, SIGNAL(clicked() ), this, SLOT(slotRotate()));
connect(pW->scaleButton,SIGNAL(clicked() ),this,SLOT(slotScale())); connect(pW->scaleButton, SIGNAL(clicked() ), this, SLOT(slotScale()));
connect(pW->projectTangentButton,SIGNAL(clicked() ),this,SLOT(slotProjectToTangentPlane())); connect(pW->projectTangentButton, SIGNAL(clicked() ), this, SLOT(slotProjectToTangentPlane()));
connect(pW->moveManipToCOG,SIGNAL(clicked() ),this,SLOT(slotMoveManipToCOG())); connect(pW->moveManipToCOG, SIGNAL(clicked() ), this, SLOT(slotMoveManipToCOG()));
// Values // Values
BaseObjectData* object; BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) { if (PluginFunctions::getObject(lastActiveManipulator_, object)) {
if ( object->manipulatorNode()->visible() ) { if (object->manipulatorNode()->visible()) {
const OpenMesh::Vec3d pos = object->manipulatorNode()->center(); const OpenMesh::Vec3d pos = object->manipulatorNode()->center();
QString num; QString num;
num = QString::number(pos[0]);
pW->posx->setText(num);
num = QString::number(pos[1]);
pW->posy->setText(num);
num = QString::number(pos[2]);
pW->posz->setText(num);
OpenMesh::Vec3d direction = object->manipulatorNode()->directionX();
num = QString::number(direction[0]);
pW->dirxx->setText(num);
num = QString::number(direction[1]);
pW->dirxy->setText(num);
num = QString::number(direction[2]);
pW->dirxz->setText(num);
direction = object->manipulatorNode()->directionY();
num = QString::number(direction[0]);
pW->diryx->setText(num);
num = QString::number(direction[1]);
pW->diryy->setText(num);
num = QString::number(direction[2]);
pW->diryz->setText(num);
direction = object->manipulatorNode()->directionZ();
num = QString::number(direction[0]);
pW->dirzx->setText(num);
num = QString::number(direction[1]);
pW->dirzy->setText(num);
num = QString::number(direction[2]);
pW->dirzz->setText(num);
num = QString::number(pos[0]); pW->posx->setText(num);
num = QString::number(pos[1]); pW->posy->setText(num);
num = QString::number(pos[2]); pW->posz->setText(num);
OpenMesh::Vec3d direction = object->manipulatorNode()->directionX();
num = QString::number(direction[0]); pW->dirxx->setText(num);
num = QString::number(direction[1]); pW->dirxy->setText(num);
num = QString::number(direction[2]); pW->dirxz->setText(num);
direction = object->manipulatorNode()->directionY();
num = QString::number(direction[0]); pW->diryx->setText(num);
num = QString::number(direction[1]); pW->diryy->setText(num);
num = QString::number(direction[2]); pW->diryz->setText(num);
direction = object->manipulatorNode()->directionZ();
num = QString::number(direction[0]); pW->dirzx->setText(num);
num = QString::number(direction[1]); pW->dirzy->setText(num);
num = QString::number(direction[2]); pW->dirzz->setText(num);
}
} }
}
pW->show(); pW->show();
propsWindows_.append(pW); propsWindows_.append(pW);
} }
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