mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-11 19:00:04 +01:00
loop recording now saves plugin AutomationSources (eg WJSendPlugin!)
This commit is contained in:
@@ -12,19 +12,6 @@ class ShaderLoopRecordPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
|||||||
|
|
||||||
self.PRESET_FILE_NAME = "ShaderLoopRecordPlugin/frames.json"
|
self.PRESET_FILE_NAME = "ShaderLoopRecordPlugin/frames.json"
|
||||||
|
|
||||||
#TODO: this doesnt work
|
|
||||||
"""self.frames = [
|
|
||||||
[
|
|
||||||
Frame(self.pc).store_copy(f)
|
|
||||||
for f in [
|
|
||||||
z for z in [
|
|
||||||
frame for frame in [
|
|
||||||
clip for clip in self.load_presets()
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]"""
|
|
||||||
for clip in self.load_presets():
|
for clip in self.load_presets():
|
||||||
c = []
|
c = []
|
||||||
for frame in clip:
|
for frame in clip:
|
||||||
@@ -188,7 +175,8 @@ class ShaderLoopRecordPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
|||||||
if self.DEBUG_FRAMES: print (">>>>>>>>>>>>>>frame at %i%%: %i" % (position*100, current_frame_index))
|
if self.DEBUG_FRAMES: print (">>>>>>>>>>>>>>frame at %i%%: %i" % (position*100, current_frame_index))
|
||||||
#print("got frame index %s" % current_frame_index)
|
#print("got frame index %s" % current_frame_index)
|
||||||
|
|
||||||
current_frame = self.pc.fm.get_live_frame() #.copy()
|
if self.recording:
|
||||||
|
current_frame = self.pc.fm.get_live_frame() #.copy()
|
||||||
|
|
||||||
selected_clip = self.selected_clip
|
selected_clip = self.selected_clip
|
||||||
if self.DEBUG_FRAMES: print("current_frame copy before recall is %s" % current_frame['shader_params'])
|
if self.DEBUG_FRAMES: print("current_frame copy before recall is %s" % current_frame['shader_params'])
|
||||||
@@ -198,6 +186,10 @@ class ShaderLoopRecordPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
|||||||
#clip = self.frames[selected_clip]
|
#clip = self.frames[selected_clip]
|
||||||
if self.is_playing() and self.recording and self.selected_clip not in self.running_clips:
|
if self.is_playing() and self.recording and self.selected_clip not in self.running_clips:
|
||||||
self.running_clips += [ self.selected_clip ]
|
self.running_clips += [ self.selected_clip ]
|
||||||
|
if self.recording:
|
||||||
|
current_frame = self.pc.fm.get_live_frame() #.copy()
|
||||||
|
if self.DEBUG_FRAMES: print("current_frame copy before recall is %s" % current_frame['shader_params'])
|
||||||
|
|
||||||
for selected_clip in self.running_clips:
|
for selected_clip in self.running_clips:
|
||||||
saved_frame = self.frames[selected_clip][current_frame_index]
|
saved_frame = self.frames[selected_clip][current_frame_index]
|
||||||
if not self.recording or (selected_clip!=self.selected_clip):
|
if not self.recording or (selected_clip!=self.selected_clip):
|
||||||
@@ -214,7 +206,7 @@ class ShaderLoopRecordPlugin(ActionsPlugin,SequencePlugin,DisplayPlugin):
|
|||||||
# add the params tweaked this frame to the params to be ignored by recall
|
# add the params tweaked this frame to the params to be ignored by recall
|
||||||
if self.DEBUG_FRAMES: print("saved frame is \t%s" % saved_frame['shader_params'])
|
if self.DEBUG_FRAMES: print("saved frame is \t%s" % saved_frame['shader_params'])
|
||||||
self.ignored = self.pc.fm.merge_frames(self.ignored, diff)
|
self.ignored = self.pc.fm.merge_frames(self.ignored, diff)
|
||||||
print("about to call get_ignored_frames with %s\n and\n %s" % (saved_frame.f, self.ignored.f))
|
if self.DEBUG_FRAMES: print("about to call get_ignored_frames with %s\n and\n %s" % (saved_frame.f, self.ignored.f))
|
||||||
diff = self.pc.fm.merge_frames(
|
diff = self.pc.fm.merge_frames(
|
||||||
self.pc.fm.get_frame_ignored(saved_frame, self.ignored),
|
self.pc.fm.get_frame_ignored(saved_frame, self.ignored),
|
||||||
diff
|
diff
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ class Frame:
|
|||||||
'shader_speeds': copy.deepcopy(self.pc.shaders.selected_speed_list),
|
'shader_speeds': copy.deepcopy(self.pc.shaders.selected_speed_list),
|
||||||
'strobe_amount': self.pc.shaders.data.settings['shader']['STROBE_AMOUNT']['value'] / 10.0
|
'strobe_amount': self.pc.shaders.data.settings['shader']['STROBE_AMOUNT']['value'] / 10.0
|
||||||
}
|
}
|
||||||
|
#print("about to call get_plugin_frame_data")
|
||||||
|
frame.update(self.pc.fm.get_plugin_frame_data())
|
||||||
self.f = frame
|
self.f = frame
|
||||||
#print("built frame: %s" % frame['shader_params'])
|
#print("built frame: %s" % self.f)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def store_copy(self, f):
|
def store_copy(self, f):
|
||||||
@@ -83,6 +85,11 @@ class Frame:
|
|||||||
if self.f.get('strobe_amount') is not None:
|
if self.f.get('strobe_amount') is not None:
|
||||||
self.pc.actions.set_strobe_amount_continuous(self.f.get('strobe_amount'))
|
self.pc.actions.set_strobe_amount_continuous(self.f.get('strobe_amount'))
|
||||||
|
|
||||||
|
from data_centre.plugin_collection import AutomationSourcePlugin
|
||||||
|
for plugin in self.pc.get_plugins(AutomationSourcePlugin):
|
||||||
|
#print("recalling for plugin %s with data %s" % (plugin, self.f.get(plugin.frame_key)))
|
||||||
|
plugin.recall_frame_data(self.f.get(plugin.frame_key))
|
||||||
|
|
||||||
def recall_frame(self):
|
def recall_frame(self):
|
||||||
preset = self
|
preset = self
|
||||||
|
|
||||||
@@ -135,6 +142,11 @@ class Frame:
|
|||||||
if frame2.f.get('strobe_amount'):
|
if frame2.f.get('strobe_amount'):
|
||||||
f['strobe_amount'] = frame2.f.get('strobe_amount')
|
f['strobe_amount'] = frame2.f.get('strobe_amount')
|
||||||
|
|
||||||
|
# todo: merge from plugins
|
||||||
|
from data_centre.plugin_collection import AutomationSourcePlugin
|
||||||
|
for plugin in self.pc.get_plugins(AutomationSourcePlugin):
|
||||||
|
f[plugin.frame_key] = frame2.f.get(plugin.frame_key)
|
||||||
|
|
||||||
if self.DEBUG_FRAMES: print("merge_frames: got return\t%s" % f)
|
if self.DEBUG_FRAMES: print("merge_frames: got return\t%s" % f)
|
||||||
return Frame(self.pc).store_copy(f)
|
return Frame(self.pc).store_copy(f)
|
||||||
|
|
||||||
@@ -159,6 +171,9 @@ class Frame:
|
|||||||
if ignored.get('strobe_amount') is not None:
|
if ignored.get('strobe_amount') is not None:
|
||||||
f['strobe_amount'] = None
|
f['strobe_amount'] = None
|
||||||
if self.DEBUG_FRAMES: print("get_frame_ignored: got return\t%s" % f)
|
if self.DEBUG_FRAMES: print("get_frame_ignored: got return\t%s" % f)
|
||||||
|
|
||||||
|
# todo: find ignored from plugin
|
||||||
|
|
||||||
return Frame(self.pc).store_copy(f)
|
return Frame(self.pc).store_copy(f)
|
||||||
|
|
||||||
def is_empty(self):
|
def is_empty(self):
|
||||||
@@ -184,6 +199,14 @@ class Frame:
|
|||||||
if f is not None:
|
if f is not None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# todo: check empty from plugins
|
||||||
|
from data_centre.plugin_collection import AutomationSourcePlugin
|
||||||
|
for plugin in self.pc.get_plugins(AutomationSourcePlugin):
|
||||||
|
if frame.get(plugin.frame_key) is None:
|
||||||
|
continue
|
||||||
|
if len(frame.get(plugin.frame_key))>1:
|
||||||
|
return False
|
||||||
|
|
||||||
if self.DEBUG_FRAMES: print("is_frame_empty: got return true")
|
if self.DEBUG_FRAMES: print("is_frame_empty: got return true")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -229,6 +252,13 @@ class Frame:
|
|||||||
print("param_values is\t%s" % param_values)
|
print("param_values is\t%s" % param_values)
|
||||||
print("speed_values is\t%s" % speed_values)
|
print("speed_values is\t%s" % speed_values)
|
||||||
|
|
||||||
|
# todo: check diff from plugins
|
||||||
|
plugin_data = {}
|
||||||
|
from data_centre.plugin_collection import AutomationSourcePlugin
|
||||||
|
for plugin in self.pc.get_plugins(AutomationSourcePlugin):
|
||||||
|
if current_frame.get(plugin.frame_key) is not None:
|
||||||
|
plugin_data[plugin.frame_key] = plugin.get_frame_diff(last_frame, current_frame)
|
||||||
|
|
||||||
diff = {
|
diff = {
|
||||||
'shader_params': param_values,
|
'shader_params': param_values,
|
||||||
'feedback_active': feedback_active,
|
'feedback_active': feedback_active,
|
||||||
@@ -236,6 +266,7 @@ class Frame:
|
|||||||
'shader_speeds': speed_values,
|
'shader_speeds': speed_values,
|
||||||
'strobe_amount': strobe_amount,
|
'strobe_amount': strobe_amount,
|
||||||
}
|
}
|
||||||
|
diff.update(plugin_data)
|
||||||
if self.DEBUG_FRAMES: print("returning\t%s\n^^^^" % diff['shader_params'])
|
if self.DEBUG_FRAMES: print("returning\t%s\n^^^^" % diff['shader_params'])
|
||||||
|
|
||||||
return Frame(self.pc).store_copy(diff)
|
return Frame(self.pc).store_copy(diff)
|
||||||
@@ -276,3 +307,12 @@ class FrameManager:
|
|||||||
def get_frame_diff(self, last_frame, current_frame):
|
def get_frame_diff(self, last_frame, current_frame):
|
||||||
return last_frame.get_diff(current_frame)
|
return last_frame.get_diff(current_frame)
|
||||||
|
|
||||||
|
def get_plugin_frame_data(self):
|
||||||
|
data = {}
|
||||||
|
from data_centre.plugin_collection import AutomationSourcePlugin
|
||||||
|
for plugin in self.pc.get_plugins(AutomationSourcePlugin):
|
||||||
|
data[plugin.frame_key] = plugin.get_frame_data()
|
||||||
|
|
||||||
|
print("get_plugin_frame_data looks like %s" % data)
|
||||||
|
return data
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user