Commit bb628282 authored by Mike Kremer's avatar Mike Kremer

Corrected setPosition function to correctly transform mesh as desired.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10983 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7d6fb1f2
......@@ -868,8 +868,23 @@ void MovePlugin::slotSetPosition() {
BaseObjectData* object;
if ( PluginFunctions::getObject(lastActiveManipulator_ , object) ) {
if ( object->manipulatorNode()->visible() )
object->manipulatorNode()->set_center( newpos );
if ( object->manipulatorNode()->visible() ) {
// Compute translation vector
ACG::Vec3d translation = newpos;
translation -= object->manipulatorNode()->center();
object->manipulatorNode()->set_center(newpos);
// Stuff it into transformation matrix
ACG::GLMatrixd m;
m.identity();
m.translate(translation);
// ...and transform mesh
if(object->dataType() == DATA_TRIANGLE_MESH)
transformMesh(m, *PluginFunctions::triMesh(object));
else if(object->dataType() == DATA_POLY_MESH)
transformMesh(m, *PluginFunctions::polyMesh(object));
emit updatedObject(object->id(), UPDATE_GEOMETRY);
}
updateManipulatorDialog();
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