17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-01 03:29:03 +01:00

fix(editor): signals move along their track again, and the editor finds the descriptions of the templates beside the game data

- a press on the mast of a selected signal grabbed the gizmo, whose up axis runs along the mast, and lifted the signal
  instead of moving it along the track; the gizmo gives way over a signal and while one is dragged
- dragged beside its track, off every track, the signal follows the nearest place of the track it stands by instead of
  staying put
- a drop away from any track, and a signal in a file the editor doesn't change, say so instead of doing nothing
- a template without a //$e description of its own takes it from editor/templates/<its path in the scenery folder>; the
  header scripts write there with --sidecar, leaving the templates alone, so a check of the game files by the store
  doesn't take the descriptions away (the descriptions written into the templates on 8.10 and 11.10 were gone, and with
  them every signal and drive the editor knew)
This commit is contained in:
maj00r
2026-10-18 02:08:19 +02:00
parent 52a762879c
commit 9474293af7
8 changed files with 85 additions and 15 deletions

View File

@@ -50,6 +50,23 @@ def options(argv, usage):
return argv[1], '--write' in argv, pack
def sidecar(data, folder, entries):
"""the descriptions next to the game data instead of in the templates: <data>/editor/templates/<the path of the
template in the scenery folder>, the lines without the marks, which the editor reads for a template without its own;
the templates stay as they are, so a check of the game files by the store doesn't take the descriptions away"""
root = os.path.join(data, 'editor', 'templates', os.path.relpath(folder, 'scenery'))
written = 0
for file, info in entries:
if info.get('header') is None:
continue
target = os.path.normpath(os.path.join(root, file))
os.makedirs(os.path.dirname(target), exist_ok=True) # NOSONAR
with open(target, 'w', encoding='utf-8', newline='\n') as out: # NOSONAR
out.write('\n'.join(info['header']) + '\n')
written += 1
print('%d descriptions written beside the data in %s' % (written, root))
def write(data, folder, name, entries):
backup = os.path.join(data, 'editor_backup')
os.makedirs(backup, exist_ok=True) # NOSONAR