Drop the Combat and SideScrolling C++ code, content and external actors/objects; nothing outside those folders referenced them. Remove the AI/StateTree module and plugin dependencies, collapse the per-variant include paths, and trim the AZERTY script and regression tests accordingly. Variant_Platforming is kept as reference for the upcoming pogo mechanics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.6 KiB
Python
69 lines
2.6 KiB
Python
"""Add AZERTY key mappings next to the QWERTY ones in every Input Mapping Context.
|
|
|
|
W -> also Z (forward), A -> also Q (left). Idempotent: skips keys already mapped.
|
|
Run headless (editor closed):
|
|
UnrealEditor pogo.uproject -run=pythonscript -script=Scripts/azerty_mappings.py -nullrhi -unattended -FullStdOutLogOutput
|
|
"""
|
|
import unreal
|
|
|
|
CONTEXTS = [
|
|
"/Game/Input/IMC_Default",
|
|
"/Game/Variant_Platforming/Input/IMC_Platforming",
|
|
]
|
|
EXTRA_KEYS = {"W": "Z", "A": "Q"}
|
|
|
|
# Properties copied when cloning instanced modifiers/triggers.
|
|
COPY_PROPS = ["order", "x", "y", "z", "lower_threshold", "upper_threshold", "type",
|
|
"scalar", "actuation_threshold"]
|
|
|
|
|
|
def clone_instanced(obj, outer):
|
|
new = unreal.new_object(type(obj), outer=outer)
|
|
for prop in COPY_PROPS:
|
|
try:
|
|
new.set_editor_property(prop, obj.get_editor_property(prop))
|
|
except Exception:
|
|
pass
|
|
return new
|
|
|
|
|
|
def log(msg):
|
|
unreal.log(f"POGO_AZERTY {msg}")
|
|
|
|
|
|
for path in CONTEXTS:
|
|
imc = unreal.load_asset(path)
|
|
if imc is None:
|
|
log(f"MISSING {path}")
|
|
continue
|
|
data = imc.get_editor_property("default_key_mappings")
|
|
mappings = list(data.get_editor_property("mappings"))
|
|
existing = {(m.get_editor_property("action").get_name(),
|
|
str(m.get_editor_property("key").get_editor_property("key_name")))
|
|
for m in mappings}
|
|
added = 0
|
|
for m in list(mappings):
|
|
action = m.get_editor_property("action")
|
|
src_key = str(m.get_editor_property("key").get_editor_property("key_name"))
|
|
dst_key = EXTRA_KEYS.get(src_key)
|
|
if not dst_key or (action.get_name(), dst_key) in existing:
|
|
continue
|
|
new = unreal.EnhancedActionKeyMapping()
|
|
new.set_editor_property("action", action)
|
|
key = unreal.Key()
|
|
key.set_editor_property("key_name", dst_key)
|
|
new.set_editor_property("key", key)
|
|
new.set_editor_property("modifiers", [clone_instanced(x, imc) for x in m.get_editor_property("modifiers")])
|
|
new.set_editor_property("triggers", [clone_instanced(x, imc) for x in m.get_editor_property("triggers")])
|
|
mappings.append(new)
|
|
existing.add((action.get_name(), dst_key))
|
|
added += 1
|
|
log(f"{path}: {action.get_name()} {src_key} -> +{dst_key}")
|
|
if added:
|
|
data.set_editor_property("mappings", mappings)
|
|
imc.set_editor_property("default_key_mappings", data)
|
|
ok = unreal.EditorAssetLibrary.save_loaded_asset(imc, only_if_is_dirty=False)
|
|
log(f"SAVED {path} added={added} ok={ok}")
|
|
else:
|
|
log(f"UNCHANGED {path}")
|