Commit 931e5d84 authored by Dirk Wilden's avatar Dirk Wilden
Browse files

animation editing

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9886 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b8854c29
...@@ -77,7 +77,7 @@ MovePlugin::MovePlugin() : ...@@ -77,7 +77,7 @@ MovePlugin::MovePlugin() :
toAllTargets_(0), toAllTargets_(0),
placeMode_(false), placeMode_(false),
recursiveJointTransformation_(true), recursiveJointTransformation_(true),
transformRefPose_(true), transformRefPose_(false),
transformCurrentPose_(false) transformCurrentPose_(false)
{ {
manip_size_ = 1.0; manip_size_ = 1.0;
......
...@@ -844,18 +844,35 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){ ...@@ -844,18 +844,35 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){
return; return;
} }
bool recursiveJointTransformation = recursiveJointTransformation_;
AnimationHandle handle = skeletonObj->skeletonNode()->getActivePose(); AnimationHandle handle = skeletonObj->skeletonNode()->getActivePose();
Skeleton::Pose* activePose; Skeleton::Pose* activePose;
if ( !handle.isValid() ) if ( !handle.isValid() )
activePose = skeleton->getReferencePose(); activePose = skeleton->getReferencePose();
else else{
activePose = skeleton->getAnimation( handle.getAnimation() )->getPose( handle.getFrame() ); activePose = skeleton->getAnimation( handle.getAnimation() )->getPose( handle.getFrame() );
//always tranform children otherwise only the local coordsys is rotated
recursiveJointTransformation = false;
// translation changes the skeleton structure
// this is only allowed in refPose therefore delete translation
Matrix4x4 mat = _matrix;
mat(0,3) = 0.0;
mat(1,3) = 0.0;
mat(2,3) = 0.0;
if ( mat.is_identity() )
_matrix = mat;
}
Matrix4x4 transform; Matrix4x4 transform;
transform.identity(); transform.identity();
Skeleton::Joint* joint = skeleton->getJoint( skeletonObj->manipulatorNode()->getData().toInt() ); Skeleton::Joint* joint = skeleton->getJoint( skeletonObj->manipulatorNode()->getData().toInt() );
if (joint == 0) if (joint == 0)
...@@ -889,14 +906,14 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){ ...@@ -889,14 +906,14 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){
//transform the local matrix //transform the local matrix
Matrix4x4 newMatrix = transform * pose->getLocal( joint->getID() ); Matrix4x4 newMatrix = transform * pose->getLocal( joint->getID() );
pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation_); pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation);
} else { } else {
//directly apply the global transformation //directly apply the global transformation
Matrix4x4 newMatrix = pose->getGlobal( joint->getID() ) * transform; Matrix4x4 newMatrix = pose->getGlobal( joint->getID() ) * transform;
pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation_); pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation);
} }
} }
...@@ -911,14 +928,14 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){ ...@@ -911,14 +928,14 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){
//transform all selected joints //transform all selected joints
Matrix4x4 newMatrix = transform * pose->getLocal( joint->getID() ); Matrix4x4 newMatrix = transform * pose->getLocal( joint->getID() );
pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation_); pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation);
} else { } else {
//directly apply the global transformation //directly apply the global transformation
Matrix4x4 newMatrix = pose->getGlobal( joint->getID() ) * transform; Matrix4x4 newMatrix = pose->getGlobal( joint->getID() ) * transform;
pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation_); pose->setLocal( joint->getID(), newMatrix, !recursiveJointTransformation);
} }
...@@ -930,7 +947,15 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){ ...@@ -930,7 +947,15 @@ void MovePlugin::transformSkeletonJoint( int _objectId , Matrix4x4 _matrix ){
if (exists) if (exists)
RPC::callFunction("segmentationplugin", "updateSegmentation"); RPC::callFunction("segmentationplugin", "updateSegmentation");
} }
//update the skin
bool exists = false;
emit functionExists("skeletonplugin", "updateSkin()", exists);
if (exists)
RPC::callFunction("skeletonplugin", "updateSkin");
emit updatedObject(_objectId, UPDATE_GEOMETRY); emit updatedObject(_objectId, UPDATE_GEOMETRY);
QString matString; QString matString;
......
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