Commit ce040476 authored by Mike Kremer's avatar Mike Kremer
Browse files

Added a context menu to move plugin which allows to set individual properties...

Added a context menu to move plugin which allows to set individual properties such as rotation, scale, position of the manipulator, etc..
Removed the old panel from the plugins widget. Added emission of scriptInfo each time an object has been transformated.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5260 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c7b67d80
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// OpenFlipper is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 4795 $
// $Author: moebius $
// $Date: 2009-02-12 10:05:59 +0100 (Thu, 12 Feb 2009) $
//
//=============================================================================
#include "MovePlugin.hh"
#include <ACG/QtScenegraph/QtManipulatorNode.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
//***********************************************************************************
// ContextMenu Action triggered
void MovePlugin::moveContextMenu(QAction* _action) {
QVariant contextObject = _action->data();
int objectId = contextObject.toInt();
if ( objectId == -1)
return;
if ( _action->text() == "Set properties")
showProps( objectId );
}
//***********************************************************************************
void MovePlugin::showProps( int objectId ){
// Get Node
ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), objectId );
ACG::SceneGraph::QtTranslationManipulatorNode* mNode;
mNode = dynamic_cast<ACG::SceneGraph::QtTranslationManipulatorNode*>(node);
if(mNode == 0) {
// Not a manipulator node
return;
}
int meshID = mNode->getIdentifier();
ACG::SceneGraph::BaseNode* mesh = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), meshID );
propsWindow_->setWindowTitle(QString((mesh->name()).c_str()));
connect(propsWindow_->posButton,SIGNAL(clicked() ),this,SLOT(slotSetPosition()));
connect(propsWindow_->axisAButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisA()));
connect(propsWindow_->axisBButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisB()));
connect(propsWindow_->dirButton,SIGNAL(clicked() ),this,SLOT(slotSetDirection()));
connect(propsWindow_->transButton,SIGNAL(clicked() ),this,SLOT(slotTranslation()));
connect(propsWindow_->rotButton,SIGNAL(clicked() ),this,SLOT(slotRotate()));
connect(propsWindow_->scaleButton,SIGNAL(clicked() ),this,SLOT(slotScale()));
connect(propsWindow_->projectTangentButton,SIGNAL(clicked() ),this,SLOT(slotProjectToTangentPlane()));
connect(propsWindow_->moveManipToCOG,SIGNAL(clicked() ),this,SLOT(slotMoveManipToCOG()));
// Values
BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) {
if ( object->manipulatorNode()->visible() ) {
const TriMesh::Point pos = object->manipulatorNode()->center();
QString num;
num = QString::number(pos[0]); propsWindow_->posx->setText(num);
num = QString::number(pos[1]); propsWindow_->posy->setText(num);
num = QString::number(pos[2]); propsWindow_->posz->setText(num);
TriMesh::Point direction = object->manipulatorNode()->directionX();
num = QString::number(direction[0]); propsWindow_->dirxx->setText(num);
num = QString::number(direction[1]); propsWindow_->dirxy->setText(num);
num = QString::number(direction[2]); propsWindow_->dirxz->setText(num);
direction = object->manipulatorNode()->directionY();
num = QString::number(direction[0]); propsWindow_->diryx->setText(num);
num = QString::number(direction[1]); propsWindow_->diryy->setText(num);
num = QString::number(direction[2]); propsWindow_->diryz->setText(num);
direction = object->manipulatorNode()->directionZ();
num = QString::number(direction[0]); propsWindow_->dirzx->setText(num);
num = QString::number(direction[1]); propsWindow_->dirzy->setText(num);
num = QString::number(direction[2]); propsWindow_->dirzz->setText(num);
}
}
propsWindow_->show();
}
\ No newline at end of file
...@@ -88,7 +88,23 @@ void MovePlugin::pluginsInitialized() { ...@@ -88,7 +88,23 @@ void MovePlugin::pluginsInitialized() {
//SCRIPTING SLOT DESCRIPTIONS //SCRIPTING SLOT DESCRIPTIONS
setDescriptions(); setDescriptions();
// CONTEXT MENU
propsWindow_ = new movePropsWidget();
propsWindow_->hide();
contextMenu_ = new QMenu("Move");
QAction* lastAction;
lastAction = contextMenu_->addAction( "Set properties" );
lastAction->setToolTip("Set properties");
lastAction->setStatusTip( lastAction->toolTip() );
emit addContextMenuItem(contextMenu_->menuAction() , CONTEXTNODEMENU );
connect( contextMenu_ , SIGNAL( triggered(QAction*) ),
this, SLOT(moveContextMenu(QAction*)) );
//TOOLBAR //TOOLBAR
toolbar_ = new QToolBar("Transform and Move"); toolbar_ = new QToolBar("Transform and Move");
...@@ -135,17 +151,17 @@ bool MovePlugin::initializeToolbox(QWidget*& _widget) ...@@ -135,17 +151,17 @@ bool MovePlugin::initializeToolbox(QWidget*& _widget)
tool_->moveToOrigin->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "moveToCOG.png") ); tool_->moveToOrigin->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "moveToCOG.png") );
tool_->moveToOrigin->setIconSize(QSize(48,48)); tool_->moveToOrigin->setIconSize(QSize(48,48));
connect(tool_->posButton,SIGNAL(clicked() ),this,SLOT(slotSetPosition())); // connect(tool_->posButton,SIGNAL(clicked() ),this,SLOT(slotSetPosition()));
connect(tool_->axisAButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisA())); // connect(tool_->axisAButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisA()));
connect(tool_->axisBButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisB())); // connect(tool_->axisBButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisB()));
connect(tool_->dirButton,SIGNAL(clicked() ),this,SLOT(slotSetDirection())); // connect(tool_->dirButton,SIGNAL(clicked() ),this,SLOT(slotSetDirection()));
connect(tool_->transButton,SIGNAL(clicked() ),this,SLOT(slotTranslation())); // connect(tool_->transButton,SIGNAL(clicked() ),this,SLOT(slotTranslation()));
//
connect(tool_->rotButton,SIGNAL(clicked() ),this,SLOT(slotRotate())); // connect(tool_->rotButton,SIGNAL(clicked() ),this,SLOT(slotRotate()));
connect(tool_->scaleButton,SIGNAL(clicked() ),this,SLOT(slotScale())); // connect(tool_->scaleButton,SIGNAL(clicked() ),this,SLOT(slotScale()));
//
connect(tool_->projectTangentButton,SIGNAL(clicked() ),this,SLOT(slotProjectToTangentPlane())); // connect(tool_->projectTangentButton,SIGNAL(clicked() ),this,SLOT(slotProjectToTangentPlane()));
connect(tool_->moveManipToCOG,SIGNAL(clicked() ),this,SLOT(slotMoveManipToCOG())); // connect(tool_->moveManipToCOG,SIGNAL(clicked() ),this,SLOT(slotMoveManipToCOG()));
connect(tool_->unifyBoundingBoxDiagonal,SIGNAL(clicked() ),this,SLOT(slotUnifyBoundingBoxDiagonal())); connect(tool_->unifyBoundingBoxDiagonal,SIGNAL(clicked() ),this,SLOT(slotUnifyBoundingBoxDiagonal()));
tool_->unifyBoundingBoxDiagonal->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "unifyBB.png") ); tool_->unifyBoundingBoxDiagonal->setIcon( QIcon(OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator() + "unifyBB.png") );
...@@ -445,11 +461,11 @@ void MovePlugin::slotSetPosition() { ...@@ -445,11 +461,11 @@ void MovePlugin::slotSetPosition() {
TriMesh::Point newpos; TriMesh::Point newpos;
bool ok = false; bool ok = false;
newpos[0] = (tool_->nposx->text()).toDouble(&ok); newpos[0] = (propsWindow_->nposx->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; }
newpos[1] = (tool_->nposy->text()).toDouble(&ok); newpos[1] = (propsWindow_->nposy->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; }
newpos[2] = (tool_->nposz->text()).toDouble(&ok); newpos[2] = (propsWindow_->nposz->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; }
BaseObjectData* object; BaseObjectData* object;
...@@ -476,9 +492,9 @@ void MovePlugin::slotToggleAxisA() { ...@@ -476,9 +492,9 @@ void MovePlugin::slotToggleAxisA() {
axisA_ = (axisA_ + 1) % 3; axisA_ = (axisA_ + 1) % 3;
switch(axisA_){ switch(axisA_){
case 0: tool_->axisAButton->setText("X Direction"); break; case 0: propsWindow_->axisAButton->setText("X Direction"); break;
case 1: tool_->axisAButton->setText("Y Direction"); break; case 1: propsWindow_->axisAButton->setText("Y Direction"); break;
case 2: tool_->axisAButton->setText("Z Direction"); break; case 2: propsWindow_->axisAButton->setText("Z Direction"); break;
default: break; default: break;
} }
} }
...@@ -497,9 +513,9 @@ void MovePlugin::slotToggleAxisB() { ...@@ -497,9 +513,9 @@ void MovePlugin::slotToggleAxisB() {
axisB_ = (axisB_ + 1) % 3; axisB_ = (axisB_ + 1) % 3;
switch(axisB_){ switch(axisB_){
case 0: tool_->axisBButton->setText("X Direction"); break; case 0: propsWindow_->axisBButton->setText("X Direction"); break;
case 1: tool_->axisBButton->setText("Y Direction"); break; case 1: propsWindow_->axisBButton->setText("Y Direction"); break;
case 2: tool_->axisBButton->setText("Z Direction"); break; case 2: propsWindow_->axisBButton->setText("Z Direction"); break;
default: break; default: break;
} }
} }
...@@ -517,18 +533,18 @@ void MovePlugin::slotSetDirection() { ...@@ -517,18 +533,18 @@ void MovePlugin::slotSetDirection() {
ACG::Vec3d dirZ(0.0,0.0,0.0); ACG::Vec3d dirZ(0.0,0.0,0.0);
bool ok = false; bool ok = false;
newdirA[0] = (tool_->ndirAx->text()).toDouble(&ok); newdirA[0] = (propsWindow_->ndirAx->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; }
newdirA[1] = (tool_->ndirAy->text()).toDouble(&ok); newdirA[1] = (propsWindow_->ndirAy->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; }
newdirA[2] = (tool_->ndirAz->text()).toDouble(&ok); newdirA[2] = (propsWindow_->ndirAz->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; }
newdirB[0] = (tool_->ndirBx->text()).toDouble(&ok); newdirB[0] = (propsWindow_->ndirBx->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; }
newdirB[1] = (tool_->ndirBy->text()).toDouble(&ok); newdirB[1] = (propsWindow_->ndirBy->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; }
newdirB[2] = (tool_->ndirBz->text()).toDouble(&ok); newdirB[2] = (propsWindow_->ndirBz->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; }
bool xAxis = false; bool xAxis = false;
...@@ -559,7 +575,7 @@ void MovePlugin::slotSetDirection() { ...@@ -559,7 +575,7 @@ void MovePlugin::slotSetDirection() {
} }
// Apply to All Target Objects // Apply to All Target Objects
if ( tool_->targetObjects->isChecked() ) { if ( propsWindow_->targetObjects->isChecked() ) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it){ for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it){
o_it->manipulatorNode()->set_direction( dirX, dirY ); o_it->manipulatorNode()->set_direction( dirX, dirY );
...@@ -589,15 +605,15 @@ void MovePlugin::slotTranslation() { ...@@ -589,15 +605,15 @@ void MovePlugin::slotTranslation() {
ACG::Vec3d translation; ACG::Vec3d translation;
bool ok = false; bool ok = false;
translation[0] = (tool_->translationX->text()).toDouble(&ok); translation[0] = (propsWindow_->translationX->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; }
translation[1] = (tool_->translationY->text()).toDouble(&ok); translation[1] = (propsWindow_->translationY->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; }
translation[2] = (tool_->translationZ->text()).toDouble(&ok); translation[2] = (propsWindow_->translationZ->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; }
// Apply to All Target Objects // Apply to All Target Objects
if ( tool_->targetObjects->isChecked() ) { if ( propsWindow_->targetObjects->isChecked() ) {
int manipcount = 0; // Check how many of the target meshes have an visible manipulator int manipcount = 0; // Check how many of the target meshes have an visible manipulator
int targets = 0; // Count the number of target meshes int targets = 0; // Count the number of target meshes
...@@ -622,6 +638,7 @@ void MovePlugin::slotTranslation() { ...@@ -622,6 +638,7 @@ void MovePlugin::slotTranslation() {
o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() + translation ); o_it->manipulatorNode()->set_center( o_it->manipulatorNode()->center() + translation );
emit createBackup(o_it->id(),"Translation"); emit createBackup(o_it->id(),"Translation");
emit updatedObject(o_it->id());
} }
} else { } else {
...@@ -633,11 +650,13 @@ void MovePlugin::slotTranslation() { ...@@ -633,11 +650,13 @@ void MovePlugin::slotTranslation() {
object->manipulatorNode()->set_center( object->manipulatorNode()->center() + translation ); object->manipulatorNode()->set_center( object->manipulatorNode()->center() + translation );
emit createBackup(object->id(),"Translation"); emit createBackup(object->id(),"Translation");
emit updatedObject(object->id());
} }
} else return; } else return;
} }
updateManipulatorDialog(); updateManipulatorDialog();
emit scriptInfo(QString("slotTranslation()"));
emit updateView(); emit updateView();
} }
...@@ -649,7 +668,7 @@ void MovePlugin::slotTranslation() { ...@@ -649,7 +668,7 @@ void MovePlugin::slotTranslation() {
*/ */
void MovePlugin::slotProjectToTangentPlane() { void MovePlugin::slotProjectToTangentPlane() {
if ( tool_->targetObjects->isChecked() ) { if ( propsWindow_->targetObjects->isChecked() ) {
emit log(LOGWARN,"TODO Project for multiple targets"); emit log(LOGWARN,"TODO Project for multiple targets");
return; return;
} else { } else {
...@@ -666,7 +685,7 @@ void MovePlugin::slotProjectToTangentPlane() { ...@@ -666,7 +685,7 @@ void MovePlugin::slotProjectToTangentPlane() {
* *
*/ */
void MovePlugin::slotMoveManipToCOG() { void MovePlugin::slotMoveManipToCOG() {
if ( tool_->targetObjects->isChecked() ) { if ( propsWindow_->targetObjects->isChecked() ) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) { for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
if ( o_it->manipulatorNode()->hidden() ) if ( o_it->manipulatorNode()->hidden() )
continue; continue;
...@@ -708,17 +727,17 @@ void MovePlugin::slotRotate() { ...@@ -708,17 +727,17 @@ void MovePlugin::slotRotate() {
double angle; double angle;
bool ok = false; bool ok = false;
axis[0] = (tool_->rotx->text()).toDouble(&ok); axis[0] = (propsWindow_->rotx->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for X Coordinate"); return; }
axis[1] = (tool_->roty->text()).toDouble(&ok); axis[1] = (propsWindow_->roty->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Y Coordinate"); return; }
axis[2] = (tool_->rotz->text()).toDouble(&ok); axis[2] = (propsWindow_->rotz->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Z Coordinate"); return; }
angle = (tool_->rotAngle->text()).toDouble(&ok); angle = (propsWindow_->rotAngle->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for Angle"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for Angle"); return; }
if ( tool_->targetObjects->isChecked() ) { if ( propsWindow_->targetObjects->isChecked() ) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) { for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
if ( o_it->manipulatorNode()->hidden() ) if ( o_it->manipulatorNode()->hidden() )
continue; continue;
...@@ -734,6 +753,7 @@ void MovePlugin::slotRotate() { ...@@ -734,6 +753,7 @@ void MovePlugin::slotRotate() {
updateManipulatorDialog(); updateManipulatorDialog();
emit createBackup(o_it->id(),"Rotation"); emit createBackup(o_it->id(),"Rotation");
emit updatedObject(o_it->id());
} }
} else { } else {
BaseObjectData* object; BaseObjectData* object;
...@@ -750,8 +770,10 @@ void MovePlugin::slotRotate() { ...@@ -750,8 +770,10 @@ void MovePlugin::slotRotate() {
updateManipulatorDialog(); updateManipulatorDialog();
emit createBackup(object->id(),"Rotation"); emit createBackup(object->id(),"Rotation");
emit updatedObject(object->id());
} }
} }
emit scriptInfo(QString("slotRotate()"));
emit updateView(); emit updateView();
} }
...@@ -766,14 +788,14 @@ void MovePlugin::slotScale() { ...@@ -766,14 +788,14 @@ void MovePlugin::slotScale() {
TriMesh::Point scale; TriMesh::Point scale;
bool ok = false; bool ok = false;
scale[0] = (tool_->scalex->text()).toDouble(&ok); scale[0] = (propsWindow_->scalex->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for factor 1"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for factor 1"); return; }
scale[1] = (tool_->scaley->text()).toDouble(&ok); scale[1] = (propsWindow_->scaley->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for factor 2"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for factor 2"); return; }
scale[2] = (tool_->scalez->text()).toDouble(&ok); scale[2] = (propsWindow_->scalez->text()).toDouble(&ok);
if ( !ok ) { emit log(LOGERR,"Wrong Format for factor 3"); return; } if ( !ok ) { emit log(LOGERR,"Wrong Format for factor 3"); return; }
if ( tool_->targetObjects->isChecked() ) { if ( propsWindow_->targetObjects->isChecked() ) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) { for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
if ( o_it->manipulatorNode()->hidden() ) if ( o_it->manipulatorNode()->hidden() )
continue; continue;
...@@ -789,6 +811,7 @@ void MovePlugin::slotScale() { ...@@ -789,6 +811,7 @@ void MovePlugin::slotScale() {
updateManipulatorDialog(); updateManipulatorDialog();
emit createBackup(o_it->id(),"Scaling"); emit createBackup(o_it->id(),"Scaling");
emit updatedObject(o_it->id());
} }
} else { } else {
BaseObjectData* object; BaseObjectData* object;
...@@ -805,8 +828,10 @@ void MovePlugin::slotScale() { ...@@ -805,8 +828,10 @@ void MovePlugin::slotScale() {
updateManipulatorDialog(); updateManipulatorDialog();
emit createBackup(object->id(),"Scaling"); emit createBackup(object->id(),"Scaling");
emit updatedObject(object->id());
} }
} }
emit scriptInfo(QString("slotScale()"));
emit updateView(); emit updateView();
} }
...@@ -894,33 +919,38 @@ void MovePlugin::slotUnifyBoundingBoxDiagonal() ...@@ -894,33 +919,38 @@ void MovePlugin::slotUnifyBoundingBoxDiagonal()
* *
*/ */
void MovePlugin::updateManipulatorDialog() { void MovePlugin::updateManipulatorDialog() {
BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) { if(!propsWindow_->isHidden()) {
if ( object->manipulatorNode()->visible() ) {
const TriMesh::Point pos = object->manipulatorNode()->center(); BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) {
QString num; if ( object->manipulatorNode()->visible() ) {
num = QString::number(pos[0]); tool_->posx->setText(num); const TriMesh::Point pos = object->manipulatorNode()->center();
num = QString::number(pos[1]); tool_->posy->setText(num);
num = QString::number(pos[2]); tool_->posz->setText(num); QString num;
TriMesh::Point direction = object->manipulatorNode()->directionX(); num = QString::number(pos[0]); propsWindow_->posx->setText(num);
num = QString::number(direction[0]); tool_->dirxx->setText(num); num = QString::number(pos[1]); propsWindow_->posy->setText(num);
num = QString::number(direction[1]); tool_->dirxy->setText(num); num = QString::number(pos[2]); propsWindow_->posz->setText(num);
num = QString::number(direction[2]); tool_->dirxz->setText(num);
TriMesh::Point direction = object->manipulatorNode()->directionX();
direction = object->manipulatorNode()->directionY(); num = QString::number(direction[0]); propsWindow_->dirxx->setText(num);
num = QString::number(direction[0]); tool_->diryx->setText(num); num = QString::number(direction[1]); propsWindow_->dirxy->setText(num);
num = QString::number(direction[1]); tool_->diryy->setText(num); num = QString::number(direction[2]); propsWindow_->dirxz->setText(num);
num = QString::number(direction[2]); tool_->diryz->setText(num);
direction = object->manipulatorNode()->directionY();
direction = object->manipulatorNode()->directionZ(); num = QString::number(direction[0]); propsWindow_->diryx->setText(num);
num = QString::number(direction[0]); tool_->dirzx->setText(num); num = QString::number(direction[1]); propsWindow_->diryy->setText(num);
num = QString::number(direction[1]); tool_->dirzy->setText(num); num = QString::number(direction[2]); propsWindow_->diryz->setText(num);
num = QString::number(direction[2]); tool_->dirzz->setText(num);
direction = object->manipulatorNode()->directionZ();
} num = QString::number(direction[0]); propsWindow_->dirzx->setText(num);
} num = QString::number(direction[1]); propsWindow_->dirzy->setText(num);
num = QString::number(direction[2]); propsWindow_->dirzz->setText(num);
}
}
}
} }
......
...@@ -44,17 +44,19 @@ ...@@ -44,17 +44,19 @@
#include <OpenFlipper/BasePlugin/LoggingInterface.hh> #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ScriptInterface.hh> #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
#include <OpenFlipper/BasePlugin/ToolbarInterface.hh> #include <OpenFlipper/BasePlugin/ToolbarInterface.hh>
#include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
#include <OpenFlipper/common/Types.hh> #include <OpenFlipper/common/Types.hh>
#include <ObjectTypes/PolyMesh/PolyMesh.hh> #include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh> #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#include "MoveToolbar.hh" #include "MoveToolbar.hh"
#include "MoveProps.hh"
enum SelectionType {VERTEX, EDGE, FACE }; enum SelectionType {VERTEX, EDGE, FACE };
/** Plugin for moving objects and selections /** Plugin for moving objects and selections
*/ */
class MovePlugin : public QObject, BaseInterface, MouseInterface, PickingInterface, ToolboxInterface, BackupInterface, LoggingInterface, ScriptInterface,ToolbarInterface class MovePlugin : public QObject, BaseInterface, MouseInterface, PickingInterface, ToolboxInterface, BackupInterface, LoggingInterface, ScriptInterface,ToolbarInterface, ContextMenuInterface
{ {
Q_OBJECT Q_OBJECT
Q_INTERFACES(BaseInterface) Q_INTERFACES(BaseInterface)
...@@ -63,6 +65,7 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, PickingInterfa ...@@ -63,6 +65,7 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, PickingInterfa
Q_INTERFACES(ToolboxInterface) Q_INTERFACES(ToolboxInterface)
Q_INTERFACES(BackupInterface) Q_INTERFACES(BackupInterface)
Q_INTERFACES(LoggingInterface) Q_INTERFACES(LoggingInterface)
Q_INTERFACES(ContextMenuInterface)
Q_INTERFACES(ScriptInterface) Q_INTERFACES(ScriptInterface)
Q_INTERFACES(ToolbarInterface) Q_INTERFACES(ToolbarInterface)
...@@ -76,6 +79,9 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, PickingInterfa ...@@ -76,6 +79,9 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, PickingInterfa
void addHiddenPickMode( const std::string _mode ); void addHiddenPickMode( const std::string _mode );
void setPickModeMouseTracking (const std::string _mode, bool _mouseTracking); void setPickModeMouseTracking (const std::string _mode, bool _mouseTracking);
// ContextMenuInterface
void addContextMenuItem(QAction* _action , ContextMenuType _type);