mirror of
https://github.com/cyberboy666/r_e_c_u_r.git
synced 2025-12-12 19:30:11 +01:00
Merge branch 'feature_plugins' into feature_plugins_shader_gadgets
This commit is contained in:
@@ -531,7 +531,8 @@ class Actions(object):
|
|||||||
self.data.settings['shader']['STROBE_AMOUNT']['value'] = scaled_amount
|
self.data.settings['shader']['STROBE_AMOUNT']['value'] = scaled_amount
|
||||||
|
|
||||||
def get_midi_status(self):
|
def get_midi_status(self):
|
||||||
self.message_handler.set_message('INFO', ("midi status is {} to %s"%(self.data.midi_device_name)).format(self.data.midi_status))
|
device_name = 'none' if not hasattr(self.data,'midi_device_name') else self.data.midi_device_name
|
||||||
|
self.message_handler.set_message('INFO', ("midi status is {} to %s"%(device_name)).format(self.data.midi_status))
|
||||||
|
|
||||||
def cycle_midi_port_index(self):
|
def cycle_midi_port_index(self):
|
||||||
self.data.midi_port_index = self.data.midi_port_index + 1
|
self.data.midi_port_index = self.data.midi_port_index + 1
|
||||||
|
|||||||
@@ -10,22 +10,34 @@ use |f: : to bookend your formula
|
|||||||
eg
|
eg
|
||||||
|
|
||||||
"control_change 48": {
|
"control_change 48": {
|
||||||
"DEFAULT": ["invert|f:sin(x*pi):|set_the_shader_param_0_layer_offset_0_continuous&&set_variable_A&&print_arguments","set_strobe_amount_continuous"],
|
"DEFAULT": ["invert|f:sin(x*pi):|set_the_shader_param_0_layer_offset_0_continuous>&print_arguments&&set_variable_A&&print_arguments","set_strobe_amount_continuous"],
|
||||||
"NAV_DETOUR": ["set_detour_speed_position_continuous"]
|
"NAV_DETOUR": ["set_detour_speed_position_continuous"]
|
||||||
},
|
},
|
||||||
|
|
||||||
example above inverts input, runs sin(x*pi) on it, then uses that value to set the shader param layer 0. it also sets variable A to be the *original* value, and call print_arguments to print it
|
example above inverts input, runs sin(x*pi) on it, then uses that value to set the shader param layer 0 and prints the value to console. it also sets variable A to be the *original* value, and calls print_arguments to print it
|
||||||
|
|
||||||
|
"DEFAULT": ["invert|f:sin(x*pi):|set_the_shader_param_0_layer_offset_0_continuous>&set_variable_B>&print_arguments&&set_variable_A&&print_arguments","set_strobe_amount_continuous"],
|
||||||
|
|
||||||
|
this one is similar the above but there's three branches as separated by the &&:-
|
||||||
|
invert|
|
||||||
|
f:sin(x*pi):|
|
||||||
|
set_the_shader_param_0_layer_offset_0_continuous>&
|
||||||
|
set_variable_B>&
|
||||||
|
print_arguments
|
||||||
|
&&
|
||||||
|
set_variable_A
|
||||||
|
&&
|
||||||
|
print_arguments
|
||||||
|
|
||||||
"control_change 49": {
|
"control_change 49": {
|
||||||
"DEFAULT": ["set_the_shader_param_1_layer_offset_0_continuous&&A>print_arguments","set_shader_speed_layer_0_amount"],
|
"DEFAULT": ["set_the_shader_param_1_layer_offset_0_continuous&&A>print_arguments","set_shader_speed_layer_0_amount"],
|
||||||
"NAV_DETOUR": ["set_detour_start_continuous"]
|
"NAV_DETOUR": ["set_detour_start_continuous"]
|
||||||
},
|
},
|
||||||
|
|
||||||
example above outputs value stored in variable A and prints it
|
example above outputs value stored in variable A and prints it as well as seting current shader value
|
||||||
|
|
||||||
TODO: >> ?? invert|set_the_shader_param_0_layer_>>print_arguments>>set_variable_A
|
TODO: >> ?? invert|set_the_shader_param_0_layer_>>print_arguments>>set_variable_A
|
||||||
invert input, send to variable and to shader ?
|
invert input, send to variable and to shader ?
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -38,12 +50,19 @@ class ManipulatePlugin(ActionsPlugin):
|
|||||||
@property
|
@property
|
||||||
def parserlist(self):
|
def parserlist(self):
|
||||||
return [
|
return [
|
||||||
|
( r"(.*)&&(.*)", self.run_multi ), # split && first since they need to be processed separately
|
||||||
( r"^invert\|(.*)$", self.invert ),
|
( r"^invert\|(.*)$", self.invert ),
|
||||||
( r"^f:(.*):\|(.*)$", self.formula ),
|
( r"^f:(.*):\|(.*)$", self.formula ), # formula eg ```f:sin(x):|```
|
||||||
( r"^set_variable_([a-zA-Z0-9]+)$", self.set_variable ),
|
( r"^set_variable_([a-zA-Z0-9]+)$", self.set_variable ),
|
||||||
( r"^([A-Z0-9]+)>(.*)$", self.recall_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
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def run_multi(self, action1, action2, value):
|
||||||
|
print("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)
|
||||||
|
|
||||||
variables = {}
|
variables = {}
|
||||||
|
|
||||||
def invert(self, action, value):
|
def invert(self, action, value):
|
||||||
@@ -65,10 +84,34 @@ class ManipulatePlugin(ActionsPlugin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def set_variable(self, var_name, value):
|
def set_variable(self, var_name, value):
|
||||||
|
print("set_variable (%s) to %s" % (var_name, value))
|
||||||
self.variables[var_name] = value
|
self.variables[var_name] = value
|
||||||
|
|
||||||
def recall_variable(self, var_name, action, *args):
|
def recall_variable(self, var_name, action, *args):
|
||||||
print ("recall_variable(%s) got args %s" % (var_name,args))
|
print ("recall_variable (%s) as %s" % (var_name,args))
|
||||||
self.pc.actions.call_method_name(
|
self.pc.actions.call_method_name(
|
||||||
action, self.variables.get(var_name)# + list(args)
|
action, self.variables.get(var_name)# + list(args)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
"""def pipe2(self, left, right1, separator, right2, tail, value):
|
||||||
|
self.pc.actions.call_method_name(
|
||||||
|
left + separator + right1, value
|
||||||
|
)
|
||||||
|
self.pc.actions.call_method_name(
|
||||||
|
left + separator + right2, value
|
||||||
|
)
|
||||||
|
self.pc.actions.call_method_name(
|
||||||
|
tail, value
|
||||||
|
)"""
|
||||||
|
|
||||||
|
def pipe(self, left, right, value):
|
||||||
|
# ??
|
||||||
|
print("pipe calling left '%s' and right '%s', both with value '%s'" % (left, right, value))
|
||||||
|
self.pc.actions.call_method_name(
|
||||||
|
left, value
|
||||||
|
)
|
||||||
|
|
||||||
|
self.pc.actions.call_method_name(
|
||||||
|
right, value
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,16 @@ import data_centre.plugin_collection
|
|||||||
from data_centre.plugin_collection import ActionsPlugin
|
from data_centre.plugin_collection import ActionsPlugin
|
||||||
|
|
||||||
class MultiActionsPlugin(ActionsPlugin):
|
class MultiActionsPlugin(ActionsPlugin):
|
||||||
disabled = False
|
disabled = False # this is only a demo of very basic multi-actions plugin -- superceded by ManipulatePlugin
|
||||||
|
|
||||||
def __init__(self, plugin_collection):
|
def __init__(self, plugin_collection):
|
||||||
super().__init__(plugin_collection)
|
super().__init__(plugin_collection)
|
||||||
|
try:
|
||||||
|
from plugins import ManipulatePlugin
|
||||||
|
self.disabled = True # if we've found ManipulatePlugin then disable this one
|
||||||
|
except:
|
||||||
|
# if it fails, we're good to go (so long as not disabled explictly above)
|
||||||
|
pass
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parserlist(self):
|
def parserlist(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user