M3 and M4 are mounted 90° round from M1 and M2, so at pan 0 they face the middle. Knob 9 now drives a Pan slider for M1 and M2 over 0–212 and a Pan back slider for M3 and M4 over 43–255 (scripts/shows/mover_pan_back.py). The same span keeps the pairs 90° of pan apart all the way round: at knob 0 the front pair face the audience and the back pair the back wall, and the left and right pairs point at the centre and the side walls together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
71 lines
2.7 KiB
Python
71 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
||
"""Split the movers' Pan slider in shows/test.qxw so the back pair face the back wall at knob 0.
|
||
|
||
M3 and M4 are mounted 90° round from M1 and M2: at pan 0 the front pair face
|
||
the audience and the back pair face the middle. Knob 9 (CC 38) now drives two
|
||
sliders over the same span of 212 steps, so the pairs keep that 90° of pan
|
||
(about 43 steps of 540°) between them all the way round:
|
||
|
||
Pan M1, M2 0–212
|
||
Pan back M3, M4 43–255
|
||
|
||
At knob 0 the front pair face the audience and the back pair the back wall.
|
||
Turning it, the left pair (M1, M3) and the right pair (M2, M4) point at the
|
||
centre together and at the side walls together.
|
||
|
||
python3 scripts/shows/mover_pan_back.py
|
||
|
||
Run it once on a show without it; it stops if it 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
|
||
|
||
SHOW = ROOT / "shows" / "test.qxw"
|
||
|
||
BACK_OFFSET = 43 # 90° of pan, of 540° over 256 steps
|
||
ORDER = ("Brightness", "Pan", "Pan back", "Tilt", "Focus", "Rotate")
|
||
|
||
|
||
def main() -> None:
|
||
xml = SHOW.read_text()
|
||
if 'Caption="Pan back"' in xml:
|
||
raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the back movers' pan")
|
||
wid = max(int(i) for i in re.findall(r' ID="(\d+)"', xml.split("<VirtualConsole>")[1])
|
||
if int(i) != NO_FUNCTION) + 1
|
||
start = xml.index('<Frame Caption="Movers position"')
|
||
end = xml.index("</Frame>", start)
|
||
frame = xml[start:end]
|
||
|
||
pan = re.search(r' <Slider Caption="Pan" ID="\d+".*? </Slider>\n', frame, re.S).group(0)
|
||
level = re.search(r'<Level LowLimit="0" HighLimit="255" Value="\d+">', pan).group(0)
|
||
|
||
def rows(*fixtures: int) -> str:
|
||
return "".join(f' <Channel Fixture="{f}">0</Channel>\n' for f in fixtures)
|
||
|
||
channels = rows(M1, M2, M3, M4)
|
||
assert channels in pan
|
||
front = (pan.replace(level, f'<Level LowLimit="0" HighLimit="{255 - BACK_OFFSET}" Value="0">')
|
||
.replace(channels, rows(M1, M2)))
|
||
back = (re.sub(r'Caption="Pan" ID="\d+"', f'Caption="Pan back" ID="{wid}"', pan)
|
||
.replace(level, f'<Level LowLimit="{BACK_OFFSET}" HighLimit="255" Value="{BACK_OFFSET}">')
|
||
.replace(channels, rows(M3, M4)))
|
||
frame = frame.replace(pan, front + back)
|
||
|
||
# Six sliders 58 apart fit the frame as it is.
|
||
for i, caption in enumerate(ORDER):
|
||
frame, n = re.subn(rf'(<Slider Caption="{caption}" ID="\d+"[^>]*>\n\s*<WindowState Visible="True" X=")\d+"',
|
||
rf'\g<1>{5 + 58 * i}"', frame)
|
||
assert n == 1, caption
|
||
|
||
SHOW.write_text(xml[:start] + frame + xml[end:])
|
||
print(f"Split the movers' Pan in {SHOW.relative_to(ROOT)} (Pan back is widget {wid})")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|