Commit f0e132cc authored by Jan Möbius's avatar Jan Möbius

Set translator to match coordinate system transformation



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@12975 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 38f4f578
......@@ -365,8 +365,8 @@ void SkeletonEditingPlugin::placeManip(QMouseEvent * _event) {
o_it->enablePicking( o_it->dataType(DATA_SKELETON) );
//perform picking
successfullyPicked = PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx,
target_idx, &hitPoint) && PluginFunctions::getPickedObject(node_idx, object);
successfullyPicked = PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_ANYTHING, _event->pos(), node_idx, target_idx, &hitPoint) &&
PluginFunctions::getPickedObject(node_idx, object);
//reenable picking for anything
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS) ; o_it != PluginFunctions::objectsEnd(); ++o_it)
......@@ -394,6 +394,18 @@ void SkeletonEditingPlugin::placeManip(QMouseEvent * _event) {
object->manipulatorNode()->setMode( QtTranslationManipulatorNode::TranslationRotation );
object->manipulatorNode()->show();
// Get the global matrix from the picked joint
Skeleton* skeleton = PluginFunctions::skeleton( object );
Skeleton::Joint* pickedJoint = skeleton->joint( data );
Skeleton::Pose* currentPose = activePose(PluginFunctions::skeletonObject(object));
const Matrix4x4 pickedGlobalMatrix = currentPose->globalMatrix(pickedJoint->id());
// Orient the manipulator to be aligned with the joint coordinate system.
Vector x_axis = pickedGlobalMatrix.transform_vector(Vector(1.0, 0.0, 0.0));
Vector y_axis = pickedGlobalMatrix.transform_vector(Vector(0.0, 1.0, 0.0));
object->manipulatorNode()->set_direction(x_axis,y_axis);
object->manipulatorNode()->apply_transformation(false);
// Disconnect a previously connected Signal
......
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