diff --git a/actions.py b/actions.py index 1865b03..54f29d2 100644 --- a/actions.py +++ b/actions.py @@ -1036,6 +1036,8 @@ class Actions(object): ( r"^reset_selected_modulation$", self.shaders.reset_selected_modulation ), ( r"^reset_modulation_([0-3])$", self.shaders.reset_modulation ), ( r"^select_shader_modulation_slot_([0-3])$", self.shaders.select_shader_modulation_slot ), + ( r"^select_next_shader_modulation_slot$", self.shaders.select_next_shader_modulation_slot ), + ( r"^select_previous_shader_modulation_slot$", self.shaders.select_previous_shader_modulation_slot ), ( r"^set_shader_speed_layer_offset_([0-2])_amount$", self.shaders.set_speed_offset_to_amount ), ( r"^set_shader_speed_layer_([0-2])_amount$", self.shaders.set_speed_layer_to_amount ), ( r"^set_display_mode_([a-zA-Z_]*)$", self.set_display_mode ) @@ -1099,9 +1101,8 @@ class Actions(object): try: #print ("for method_name %s, arguments is %s and len is %s, got method %s" % (method_name, arguments, len(signature(method).parameters), method)) - # for the case where cc is being used as switch, we ignore note_off - print(type(argument)) + #print(type(argument)) if len(signature(method).parameters) == 0 and isinstance(argument, float) and argument == 0: print('cc off ?') return diff --git a/video_centre/shaders.py b/video_centre/shaders.py index c0f010a..519cce6 100644 --- a/video_centre/shaders.py +++ b/video_centre/shaders.py @@ -6,6 +6,9 @@ from data_centre.plugin_collection import ModulationReceiverPlugin class Shaders(object): MENU_HEIGHT = 10 EMPTY_SHADER = dict(name='none',is_shader=True,shad_type='-',param_number=4,path='-') + + MAX_MOD_SLOTS = 4 + def __init__(self, root, osc_client, message_handler, data): self.root = root self.osc_client = osc_client @@ -25,7 +28,7 @@ class Shaders(object): self.selected_modulation_slot = 0 #self.modulation_level = [[[0.0,0.0,0.0,0.0] for i in range(4)] for i in range(3)] - self.modulation_value = [0.0,0.0,0.0,0.0] + self.modulation_value = [0.0] * self.MAX_MOD_SLOTS #,0.0,0.0,0.0] #self.load_selected_shader() @@ -177,6 +180,16 @@ class Shaders(object): def select_shader_modulation_slot(self, slot): self.selected_modulation_slot = slot + def select_next_shader_modulation_slot(self): + self.selected_modulation_slot += 1 + if self.selected_modulation_slot >= self.MAX_MOD_SLOTS: + self.selected_modulation_slot = 0 + + def select_previous_shader_modulation_slot(self): + self.selected_modulation_slot -= 1 + if self.selected_modulation_slot < 0: + self.selected_modulation_slot = self.MAX_MOD_SLOTS-1 + def reset_modulation(self, slot): for layer in self.modulation_level: for layer,levels in enumerate(layer):