Make a click on a cans chase button run the whole chase in the test show.
Each chase was two buttons on one pad note: the pads frame's ran the side dimmer hold under Peak, and the Chase runs frame's ran the stripe outside it. The pad pressed both; a click pressed only the hold, which lit nothing. Now the pads frame's button runs a hold of the chase's own whose step is the Sides dimmer and a Script that starts the stripe. Peak reaches the dimmer through the chaser and collection but not the stripe through the script, as with the pad (scripts/shows/chase_clicks.py). The Chase runs buttons no longer listen to the pad. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cf94c7b1ba
commit
31ccbab340
2 files changed
+178
-16
No files matched your search
@@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Make a click on a chase button in shows/test.qxw do what its pad does.
|
||||
|
||||
Each cans chase was two buttons on one pad note: the pads frame's button runs
|
||||
the side dimmer hold, under the frame's Peak (CC 35), and the Chase runs frame's
|
||||
button runs the stripe matrix, outside it, so Peak caps the dimmers and not the
|
||||
stripe's colour. The pad pressed both; a click pressed only the hold.
|
||||
|
||||
Now the pads frame's button runs a hold of the chase's own, which runs both.
|
||||
Its one step is a collection of the Sides dimmer scene and a Script that starts
|
||||
the stripe and waits. A chaser and a collection pass Peak on to what they run,
|
||||
but a script doesn't, so the dimmers are capped and the stripe isn't, as with
|
||||
the pad. QLC+ 4.12 stops what a script started when the script ends (it has no
|
||||
stoponexit), so the script waits until the hold's step ends and the chaser stops
|
||||
it; the stripe has run its course by then. The holds are on the Speed dial (knob
|
||||
1) as the shared ones were. The Chase runs buttons no longer listen to the pad,
|
||||
which would otherwise toggle the stripe straight back off; clicked, they still
|
||||
run the stripe on its own.
|
||||
|
||||
python3 scripts/shows/chase_clicks.py
|
||||
|
||||
Run it once; it stops if the chases' own holds are already there. QLC+ has to
|
||||
reopen the show to see it.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
|
||||
from mover_bank import ROOT
|
||||
|
||||
SHOW = ROOT / "shows" / "test.qxw"
|
||||
SPEED_DIAL = 111 # the cans' Speed dial, knob 1
|
||||
SIDES_DIMMER = 44 # the Sides dimmer scene the shared holds run
|
||||
WAIT_MS = 3600000 # longer than any hold: the chaser stops the script first
|
||||
|
||||
# pads frame button, Chase runs button, collection, stripe matrix, shared hold
|
||||
CHASES = (
|
||||
("Chase forward", 45, 79, 46, 43, 45),
|
||||
("Chase reverse", 46, 80, 48, 47, 45),
|
||||
("Zigzag forward", 47, 81, 51, 49, 50),
|
||||
("Opposing zigzag", 48, 82, 53, 52, 45),
|
||||
)
|
||||
|
||||
|
||||
def script(fid: int, name: str, start: int) -> str:
|
||||
return f""" <Function ID="{fid}" Type="Script" Name="{name}">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="0"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<Command>startfunction%3A{start}</Command>
|
||||
<Command>wait%3A{WAIT_MS}</Command>
|
||||
</Function>
|
||||
"""
|
||||
|
||||
|
||||
def main() -> None:
|
||||
xml = SHOW.read_text()
|
||||
if any(f'Name="{name} hold"' in xml for name, *_ in CHASES):
|
||||
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the chases' own holds")
|
||||
next_fid = max(int(i) for i in re.findall(r'<Function ID="(\d+)" Type', xml)) + 1
|
||||
dial = re.search(rf' <SpeedDial Caption="Speed" ID="{SPEED_DIAL}">.*? </SpeedDial>\n', xml, re.S)
|
||||
if dial is None:
|
||||
raise SystemExit("Couldn't find the Speed dial")
|
||||
new_dial = dial.group(0)
|
||||
functions = ""
|
||||
for k, (name, pad_button, run_button, coll, stripe, hold) in enumerate(CHASES):
|
||||
sid, hid = next_fid + 2 * k, next_fid + 2 * k + 1
|
||||
functions += script(sid, f"{name} start", stripe)
|
||||
|
||||
# The chase's own hold: the shared one, running the dimmer and the stripe's script.
|
||||
shared = re.search(rf' <Function ID="{hold}" Type="Chaser" Name="[^"]*">\n.*? </Function>\n', xml, re.S).group(0)
|
||||
if f">{SIDES_DIMMER}</Step>" not in shared:
|
||||
raise SystemExit(f"Hold {hold} doesn't run the Sides dimmer")
|
||||
own = re.sub(r'<Function ID="\d+" Type="Chaser" Name="[^"]*">',
|
||||
f'<Function ID="{hid}" Type="Chaser" Name="{name} hold">', shared)
|
||||
functions += own.replace(f">{SIDES_DIMMER}</Step>", f">{coll}</Step>")
|
||||
row = re.search(rf' <Function FadeIn="\d+" FadeOut="\d+" Duration="\d+">{hold}</Function>\n', new_dial)
|
||||
if row is None:
|
||||
raise SystemExit(f"Hold {hold} isn't on the Speed dial")
|
||||
new_dial = new_dial.replace(" </SpeedDial>\n", row.group(0).replace(f">{hold}<", f">{hid}<") + " </SpeedDial>\n")
|
||||
|
||||
old = re.search(rf' <Function ID="{coll}" Type="Collection" Name="{name}">\n.*? </Function>\n', xml, re.S)
|
||||
if old is None or f">{stripe}</Step>" not in old.group(0) or f">{hold}</Step>" not in old.group(0):
|
||||
raise SystemExit(f"The {name} collection is not the stripe and hold it was")
|
||||
xml = xml.replace(old.group(0), f' <Function ID="{coll}" Type="Collection" Name="{name}">\n'
|
||||
f' <Step Number="0">{SIDES_DIMMER}</Step>\n <Step Number="1">{sid}</Step>\n </Function>\n', 1)
|
||||
|
||||
btn = re.search(rf'<Button Caption="{name}" ID="{pad_button}" .*?</Button>', xml, re.S)
|
||||
if btn is None or f'<Function ID="{hold}"/>' not in btn.group(0):
|
||||
raise SystemExit(f"The {name} button doesn't run its hold")
|
||||
xml = xml.replace(btn.group(0), btn.group(0).replace(f'<Function ID="{hold}"/>', f'<Function ID="{hid}"/>'), 1)
|
||||
|
||||
run = re.search(rf'<Button Caption="{name} run" ID="{run_button}" .*?</Button>', xml, re.S)
|
||||
if run is None:
|
||||
raise SystemExit(f"Couldn't find the {name} run button")
|
||||
xml = xml.replace(run.group(0), re.sub(r'\n\s*<Input Universe="1" Channel="\d+"/>', "", run.group(0)), 1)
|
||||
|
||||
xml = xml.replace(dial.group(0), new_dial, 1)
|
||||
xml = xml.replace(" </Engine>", functions + " </Engine>", 1)
|
||||
SHOW.write_text(xml)
|
||||
print(f"Chase buttons in {SHOW.relative_to(ROOT)} now run the whole chase")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user