#!/usr/bin/env python3 """Smooth the movers' Corners in shows/test.qxw. Corners (pad 11 on the movers layer) jumps the heads corner to corner of a square. At full motor speed each jump is a slam of about 100° of pan, and at an eighth of the speed dial the next comes 0.6 s later. Now it runs at a quarter, like the other shapes (about 1.4 s a corner, 5.5 s a round to start with), and its pad starts a collection of the EFX and a Movers glide scene that sets the heads' Pan/Tilt Speed to GLIDE while it runs (0 is fastest, 255 slowest), so they ease into each corner and settle there before the next. The channel is forced HTP on the movers, so like a dimmer it drops back to 0, full speed, when Corners stops; left LTP, QLC+ would hold it at GLIDE for everything after. python3 scripts/shows/mover_corners_glide.py Run it once on a show with Corners; it stops if the glide 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, ROOT, scene from mover_more_efx import START_MS SHOW = ROOT / "shows" / "test.qxw" PAN_TILT_SPEED = 4 # mover channel GLIDE = 40 TIMES_1_4 = 4 # speed dial factor index: (Not Sent), 0, 1/16, 1/8, 1/4, ... def main() -> None: xml = SHOW.read_text() if 'Name="Movers glide"' in xml: raise SystemExit(f"{SHOW.relative_to(ROOT)} already has the movers glide") engine = xml.split("")[0] corners = int(re.search(r'', engine).group(1)) glide = max(int(i) for i in re.findall(r'\n.*?{START_MS}"', xml, count=1, flags=re.S) assert n == 1 xml, n = re.subn(rf'({corners})', rf"\g<1>{TIMES_1_4}\2", xml) assert n == 1 functions = (scene(glide, "Movers glide", {PAN_TILT_SPEED: GLIDE}) + f' \n' f' {corners}\n {glide}\n \n') xml = xml.replace(" ", functions + " ", 1) for fid in (M1, M2, M3, M4): xml, n = re.subn(rf'( {fid}\n(?: .*\n)*? 43\n)', rf"\1 {PAN_TILT_SPEED}\n", xml, count=1) assert n == 1, fid xml, n = re.subn(r'(