Commit 37474104 authored by Dirk Wilden's avatar Dirk Wilden

changes for new backup system

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@11262 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 3f6ff611
......@@ -440,6 +440,15 @@ void SkeletonEditingPlugin::manipulatorMoved( QtTranslationManipulatorNode* _nod
transformJoint( objectId, _node->getData().toInt(), mat );
if (_event->type() == QEvent::MouseButtonPress)
accumMatrix_.identity();
accumMatrix_ *= mat;
//only backup on mouseRelease
if ( (_event->type() == QEvent::MouseButtonRelease) && !accumMatrix_.is_identity() )
emit createBackup(objectId, "Joint Transformation", UPDATE_GEOMETRY);
BaseObjectData* object = 0;
PluginFunctions::getObject(objectId, object);
......@@ -590,6 +599,7 @@ void SkeletonEditingPlugin::deleteJoint(QMouseEvent* _event)
skeleton->removeJoint(joint);
PluginFunctions::skeletonObject(object)->updateIndices();
emit updatedObject(object->id(), UPDATE_ALL);
emit createBackup(object->id(), "Delete Joint", UPDATE_TOPOLOGY);
} else
emit deleteObject( object->id() );
}
......@@ -717,6 +727,7 @@ void SkeletonEditingPlugin::insertJoint(QMouseEvent* _event)
// set joint position
setJointPosition(PluginFunctions::skeletonObject(baseObject), rootJoint, lastHitPoint);
emit updatedObject(baseObject->id(), UPDATE_ALL);
emit createBackup(baseObject->id(), "Add Joints", UPDATE_ALL);
// add an additional joint which is moved on mousemove
Skeleton::Joint* tmpJoint = new Skeleton::Joint(rootJoint);
......@@ -948,6 +959,7 @@ void SkeletonEditingPlugin::cancelJointInsertion(){
skeleton->removeJoint(joint);
emit updatedObject(baseObject->id(), UPDATE_ALL);
emit createBackup(baseObject->id(), "Add Joints", UPDATE_ALL);
}
//--------------------------------------------------------------------------------
......
......@@ -78,7 +78,7 @@ class SkeletonEditingPlugin : public QObject, BaseInterface, MouseInterface, Key
void deleteObject( int _id);
// BackupInterface
void createBackup( int _objectid, QString _name);
void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL );
private slots :
......@@ -217,6 +217,8 @@ class SkeletonEditingPlugin : public QObject, BaseInterface, MouseInterface, Key
// Object marker to dimm Objects during manipulator transformation
SkeletonMarker objectMarker_;
ACG::Matrix4x4d accumMatrix_;
private:
/// Place and show the Manipulator
void placeManip(QMouseEvent* _event);
......
......@@ -120,12 +120,12 @@ void SkeletonEditingPlugin::splitBone( int _objectId, int _tailJoint){
}
}
emit updatedObject(_objectId, UPDATE_ALL);
emit updatedObject(_objectId, UPDATE_GEOMETRY);
emit scriptInfo("splitBone( ObjectId, " + QString::number(_tailJoint) + " )" );
// Create backup
emit createBackup(_objectId, "Split Bone");
emit createBackup(_objectId, "Split Bone", UPDATE_TOPOLOGY);
}
//------------------------------------------------------------------------------
......@@ -165,7 +165,7 @@ void SkeletonEditingPlugin::addJoint( int _objectId , int _parent, Vector _posit
+ QString::number(_position[2]) + ") )" );
// Create backup
emit createBackup(_objectId, "Remove Joint");
emit createBackup(_objectId, "Add Joint", UPDATE_TOPOLOGY);
}
//------------------------------------------------------------------------------
......@@ -196,7 +196,7 @@ void SkeletonEditingPlugin::deleteJoint( int _objectId , int _jointId ){
emit scriptInfo("deleteJoint( ObjectId, " + QString::number(_jointId) + " )" );
// Create backup
emit createBackup(_objectId, "Delete Joint");
emit createBackup(_objectId, "Delete Joint", UPDATE_TOPOLOGY);
emit updatedObject(_objectId, UPDATE_ALL);
}
......@@ -290,8 +290,10 @@ void SkeletonEditingPlugin::transformJoint( int _objectId , int _jointId, Matrix
emit scriptInfo( "transformJoint( ObjectId, " + QString::number(_jointId) + ", Matrix4x4(" + matString + " ) )" );
// Create backup
emit createBackup(_objectId, "Joint Transformation");
// Create backup if there was a change
// the backup is only created when the slot is called via scripting (sender == 0)
if ( !_matrix.is_identity() && (sender() == 0) )
emit createBackup(_objectId, "Joint Transformation", UPDATE_GEOMETRY);
}
//------------------------------------------------------------------------------
......@@ -662,7 +664,7 @@ void SkeletonEditingPlugin::addAnimation(int _objectId, QString _name, int _fram
emit scriptInfo("addAnimation( ObjectId, " + _name + ", " + QString::number(_frames) + ")" );
// Create backup
emit createBackup(_objectId, "Add Animation");
emit createBackup(_objectId, "Add Animation", UPDATE_ALL);
}
//------------------------------------------------------------------------------
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