The movers layer loses its Strobe (pad 9): its button, its scene and the forced-HTP strobe channel it needed. Its pad, the rest of the second row and pad 5 take the five shapes the movers did not have yet: Diamond, Square, Corners (SquareChoppy), Leaf, and Tilt (Line2 on tilt alone). All nine sit in the Movement solo frame, one at a time, mirrored and relative to the knobs. Knob 13's speed dial gives Corners an eighth of its time and the rest a quarter (scripts/shows/mover_all_efx.py). The pad controller settles the knobs after all nine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
95 lines
4.6 KiB
Python
95 lines
4.6 KiB
Python
#!/usr/bin/env python3
|
||
"""Drop the movers' Strobe from shows/test.qxw and add the rest of QLC+'s EFX shapes.
|
||
|
||
The movers layer has no Strobe any more (pad 9, note 92): its button, its scene
|
||
and the HTP strobe channel that let it beat the colour scenes all go. Its pad and
|
||
the rest of the second row, and pad 5, take the five EFX shapes the movers did
|
||
not have yet. They join Wander, Ballyhoo, Circle and Sweep in the Movement solo
|
||
frame, now three rows deep, so still only one runs at a time:
|
||
|
||
92 Diamond pad 9 a diamond, about ±64° of pan and ±21° of tilt
|
||
93 Square pad 10 a square, about ±53° of pan and ±16° of tilt
|
||
94 Corners pad 11 SquareChoppy: jumps corner to corner of the same square
|
||
95 Leaf pad 12 a four-petal leaf, about ±53° of pan and ±26° of tilt
|
||
88 Tilt pad 5 Line2 on tilt alone, about ±26° up and down
|
||
|
||
Like the others each is a relative EFX around the Pan and Tilt knobs, with all
|
||
four movers together so the pairs mirror, fading in over 0.5 s. Knob 13's speed
|
||
dial gives Corners an eighth of its time (2.5 s a round to start with) and the
|
||
rest a quarter (5.5 s). padcontroller/layer.py settles the knobs after all nine.
|
||
|
||
python3 scripts/shows/mover_all_efx.py
|
||
|
||
Run it once on a show with Circle and Sweep and the movers' Strobe; it stops if
|
||
Diamond is already there. QLC+ has to reopen the show to see it.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
|
||
from mover_bank import M1, M2, M3, M4, NO_FUNCTION, ROOT, STROBE, button, note
|
||
from mover_more_efx import SIZE, START_MS, efx
|
||
|
||
SHOW = ROOT / "shows" / "test.qxw"
|
||
|
||
# Speed dial factor indexes: (Not Sent), 0, 1/16, 1/8, 1/4, ...
|
||
TIMES_1_8, TIMES_1_4 = 3, 4
|
||
|
||
# Caption, function name, algorithm, width, height (of 255 each way), can note, column, row, dial factor
|
||
MOVES = (
|
||
("Diamond", "Movers diamond", "Diamond", 30, 20, 44, 0, 1, TIMES_1_4),
|
||
("Square", "Movers square", "Square", 25, 15, 45, 1, 1, TIMES_1_4),
|
||
("Corners", "Movers corners", "SquareChoppy", 25, 15, 46, 2, 1, TIMES_1_8),
|
||
("Leaf", "Movers leaf", "Leaf", 25, 25, 47, 3, 1, TIMES_1_4),
|
||
("Tilt", "Movers tilt", "Line2", 0, 25, 40, 0, 2, TIMES_1_4),
|
||
)
|
||
ROWS = 3
|
||
|
||
|
||
def cut(xml: str, pattern: str) -> str:
|
||
xml, n = re.subn(pattern, "", xml, count=1, flags=re.S)
|
||
assert n == 1, pattern
|
||
return xml
|
||
|
||
|
||
def main() -> None:
|
||
xml = SHOW.read_text()
|
||
if 'Name="Movers diamond"' in xml:
|
||
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers diamond")
|
||
|
||
strobe = int(re.search(r'<Function ID="(\d+)" Type="Scene" Name="Movers strobe">', xml).group(1))
|
||
xml = cut(xml, rf' <Function ID="{strobe}" Type="Scene" Name="Movers strobe">\n.*? </Function>\n')
|
||
# The cans' Strobe has the same caption; the movers' one is widget 89 (scripts/shows/mover_bank.py).
|
||
xml = cut(xml, r' <Button Caption="Strobe" ID="89" Icon="">\n.*? </Button>\n')
|
||
for fid in (M1, M2, M3, M4):
|
||
xml, n = re.subn(rf'( <ID>{fid}</ID>\n(?: .*\n)*?) <ForcedHTP>{STROBE}</ForcedHTP>\n', r"\1", xml, count=1)
|
||
assert n == 1, fid
|
||
|
||
engine, console = xml.split("<VirtualConsole>")
|
||
fid = max(int(i) for i in re.findall(r'<Function ID="(\d+)" Type', engine)) + 1
|
||
wid = max(int(i) for i in re.findall(r' ID="(\d+)"', console) if int(i) != NO_FUNCTION) + 1
|
||
|
||
solo = re.search(r' <SoloFrame Caption="Movement" ID="\d+">\n.*? </SoloFrame>\n', xml, re.S).group(0)
|
||
dial = re.search(r' <SpeedDial Caption="Movers speed" ID="\d+">\n.*? </SpeedDial>\n', xml, re.S).group(0)
|
||
functions, buttons, rows = "", "", ""
|
||
for i, (caption, name, algorithm, width, height, can_note, column, row, factor) in enumerate(MOVES):
|
||
start_ms = START_MS // 2 if factor == TIMES_1_8 else START_MS
|
||
functions += efx(fid + i, name, algorithm, width, height, start_ms)
|
||
buttons += button(wid + i, caption, SIZE * column, SIZE * row, SIZE, fid + i, note(can_note), indent=" ")
|
||
rows += f' <Function FadeIn="0" FadeOut="0" Duration="{factor}">{fid + i}</Function>\n'
|
||
|
||
grown = re.sub(r'(<WindowState Visible="True" X="10" Y="10" Width="\d+" Height=")\d+"', rf'\g<1>{SIZE * ROWS}"',
|
||
solo, count=1)
|
||
grown = grown.replace(" </SoloFrame>\n", buttons + " </SoloFrame>\n")
|
||
xml = xml.replace(solo, grown, 1)
|
||
xml = xml.replace(dial, dial.replace(" </SpeedDial>\n", rows + " </SpeedDial>\n"), 1)
|
||
xml = xml.replace(" </Engine>", functions + " </Engine>", 1)
|
||
SHOW.write_text(xml)
|
||
print(f"Dropped the movers' Strobe and added {len(MOVES)} shapes to {SHOW.relative_to(ROOT)} "
|
||
f"(functions {fid}–{fid + len(MOVES) - 1}, widgets {wid}–{wid + len(MOVES) - 1})")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|