Browse Source

autowriteagain at preset color change

main
TFLCL 3 months ago
parent
commit
66faf94f77
  1. 8
      code/tc.preset.js

8
code/tc.preset.js

@ -570,6 +570,9 @@ function setcolor() {
var args = arrayfromargs(arguments); var args = arrayfromargs(arguments);
var nb_args = args.length; var nb_args = args.length;
var slot_nb = selected_slot; var slot_nb = selected_slot;
if (nb_args < 1 && nb_args > 5) {
error("color: wrong number of arguments.");
} else {
if (nb_args == 1) { if (nb_args == 1) {
// Set the color index of the currently selected slot (for when color_mode is 2) // Set the color index of the currently selected slot (for when color_mode is 2)
slots[selected_slot].color_index = Math.floor(args); slots[selected_slot].color_index = Math.floor(args);
@ -584,11 +587,11 @@ function setcolor() {
// Set the custom color for the slot number defined by the 1st argument to the color defined by following arguments in rgba format. // Set the custom color for the slot number defined by the 1st argument to the color defined by following arguments in rgba format.
slot_nb = Math.floor(args[0]); slot_nb = Math.floor(args[0]);
slots[slot_nb].color_custom = [args[1], args[2], args[3], args[4]]; slots[slot_nb].color_custom = [args[1], args[2], args[3], args[4]];
} else {
error("color: wrong number of arguments.");
} }
update_preset_color_pattr(slot_nb); update_preset_color_pattr(slot_nb);
paint_base(); paint_base();
trigger_writeagain();
}
} }
} }
@ -886,6 +889,7 @@ function store(v) {
outlet(0, "store", v); outlet(0, "store", v);
if (v) { if (v) {
// We writagain only if stored preset is > 0
trigger_writeagain(); trigger_writeagain();
} }
} }

Loading…
Cancel
Save