feat(facades): 0.1.5 — hero detail, scene audit, material orphaning fixed (#32)

Merged PR #32: 0.1.5 — hero detail, scene audit, material orphaning fixed

Co-authored-by: Zwitschi <zwitschi82@gmail.com>
This commit was merged in pull request #32.
This commit is contained in:
zwitschi authored and zwitschi committed 2026-11-08 22:56:08 +01:00
1 parent 743a290ac9
commit 73aca9db80
50 files changed
+1326 -88

No files matched your search

+18 -7
View File
@@ -23,6 +23,8 @@ import unreal
MAP = "/Game/Hollywood/DemoMap"
# Repository root, so the texture generator can be invoked by path.
ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import ue_placement # noqa: E402
RESULT = "/tmp/gigline/demo-map.txt"
lines = []
@@ -116,14 +118,23 @@ def ensure_material(mat_name, spec, textures=None):
does not read as one flat specular value.
"""
path = f"/Game/Hollywood/Site/{mat_name}"
if unreal.EditorAssetLibrary.does_asset_exist(path):
# Rebuilt every run so a look change cannot be masked by a stale asset.
unreal.EditorAssetLibrary.delete_asset(path)
mat = unreal.AssetToolsHelpers.get_asset_tools().create_asset(
mat_name, "/Game/Hollywood/Site", unreal.Material, unreal.MaterialFactoryNew())
lib = unreal.MaterialEditingLibrary
# Update the existing material IN PLACE rather than deleting and recreating it.
# Deleting the asset to force a look rebuild silently orphaned every reference:
# after one demo-builder run, all 598 kit actors and the theatre trim pointed at
# deleted materials and rendered with the default one (604 actors with no
# material), while the map itself looked merely "a bit flat".
mat = unreal.EditorAssetLibrary.load_asset(path)
if mat is None:
mat = unreal.AssetToolsHelpers.get_asset_tools().create_asset(
mat_name, "/Game/Hollywood/Site", unreal.Material, unreal.MaterialFactoryNew())
else:
# Clear the old graph so a removed node cannot survive a look change.
# `Material.expressions` is protected from Python, so use the editing
# library's own deleter rather than reading the array.
lib.delete_all_material_expressions(mat)
def node(cls):
return lib.create_material_expression(mat, cls)
@@ -401,7 +412,7 @@ def build():
# the NORTH side of the street, which only looked right while it stood alone.
hero = unreal.EditorAssetLibrary.load_asset("/Game/Hollywood/ElCapitan/SM_HeroFacade")
if hero:
actor = spawn(unreal.StaticMeshActor, unreal.Vector(-13336.0, 1307.0, 0.0), "Hero_Facade")
actor = spawn(unreal.StaticMeshActor, unreal.Vector(*ue_placement.HERO_LOCATION_CM), ue_placement.HERO_ACTOR)
if actor:
actor.static_mesh_component.set_static_mesh(hero)
actor.static_mesh_component.set_mobility(unreal.ComponentMobility.STATIC)