mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-14 04:10:08 +01:00
Whitespace
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from data_centre.plugin_collection import ActionsPlugin, DisplayPlugin, ModulationReceiverPlugin#, SequencePlugin
|
||||
#import math
|
||||
from data_centre.plugin_collection import ActionsPlugin, DisplayPlugin, ModulationReceiverPlugin # , SequencePlugin
|
||||
|
||||
# import math
|
||||
|
||||
"""
|
||||
add to midi or osc mapping
|
||||
@@ -39,8 +40,8 @@ TODO: >> ?? invert|set_the_shader_param_0_layer_>>print_arguments>>set_variab
|
||||
|
||||
"""
|
||||
|
||||
class ManipulatePlugin(ActionsPlugin,DisplayPlugin,ModulationReceiverPlugin):
|
||||
|
||||
class ManipulatePlugin(ActionsPlugin, DisplayPlugin, ModulationReceiverPlugin):
|
||||
DEBUG = False
|
||||
|
||||
def __init__(self, plugin_collection):
|
||||
@@ -49,31 +50,32 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin,ModulationReceiverPlugin):
|
||||
# ActionsPlugin methods
|
||||
@property
|
||||
def parserlist(self):
|
||||
return [
|
||||
( r"(.*)&&(.*)", self.run_multi ), # split && first since they need to be processed separately
|
||||
( r"^invert\|(.*)$", self.invert ),
|
||||
( r"^f:(.*):\|(.*)$", self.formula ), # formula eg ```f:sin(x):|```
|
||||
( r"^set_variable_([a-zA-Z0-9]+)$", self.set_variable ),
|
||||
( r"^([A-Z0-9]+)>(.*)$", self.recall_variable ), # recall variable and pipe into righthand side eg ```VAR1>invert|set_the_shader_.....```
|
||||
( r"^(.*)>\&(.*)$", self.run_multi ), # pick up piped commands that duplicate a chain of values last
|
||||
return [
|
||||
(r"(.*)&&(.*)", self.run_multi), # split && first since they need to be processed separately
|
||||
(r"^invert\|(.*)$", self.invert),
|
||||
(r"^f:(.*):\|(.*)$", self.formula), # formula eg ```f:sin(x):|```
|
||||
(r"^set_variable_([a-zA-Z0-9]+)$", self.set_variable),
|
||||
(r"^([A-Z0-9]+)>(.*)$", self.recall_variable), # recall variable and pipe into righthand side eg ```VAR1>invert|set_the_shader_.....```
|
||||
(r"^(.*)>\&(.*)$", self.run_multi), # pick up piped commands that duplicate a chain of values last
|
||||
]
|
||||
|
||||
# DisplayPlugin methods
|
||||
def show_plugin(self, display, display_mode):
|
||||
from tkinter import END
|
||||
#super(DisplayPlugin).show_plugin(display, display_mode)
|
||||
# super(DisplayPlugin).show_plugin(display, display_mode)
|
||||
display.display_text.insert(END, '{} \n'.format(display.body_title))
|
||||
display.display_text.insert(END, "test from ManipulatePlugin!\n")
|
||||
|
||||
for key,value in self.variables.items():
|
||||
for key, value in self.variables.items():
|
||||
display.display_text.insert(END, "\t" + key + "\t{:03.2f}\n".format(value))
|
||||
|
||||
def get_display_modes(self):
|
||||
return ["MANIPULA","NAV_MANI"] #"NAV_MANIPULATE"]
|
||||
return ["MANIPULA", "NAV_MANI"] # "NAV_MANIPULATE"]
|
||||
|
||||
# Actions
|
||||
def run_multi(self, action1, action2, value):
|
||||
if self.DEBUG: print("ManipulatePlugin>> multi-running '%s' and '%s' with value %s" % (action1, action2, value))
|
||||
if self.DEBUG:
|
||||
print("ManipulatePlugin>> multi-running '%s' and '%s' with value %s" % (action1, action2, value))
|
||||
self.pc.actions.call_method_name(action1, value)
|
||||
self.pc.actions.call_method_name(action2, value)
|
||||
|
||||
@@ -89,16 +91,19 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin,ModulationReceiverPlugin):
|
||||
|
||||
def formula(self, formula, action, value):
|
||||
self.variables['x'] = value
|
||||
if self.DEBUG: print("ManipulatePlugin>> evaluating formula `%s` with value `%s`" % (formula, value))
|
||||
if self.DEBUG:
|
||||
print("ManipulatePlugin>> evaluating formula `%s` with value `%s`" % (formula, value))
|
||||
value = eval(formula, globals(), self.variables)
|
||||
if self.DEBUG: print("ManipulatePlugin>> got evaluated value `%s`" % value)
|
||||
if self.DEBUG:
|
||||
print("ManipulatePlugin>> got evaluated value `%s`" % value)
|
||||
|
||||
self.pc.actions.call_method_name(
|
||||
action, value
|
||||
)
|
||||
|
||||
def set_variable(self, var_name, value):
|
||||
if self.DEBUG: print("ManipulatePlugin>> set_variable (%s) to %s" % (var_name, value))
|
||||
if self.DEBUG:
|
||||
print("ManipulatePlugin>> set_variable (%s) to %s" % (var_name, value))
|
||||
self.variables[var_name] = value
|
||||
|
||||
def get_variable(self, var_name, default):
|
||||
@@ -108,16 +113,16 @@ class ManipulatePlugin(ActionsPlugin,DisplayPlugin,ModulationReceiverPlugin):
|
||||
return default
|
||||
|
||||
def recall_variable(self, var_name, action, *args):
|
||||
if self.DEBUG: print ("ManipulatePlugin>> recall_variable (%s) as %s" % (var_name,args))
|
||||
if self.DEBUG:
|
||||
print("ManipulatePlugin>> recall_variable (%s) as %s" % (var_name, args))
|
||||
self.pc.actions.call_method_name(
|
||||
action, self.variables.get(var_name)# + list(args)
|
||||
action, self.variables.get(var_name) # + list(args)
|
||||
)
|
||||
|
||||
|
||||
# ModulationReceiverPlugin methods
|
||||
# methods for ModulationReceiverPlugin - receives changes to the in-built modulation levels (-1 to +1)
|
||||
def set_modulation_value(self, param, value):
|
||||
# take modulation value and throw it to local parameter
|
||||
if self.DEBUG: print("||||| ManipulatePlugin received set_modulation_value for param %s with value %s!" % (param, value))
|
||||
if self.DEBUG:
|
||||
print("||||| ManipulatePlugin received set_modulation_value for param %s with value %s!" % (param, value))
|
||||
self.set_variable("MODVALUE%s" % ('ABCD'[param]), value)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user