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 @@
// 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/>.
//
......@@ -37,45 +37,45 @@
//***********************************************************************************
void MovePlugin::showProps(){
QVariant contextObject = contextAction_->data();
int objectId = contextObject.toInt();
if ( objectId == -1)
return;
// 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();
BaseObjectData* obj;
if ( ! PluginFunctions::getObject(meshID,obj) )
return;
movePropsWidget* pW = new movePropsWidget(obj);
pW->setWindowTitle(QString((mNode->name()).c_str()));
connect(pW->posButton,SIGNAL(clicked() ),this,SLOT(slotSetPosition()));
connect(pW->axisAButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisA()));
connect(pW->axisBButton,SIGNAL(clicked() ),this,SLOT(slotToggleAxisB()));
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->scaleButton,SIGNAL(clicked() ),this,SLOT(slotScale()));
connect(pW->projectTangentButton,SIGNAL(clicked() ),this,SLOT(slotProjectToTangentPlane()));
connect(pW->moveManipToCOG,SIGNAL(clicked() ),this,SLOT(slotMoveManipToCOG()));
// Values
BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) {
......@@ -83,7 +83,7 @@ void MovePlugin::showProps(){
const TriMesh::Point pos = object->manipulatorNode()->center();
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);
......@@ -92,20 +92,20 @@ void MovePlugin::showProps(){
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();
propsWindows_.append(pW);
}
\ No newline at end of file
}
......@@ -758,16 +758,20 @@ void MovePlugin::slotTranslation() {
// }
BaseObjectData* object = pW->getBaseObjectData();
if ( object != 0 ) {
if ( object->manipulatorNode()->visible() ){
if (object != 0) {
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 );
emit createBackup(object->id(),"Translation");
emit updatedObject(object->id());
object->manipulatorNode()->set_center(
object->manipulatorNode()->center() + translation);
emit createBackup(object->id(), "Translation");
emit updatedObject(object->id());
}
} else {
return;
}
} else return;
updateManipulatorDialog();
......@@ -890,26 +894,29 @@ void MovePlugin::slotRotate() {
BaseObjectData* object = pW->getBaseObjectData();
if ( object != 0 ) {
if ( object->manipulatorNode()->visible() ){
if (object != 0) {
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 ) )
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::triMesh(object)) );
if (object->dataType(DATA_TRIANGLE_MESH))
transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::triMesh(object)));
if (object->dataType( DATA_POLY_MESH ) )
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::polyMesh(object)) );
if (object->dataType(DATA_POLY_MESH))
transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::polyMesh(object)));
updateManipulatorDialog();
updateManipulatorDialog();
emit createBackup(object->id(),"Rotation");
emit updatedObject(object->id());
emit createBackup(object->id(), "Rotation");
emit updatedObject(object->id());
}
}
}
emit scriptInfo(QString("slotRotate()"));
emit updateView();
emit scriptInfo(QString("slotRotate()"));
emit updateView();
}
......@@ -957,23 +964,26 @@ void MovePlugin::slotScale() {
BaseObjectData* object = pW->getBaseObjectData();
if ( object != 0 ) {
if ( object->manipulatorNode()->visible() ){
if (object != 0) {
if (object->manipulatorNode()->visible() && (object->target()
|| !pW->targetObjects->isChecked())) {
object->manipulatorNode()->scale( scale);
object->manipulatorNode()->scale(scale);
if (object->dataType( DATA_TRIANGLE_MESH ) )
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::triMesh(object)) );
if (object->dataType(DATA_TRIANGLE_MESH))
transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::triMesh(object)));
if (object->dataType( DATA_POLY_MESH ) )
transformMesh( getLastManipulatorMatrix(true) , (*PluginFunctions::polyMesh(object)) );
if (object->dataType(DATA_POLY_MESH))
transformMesh(getLastManipulatorMatrix(true),
(*PluginFunctions::polyMesh(object)));
updateManipulatorDialog();
updateManipulatorDialog();
emit createBackup(object->id(),"Scaling");
emit updatedObject(object->id());
emit createBackup(object->id(), "Scaling");
emit updatedObject(object->id());
}
}
}
emit scriptInfo(QString("slotScale()"));
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