From 696cd4d1360ea95d3f39953f2387231f41660299 Mon Sep 17 00:00:00 2001 From: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com> Date: Mon, 26 Sep 2022 16:00:52 -0500 Subject: [PATCH] Updating method used for finding necessary entity for Terrain_NodeConstruction test Signed-off-by: jckand-amzn <82226555+jckand-amzn@users.noreply.github.com> --- .../EditorScripts/Terrain_NodeConstruction.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/Terrain_NodeConstruction.py b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/Terrain_NodeConstruction.py index 6c5cc6fe9b84..ad24ec8ebac2 100644 --- a/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/Terrain_NodeConstruction.py +++ b/AutomatedTesting/Gem/PythonTests/largeworlds/landscape_canvas/EditorScripts/Terrain_NodeConstruction.py @@ -77,6 +77,11 @@ def on_entity_created(parameters): # Open an existing simple level hydra.open_base_level() + # Listen for entity creation notifications + handler = editor.EditorEntityContextNotificationBusHandler() + handler.connect() + handler.add_callback("OnEditorEntityCreated", on_entity_created) + # Open Landscape Canvas tool and verify general.open_pane("Landscape Canvas") Report.critical_result(Tests.lc_tool_opened, general.is_pane_visible("Landscape Canvas")) @@ -86,18 +91,13 @@ def on_entity_created(parameters): Report.critical_result(Tests.new_graph_created, new_graph_id is not None) # Reposition the automatically created entity to origin - root_entity = EditorEntity.find_editor_entity("Entity1") + root_entity = EditorEntity(created_entity_id) root_entity.set_world_translation(math.Vector3(0.0, 0.0, 0.0)) # Make sure the graph we created is in Landscape Canvas graph_registered = graph.AssetEditorRequestBus(bus.Event, "ContainsGraph", editor_id, new_graph_id) Report.result(Tests.graph_registered, graph_registered) - # Listen for entity creation notifications - handler = editor.EditorEntityContextNotificationBusHandler() - handler.connect() - handler.add_callback("OnEditorEntityCreated", on_entity_created) - # Add the required Terrain level components terrain_world_component = EditorLevelEntity.add_component("Terrain World") terrain_world_renderer = EditorLevelEntity.add_component("Terrain World Renderer")