Commit 415c8706 authored by Mike Kremer's avatar Mike Kremer
Browse files

Added checkbox "Apply to all targets" to move-plugin context menu.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6009 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c3a169ce
...@@ -64,8 +64,6 @@ void MovePlugin::showProps(){ ...@@ -64,8 +64,6 @@ void MovePlugin::showProps(){
movePropsWidget* pW = new movePropsWidget(obj); movePropsWidget* pW = new movePropsWidget(obj);
pW->setWindowTitle(QString((mNode->name()).c_str())); pW->setWindowTitle(QString((mNode->name()).c_str()));
connect(pW->targetObjects,SIGNAL(stateChanged(int) ),this,SLOT(setAllTargets(int)));
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()));
......
...@@ -58,7 +58,9 @@ ...@@ -58,7 +58,9 @@
* *
*/ */
MovePlugin::MovePlugin() : MovePlugin::MovePlugin() :
manMode_ (QtTranslationManipulatorNode::TranslationRotation) manMode_ (QtTranslationManipulatorNode::TranslationRotation),
contextAction_(0),
toAllTargets_(0)
{ {
manip_size_ = 1.0; manip_size_ = 1.0;
manip_size_modifier_ = 1.0; manip_size_modifier_ = 1.0;
...@@ -70,7 +72,7 @@ MovePlugin::MovePlugin() : ...@@ -70,7 +72,7 @@ MovePlugin::MovePlugin() :
axisB_ = 1; axisB_ = 1;
hide_ = true; hide_ = true;
allTargets_ = true; allTargets_ = false;
} }
...@@ -100,12 +102,20 @@ void MovePlugin::pluginsInitialized() { ...@@ -100,12 +102,20 @@ void MovePlugin::pluginsInitialized() {
setDescriptions(); setDescriptions();
// CONTEXT MENU // CONTEXT MENU
toAllTargets_ = new QAction("Apply to all targets", this);
toAllTargets_->setCheckable(true);
toAllTargets_->setToolTip("Apply transformation to all target objects");
toAllTargets_->setStatusTip( toAllTargets_->toolTip() );
contextAction_ = new QAction("Set properties", this); contextAction_ = new QAction("Set properties", this);
contextAction_->setToolTip("Set properties"); contextAction_->setToolTip("Set properties");
contextAction_->setStatusTip( contextAction_->toolTip() ); contextAction_->setStatusTip( contextAction_->toolTip() );
emit addContextMenuItem(toAllTargets_ , CONTEXTNODEMENU );
emit addContextMenuItem(contextAction_ , CONTEXTNODEMENU ); emit addContextMenuItem(contextAction_ , CONTEXTNODEMENU );
connect(toAllTargets_,SIGNAL(toggled(bool) ),this,SLOT(setAllTargets(bool)));
connect( contextAction_ , SIGNAL( triggered() ), connect( contextAction_ , SIGNAL( triggered() ),
this, SLOT(showProps()) ); this, SLOT(showProps()) );
...@@ -844,12 +854,12 @@ void MovePlugin::slotProjectToTangentPlane() { ...@@ -844,12 +854,12 @@ void MovePlugin::slotProjectToTangentPlane() {
movePropsWidget* pW = getDialogFromButton(but); movePropsWidget* pW = getDialogFromButton(but);
if(pW == 0) return; if(pW == 0) return;
if ( pW->targetObjects->isChecked() ) { if ( allTargets_ ) {
emit log(LOGWARN,"TODO Project for multiple targets"); emit log(LOGWARN,"TODO Project for multiple targets");
return; return;
} else { } else {
emit log(LOGWARN,"TODO Project for one target"); emit log(LOGWARN,"TODO Project for one target");
return; return;
} }
} }
...@@ -949,7 +959,7 @@ void MovePlugin::slotRotate() { ...@@ -949,7 +959,7 @@ void MovePlugin::slotRotate() {
BaseObjectData* object = pW->getBaseObjectData(); BaseObjectData* object = pW->getBaseObjectData();
if (object != 0) { if (object != 0) {
if (object->manipulatorNode()->visible() && (object->target() if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) { || !allTargets_)) {
object->manipulatorNode()->rotate(angle, axis); object->manipulatorNode()->rotate(angle, axis);
...@@ -1019,7 +1029,7 @@ void MovePlugin::slotScale() { ...@@ -1019,7 +1029,7 @@ void MovePlugin::slotScale() {
BaseObjectData* object = pW->getBaseObjectData(); BaseObjectData* object = pW->getBaseObjectData();
if (object != 0) { if (object != 0) {
if (object->manipulatorNode()->visible() && (object->target() if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) { || !allTargets_)) {
object->manipulatorNode()->scale(scale); object->manipulatorNode()->scale(scale);
...@@ -1092,7 +1102,7 @@ void MovePlugin::slotMoveToOrigin() { ...@@ -1092,7 +1102,7 @@ void MovePlugin::slotMoveToOrigin() {
*/ */
void MovePlugin::slotUnifyBoundingBoxDiagonal() void MovePlugin::slotUnifyBoundingBoxDiagonal()
{ {
if ( tool_->targetObjects->isChecked() ) { if ( allTargets_ ) {
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->dataType( DATA_TRIANGLE_MESH ) ) if ( o_it->dataType( DATA_TRIANGLE_MESH ) )
unifyBBDiag(*PluginFunctions::triMesh(*o_it)); unifyBBDiag(*PluginFunctions::triMesh(*o_it));
...@@ -1425,8 +1435,8 @@ void MovePlugin::slotSelectionModeChanged(QAction* _action){ ...@@ -1425,8 +1435,8 @@ void MovePlugin::slotSelectionModeChanged(QAction* _action){
* @param _state Qt::CheckState of checkbox * @param _state Qt::CheckState of checkbox
*/ */
void MovePlugin::setAllTargets(int _state) { void MovePlugin::setAllTargets(bool _state) {
allTargets_ = (_state == Qt::Checked); allTargets_ = _state;
} }
Q_EXPORT_PLUGIN2( moveplugin , MovePlugin ); Q_EXPORT_PLUGIN2( moveplugin , MovePlugin );
......
...@@ -331,7 +331,7 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface, ...@@ -331,7 +331,7 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface,
void slotSelectionModeChanged(QAction* _action); void slotSelectionModeChanged(QAction* _action);
/// Sets whether all targets should be affected or not /// Sets whether all targets should be affected or not
void setAllTargets(int _state); void setAllTargets(bool _state);
/** @} */ /** @} */
...@@ -366,6 +366,9 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface, ...@@ -366,6 +366,9 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface,
/// Context menu entry /// Context menu entry
QAction* contextAction_; QAction* contextAction_;
/// Checked if transformation should be applied to all target objs
QAction* toAllTargets_;
/** @} */ /** @} */
//=========================================================================== //===========================================================================
......
...@@ -30,27 +30,11 @@ ...@@ -30,27 +30,11 @@
<property name="title" > <property name="title" >
<string>Set Properties</string> <string>Set Properties</string>
</property> </property>
<widget class="QCheckBox" name="targetObjects" >
<property name="geometry" >
<rect>
<x>10</x>
<y>40</y>
<width>330</width>
<height>26</height>
</rect>
</property>
<property name="text" >
<string>Apply Transformation to Target Objects</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_4" > <widget class="QGroupBox" name="groupBox_4" >
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>10</x> <x>10</x>
<y>740</y> <y>686</y>
<width>308</width> <width>308</width>
<height>111</height> <height>111</height>
</rect> </rect>
...@@ -79,7 +63,7 @@ ...@@ -79,7 +63,7 @@
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>10</x> <x>10</x>
<y>290</y> <y>236</y>
<width>308</width> <width>308</width>
<height>441</height> <height>441</height>
</rect> </rect>
...@@ -678,7 +662,7 @@ ...@@ -678,7 +662,7 @@
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>10</x> <x>10</x>
<y>84</y> <y>30</y>
<width>308</width> <width>308</width>
<height>198</height> <height>198</height>
</rect> </rect>
...@@ -990,7 +974,6 @@ ...@@ -990,7 +974,6 @@
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>targetObjects</tabstop>
<tabstop>posx</tabstop> <tabstop>posx</tabstop>
<tabstop>posy</tabstop> <tabstop>posy</tabstop>
<tabstop>posz</tabstop> <tabstop>posz</tabstop>
......
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