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
+26 -2
View File
@@ -11,8 +11,17 @@ WOOD_ITEM_PATH = "/Game/Agrarian/DataAssets/Items/DA_Item_Wood"
FIBER_ITEM_PATH = "/Game/Agrarian/DataAssets/Items/DA_Item_Fiber"
STONE_ITEM_PATH = "/Game/Agrarian/DataAssets/Items/DA_Item_Stone"
MESH_CUBE_PATH = "/Game/LevelPrototyping/Meshes/SM_Cube"
MESH_CYLINDER_PATH = "/Game/LevelPrototyping/Meshes/SM_Cylinder"
PLACEHOLDER_MESH_FOLDER = "/Game/Agrarian/Environment/PlaceholderMeshes"
PLACEHOLDER_MESH_SOURCES = {
"SM_AGR_Placeholder_Cube": "/Game/LevelPrototyping/Meshes/SM_Cube",
"SM_AGR_Placeholder_Cylinder": "/Game/LevelPrototyping/Meshes/SM_Cylinder",
}
PLACEHOLDER_MESHES = {
name: f"{PLACEHOLDER_MESH_FOLDER}/{name}"
for name in PLACEHOLDER_MESH_SOURCES
}
MESH_CUBE_PATH = PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cube"]
MESH_CYLINDER_PATH = PLACEHOLDER_MESHES["SM_AGR_Placeholder_Cylinder"]
BLUEPRINTS = [
{
@@ -125,6 +134,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 create_or_load_blueprint(asset_name, folder, parent_class):
path = f"{folder}/{asset_name}"
existing = unreal.EditorAssetLibrary.load_asset(path)
@@ -177,6 +199,8 @@ def apply_defaults(blueprint, config):
def main():
ensure_native_placeholder_meshes()
for folder in (RESOURCE_FOLDER, STRUCTURE_FOLDER, WILDLIFE_FOLDER, WORLD_FOLDER):
unreal.EditorAssetLibrary.make_directory(folder)