They fill the movers layer's top row, pads 15 and 16 (notes 98 and 99), in the Movement solo frame with Wander and Ballyhoo: a circle of about ±45° of pan and ±21° of tilt, and a straight pan sweep of about ±60°, both mirrored and relative to the knobs. Knob 13's speed dial gives them a quarter of its time, 5.5 s a round to start with (scripts/shows/mover_more_efx.py). The pad controller settles the knobs after them too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
103 lines
4.2 KiB
Python
103 lines
4.2 KiB
Python
#!/usr/bin/env python3
|
||
"""Add Circle and Sweep for the movers to shows/test.qxw, on notes 98 and 99.
|
||
|
||
They fill the top row of the movers layer after Wander and Ballyhoo, in the same
|
||
Movement solo frame, so only one of the four runs at a time. Like them, each is
|
||
a relative EFX around wherever the Pan and Tilt knobs (9 and 10) put the movers:
|
||
|
||
98 Circle pad 15 a circle about ±45° of pan and ±21° of tilt
|
||
99 Sweep pad 16 a straight pan sweep, about ±60° side to side
|
||
|
||
All four movers start together, so the pairs mirror left to right and front to
|
||
back as in Ballyhoo. Each fades in over 0.5 s. Knob 13's Movers speed dial gives
|
||
them a quarter of its time, less the fade-in that QLC+ counts in each round:
|
||
5.5 s a round to start with, from 15.5 s fully left to 2.5 s fully right.
|
||
padcontroller/layer.py settles the knobs after them too.
|
||
|
||
python3 scripts/shows/mover_more_efx.py
|
||
|
||
Run it once on a show with the Movement solo frame and the Movers speed dial;
|
||
it stops if Circle is already there. QLC+ has to reopen the show to see it.
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import re
|
||
|
||
from mover_bank import LEFT_TO_RIGHT, NO_FUNCTION, ROOT, button, note
|
||
|
||
SHOW = ROOT / "shows" / "test.qxw"
|
||
|
||
FADE_IN_MS = 500
|
||
START_MS = 6000 # a quarter of the speed dial's starting 24 s
|
||
TIMES_1_4 = 4 # speed dial factor index: (Not Sent), 0, 1/16, 1/8, 1/4, ...
|
||
SIZE = 90
|
||
|
||
# Caption, function name, algorithm, width, height (of 255 each way), can note, column
|
||
MOVES = (
|
||
("Circle", "Movers circle", "Circle", 21, 20, 50, 2),
|
||
("Sweep", "Movers sweep", "Line", 28, 0, 51, 3),
|
||
)
|
||
|
||
|
||
def efx(fid: int, name: str, algorithm: str, width: int, height: int) -> str:
|
||
fixtures = "".join(f""" <Fixture>
|
||
<ID>{f}</ID>
|
||
<Head>0</Head>
|
||
<Mode>0</Mode>
|
||
<Direction>Forward</Direction>
|
||
<StartOffset>0</StartOffset>
|
||
</Fixture>
|
||
""" for f in LEFT_TO_RIGHT)
|
||
axes = "".join(f""" <Axis Name="{axis}">
|
||
<Offset>127</Offset>
|
||
<Frequency>1</Frequency>
|
||
<Phase>0</Phase>
|
||
</Axis>
|
||
""" for axis in "XY")
|
||
# Relative: the EFX adds its offset from 127 to the Pan and Tilt sliders' levels.
|
||
return f""" <Function ID="{fid}" Type="EFX" Name="{name}">
|
||
{fixtures} <PropagationMode>Parallel</PropagationMode>
|
||
<Speed FadeIn="{FADE_IN_MS}" FadeOut="0" Duration="{START_MS}"/>
|
||
<Direction>Forward</Direction>
|
||
<RunOrder>Loop</RunOrder>
|
||
<Algorithm>{algorithm}</Algorithm>
|
||
<Width>{width}</Width>
|
||
<Height>{height}</Height>
|
||
<Rotation>0</Rotation>
|
||
<StartOffset>0</StartOffset>
|
||
<IsRelative>1</IsRelative>
|
||
{axes} </Function>
|
||
"""
|
||
|
||
|
||
def main() -> None:
|
||
xml = SHOW.read_text()
|
||
if 'Name="Movers circle"' in xml:
|
||
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers circle")
|
||
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) in enumerate(MOVES):
|
||
functions += efx(fid + i, name, algorithm, width, height)
|
||
buttons += button(wid + i, caption, SIZE * column, 0, SIZE, fid + i, note(can_note), indent=" ")
|
||
rows += f' <Function FadeIn="0" FadeOut="0" Duration="{TIMES_1_4}">{fid + i}</Function>\n'
|
||
|
||
columns = 2 + len(MOVES)
|
||
grown = re.sub(r'(<WindowState Visible="True" X="10" Y="10" Width=")\d+"', rf'\g<1>{SIZE * columns}"', 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"Added Circle and Sweep to {SHOW.relative_to(ROOT)} (functions {fid}–{fid + len(MOVES) - 1}, "
|
||
f"widgets {wid}–{wid + len(MOVES) - 1})")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|