Integrating github/staging through commit ab87ed9
This commit is contained in:
+26
-6
@@ -11,6 +11,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.components as components
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
|
||||
@@ -36,8 +41,8 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
|
||||
:return: None
|
||||
"""
|
||||
|
||||
PREPROCESS_INSTANCE_COUNT = 16
|
||||
POSTPROCESS_INSTANCE_COUNT = 13
|
||||
PREPROCESS_INSTANCE_COUNT = 24
|
||||
POSTPROCESS_INSTANCE_COUNT = 18
|
||||
|
||||
# Create empty level
|
||||
self.test_success = self.create_level(
|
||||
@@ -60,7 +65,22 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
|
||||
dynveg.create_surface_entity("Surface_Entity_Parent", position, 16.0, 16.0, 1.0)
|
||||
|
||||
# Add entity with Mesh to replicate creation of hills
|
||||
dynveg.create_mesh_surface_entity_with_slopes("hill", position, 40.0, 40.0, 40.0)
|
||||
hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 40.0, 40.0, 40.0)
|
||||
|
||||
# Disable/Re-enable Mesh component due to ATOM-14299
|
||||
general.idle_wait(1.0)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
|
||||
if is_enabled:
|
||||
print("Mesh component is still enabled")
|
||||
else:
|
||||
print("Mesh component was disabled")
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
|
||||
if is_enabled:
|
||||
print("Mesh component is now enabled")
|
||||
else:
|
||||
print("Mesh component is still disabled")
|
||||
|
||||
# Increase Box Shape size to encompass the hills
|
||||
vegetation.get_set_test(1, "Box Shape|Box Configuration|Dimensions", math.Vector3(100.0, 100.0, 100.0))
|
||||
@@ -69,8 +89,8 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
|
||||
vegetation.get_set_test(3, "Configuration|Altitude Min", 38.0)
|
||||
vegetation.get_set_test(3, "Configuration|Altitude Max", 40.0)
|
||||
|
||||
# Create a new entity as a child of the vegetation area entity with Random Noise Gradient Generator, Gradient Transform Modifier,
|
||||
# and Box Shape component
|
||||
# Create a new entity as a child of the vegetation area entity with Random Noise Gradient Generator, Gradient
|
||||
# Transform Modifier, and Box Shape component
|
||||
random_noise = hydra.Entity("random_noise")
|
||||
random_noise.create_entity(position, ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"])
|
||||
random_noise.set_test_parent_entity(vegetation)
|
||||
@@ -91,4 +111,4 @@ class TestAltitudeFilterFilterStageToggle(EditorTestHelper):
|
||||
|
||||
|
||||
test = TestAltitudeFilterFilterStageToggle()
|
||||
test.run()
|
||||
test.run()
|
||||
|
||||
+33
-9
@@ -12,6 +12,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
import os
|
||||
import sys
|
||||
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
|
||||
@@ -36,8 +39,8 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
|
||||
:return: None
|
||||
"""
|
||||
|
||||
PREPROCESS_INSTANCE_COUNT = 16
|
||||
POSTPROCESS_INSTANCE_COUNT = 19
|
||||
PREPROCESS_INSTANCE_COUNT = 425
|
||||
POSTPROCESS_INSTANCE_COUNT = 430
|
||||
|
||||
# Create empty level
|
||||
self.test_success = self.create_level(
|
||||
@@ -48,13 +51,17 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
general.set_current_view_position(500.49, 498.69, 46.66)
|
||||
general.set_current_view_rotation(-42.05, 0.00, -36.33)
|
||||
|
||||
# Create a vegetation area with all needed components
|
||||
position = math.Vector3(512.0, 512.0, 32.0)
|
||||
asset_path = os.path.join("Slices", "PinkFlower.dynamicslice")
|
||||
vegetation_entity = dynveg.create_vegetation_area("vegetation", position, 16.0, 16.0, 10.0, asset_path)
|
||||
vegetation_entity.add_component("Vegetation Slope Filter")
|
||||
vegetation_entity = dynveg.create_vegetation_area("vegetation", position, 16.0, 16.0, 16.0, asset_path)
|
||||
vegetation_entity.add_component("Vegetation Altitude Filter")
|
||||
vegetation_entity.add_component("Vegetation Position Modifier")
|
||||
|
||||
|
||||
# Create a child entity under vegetation area
|
||||
child_entity = hydra.Entity("child_entity")
|
||||
components_to_add = ["Random Noise Gradient", "Gradient Transform Modifier", "Box Shape"]
|
||||
@@ -64,12 +71,29 @@ class TestLayerSpawnerFilterStageToggle(EditorTestHelper):
|
||||
vegetation_entity.get_set_test(4, "Configuration|Position X|Gradient|Gradient Entity Id", child_entity.id)
|
||||
vegetation_entity.get_set_test(4, "Configuration|Position Y|Gradient|Gradient Entity Id", child_entity.id)
|
||||
|
||||
# Set the min and max values for Slope Filter
|
||||
vegetation_entity.get_set_test(3, "Configuration|Slope Min", 25)
|
||||
vegetation_entity.get_set_test(3, "Configuration|Slope Max", 35)
|
||||
|
||||
# Add entity with Mesh to replicate creation of hills
|
||||
dynveg.create_mesh_surface_entity_with_slopes("hill", position, 5.0, 5.0, 5.0)
|
||||
# Set the min and max values for Altitude Filter
|
||||
vegetation_entity.get_set_test(3, "Configuration|Altitude Min", 32.0)
|
||||
vegetation_entity.get_set_test(3, "Configuration|Altitude Max", 35.0)
|
||||
|
||||
# Add entity with Mesh to replicate creation of hills and a flat surface to plant on
|
||||
dynveg.create_surface_entity("Flat Surface", position, 32.0, 32.0, 1.0)
|
||||
hill_entity = dynveg.create_mesh_surface_entity_with_slopes("hill", position, 4.0, 4.0, 4.0)
|
||||
|
||||
# Disable/Re-enable Mesh component due to ATOM-14299
|
||||
general.idle_wait(1.0)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
|
||||
if is_enabled:
|
||||
print("Mesh component is still enabled")
|
||||
else:
|
||||
print("Mesh component was disabled")
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
|
||||
if is_enabled:
|
||||
print("Mesh component is now enabled")
|
||||
else:
|
||||
print("Mesh component is still disabled")
|
||||
|
||||
# Set the filter stage to preprocess and postprocess respectively and verify instance count
|
||||
vegetation_entity.get_set_test(0, "Configuration|Filter Stage", 1)
|
||||
|
||||
+25
-5
@@ -14,6 +14,9 @@ import os, sys
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.components as components
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
|
||||
sys.path.append(os.path.join(azlmbr.paths.devroot, 'AutomatedTesting', 'Gem', 'PythonTests'))
|
||||
@@ -70,19 +73,36 @@ class test_MeshBlocker_InstancesBlockedByMesh(EditorTestHelper):
|
||||
dynveg.create_surface_entity("Surface Entity", entity_position, 10.0, 10.0, 1.0)
|
||||
|
||||
# Create blocker entity with cube mesh
|
||||
mesh_type_id = azlmbr.globals.property.EditorMeshComponentTypeId
|
||||
blocker_entity = hydra.Entity("Blocker Entity")
|
||||
blocker_entity.create_entity(entity_position,
|
||||
["Mesh", "Vegetation Layer Blocker (Mesh)"])
|
||||
["Vegetation Layer Blocker (Mesh)"])
|
||||
blocker_entity.add_component_of_type(mesh_type_id)
|
||||
if blocker_entity.id.IsValid():
|
||||
print(f"'{blocker_entity.name}' created")
|
||||
|
||||
cubeId = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "default", "primitive_cube.cgf"), math.Uuid(),
|
||||
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "_primitives", "_box_1x1.azmodel"), math.Uuid(),
|
||||
False)
|
||||
blocker_entity.get_set_test(0, "MeshComponentRenderNode|Mesh asset", cubeId)
|
||||
blocker_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", cubeId)
|
||||
components.TransformBus(bus.Event, "SetLocalScale", blocker_entity.id, math.Vector3(2.0, 2.0, 2.0))
|
||||
|
||||
# Disable/Re-enable Mesh component due to ATOM-14299
|
||||
general.idle_wait(1.0)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [blocker_entity.components[1]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
|
||||
if is_enabled:
|
||||
print("Mesh component is still enabled")
|
||||
else:
|
||||
print("Mesh component was disabled")
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [blocker_entity.components[1]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
|
||||
if is_enabled:
|
||||
print("Mesh component is now enabled")
|
||||
else:
|
||||
print("Mesh component is still disabled")
|
||||
|
||||
# Verify spawned instance counts are accurate after addition of Blocker Entity
|
||||
num_expected = 160 # Number of "PurpleFlower"s that plant on a 10 x 10 surface minus 1m blocker cube
|
||||
num_expected = 160 # Number of "PurpleFlower"s that plant on a 10 x 10 surface minus 2m blocker cube
|
||||
result = self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id,
|
||||
num_expected), 2.0)
|
||||
self.test_success = self.test_success and result
|
||||
|
||||
+34
-11
@@ -10,6 +10,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
"""
|
||||
|
||||
import os
|
||||
import math as pymath
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
@@ -17,6 +18,8 @@ import azlmbr
|
||||
import azlmbr.asset as asset
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.components as components
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.math as math
|
||||
|
||||
|
||||
@@ -63,6 +66,9 @@ class test_MeshBlocker_InstancesBlockedByMeshHeightTuning(EditorTestHelper):
|
||||
use_terrain=False,
|
||||
)
|
||||
|
||||
general.set_current_view_position(500.49, 498.69, 46.66)
|
||||
general.set_current_view_rotation(-42.05, 0.00, -36.33)
|
||||
|
||||
# 2) Create entity with components "Vegetation Layer Spawner", "Vegetation Asset List", "Box Shape"
|
||||
entity_position = math.Vector3(512.0, 512.0, 32.0)
|
||||
asset_path = os.path.join("Slices", "PurpleFlower.dynamicslice")
|
||||
@@ -74,29 +80,46 @@ class test_MeshBlocker_InstancesBlockedByMeshHeightTuning(EditorTestHelper):
|
||||
# 3) Create surface entity to plant on
|
||||
dynveg.create_surface_entity("Surface Entity", entity_position, 10.0, 10.0, 1.0)
|
||||
|
||||
# 4) Create blocker entity with cube mesh
|
||||
entity_position = math.Vector3(512.0, 512.0, 36.0)
|
||||
# 4) Create blocker entity with rotated cube mesh
|
||||
y_rotation = pymath.radians(45.0)
|
||||
mesh_type_id = azlmbr.globals.property.EditorMeshComponentTypeId
|
||||
blocker_entity = hydra.Entity("Blocker Entity")
|
||||
blocker_entity.create_entity(entity_position,
|
||||
["Mesh", "Vegetation Layer Blocker (Mesh)"])
|
||||
["Vegetation Layer Blocker (Mesh)"])
|
||||
blocker_entity.add_component_of_type(mesh_type_id)
|
||||
if blocker_entity.id.IsValid():
|
||||
print(f"'{blocker_entity.name}' created")
|
||||
|
||||
sphereId = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "default", "primitive_sphere.cgf"), math.Uuid(),
|
||||
sphere_id = asset.AssetCatalogRequestBus(
|
||||
bus.Broadcast, "GetAssetIdByPath", os.path.join("objects", "_primitives", "_box_1x1.azmodel"), math.Uuid(),
|
||||
False)
|
||||
blocker_entity.get_set_test(0, "MeshComponentRenderNode|Mesh asset", sphereId)
|
||||
blocker_entity.get_set_test(1, "Controller|Configuration|Mesh Asset", sphere_id)
|
||||
components.TransformBus(bus.Event, "SetLocalScale", blocker_entity.id, math.Vector3(5.0, 5.0, 5.0))
|
||||
components.TransformBus(bus.Event, "SetLocalRotation", blocker_entity.id, math.Vector3(0.0, y_rotation, 0.0))
|
||||
|
||||
# Disable/Re-enable Mesh component due to ATOM-14299
|
||||
general.idle_wait(1.0)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [blocker_entity.components[1]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
|
||||
if is_enabled:
|
||||
print("Mesh component is still enabled")
|
||||
else:
|
||||
print("Mesh component was disabled")
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [blocker_entity.components[1]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', blocker_entity.components[1])
|
||||
if is_enabled:
|
||||
print("Mesh component is now enabled")
|
||||
else:
|
||||
print("Mesh component is still disabled")
|
||||
|
||||
# 5) Adjust the height Max percentage values of blocker
|
||||
blocker_entity.get_set_test(1, "Configuration|Mesh Height Percent Max", 0.8)
|
||||
blocker_entity.get_set_test(0, "Configuration|Mesh Height Percent Max", 0.8)
|
||||
|
||||
# 6) Verify spawned instance counts are accurate after adjusting height Max percentage of Blocker Entity
|
||||
# The number of "PurpleFlower" instances that plant on a 10 x 10 surface minus those blocked by the sphere at
|
||||
# The number of "PurpleFlower" instances that plant on a 10 x 10 surface minus those blocked by the rotated at
|
||||
# 80% max height factored in.
|
||||
num_expected = 117
|
||||
num_expected = 127
|
||||
result = self.wait_for_condition(lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id,
|
||||
num_expected), 2.0)
|
||||
num_expected), 5.0)
|
||||
self.test_success = self.test_success and result
|
||||
|
||||
|
||||
|
||||
+25
-3
@@ -13,7 +13,9 @@ import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
||||
import azlmbr.bus as bus
|
||||
import azlmbr.legacy.general as general
|
||||
import azlmbr.editor as editor
|
||||
import azlmbr.math as math
|
||||
import azlmbr.paths
|
||||
|
||||
@@ -82,14 +84,34 @@ class TestPositionModifierAutoSnapToSurface(EditorTestHelper):
|
||||
for path in position_modifier_paths:
|
||||
spawner_entity.get_set_test(3, path, 0)
|
||||
|
||||
# 3) Create a spherical planting surface
|
||||
dynveg.create_mesh_surface_entity_with_slopes("Planting Surface", spawner_center_point, 5.0, 5.0, 5.0)
|
||||
# 3) Create a spherical planting surface and a flat surface
|
||||
flat_entity = dynveg.create_surface_entity("Flat Surface", spawner_center_point, 32.0, 32.0, 1.0)
|
||||
hill_entity = dynveg.create_mesh_surface_entity_with_slopes("Planting Surface", spawner_center_point, 5.0, 5.0, 5.0)
|
||||
|
||||
# Disable/Re-enable Mesh component due to ATOM-14299
|
||||
general.idle_wait(1.0)
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [hill_entity.components[0]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
|
||||
if is_enabled:
|
||||
print("Mesh component is still enabled")
|
||||
else:
|
||||
print("Mesh component was disabled")
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'EnableComponents', [hill_entity.components[0]])
|
||||
is_enabled = editor.EditorComponentAPIBus(bus.Broadcast, 'IsComponentEnabled', hill_entity.components[0])
|
||||
if is_enabled:
|
||||
print("Mesh component is now enabled")
|
||||
else:
|
||||
print("Mesh component is still disabled")
|
||||
|
||||
# Disable the Flat Surface Box Shape component, and temporarily ignore initial instance counts due to LYN-2245
|
||||
editor.EditorComponentAPIBus(bus.Broadcast, 'DisableComponents', [flat_entity.components[0]])
|
||||
"""
|
||||
# 4) Verify initial instance counts pre-filter
|
||||
num_expected = 121 # Single instance planted
|
||||
num_expected = 121
|
||||
spawner_success = self.wait_for_condition(
|
||||
lambda: dynveg.validate_instance_count_in_entity_shape(spawner_entity.id, num_expected), 5.0)
|
||||
self.test_success = self.test_success and spawner_success
|
||||
"""
|
||||
|
||||
# 5) Create a child entity of the spawner entity with a Constant Gradient component and pin to spawner
|
||||
components_to_add = ["Constant Gradient"]
|
||||
|
||||
+3
-3
@@ -63,11 +63,11 @@ class TestSlopeAlignmentModifierOverrides(EditorTestHelper):
|
||||
spawner_entity = dynveg.create_vegetation_area("Instance Spawner", center_point, 16.0, 16.0, 32.0, asset_path)
|
||||
|
||||
# Create a sloped mesh surface for the instances to plant on
|
||||
mesh_asset_path = os.path.join("Objects", "default", "primitive_plane.cgf")
|
||||
mesh_asset_path = os.path.join("objects", "_primitives", "_box_1x1.azmodel")
|
||||
mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(),
|
||||
False)
|
||||
rotation = math.Vector3(0.0, radians(45.0), 0.0)
|
||||
scale = math.Vector3(30.0, 30.0, 30.0)
|
||||
scale = math.Vector3(10.0, 10.0, 10.0)
|
||||
surface_entity = hydra.Entity("Surface Entity")
|
||||
surface_entity.create_entity(
|
||||
center_point,
|
||||
@@ -75,7 +75,7 @@ class TestSlopeAlignmentModifierOverrides(EditorTestHelper):
|
||||
)
|
||||
if surface_entity.id.IsValid():
|
||||
print(f"'{surface_entity.name}' created")
|
||||
hydra.get_set_test(surface_entity, 0, "MeshComponentRenderNode|Mesh asset", mesh_asset)
|
||||
hydra.get_set_test(surface_entity, 0, "Controller|Configuration|Mesh Asset", mesh_asset)
|
||||
components.TransformBus(bus.Event, "SetLocalRotation", surface_entity.id, rotation)
|
||||
components.TransformBus(bus.Event, "SetLocalScale", surface_entity.id, scale)
|
||||
|
||||
|
||||
+3
-3
@@ -66,11 +66,11 @@ class TestSlopeAlignmentModifier(EditorTestHelper):
|
||||
spawner_entity = dynveg.create_vegetation_area("Instance Spawner", center_point, 16.0, 16.0, 32.0, asset_path)
|
||||
|
||||
# Create a sloped mesh surface for the instances to plant on
|
||||
mesh_asset_path = os.path.join("Objects", "default", "primitive_plane.cgf")
|
||||
mesh_asset_path = os.path.join("objects", "_primitives", "_box_1x1.azmodel")
|
||||
mesh_asset = asset.AssetCatalogRequestBus(bus.Broadcast, "GetAssetIdByPath", mesh_asset_path, math.Uuid(),
|
||||
False)
|
||||
rotation = math.Vector3(0.0, radians(45.0), 0.0)
|
||||
scale = math.Vector3(30.0, 30.0, 30.0)
|
||||
scale = math.Vector3(10.0, 10.0, 10.0)
|
||||
surface_entity = hydra.Entity("Surface Entity")
|
||||
surface_entity.create_entity(
|
||||
center_point,
|
||||
@@ -78,7 +78,7 @@ class TestSlopeAlignmentModifier(EditorTestHelper):
|
||||
)
|
||||
if surface_entity.id.IsValid():
|
||||
print(f"'{surface_entity.name}' created")
|
||||
hydra.get_set_test(surface_entity, 0, "MeshComponentRenderNode|Mesh asset", mesh_asset)
|
||||
hydra.get_set_test(surface_entity, 0, "Controller|Configuration|Mesh Asset", mesh_asset)
|
||||
components.TransformBus(bus.Event, "SetLocalRotation", surface_entity.id, rotation)
|
||||
components.TransformBus(bus.Event, "SetLocalScale", surface_entity.id, scale)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user