mrPlow58/Scripts/audit_kamaz_cr_asset_bounds.py
2026-07-03 07:06:16 +03:00

50 lines
1.7 KiB
Python

import json
import os
import unreal
ASSET_PATHS = [
"/Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Chassis_Empty.SM_KAMAZ_CR_Chassis_Empty",
"/Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Wheel_FL.SM_KAMAZ_CR_Wheel_FL",
"/Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Wheel_FR.SM_KAMAZ_CR_Wheel_FR",
"/Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Wheel_RL.SM_KAMAZ_CR_Wheel_RL",
"/Game/MrPlow/Vehicles/KAMAZ_CR/Modular/SM_KAMAZ_CR_Wheel_RR.SM_KAMAZ_CR_Wheel_RR",
"/Game/MrPlow/Vehicles/KAMAZ_CR/ChaosRig/SK_KAMAZ_CR_ChaosRig_53605.SK_KAMAZ_CR_ChaosRig_53605",
]
def bounds_payload(asset):
bounds = asset.get_bounds()
return {
"origin": [round(bounds.origin.x, 2), round(bounds.origin.y, 2), round(bounds.origin.z, 2)],
"boxExtent": [round(bounds.box_extent.x, 2), round(bounds.box_extent.y, 2), round(bounds.box_extent.z, 2)],
"sphereRadius": round(bounds.sphere_radius, 2),
}
def main():
report = []
for path in ASSET_PATHS:
asset = unreal.load_asset(path)
item = {
"path": path,
"exists": bool(asset),
"class": asset.get_class().get_name() if asset else None,
}
if asset and hasattr(asset, "get_bounds"):
item["bounds"] = bounds_payload(asset)
report.append(item)
output_path = os.path.join(
unreal.Paths.project_dir(),
"VehicleExports",
"KAMAZ_CR",
"unreal_kamaz_cr_asset_bounds_report.json",
)
with open(output_path, "w", encoding="utf-8") as handle:
json.dump(report, handle, ensure_ascii=False, indent=2)
unreal.log("KAMAZ_CR asset bounds: " + json.dumps(report, ensure_ascii=False))
main()