implemented adding keyframes by click to graph editor

This commit is contained in:
itsmattkc
2019-01-04 22:35:26 +11:00
parent 3f641ff815
commit fc7c17dee9
4 changed files with 292 additions and 80 deletions
+22
View File
@@ -1269,3 +1269,25 @@ void SetLong::redo() {
*p = newval;
mainWindow->setWindowModified(true);
}
KeyframeFieldSet::KeyframeFieldSet(EffectField *ifield, int ii) :
field(ifield),
index(ii),
key(ifield->keyframes.at(ii)),
done(true),
old_project_changed(mainWindow->isWindowModified())
{}
void KeyframeFieldSet::undo() {
field->keyframes.removeAt(index);
mainWindow->setWindowModified(old_project_changed);
done = false;
}
void KeyframeFieldSet::redo() {
if (!done) {
field->keyframes.insert(index, key);
mainWindow->setWindowModified(true);
}
done = true;
}
+15
View File
@@ -360,6 +360,21 @@ private:
bool done;
};
// a more modern version of the above, could probably replace it
// assumes the keyframe already exists
class KeyframeFieldSet : public QUndoCommand {
public:
KeyframeFieldSet(EffectField* ifield, int ii);
void undo();
void redo();
private:
EffectField* field;
int index;
EffectKeyframe key;
bool done;
bool old_project_changed;
};
class EffectFieldUndo : public QUndoCommand {
public:
EffectFieldUndo(EffectField* field);