""" Adds or replaces the station's outer shell and the ice it stands on in an EXISTING station file, in place. Nothing else in the file is touched: the kit rooms, the dressing and anything moved by hand stay as they are. blender -b --factory-startup Anchorage_Station_exterior.blend --python build/apply_exterior.py [-- options] --only exterior | ice do one of the two (default: both) --only floe only the floe's own mesh, swapped in place: the object, the seracs, blocks and drift ice on it and everything else stay untouched (for a new rim or relief) --only coolers only the four ice coolers on the floe (build/coolers.py: the Fab machine, instanced) --only relay only the relay dish on Relay Control's roof (the Sci-Fi Lite pack's satellite): put there, or put back where the recipe has it --only outpost only the outpost: the armour, pylons, portals, roof works and site works over the shell (build/outpost.py); the shell itself, the ice and the rooms stay untouched --only doors only what the door leaves need to open: the slots in the roofs they lift through and the housings over them (new meshes in place for the two shells, the galleries' armour and the roof works); then run build/check_doors.py --no-save try it without writing the file --refresh-materials A,B rebuild the Blender preview of these Unreal materials (asset names, for example MI_Ice_A-2,M_Cave_SimpleSnow) from build/bl_kit.py; other materials are left alone Use this, not build_anchorage.py, once the file has been worked on by hand. """ import os import sys import bpy sys.dont_write_bytecode = True HERE = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, HERE) ARGS = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [] ONLY = ARGS[ARGS.index("--only") + 1] if "--only" in ARGS else None import build_anchorage as plan # noqa: E402 (only its numbers and the Builder; nothing is built by importing it) if bpy.data.collections.get(plan.STATION) is None: raise RuntimeError("this file has no %r collection: open a station file" % plan.STATION) b = plan.Builder() if "--refresh-materials" in ARGS: import bl_kit # noqa: E402 names = set(ARGS[ARGS.index("--refresh-materials") + 1].split(",")) for mat in bpy.data.materials: path = mat.get("ue_material", "") if path and path.split("/")[-1] in names: bl_kit._MaterialBuilder(b.kit, mat, path, b.kit.materials.get(path)).build() print("[anchorage] preview material rebuilt: %s" % mat.name) if ONLY in (None, "exterior"): import exterior # noqa: E402 exterior.add_exterior(b) if ONLY in (None, "ice"): import ice # noqa: E402 ice.add_ice(b) if ONLY == "floe": import ice # noqa: E402 ice.update_floe(b) if ONLY == "coolers": # the four ice coolers (the Fab machine) on their pads: the model brought in once, the four of it stood anew import coolers # noqa: E402 coolers.add(b) if ONLY == "outpost": import ice # noqa: E402 import outpost # noqa: E402 ice.update_floe(b) # the site works stand on level ground: the floe's mesh, in place outpost.add_outpost(b) bpy.ops.file.make_paths_relative() if ONLY == "doors": # the slots the door leaves lift through and the housings that take them: new meshes for the roofs they cut and # for the armour and roof works, in place import exterior # noqa: E402 import outpost # noqa: E402 exterior.refresh(b) outpost.refresh(b) bpy.ops.file.make_paths_relative() if ONLY == "relay": import exterior # noqa: E402 from bl_kit import get_collection # noqa: E402 exterior.add_relay_dish(b, get_collection(exterior.COLLECTION, get_collection(plan.STATION))) bpy.ops.file.make_paths_relative() # its textures are new to the file if "--no-save" not in ARGS: bpy.context.preferences.filepaths.save_version = 0 bpy.ops.wm.save_mainfile(compress=True) print("[anchorage] saved in place: %s" % bpy.data.filepath)