[pitivi] Serialize KeyFrame in the scenario files
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Serialize KeyFrame in the scenario files
- Date: Sat, 15 Nov 2014 10:33:45 +0000 (UTC)
commit 495029b70a68f7edba446b3954d1a0e1318c001e
Author: Thibault Saunier <tsaunier gnome org>
Date: Wed Oct 1 09:33:28 2014 +0200
Serialize KeyFrame in the scenario files
https://bugzilla.gnome.org/show_bug.cgi?id=739251
pitivi/undo/timeline.py | 43 +++++++++++++++++++++++++++++++++++++------
1 files changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/pitivi/undo/timeline.py b/pitivi/undo/timeline.py
index 4749f08..adff955 100644
--- a/pitivi/undo/timeline.py
+++ b/pitivi/undo/timeline.py
@@ -377,12 +377,14 @@ class LayerRemoved(UndoableAction):
class ControlSourceValueAdded(UndoableAction):
- def __init__(self, control_source, keyframe,
+ def __init__(self, track_element,
+ control_source, keyframe,
property_name):
UndoableAction.__init__(self)
self.control_source = control_source
self.keyframe = keyframe
self.property_name = property_name
+ self.track_element = track_element
def do(self):
self.control_source.set(self.keyframe.timestamp,
@@ -393,14 +395,24 @@ class ControlSourceValueAdded(UndoableAction):
self.control_source.unset(self.keyframe.timestamp)
self._undone()
+ def serializeLastAction(self):
+ st = Gst.Structure.new_empty("add-keyframe")
+ st.set_value("element-name", self.track_element.get_name())
+ st.set_value("property-name", self.property_name)
+ st.set_value("timestamp", float(self.keyframe.timestamp / Gst.SECOND))
+ st.set_value("value", self.keyframe.value)
+ return st
+
class ControlSourceValueRemoved(UndoableAction):
- def __init__(self, control_source, keyframe, property_name):
+ def __init__(self, track_element,
+ control_source, keyframe, property_name):
UndoableAction.__init__(self)
self.control_source = control_source
self.keyframe = keyframe
self.property_name = property_name
+ self.track_element = track_element
def do(self):
self.control_source.unset(self.keyframe.timestamp)
@@ -411,6 +423,14 @@ class ControlSourceValueRemoved(UndoableAction):
self.keyframe.value)
self._done()
+ def serializeLastAction(self):
+ st = Gst.Structure.new_empty("remove-keyframe")
+ st.set_value("element-name", self.track_element.get_name())
+ st.set_value("property-name", self.property_name)
+ st.set_value("timestamp", float(self.keyframe.timestamp / Gst.SECOND))
+ st.set_value("value", self.keyframe.value)
+ return st
+
class ControlSourceKeyframeChanged(UndoableAction):
@@ -562,6 +582,15 @@ class TimelineLogObserver(object):
tracker.connect("keyframe-moved", self._controlSourceKeyFrameMovedCb)
self.control_source_keyframe_trackers[control_source] = tracker
+ if self.log.app:
+ self.log.app.write_action("set-control-source",
+ {"element-name": track_element.get_name(),
+ "property-name": binding.props.name,
+ "binding-type": "direct",
+ "source-type": "interpolation",
+ "interpolation-mode": "linear"
+ })
+
def _disconnectFromControlSource(self, binding):
control_source = binding.props.control_source
control_source.disconnect_by_func(self._controlSourceKeyFrameAddedCb)
@@ -610,13 +639,15 @@ class TimelineLogObserver(object):
self.log.push(action)
def _controlSourceKeyFrameAddedCb(self, source, keyframe, track_element,
- property_name):
- action = ControlSourceValueAdded(source, keyframe, property_name)
+ property_name):
+ action = ControlSourceValueAdded(track_element,
+ source, keyframe, property_name)
self.log.push(action)
def _controlSourceKeyFrameRemovedCb(self, source, keyframe, track_element,
property_name):
- action = ControlSourceValueRemoved(source, keyframe, property_name)
+ action = ControlSourceValueRemoved(track_element,
+ source, keyframe, property_name)
self.log.push(action)
def _trackElementActiveChangedCb(self, track_element, active, add_effect_action):
@@ -627,7 +658,7 @@ class TimelineLogObserver(object):
self.log.push(action)
def _controlSourceKeyFrameMovedCb(self, tracker, track_element,
- keyframe, old_snapshot, new_snapshot):
+ keyframe, old_snapshot, new_snapshot):
action = ControlSourceKeyframeChanged(track_element, keyframe,
old_snapshot, new_snapshot)
self.log.push(action)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]