41 lines
1.5 KiB
Python
41 lines
1.5 KiB
Python
import json
|
|
import os
|
|
|
|
import unreal
|
|
|
|
|
|
SOURCE_MAP = "/Game/MrPlow/Maps/VehicleImports/Lvl_ModularContract_Kamaz_Auto"
|
|
DEST_MAP = "/Game/MrPlow/Maps/VehicleImports/Lvl_VehicleSelector_ModularTest"
|
|
REPORT_PATH = r"C:\Users\post\Documents\mrPlow\mrPlow58\VehicleExports\vehicle_selector_level_report.json"
|
|
|
|
|
|
def main():
|
|
result = {
|
|
"ok": False,
|
|
"sourceMap": SOURCE_MAP,
|
|
"destinationMap": DEST_MAP,
|
|
"notes": [],
|
|
}
|
|
|
|
if not unreal.EditorAssetLibrary.does_asset_exist(SOURCE_MAP):
|
|
result["notes"].append("Source map does not exist.")
|
|
else:
|
|
if unreal.EditorAssetLibrary.does_asset_exist(DEST_MAP):
|
|
result["notes"].append("Destination map already existed; deleting before clean duplicate.")
|
|
unreal.EditorAssetLibrary.delete_asset(DEST_MAP)
|
|
|
|
duplicated = unreal.EditorAssetLibrary.duplicate_asset(SOURCE_MAP, DEST_MAP)
|
|
result["duplicated"] = bool(duplicated)
|
|
if duplicated:
|
|
unreal.EditorAssetLibrary.save_asset(DEST_MAP, only_if_is_dirty=False)
|
|
result["ok"] = True
|
|
result["notes"].append("Created a clean test map based on the proven modular KAMAZ level.")
|
|
|
|
os.makedirs(os.path.dirname(REPORT_PATH), exist_ok=True)
|
|
with open(REPORT_PATH, "w", encoding="utf-8") as report_file:
|
|
json.dump(result, report_file, ensure_ascii=False, indent=2)
|
|
|
|
unreal.log("Vehicle selector level report: {}".format(json.dumps(result, ensure_ascii=False)))
|
|
|
|
|
|
main()
|