diff --git a/Tools/VehiclePipeline/README.md b/Tools/VehiclePipeline/README.md index ea4a6ca..9988e87 100644 --- a/Tools/VehiclePipeline/README.md +++ b/Tools/VehiclePipeline/README.md @@ -105,7 +105,7 @@ Open it in Blender and inspect: - `MrPlow_Chassis`: clean KAMAZ chassis and rig source - `MrPlow_Modules`: original KAMAZ modules still in the master file -- `Verify_02_KAMAZ_With_KRAZ_Modules`: side-by-side fit check with KRAZ `body for bulk` and `blade bucket` +- `Verify_02_KAMAZ_With_Alt_Modules`: side-by-side KAMAZ fit check with KRAZ `body for bulk` and `blade bucket` - `Verify_Labels`: socket markers and labels The visual verification file is for checking fit. Unreal import remains modular: chassis as skeletal mesh, equipment as separate static/skeletal modules. diff --git a/Tools/VehiclePipeline/build_modular_assembly_verify.py b/Tools/VehiclePipeline/build_modular_assembly_verify.py index 4cde0de..d16ebed 100644 --- a/Tools/VehiclePipeline/build_modular_assembly_verify.py +++ b/Tools/VehiclePipeline/build_modular_assembly_verify.py @@ -186,7 +186,7 @@ def main(): bpy.ops.wm.open_mainfile(filepath=str(kamaz_clean_path)) labels_collection = clear_collection("Verify_Labels") - variant_collection = clear_collection("Verify_02_KAMAZ_With_KRAZ_Modules") + variant_collection = clear_collection("Verify_02_KAMAZ_With_Alt_Modules") parking_collection = clear_collection("Verify_03_Module_Parking") ensure_collection("Verify_01_KAMAZ_Default") @@ -201,7 +201,7 @@ def main(): bpy.ops.object.transform_apply(location=False, rotation=True, scale=True) variant_offset = Vector((0, 5.0, 0)) - variant_chassis = duplicate_collection_objects("MrPlow_Chassis", "_VerifyKrazVariant", variant_offset, variant_collection) + variant_chassis = duplicate_collection_objects("MrPlow_Chassis", "_VerifyAltModulesVariant", variant_offset, variant_collection) kuzov = bpy.data.objects.get("KUZOV") kamaz_modules = [bpy.data.objects.get(name) for name in KAMAZ_MODULE_NAMES] @@ -238,7 +238,7 @@ def main(): labels_collection, ) add_text_label( - "Label_Kraz_Modules", + "Label_Alt_Modules", "02 KAMAZ fit check: KRAZ body for bulk + blade bucket", Vector((default_center.x, 5.0 - 2.9, 3.4)), labels_collection, @@ -270,7 +270,7 @@ def main(): "MrPlow_Chassis", "MrPlow_Modules", "MrPlow_Rig", - "Verify_02_KAMAZ_With_KRAZ_Modules", + "Verify_02_KAMAZ_With_Alt_Modules", "Verify_03_Module_Parking", "Verify_Labels", ], @@ -279,7 +279,7 @@ def main(): "variantChassisBounds": object_report(variant_chassis[0]) if variant_chassis else {}, "notes": [ "KAMAZ default modules remain in the clean source file and are exported separately.", - "KRAZ modules are placed in a side-by-side fit variant, offset by +5m on Y.", + "KRAZ modules are placed on the KAMAZ alternative module fit variant, offset by +5m on Y.", "Final Unreal import still uses separate FBX assets, not one combined mesh.", ], } diff --git a/Tools/VehiclePipeline/rename_verify_variant_objects.py b/Tools/VehiclePipeline/rename_verify_variant_objects.py new file mode 100644 index 0000000..7cd8a35 --- /dev/null +++ b/Tools/VehiclePipeline/rename_verify_variant_objects.py @@ -0,0 +1,104 @@ +import argparse +import json +import sys +from pathlib import Path + +import bpy + + +VERIFY_FILE = "mrplow_modular_assembly_verify.blend" +VERIFY_REPORT = "mrplow_modular_assembly_verify_rename_report.json" + + +RENAMES = { + "Verify_02_KAMAZ_With_KRAZ_Modules": "Verify_02_KAMAZ_With_Alt_Modules", + "Label_Kraz_Modules": "Label_Alt_Modules", +} + + +def parse_args(): + parser = argparse.ArgumentParser() + parser.add_argument("--input-root", required=True) + parser.add_argument("--export-report", default="") + argv = sys.argv + if "--" in argv: + argv = argv[argv.index("--") + 1:] + else: + argv = [] + return parser.parse_args(argv) + + +def safe_rename(datablock, new_name): + old_name = datablock.name + if old_name == new_name: + return None + datablock.name = new_name + return {"old": old_name, "new": datablock.name} + + +def main(): + args = parse_args() + input_root = Path(args.input_root) + blend_path = input_root / VERIFY_FILE + report_path = input_root / VERIFY_REPORT + + bpy.ops.wm.open_mainfile(filepath=str(blend_path)) + + renamed = [] + for old_name, new_name in RENAMES.items(): + collection = bpy.data.collections.get(old_name) + if collection: + item = safe_rename(collection, new_name) + if item: + item["type"] = "COLLECTION" + renamed.append(item) + + obj = bpy.data.objects.get(old_name) + if obj: + item = safe_rename(obj, new_name) + if item: + item["type"] = "OBJECT" + renamed.append(item) + + text = bpy.data.curves.get(f"{old_name}_Text") + if text: + item = safe_rename(text, f"{new_name}_Text") + if item: + item["type"] = "TEXT_CURVE" + renamed.append(item) + + for obj in list(bpy.data.objects): + if obj.name.endswith("_VerifyKrazVariant"): + item = safe_rename(obj, obj.name.replace("_VerifyKrazVariant", "_VerifyAltModulesVariant")) + if item: + item["type"] = "OBJECT" + renamed.append(item) + + collections = { + collection.name: len(collection.objects) + for collection in bpy.data.collections + if collection.name.startswith(("MrPlow", "Verify")) + } + confusing_names = sorted([ + obj.name for obj in bpy.data.objects + if "VerifyKrazVariant" in obj.name + ]) + report = { + "blend": str(blend_path), + "renamed": renamed, + "collections": collections, + "remainingConfusingObjectNames": confusing_names, + "note": "KRAZ remains only in actual KRAZ attachment object names, not the duplicated KAMAZ chassis variant.", + } + + report_path.write_text(json.dumps(report, indent=2), encoding="utf-8") + if args.export_report: + export_path = Path(args.export_report) + export_path.parent.mkdir(parents=True, exist_ok=True) + export_path.write_text(json.dumps(report, indent=2), encoding="utf-8") + + bpy.ops.wm.save_as_mainfile(filepath=str(blend_path)) + + +if __name__ == "__main__": + main() diff --git a/VehicleExports/mrplow_modular_assembly_verify_rename_report.json b/VehicleExports/mrplow_modular_assembly_verify_rename_report.json new file mode 100644 index 0000000..362a3bf --- /dev/null +++ b/VehicleExports/mrplow_modular_assembly_verify_rename_report.json @@ -0,0 +1,331 @@ +{ + "blend": "C:\\Users\\post\\Documents\\mrPlow\\in\\mrplow_modular_assembly_verify.blend", + "renamed": [ + { + "old": "Verify_02_KAMAZ_With_KRAZ_Modules", + "new": "Verify_02_KAMAZ_With_Alt_Modules", + "type": "COLLECTION" + }, + { + "old": "Label_Kraz_Modules", + "new": "Label_Alt_Modules", + "type": "OBJECT" + }, + { + "old": "Label_Kraz_Modules_Text", + "new": "Label_Alt_Modules_Text", + "type": "TEXT_CURVE" + }, + { + "old": "blinker_VerifyKrazVariant", + "new": "blinker_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "bolt001_VerifyKrazVariant", + "new": "bolt001_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "bolt009_VerifyKrazVariant", + "new": "bolt009_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "bolt010_VerifyKrazVariant", + "new": "bolt010_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "bolt011_VerifyKrazVariant", + "new": "bolt011_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "bolt012_VerifyKrazVariant", + "new": "bolt012_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "bolt013_VerifyKrazVariant", + "new": "bolt013_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "CABIN_VerifyKrazVariant", + "new": "CABIN_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk001_VerifyKrazVariant", + "new": "disk001_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk012_VerifyKrazVariant", + "new": "disk012_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk013_VerifyKrazVariant", + "new": "disk013_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk014_VerifyKrazVariant", + "new": "disk014_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk016_VerifyKrazVariant", + "new": "disk016_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk017_VerifyKrazVariant", + "new": "disk017_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk018_VerifyKrazVariant", + "new": "disk018_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk020_VerifyKrazVariant", + "new": "disk020_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk021_VerifyKrazVariant", + "new": "disk021_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk022_VerifyKrazVariant", + "new": "disk022_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "disk023_VerifyKrazVariant", + "new": "disk023_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "fuel_tank_other_VerifyKrazVariant", + "new": "fuel_tank_other_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "glass_cabin_VerifyKrazVariant", + "new": "glass_cabin_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "INTERIOR_VerifyKrazVariant", + "new": "INTERIOR_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "kolpak001_VerifyKrazVariant", + "new": "kolpak001_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "kolpak004_VerifyKrazVariant", + "new": "kolpak004_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "kozirek_VerifyKrazVariant", + "new": "kozirek_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "light-front_VerifyKrazVariant", + "new": "light-front_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "mirror_VerifyKrazVariant", + "new": "mirror_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "number-front_VerifyKrazVariant", + "new": "number-front_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "number-rear_VerifyKrazVariant", + "new": "number-rear_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object008_VerifyKrazVariant", + "new": "Object008_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object009_VerifyKrazVariant", + "new": "Object009_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object010_VerifyKrazVariant", + "new": "Object010_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object011_VerifyKrazVariant", + "new": "Object011_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object012_VerifyKrazVariant", + "new": "Object012_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object013_VerifyKrazVariant", + "new": "Object013_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object014_VerifyKrazVariant", + "new": "Object014_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object015_VerifyKrazVariant", + "new": "Object015_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object016_VerifyKrazVariant", + "new": "Object016_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object017_VerifyKrazVariant", + "new": "Object017_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "Object018_VerifyKrazVariant", + "new": "Object018_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "radiator_VerifyKrazVariant", + "new": "radiator_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "rama_VerifyKrazVariant", + "new": "rama_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "rear axle_VerifyKrazVariant", + "new": "rear axle_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "rear light_VerifyKrazVariant", + "new": "rear light_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "rubber-glass_VerifyKrazVariant", + "new": "rubber-glass_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "stekloochistka_stupeni_VerifyKrazVariant", + "new": "stekloochistka_stupeni_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "transmission_VerifyKrazVariant", + "new": "transmission_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre001_VerifyKrazVariant", + "new": "tyre001_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre013_VerifyKrazVariant", + "new": "tyre013_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre014_VerifyKrazVariant", + "new": "tyre014_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre015_VerifyKrazVariant", + "new": "tyre015_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre017_VerifyKrazVariant", + "new": "tyre017_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre018_VerifyKrazVariant", + "new": "tyre018_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre019_VerifyKrazVariant", + "new": "tyre019_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre021_VerifyKrazVariant", + "new": "tyre021_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre022_VerifyKrazVariant", + "new": "tyre022_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre023_VerifyKrazVariant", + "new": "tyre023_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "tyre024_VerifyKrazVariant", + "new": "tyre024_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "vihlop_VerifyKrazVariant", + "new": "vihlop_VerifyAltModulesVariant", + "type": "OBJECT" + }, + { + "old": "wing_VerifyKrazVariant", + "new": "wing_VerifyAltModulesVariant", + "type": "OBJECT" + } + ], + "collections": { + "MrPlow_Chassis": 60, + "MrPlow_Modules": 3, + "MrPlow_Rig": 6, + "Verify_01_KAMAZ_Default": 0, + "Verify_02_KAMAZ_With_Alt_Modules": 62, + "Verify_03_Module_Parking": 0, + "Verify_Labels": 12 + }, + "remainingConfusingObjectNames": [], + "note": "KRAZ remains only in actual KRAZ attachment object names, not the duplicated KAMAZ chassis variant." +} \ No newline at end of file