Files
aego/tools/site_demo_prepare.py
sanspie 50be5c04bc
ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Stage 12.5: Art Workspace and asset authoring
Add dockable Art tools, animation and previews, guarded asset workflows,
and the Web Asset Studio built on the shared Art Core. Expand English and
Russian documentation, interactive Try scenes, examples and editor icons.

Add audio waveform navigation, source analysis, guarded previews and a
browser Worker mixer. Preserve source changes and recovery with bounded
checks, and strengthen native, browser and interoperability CI.

Prepare version 0.12.5 and manually built native artifact candidates.
Fix the production site image demo build dependency.
Reuse immutable scene indices when capturing keyframes.
Wait for real Persist save/load completion in component tests.
Stabilize browser Game View captures outside pointer hover.
Aseprite interchange and persistent Audio EDL recovery remain limited;
the artifact workflow does not publish releases or change stable.
2026-11-15 10:37:50 +03:00

68 lines
2.6 KiB
Python

"""Prepare the website-only platformer in a new directory, without editing its source."""
import os
from pathlib import Path
import shutil
import sys
GROUND3 = ' node "0e82ddf02905a5ee0aab0dfb48bc8039" name="Ground3"'
REPLACEMENTS = (
('position=[23, 4]', 'position=[21.5, 4]'),
('size=[10, 1]', 'size=[13, 1]'),
('points=[[-5, 1.5], [-5, -0.5], [5, -0.5], [5, 1.5]]',
'points=[[-6.5, 1.5], [-6.5, -0.5], [6.5, -0.5], [6.5, 1.5]]'),
('polygon=[[-5, -0.5], [5, -0.5], [5, 0.5], [-5, 0.5]]',
'polygon=[[-6.5, -0.5], [6.5, -0.5], [6.5, 0.5], [-6.5, 0.5]]'),
)
def close_checkpoint_gap(scene):
"""Extend Ground3 from x=18 to x=15, retaining its x=28 right end."""
if scene.count(GROUND3) != 1:
raise ValueError('the platformer Ground3 is missing or ambiguous')
start = scene.index(GROUND3)
end = scene.index('\n node ', start + len(GROUND3))
block = scene[start:end]
for before, after in REPLACEMENTS:
if block.count(before) != 1:
raise ValueError('the platformer Ground3 has changed: ' + before)
block = block.replace(before, after, 1)
return scene[:start] + block + scene[end:]
def prepare(source, dest):
source = Path(source).resolve(strict=True)
dest = Path(dest).absolute()
if dest.exists() or dest.is_symlink():
raise ValueError('destination must not exist')
dest_parent = dest.parent.resolve(strict=True)
dest = dest_parent / dest.name
if not source.is_dir() or source == dest or source in dest.parents or dest in source.parents:
raise ValueError('source and destination must be separate directories')
dest.mkdir()
for parent, dirs, files in os.walk(source, followlinks=False):
parent = Path(parent)
rel = parent.relative_to(source)
dirs[:] = [d for d in dirs if not (rel == Path('.') and d in {'.aego', '.git', 'exports'})]
for name in dirs + files:
if (parent / name).is_symlink():
raise ValueError('project symlinks are not supported: ' + str(parent / name))
for name in dirs:
(dest / rel / name).mkdir()
for name in files:
src = parent / name
if not src.is_file():
raise ValueError('unsupported project entry: ' + str(src))
shutil.copy2(src, dest / rel / name)
scene = dest / 'scenes/main.aescene'
before = scene.read_bytes()
after = close_checkpoint_gap(before.decode('utf-8')).encode('utf-8')
scene.write_bytes(after)
if __name__ == '__main__':
if len(sys.argv) != 3:
raise SystemExit('usage: site_demo_prepare.py <project> <new-destination>')
prepare(sys.argv[1], sys.argv[2])