Stabilize investor frontend entry

This commit is contained in:
2026-05-19 20:46:09 -07:00
parent d59f613e2b
commit d2b8185333
9 changed files with 169 additions and 47 deletions
@@ -0,0 +1,43 @@
import unreal
MATERIAL_PATHS = [
"/Game/Agrarian/Materials/M_AGR_GZ_Tree_CoastalOak",
"/Game/Agrarian/Materials/M_AGR_GZ_Shrub_CoyoteBrush",
"/Game/Agrarian/Materials/M_AGR_GZ_Grass_DryCoastal",
]
def set_instanced_usage(material):
applied = False
for property_name in (
"used_with_instanced_static_meshes",
"bUsedWithInstancedStaticMeshes",
):
try:
material.set_editor_property(property_name, True)
applied = True
except Exception:
pass
return applied
dirty_assets = []
for material_path in MATERIAL_PATHS:
material = unreal.EditorAssetLibrary.load_asset(material_path)
if not material:
raise RuntimeError(f"Missing material: {material_path}")
if not set_instanced_usage(material):
raise RuntimeError(f"Could not set instanced static mesh usage on {material_path}")
unreal.MaterialEditingLibrary.recompile_material(material)
dirty_assets.append(material_path)
for material_path in dirty_assets:
if not unreal.EditorAssetLibrary.save_asset(material_path, only_if_is_dirty=False):
raise RuntimeError(f"Failed to save updated material: {material_path}")
print("Updated instanced static mesh usage for Ground Zero foliage materials:")
for material_path in dirty_assets:
print(f" - {material_path}")
+7
View File
@@ -52,16 +52,19 @@ ENVIRONMENT_MATERIALS = {
"path": f"{MATERIAL_FOLDER}/M_AGR_GZ_Tree_CoastalOak",
"color": unreal.LinearColor(0.18, 0.31, 0.16, 1.0),
"roughness": 0.88,
"used_with_instanced_static_meshes": True,
},
"shrub": {
"path": f"{MATERIAL_FOLDER}/M_AGR_GZ_Shrub_CoyoteBrush",
"color": unreal.LinearColor(0.31, 0.39, 0.20, 1.0),
"roughness": 0.9,
"used_with_instanced_static_meshes": True,
},
"grass": {
"path": f"{MATERIAL_FOLDER}/M_AGR_GZ_Grass_DryCoastal",
"color": unreal.LinearColor(0.47, 0.42, 0.23, 1.0),
"roughness": 0.95,
"used_with_instanced_static_meshes": True,
},
"wood_resource": {
"path": f"{MATERIAL_FOLDER}/M_AGR_GZ_Wood_Resource",
@@ -807,6 +810,10 @@ def ensure_environment_materials():
unreal.MaterialEditingLibrary.recompile_material(material)
unreal.EditorAssetLibrary.save_asset(spec["path"])
unreal.log(f"Created Ground Zero environment material: {spec['path']}")
if spec.get("used_with_instanced_static_meshes"):
material.set_editor_property("used_with_instanced_static_meshes", True)
unreal.MaterialEditingLibrary.recompile_material(material)
unreal.EditorAssetLibrary.save_asset(spec["path"], only_if_is_dirty=False)
created_or_loaded[key] = material
return created_or_loaded
+2 -3
View File
@@ -37,9 +37,8 @@ def main() -> None:
"UButton::StaticClass()",
"UTextBlock::StaticClass()",
"OnClicked.AddDynamic",
"OnHovered.AddDynamic",
"ButtonStyle.Hovered.TintColor",
"ButtonStyle.Pressed.TintColor",
"SetBackgroundColor",
"DeferFrontendAction",
"SetIsFocusable(true)",
"SetKeyboardFocus()",
"BackFromActiveScreen()",