diff --git a/ACTIONS.md b/ACTIONS.md index 6c3280e..e2d7bcd 100644 --- a/ACTIONS.md +++ b/ACTIONS.md @@ -1,6 +1,6 @@ # Auto-generated Actions list -Fri 31 Jan 20:24:05 UTC 2020 +Fri 31 Jan 21:14:27 UTC 2020 for branch=feature_plugins_shader_gadgets @@ -173,6 +173,7 @@ for branch=feature_plugins_shader_gadgets * set_shader_speed_layer_([0-2])_amount ### Plugin routes + * (.*)|invert (from ManipulatePlugin) * (.*)&&(.*) (from MultiActionsPlugin) * run_automation (from ShaderLoopRecordPlugin) * stop_automation (from ShaderLoopRecordPlugin) @@ -199,6 +200,8 @@ for branch=feature_plugins_shader_gadgets * toggle_pause_automation (from TestPlugin) * pause_automation (from TestPlugin) * toggle_loop_automation (from TestPlugin) + * print_arguments (from TestPlugin) + * set_the_shader_param_([0-3])_layer_offset_([0-2])_continuous_inverted_example (from TestPlugin) ---- diff --git a/dotfiles/generate-list-actions.sh b/dotfiles/generate-list-actions.sh index 363c7bb..c572d31 100755 --- a/dotfiles/generate-list-actions.sh +++ b/dotfiles/generate-list-actions.sh @@ -12,11 +12,11 @@ grep " def " actions.py | grep -v "^#" | sed -e 's/ def //' | sed -e 's/self//' echo echo "## Dynamic routes" -grep '( r"' actions.py | sed -e 's/\(.*\)"\(.*\)"\(.*\)/ * \2/' | sed -e 's/\$//' | sed -e 's/\^//' +grep '( r"' actions.py | sed -e 's/\(.*\)"\(.*\)"\(.*\)/ * \2/' | sed -e 's/\$//' | sed -e 's/\^//' | sed -e 's/\\//' echo echo "### Plugin routes" -grep "( r\"" plugins/*.py | sed -e 's/plugins\/\(.*\)\.py:\(.*\)\( r\"\)\(.*\)\"\(.*\)/ * \4\t(from \1)/' | grep -v "open_serial" | sed -e 's/\$//' | sed -e 's/\^//' +grep "( r\"" plugins/*.py | sed -e 's/plugins\/\(.*\)\.py:\(.*\)\( r\"\)\(.*\)\"\(.*\)/ * \4\t(from \1)/' | grep -v "open_serial" | sed -e 's/\$//' | sed -e 's/\^//' | sed -e 's/\\//' echo echo "----" diff --git a/plugins/ManipulatePlugin.py b/plugins/ManipulatePlugin.py new file mode 100644 index 0000000..d6c14d0 --- /dev/null +++ b/plugins/ManipulatePlugin.py @@ -0,0 +1,22 @@ +import data_centre.plugin_collection +from data_centre.plugin_collection import ActionsPlugin#, SequencePlugin + +class ManipulatePlugin(ActionsPlugin): + disabled = False + + def __init__(self, plugin_collection): + super().__init__(plugin_collection) + + @property + def parserlist(self): + return [ + ( r"(.*)\|invert$", self.invert ), + ] + + def invert(self, action, value): + # invert the value + self.pc.actions.call_method_name( + action, 1.0 - value + # if you were calling an action with no argument, use eg: + # "toggle_automation_pause", None + ) diff --git a/plugins/TestPlugin.py b/plugins/TestPlugin.py index bf2e729..a6ad99e 100644 --- a/plugins/TestPlugin.py +++ b/plugins/TestPlugin.py @@ -17,6 +17,8 @@ class MidiActionsTestPlugin(ActionsPlugin,SequencePlugin): ( r"^toggle_pause_automation$", self.toggle_pause_automation ), ( r"^pause_automation$", self.pause_automation ), ( r"^toggle_loop_automation$", self.toggle_loop_automation ), + ( r"^print_arguments$", self.print_arguments ), + ( r"^set_the_shader_param_([0-3])_layer_offset_([0-2])_continuous_inverted_example$", self.invert_shader_param_layer ) ] def test_plugin(self): @@ -49,3 +51,13 @@ class MidiActionsTestPlugin(ActionsPlugin,SequencePlugin): "set_the_shader_param_1_layer_0_continuous", position ) + def print_arguments(self, *args): + print(">>>>print_arguments ( %s )" % args) + + def invert_shader_param_layer(self, param, layer, value): + # invert the value + self.pc.actions.call_method_name( + "set_the_shader_param_%s_layer_offset_%s_continuous" % ( param, layer), 1.0 - value + # if you were calling an action with no argument, use eg: + # "toggle_automation_pause", None + )