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 ...@@ -440,6 +440,15 @@ void SkeletonEditingPlugin::manipulatorMoved( QtTranslationManipulatorNode* _nod
transformJoint( objectId, _node->getData().toInt(), mat ); 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; BaseObjectData* object = 0;
PluginFunctions::getObject(objectId, object); PluginFunctions::getObject(objectId, object);
...@@ -590,6 +599,7 @@ void SkeletonEditingPlugin::deleteJoint(QMouseEvent* _event) ...@@ -590,6 +599,7 @@ void SkeletonEditingPlugin::deleteJoint(QMouseEvent* _event)
skeleton->removeJoint(joint); skeleton->removeJoint(joint);
PluginFunctions::skeletonObject(object)->updateIndices(); PluginFunctions::skeletonObject(object)->updateIndices();
emit updatedObject(object->id(), UPDATE_ALL); emit updatedObject(object->id(), UPDATE_ALL);
emit createBackup(object->id(), "Delete Joint", UPDATE_TOPOLOGY);
} else } else
emit deleteObject( object->id() ); emit deleteObject( object->id() );
} }
...@@ -717,6 +727,7 @@ void SkeletonEditingPlugin::insertJoint(QMouseEvent* _event) ...@@ -717,6 +727,7 @@ void SkeletonEditingPlugin::insertJoint(QMouseEvent* _event)
// set joint position // set joint position
setJointPosition(PluginFunctions::skeletonObject(baseObject), rootJoint, lastHitPoint); setJointPosition(PluginFunctions::skeletonObject(baseObject), rootJoint, lastHitPoint);
emit updatedObject(baseObject->id(), UPDATE_ALL); emit updatedObject(baseObject->id(), UPDATE_ALL);
emit createBackup(baseObject->id(), "Add Joints", UPDATE_ALL);
// add an additional joint which is moved on mousemove // add an additional joint which is moved on mousemove
Skeleton::Joint* tmpJoint = new Skeleton::Joint(rootJoint); Skeleton::Joint* tmpJoint = new Skeleton::Joint(rootJoint);
...@@ -948,6 +959,7 @@ void SkeletonEditingPlugin::cancelJointInsertion(){ ...@@ -948,6 +959,7 @@ void SkeletonEditingPlugin::cancelJointInsertion(){
skeleton->removeJoint(joint); skeleton->removeJoint(joint);
emit updatedObject(baseObject->id(), UPDATE_ALL); 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 ...@@ -78,7 +78,7 @@ class SkeletonEditingPlugin : public QObject, BaseInterface, MouseInterface, Key
void deleteObject( int _id); void deleteObject( int _id);
// BackupInterface // BackupInterface
void createBackup( int _objectid, QString _name); void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL );
private slots : private slots :
...@@ -217,6 +217,8 @@ class SkeletonEditingPlugin : public QObject, BaseInterface, MouseInterface, Key ...@@ -217,6 +217,8 @@ class SkeletonEditingPlugin : public QObject, BaseInterface, MouseInterface, Key
// Object marker to dimm Objects during manipulator transformation // Object marker to dimm Objects during manipulator transformation
SkeletonMarker objectMarker_; SkeletonMarker objectMarker_;
ACG::Matrix4x4d accumMatrix_;
private: private:
/// Place and show the Manipulator /// Place and show the Manipulator
void placeManip(QMouseEvent* _event); void placeManip(QMouseEvent* _event);
......
...@@ -120,12 +120,12 @@ void SkeletonEditingPlugin::splitBone( int _objectId, int _tailJoint){ ...@@ -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) + " )" ); emit scriptInfo("splitBone( ObjectId, " + QString::number(_tailJoint) + " )" );
// Create backup // 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 ...@@ -165,7 +165,7 @@ void SkeletonEditingPlugin::addJoint( int _objectId , int _parent, Vector _posit
+ QString::number(_position[2]) + ") )" ); + QString::number(_position[2]) + ") )" );
// Create backup // 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 ){ ...@@ -196,7 +196,7 @@ void SkeletonEditingPlugin::deleteJoint( int _objectId , int _jointId ){
emit scriptInfo("deleteJoint( ObjectId, " + QString::number(_jointId) + " )" ); emit scriptInfo("deleteJoint( ObjectId, " + QString::number(_jointId) + " )" );
// Create backup // Create backup
emit createBackup(_objectId, "Delete Joint"); emit createBackup(_objectId, "Delete Joint", UPDATE_TOPOLOGY);
emit updatedObject(_objectId, UPDATE_ALL); emit updatedObject(_objectId, UPDATE_ALL);
} }
...@@ -290,8 +290,10 @@ void SkeletonEditingPlugin::transformJoint( int _objectId , int _jointId, Matrix ...@@ -290,8 +290,10 @@ void SkeletonEditingPlugin::transformJoint( int _objectId , int _jointId, Matrix
emit scriptInfo( "transformJoint( ObjectId, " + QString::number(_jointId) + ", Matrix4x4(" + matString + " ) )" ); emit scriptInfo( "transformJoint( ObjectId, " + QString::number(_jointId) + ", Matrix4x4(" + matString + " ) )" );
// Create backup // Create backup if there was a change
emit createBackup(_objectId, "Joint Transformation"); // 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 ...@@ -662,7 +664,7 @@ void SkeletonEditingPlugin::addAnimation(int _objectId, QString _name, int _fram
emit scriptInfo("addAnimation( ObjectId, " + _name + ", " + QString::number(_frames) + ")" ); emit scriptInfo("addAnimation( ObjectId, " + _name + ", " + QString::number(_frames) + ")" );
// Create backup // 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