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

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(){
movePropsWidget* pW = new movePropsWidget(obj);
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->axisAButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisA()));
connect(pW->axisBButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisB()));
......
......@@ -58,7 +58,9 @@
*
*/
MovePlugin::MovePlugin() :
manMode_ (QtTranslationManipulatorNode::TranslationRotation)
manMode_ (QtTranslationManipulatorNode::TranslationRotation),
contextAction_(0),
toAllTargets_(0)
{
manip_size_ = 1.0;
manip_size_modifier_ = 1.0;
......@@ -70,7 +72,7 @@ MovePlugin::MovePlugin() :
axisB_ = 1;
hide_ = true;
allTargets_ = true;
allTargets_ = false;
}
......@@ -100,12 +102,20 @@ void MovePlugin::pluginsInitialized() {
setDescriptions();
// 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_->setToolTip("Set properties");
contextAction_->setStatusTip( contextAction_->toolTip() );
emit addContextMenuItem(toAllTargets_ , CONTEXTNODEMENU );
emit addContextMenuItem(contextAction_ , CONTEXTNODEMENU );
connect(toAllTargets_,SIGNAL(toggled(bool) ),this,SLOT(setAllTargets(bool)));
connect( contextAction_ , SIGNAL( triggered() ),
this, SLOT(showProps()) );
......@@ -844,12 +854,12 @@ void MovePlugin::slotProjectToTangentPlane() {
movePropsWidget* pW = getDialogFromButton(but);
if(pW == 0) return;
if ( pW->targetObjects->isChecked() ) {
emit log(LOGWARN,"TODO Project for multiple targets");
return;
if ( allTargets_ ) {
emit log(LOGWARN,"TODO Project for multiple targets");
return;
} else {
emit log(LOGWARN,"TODO Project for one target");
return;
emit log(LOGWARN,"TODO Project for one target");
return;
}
}
......@@ -949,7 +959,7 @@ void MovePlugin::slotRotate() {
BaseObjectData* object = pW->getBaseObjectData();
if (object != 0) {
if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) {
|| !allTargets_)) {
object->manipulatorNode()->rotate(angle, axis);
......@@ -1019,7 +1029,7 @@ void MovePlugin::slotScale() {
BaseObjectData* object = pW->getBaseObjectData();
if (object != 0) {
if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) {
|| !allTargets_)) {
object->manipulatorNode()->scale(scale);
......@@ -1092,7 +1102,7 @@ void MovePlugin::slotMoveToOrigin() {
*/
void MovePlugin::slotUnifyBoundingBoxDiagonal()
{
if ( tool_->targetObjects->isChecked() ) {
if ( allTargets_ ) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
if ( o_it->dataType( DATA_TRIANGLE_MESH ) )
unifyBBDiag(*PluginFunctions::triMesh(*o_it));
......@@ -1425,8 +1435,8 @@ void MovePlugin::slotSelectionModeChanged(QAction* _action){
* @param _state Qt::CheckState of checkbox
*/
void MovePlugin::setAllTargets(int _state) {
allTargets_ = (_state == Qt::Checked);
void MovePlugin::setAllTargets(bool _state) {
allTargets_ = _state;
}
Q_EXPORT_PLUGIN2( moveplugin , MovePlugin );
......
......@@ -331,7 +331,7 @@ class MovePlugin : public QObject, BaseInterface, MouseInterface, KeyInterface,
void slotSelectionModeChanged(QAction* _action);
/// 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,
/// Context menu entry
QAction* contextAction_;
/// Checked if transformation should be applied to all target objs
QAction* toAllTargets_;
/** @} */
//===========================================================================
......
......@@ -30,27 +30,11 @@
<property name="title" >
<string>Set Properties</string>
</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" >
<property name="geometry" >
<rect>
<x>10</x>
<y>740</y>
<y>686</y>
<width>308</width>
<height>111</height>
</rect>
......@@ -79,7 +63,7 @@
<property name="geometry" >
<rect>
<x>10</x>
<y>290</y>
<y>236</y>
<width>308</width>
<height>441</height>
</rect>
......@@ -678,7 +662,7 @@
<property name="geometry" >
<rect>
<x>10</x>
<y>84</y>
<y>30</y>
<width>308</width>
<height>198</height>
</rect>
......@@ -990,7 +974,6 @@
</layout>
</widget>
<tabstops>
<tabstop>targetObjects</tabstop>
<tabstop>posx</tabstop>
<tabstop>posy</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