Commit ce07789d authored by Mike Kremer's avatar Mike Kremer

Fixed "Apply to target objects" issue. A transformation can now be restrained...

Fixed "Apply to target objects" issue. A transformation can now be restrained to target objects by checking the appropriate checkbox in the manipulator node's properties widget.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5948 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 63d41d34
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
// it under the terms of the GNU Lesser General Public License as published by // 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 // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// OpenFlipper is distributed in the hope that it will be useful, // OpenFlipper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details. // GNU Lesser General Public License for more details.
// //
// You should have received a copy of the GNU Lesser General Public License // You should have received a copy of the GNU Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>. // along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
// //
...@@ -37,45 +37,45 @@ ...@@ -37,45 +37,45 @@
//*********************************************************************************** //***********************************************************************************
void MovePlugin::showProps(){ void MovePlugin::showProps(){
QVariant contextObject = contextAction_->data(); QVariant contextObject = contextAction_->data();
int objectId = contextObject.toInt(); int objectId = contextObject.toInt();
if ( objectId == -1) if ( objectId == -1)
return; return;
// Get Node // Get Node
ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), objectId ); ACG::SceneGraph::BaseNode* node = ACG::SceneGraph::find_node( PluginFunctions::getSceneGraphRootNode(), objectId );
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 meshID = mNode->getIdentifier(); int meshID = mNode->getIdentifier();
BaseObjectData* obj; BaseObjectData* obj;
if ( ! PluginFunctions::getObject(meshID,obj) ) if ( ! PluginFunctions::getObject(meshID,obj) )
return; return;
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->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) ) {
...@@ -83,7 +83,7 @@ void MovePlugin::showProps(){ ...@@ -83,7 +83,7 @@ void MovePlugin::showProps(){
const TriMesh::Point pos = object->manipulatorNode()->center(); const TriMesh::Point pos = object->manipulatorNode()->center();
QString num; QString num;
num = QString::number(pos[0]); pW->posx->setText(num); num = QString::number(pos[0]); pW->posx->setText(num);
num = QString::number(pos[1]); pW->posy->setText(num); num = QString::number(pos[1]); pW->posy->setText(num);
num = QString::number(pos[2]); pW->posz->setText(num); num = QString::number(pos[2]); pW->posz->setText(num);
...@@ -92,20 +92,20 @@ void MovePlugin::showProps(){ ...@@ -92,20 +92,20 @@ void MovePlugin::showProps(){
num = QString::number(direction[0]); pW->dirxx->setText(num); num = QString::number(direction[0]); pW->dirxx->setText(num);
num = QString::number(direction[1]); pW->dirxy->setText(num); num = QString::number(direction[1]); pW->dirxy->setText(num);
num = QString::number(direction[2]); pW->dirxz->setText(num); num = QString::number(direction[2]); pW->dirxz->setText(num);
direction = object->manipulatorNode()->directionY(); direction = object->manipulatorNode()->directionY();
num = QString::number(direction[0]); pW->diryx->setText(num); num = QString::number(direction[0]); pW->diryx->setText(num);
num = QString::number(direction[1]); pW->diryy->setText(num); num = QString::number(direction[1]); pW->diryy->setText(num);
num = QString::number(direction[2]); pW->diryz->setText(num); num = QString::number(direction[2]); pW->diryz->setText(num);
direction = object->manipulatorNode()->directionZ(); direction = object->manipulatorNode()->directionZ();
num = QString::number(direction[0]); pW->dirzx->setText(num); num = QString::number(direction[0]); pW->dirzx->setText(num);
num = QString::number(direction[1]); pW->dirzy->setText(num); num = QString::number(direction[1]); pW->dirzy->setText(num);
num = QString::number(direction[2]); pW->dirzz->setText(num); num = QString::number(direction[2]); pW->dirzz->setText(num);
} }
} }
pW->show(); pW->show();
propsWindows_.append(pW); propsWindows_.append(pW);
} }
\ No newline at end of file
...@@ -758,16 +758,20 @@ void MovePlugin::slotTranslation() { ...@@ -758,16 +758,20 @@ void MovePlugin::slotTranslation() {
// } // }
BaseObjectData* object = pW->getBaseObjectData(); BaseObjectData* object = pW->getBaseObjectData();
if ( object != 0 ) { if (object != 0) {
if ( object->manipulatorNode()->visible() ){ if (object->manipulatorNode()->visible() &&
(object->target() || !pW->targetObjects->isChecked())) {
translate( object->id() , translation ); translate(object->id(), translation);
object->manipulatorNode()->set_center( object->manipulatorNode()->center() + translation ); object->manipulatorNode()->set_center(
emit createBackup(object->id(),"Translation"); object->manipulatorNode()->center() + translation);
emit updatedObject(object->id()); emit createBackup(object->id(), "Translation");
emit updatedObject(object->id());
}
} else {
return;
} }
} else return;
updateManipulatorDialog(); updateManipulatorDialog();
...@@ -890,26 +894,29 @@ void MovePlugin::slotRotate() { ...@@ -890,26 +894,29 @@ void MovePlugin::slotRotate() {
BaseObjectData* object = pW->getBaseObjectData(); BaseObjectData* object = pW->getBaseObjectData();
if ( object != 0 ) { if (object != 0) {
if ( object->manipulatorNode()->visible() ){ if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) {
object->manipulatorNode()->rotate(angle,axis); object->manipulatorNode()->rotate(angle, axis);
if (object->dataType( DATA_TRIANGLE_MESH ) ) if (object->dataType(DATA_TRIANGLE_MESH))
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::triMesh(object)) ); transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::triMesh(object)));
if (object->dataType( DATA_POLY_MESH ) ) if (object->dataType(DATA_POLY_MESH))
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::polyMesh(object)) ); transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::polyMesh(object)));
updateManipulatorDialog(); updateManipulatorDialog();
emit createBackup(object->id(),"Rotation"); emit createBackup(object->id(), "Rotation");
emit updatedObject(object->id()); emit updatedObject(object->id());
}
} }
}
emit scriptInfo(QString("slotRotate()")); emit scriptInfo(QString("slotRotate()"));
emit updateView(); emit updateView();
} }
...@@ -957,23 +964,26 @@ void MovePlugin::slotScale() { ...@@ -957,23 +964,26 @@ void MovePlugin::slotScale() {
BaseObjectData* object = pW->getBaseObjectData(); BaseObjectData* object = pW->getBaseObjectData();
if ( object != 0 ) { if (object != 0) {
if ( object->manipulatorNode()->visible() ){ if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) {
object->manipulatorNode()->scale( scale); object->manipulatorNode()->scale(scale);
if (object->dataType( DATA_TRIANGLE_MESH ) ) if (object->dataType(DATA_TRIANGLE_MESH))
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::triMesh(object)) ); transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::triMesh(object)));
if (object->dataType( DATA_POLY_MESH ) ) if (object->dataType(DATA_POLY_MESH))
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::polyMesh(object)) ); transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::polyMesh(object)));
updateManipulatorDialog(); updateManipulatorDialog();
emit createBackup(object->id(),"Scaling"); emit createBackup(object->id(), "Scaling");
emit updatedObject(object->id()); emit updatedObject(object->id());
}
} }
}
emit scriptInfo(QString("slotScale()")); emit scriptInfo(QString("slotScale()"));
emit updateView(); emit updateView();
......
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