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()
|
||||
+72
-16
@@ -807,8 +807,8 @@
|
||||
<Step Number="0" FadeIn="0" Hold="0" FadeOut="0">44</Step>
|
||||
</Function>
|
||||
<Function ID="46" Type="Collection" Name="Chase forward">
|
||||
<Step Number="0">43</Step>
|
||||
<Step Number="1">45</Step>
|
||||
<Step Number="0">44</Step>
|
||||
<Step Number="1">104</Step>
|
||||
</Function>
|
||||
<Function ID="47" Type="RGBMatrix" Name="Chase reverse run">
|
||||
<Speed FadeIn="0" FadeOut="500" Duration="200"/>
|
||||
@@ -821,8 +821,8 @@
|
||||
<Property Name="orientation" Value="Vertical"/>
|
||||
</Function>
|
||||
<Function ID="48" Type="Collection" Name="Chase reverse">
|
||||
<Step Number="0">47</Step>
|
||||
<Step Number="1">45</Step>
|
||||
<Step Number="0">44</Step>
|
||||
<Step Number="1">106</Step>
|
||||
</Function>
|
||||
<Function ID="49" Type="RGBMatrix" Name="Zigzag forward run">
|
||||
<Speed FadeIn="0" FadeOut="500" Duration="100"/>
|
||||
@@ -842,8 +842,8 @@
|
||||
<Step Number="0" FadeIn="0" Hold="0" FadeOut="0">44</Step>
|
||||
</Function>
|
||||
<Function ID="51" Type="Collection" Name="Zigzag forward">
|
||||
<Step Number="0">49</Step>
|
||||
<Step Number="1">50</Step>
|
||||
<Step Number="0">44</Step>
|
||||
<Step Number="1">108</Step>
|
||||
</Function>
|
||||
<Function ID="52" Type="RGBMatrix" Name="Opposing zigzag run">
|
||||
<Speed FadeIn="0" FadeOut="500" Duration="200"/>
|
||||
@@ -856,8 +856,8 @@
|
||||
<Property Name="orientation" Value="Vertical"/>
|
||||
</Function>
|
||||
<Function ID="53" Type="Collection" Name="Opposing zigzag">
|
||||
<Step Number="0">52</Step>
|
||||
<Step Number="1">45</Step>
|
||||
<Step Number="0">44</Step>
|
||||
<Step Number="1">110</Step>
|
||||
</Function>
|
||||
<Function ID="54" Type="Scene" Name="Cans strobe">
|
||||
<Speed FadeIn="0" FadeOut="50" Duration="0"/>
|
||||
@@ -1551,6 +1551,62 @@
|
||||
<Step Number="0">101</Step>
|
||||
<Step Number="1">102</Step>
|
||||
</Function>
|
||||
<Function ID="104" Type="Script" Name="Chase forward start">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="0"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<Command>startfunction%3A43</Command>
|
||||
<Command>wait%3A3600000</Command>
|
||||
</Function>
|
||||
<Function ID="105" Type="Chaser" Name="Chase forward hold">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="1500"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<SpeedModes FadeIn="Common" FadeOut="Common" Duration="Common"/>
|
||||
<Step Number="0" FadeIn="0" Hold="0" FadeOut="0">46</Step>
|
||||
</Function>
|
||||
<Function ID="106" Type="Script" Name="Chase reverse start">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="0"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<Command>startfunction%3A47</Command>
|
||||
<Command>wait%3A3600000</Command>
|
||||
</Function>
|
||||
<Function ID="107" Type="Chaser" Name="Chase reverse hold">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="1500"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<SpeedModes FadeIn="Common" FadeOut="Common" Duration="Common"/>
|
||||
<Step Number="0" FadeIn="0" Hold="0" FadeOut="0">48</Step>
|
||||
</Function>
|
||||
<Function ID="108" Type="Script" Name="Zigzag forward start">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="0"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<Command>startfunction%3A49</Command>
|
||||
<Command>wait%3A3600000</Command>
|
||||
</Function>
|
||||
<Function ID="109" Type="Chaser" Name="Zigzag forward hold">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="1700"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<SpeedModes FadeIn="Common" FadeOut="Common" Duration="Common"/>
|
||||
<Step Number="0" FadeIn="0" Hold="0" FadeOut="0">51</Step>
|
||||
</Function>
|
||||
<Function ID="110" Type="Script" Name="Opposing zigzag start">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="0"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<Command>startfunction%3A52</Command>
|
||||
<Command>wait%3A3600000</Command>
|
||||
</Function>
|
||||
<Function ID="111" Type="Chaser" Name="Opposing zigzag hold">
|
||||
<Speed FadeIn="0" FadeOut="0" Duration="1500"/>
|
||||
<Direction>Forward</Direction>
|
||||
<RunOrder>SingleShot</RunOrder>
|
||||
<SpeedModes FadeIn="Common" FadeOut="Common" Duration="Common"/>
|
||||
<Step Number="0" FadeIn="0" Hold="0" FadeOut="0">53</Step>
|
||||
</Function>
|
||||
</Engine>
|
||||
<VirtualConsole>
|
||||
<Frame Caption="">
|
||||
@@ -2067,7 +2123,7 @@
|
||||
<BackgroundImage>None</BackgroundImage>
|
||||
<Font>Default</Font>
|
||||
</Appearance>
|
||||
<Function ID="45"/>
|
||||
<Function ID="105"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37040"/>
|
||||
@@ -2081,7 +2137,7 @@
|
||||
<BackgroundImage>None</BackgroundImage>
|
||||
<Font>Default</Font>
|
||||
</Appearance>
|
||||
<Function ID="45"/>
|
||||
<Function ID="107"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37041"/>
|
||||
@@ -2095,7 +2151,7 @@
|
||||
<BackgroundImage>None</BackgroundImage>
|
||||
<Font>Default</Font>
|
||||
</Appearance>
|
||||
<Function ID="50"/>
|
||||
<Function ID="109"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37042"/>
|
||||
@@ -2109,7 +2165,7 @@
|
||||
<BackgroundImage>None</BackgroundImage>
|
||||
<Font>Default</Font>
|
||||
</Appearance>
|
||||
<Function ID="45"/>
|
||||
<Function ID="111"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37043"/>
|
||||
@@ -2439,7 +2495,6 @@
|
||||
<Function ID="43"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37040"/>
|
||||
</Button>
|
||||
<Button Caption="Chase reverse run" ID="80" Icon="">
|
||||
<WindowState Visible="True" X="82" Y="10" Width="70" Height="70"/>
|
||||
@@ -2453,7 +2508,6 @@
|
||||
<Function ID="47"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37041"/>
|
||||
</Button>
|
||||
<Button Caption="Zigzag forward run" ID="81" Icon="">
|
||||
<WindowState Visible="True" X="154" Y="10" Width="70" Height="70"/>
|
||||
@@ -2467,7 +2521,6 @@
|
||||
<Function ID="49"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37042"/>
|
||||
</Button>
|
||||
<Button Caption="Opposing zigzag run" ID="82" Icon="">
|
||||
<WindowState Visible="True" X="226" Y="10" Width="70" Height="70"/>
|
||||
@@ -2481,7 +2534,6 @@
|
||||
<Function ID="52"/>
|
||||
<Action>Toggle</Action>
|
||||
<Intensity Adjust="False">100</Intensity>
|
||||
<Input Universe="1" Channel="37043"/>
|
||||
</Button>
|
||||
</Frame>
|
||||
<Frame Caption="Chase colours" ID="62">
|
||||
@@ -4011,6 +4063,10 @@
|
||||
<Function FadeIn="6" FadeOut="0" Duration="8">99</Function>
|
||||
<Function FadeIn="0" FadeOut="0" Duration="7">101</Function>
|
||||
<Function FadeIn="0" FadeOut="0" Duration="7">102</Function>
|
||||
<Function FadeIn="0" FadeOut="0" Duration="9">105</Function>
|
||||
<Function FadeIn="0" FadeOut="0" Duration="9">107</Function>
|
||||
<Function FadeIn="0" FadeOut="0" Duration="9">109</Function>
|
||||
<Function FadeIn="0" FadeOut="0" Duration="9">111</Function>
|
||||
</SpeedDial>
|
||||
<SpeedDial Caption="Movers speed" ID="115">
|
||||
<WindowState Visible="True" X="1820" Y="10" Width="110" Height="240"/>
|
||||
|
||||
Reference in new issue
Block a user