Add Ground Zero water source visual gate

This commit is contained in:
2026-05-19 11:01:14 -07:00
parent be6486202c
commit d0c1e22d98
5 changed files with 198 additions and 6 deletions
+22 -3
View File
@@ -723,6 +723,20 @@ def apply_material_to_actor_meshes(actor, material):
return applied_count
def apply_water_source_materials(actor, materials):
component_materials = {
"Mesh": materials["stone_resource"],
"StoneBankProxy": materials["stone_resource"],
"WaterSurfaceProxy": materials["fresh_water"],
"CollectMarkerProxy": materials["fresh_water"],
}
for component in actor.get_components_by_class(unreal.StaticMeshComponent):
material = component_materials.get(component.get_name())
if material:
component.set_material(0, material)
def material_key_for_actor_label(label):
for prefix, material_key in RESOURCE_MATERIAL_BY_LABEL_PREFIX.items():
if label.startswith(prefix):
@@ -976,9 +990,14 @@ def spawn_demo_actor(spec, height_values, materials, safe_spawn_location_xy=None
actor.set_editor_property("persistence_node_id", spec["label"])
except Exception:
pass
material_key = material_key_for_actor_label(spec["label"])
if material_key:
apply_material_to_actor_meshes(actor, materials[material_key])
if spec["label"].startswith("AGR_GZ_FreshWaterSource"):
apply_water_source_materials(actor, materials)
else:
material_key = material_key_for_actor_label(spec["label"])
if material_key:
apply_material_to_actor_meshes(actor, materials[material_key])
unreal.log(f"Placed {spec['label']} at {actor.get_actor_location()}")
return actor