Replace template meshes with native placeholders

This commit is contained in:
2026-05-16 02:45:00 -07:00
parent f78c552d30
commit b5d13598f8
18 changed files with 229 additions and 37 deletions
+35 -8
View File
@@ -17,17 +17,29 @@ LANDSCAPE_MIN_XY = -50000.0
FOLIAGE_LABEL = "AGR_GroundZeroFoliage_FirstPass"
FOLIAGE_RANDOM_SEED = 4160544
PLACEHOLDER_MESH_FOLDER = "/Game/Agrarian/Environment/PlaceholderMeshes"
PLACEHOLDER_MESH_SOURCES = {
"SM_AGR_Placeholder_Cube": "/Game/LevelPrototyping/Meshes/SM_Cube",
"SM_AGR_Placeholder_ChamferCube": "/Game/LevelPrototyping/Meshes/SM_ChamferCube",
"SM_AGR_Placeholder_Cylinder": "/Game/LevelPrototyping/Meshes/SM_Cylinder",
"SM_AGR_Placeholder_QuarterCylinder": "/Game/LevelPrototyping/Meshes/SM_QuarterCylinder",
"SM_AGR_Placeholder_Plane": "/Game/LevelPrototyping/Meshes/SM_Plane",
}
PLACEHOLDER_MESHES = {
name: f"{PLACEHOLDER_MESH_FOLDER}/{name}"
for name in PLACEHOLDER_MESH_SOURCES
}
FOLIAGE_MESHES = {
"tree": "/Game/LevelPrototyping/Meshes/SM_Cylinder",
"shrub": "/Game/LevelPrototyping/Meshes/SM_Cube",
"grass": "/Game/LevelPrototyping/Meshes/SM_Cylinder",
"tree": PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cylinder"],
"shrub": PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cube"],
"grass": PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cylinder"],
}
VARIATION_MESHES = {
"cube": "/Game/LevelPrototyping/Meshes/SM_Cube",
"chamfer_cube": "/Game/LevelPrototyping/Meshes/SM_ChamferCube",
"cylinder": "/Game/LevelPrototyping/Meshes/SM_Cylinder",
"quarter_cylinder": "/Game/LevelPrototyping/Meshes/SM_QuarterCylinder",
"plane": "/Game/LevelPrototyping/Meshes/SM_Plane",
"cube": PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cube"],
"chamfer_cube": PLACEHOLDER_MESHES["SM_AGR_Placeholder_ChamferCube"],
"cylinder": PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cylinder"],
"quarter_cylinder": PLACEHOLDER_MESHES["SM_AGR_Placeholder_QuarterCylinder"],
"plane": PLACEHOLDER_MESHES["SM_AGR_Placeholder_Plane"],
}
MATERIAL_FOLDER = "/Game/Agrarian/Materials"
ENVIRONMENT_MATERIALS = {
@@ -405,6 +417,19 @@ def load_required_asset(path):
return asset
def ensure_native_placeholder_meshes():
unreal.EditorAssetLibrary.make_directory(PLACEHOLDER_MESH_FOLDER)
for asset_name, source_path in PLACEHOLDER_MESH_SOURCES.items():
destination_path = f"{PLACEHOLDER_MESH_FOLDER}/{asset_name}"
if unreal.EditorAssetLibrary.does_asset_exist(destination_path):
continue
if not unreal.EditorAssetLibrary.duplicate_asset(source_path, destination_path):
raise RuntimeError(f"Could not create native placeholder mesh {destination_path} from {source_path}")
unreal.EditorAssetLibrary.save_asset(destination_path)
unreal.log(f"Created native placeholder mesh: {destination_path}")
def ensure_environment_materials():
if not unreal.EditorAssetLibrary.does_directory_exist(MATERIAL_FOLDER):
unreal.EditorAssetLibrary.make_directory(MATERIAL_FOLDER)
@@ -669,6 +694,8 @@ def main():
if not unreal.EditorLevelLibrary.load_level(MAP_PATH):
raise RuntimeError(f"Could not load map: {MAP_PATH}")
ensure_native_placeholder_meshes()
labels = {spec["label"] for spec in DEMO_ACTORS}
labels.update(LEGACY_DEMO_LIGHTING_LABELS)
labels.update(spec["label"] for spec in BIOME_RESOURCE_ACTORS)