Add Ground Zero environment asset variation
This commit is contained in:
@@ -26,6 +26,16 @@ RESOURCE_MATERIALS = {
|
||||
"AGR_DemoFiberResource": "fiber_resource",
|
||||
"AGR_GZ_FreshWaterSource": "fresh_water",
|
||||
}
|
||||
VARIATION_PREFIX = "AGR_GZ_EnvVar_"
|
||||
EXPECTED_VARIATION_COUNT = 11
|
||||
EXPECTED_VARIATION_MATERIALS = {
|
||||
"AGR_GZ_EnvVar_Tree_Canopy": "tree",
|
||||
"AGR_GZ_EnvVar_Tree_Trunk": "wood_resource",
|
||||
"AGR_GZ_EnvVar_Bush": "shrub",
|
||||
"AGR_GZ_EnvVar_Grass": "grass",
|
||||
"AGR_GZ_EnvVar_Rock": "stone_resource",
|
||||
"AGR_GZ_EnvVar_Water": "fresh_water",
|
||||
}
|
||||
|
||||
|
||||
def get_actor_label(actor):
|
||||
@@ -48,6 +58,13 @@ def material_key_for_label(label):
|
||||
return None
|
||||
|
||||
|
||||
def variation_material_key_for_label(label):
|
||||
for prefix, material_key in EXPECTED_VARIATION_MATERIALS.items():
|
||||
if label.startswith(prefix):
|
||||
return material_key
|
||||
return None
|
||||
|
||||
|
||||
def assert_asset(path):
|
||||
asset = unreal.EditorAssetLibrary.load_asset(path)
|
||||
if not asset:
|
||||
@@ -118,11 +135,50 @@ def main():
|
||||
if checked_resource_actors < 10:
|
||||
failures.append(f"expected at least 10 dressed resource/water actors, checked {checked_resource_actors}")
|
||||
|
||||
variation_actors = [actor for actor in actors if get_actor_label(actor).startswith(VARIATION_PREFIX)]
|
||||
if len(variation_actors) != EXPECTED_VARIATION_COUNT:
|
||||
failures.append(f"expected {EXPECTED_VARIATION_COUNT} environment variation actors, found {len(variation_actors)}")
|
||||
|
||||
variation_meshes = set()
|
||||
variation_scales = set()
|
||||
variation_material_keys = set()
|
||||
for actor in variation_actors:
|
||||
label = get_actor_label(actor)
|
||||
expected_material_key = variation_material_key_for_label(label)
|
||||
if not expected_material_key:
|
||||
failures.append(f"{label} does not match a known variation material family")
|
||||
continue
|
||||
|
||||
mesh_components = actor.get_components_by_class(unreal.StaticMeshComponent)
|
||||
if not mesh_components:
|
||||
failures.append(f"{label} has no static mesh component")
|
||||
continue
|
||||
|
||||
component = mesh_components[0]
|
||||
mesh = component.get_editor_property("static_mesh")
|
||||
variation_meshes.add(mesh.get_path_name().split(".", 1)[0] if mesh else "")
|
||||
scale = actor.get_actor_scale3d()
|
||||
variation_scales.add((round(scale.x, 2), round(scale.y, 2), round(scale.z, 2)))
|
||||
variation_material_keys.add(expected_material_key)
|
||||
|
||||
assigned = material_path(component.get_material(0))
|
||||
expected = MATERIALS[expected_material_key]
|
||||
if assigned != expected:
|
||||
failures.append(f"{label} material expected {expected}, got {assigned}")
|
||||
|
||||
if len(variation_meshes) < 4:
|
||||
failures.append(f"expected at least 4 variation mesh silhouettes, got {len(variation_meshes)}")
|
||||
if len(variation_scales) < EXPECTED_VARIATION_COUNT:
|
||||
failures.append("environment variation actors should use unique scale profiles")
|
||||
if not {"tree", "wood_resource", "shrub", "grass", "stone_resource", "fresh_water"}.issubset(variation_material_keys):
|
||||
failures.append("environment variation actors do not cover tree, shrub, grass, resource, and water families")
|
||||
|
||||
docs = unreal.Paths.convert_relative_path_to_full(unreal.Paths.project_dir()) + "Docs/Terrain/GroundZeroNaturalEnvironmentPass.md"
|
||||
roadmap = unreal.Paths.convert_relative_path_to_full(unreal.Paths.project_dir()) + "AGRARIAN_DEVELOPMENT_ROADMAP.md"
|
||||
for path, snippet in [
|
||||
(docs, "MVP natural environment pass"),
|
||||
(docs, "asset variation"),
|
||||
(roadmap, "[x] Replace grey-box environment presentation with an MVP natural environment pass"),
|
||||
(roadmap, "[x] Add first-pass environment asset variation"),
|
||||
]:
|
||||
with open(path, "r", encoding="utf-8") as handle:
|
||||
text = handle.read()
|
||||
@@ -134,7 +190,8 @@ def main():
|
||||
|
||||
unreal.log(
|
||||
"Ground Zero natural environment verification complete: "
|
||||
f"{len(materials)} materials, {len(landscapes)} landscape(s), {checked_resource_actors} dressed resource/water actor(s)."
|
||||
f"{len(materials)} materials, {len(landscapes)} landscape(s), "
|
||||
f"{checked_resource_actors} dressed resource/water actor(s), {len(variation_actors)} variation actor(s)."
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user