c9fb41d0e5
The EditorEntitySortComponent was relying on serialization callbacks not exposed to the JSON serializer to marshal data between its serialized state and its runtime state, which led to the outliner sort order becoming disrupted every time a prefab propagation occurs (and the component is subsequently serialized and deserialized). This change: - Forces `PrepareSave` and `PostLoad` for `EditorEntitySortComponent` to be called at update (direct descendant added or removed) and activation time respectively while prefabs are enabled. While this could be optimized, and this logic stands to be refactored once slices are fully removed, I was unable to gather any samples in which `PrepareSave` are called in a sampling profiler in a scene with 1000 top-level entities, so I don't anticipate this introducing a meaningful performance regression in the short term. - Disables updates in `EditorEntitySortComponent` during prefab propagation, as any detected changes do not signal authored intent at this time - Made `GetEntityChildOrder` in `EditorEntityHelpers` work with prefabs enabled, which restores the existing "Sort: A -> Z" and "Sort: Z -> A" behaviors (which have some preexisting issues this does not fix) - Adds a Python regression test to the Editor suite to validate this behavior - the test is currently in TestSuite_Main and not TestSuite_Main_Optimized because it requires an Editor launch with prefabs enabled, this can be fixed once AutomatedTesting is further migrated away from slices @AMZN-daimini has a larger change that improves the JSON serialization format (https://github.com/o3de/o3de/pull/1292) which we should absolutely bring in in the future to improve the legibility of the Prefab format, but this change fixes the functionality (including saving & reloading a level and keeping a consistent order) without altering the Prefab format - this lower impact radius fix is my preference for our stabilization period. Signed-off-by: nvsickle <nvsickle@amazon.com>
56 lines
2.3 KiB
Python
56 lines
2.3 KiB
Python
"""
|
|
Copyright (c) Contributors to the Open 3D Engine Project.
|
|
For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
|
|
|
SPDX-License-Identifier: Apache-2.0 OR MIT
|
|
"""
|
|
|
|
import os
|
|
import pytest
|
|
import sys
|
|
|
|
import ly_test_tools.environment.file_system as file_system
|
|
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../automatedtesting_shared')
|
|
from base import TestAutomationBase
|
|
|
|
|
|
@pytest.fixture
|
|
def remove_test_level(request, workspace, project):
|
|
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True)
|
|
|
|
def teardown():
|
|
file_system.delete([os.path.join(workspace.paths.engine_root(), project, "Levels", "tmp_level")], True, True)
|
|
|
|
request.addfinalizer(teardown)
|
|
|
|
|
|
@pytest.mark.SUITE_main
|
|
@pytest.mark.parametrize("launcher_platform", ['windows_editor'])
|
|
@pytest.mark.parametrize("project", ["AutomatedTesting"])
|
|
class TestAutomation(TestAutomationBase):
|
|
|
|
def test_BasicEditorWorkflows_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform,
|
|
remove_test_level):
|
|
from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module
|
|
self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False)
|
|
|
|
@pytest.mark.REQUIRES_gpu
|
|
def test_BasicEditorWorkflows_GPU_LevelEntityComponentCRUD(self, request, workspace, editor, launcher_platform,
|
|
remove_test_level):
|
|
from .EditorScripts import BasicEditorWorkflows_LevelEntityComponentCRUD as test_module
|
|
self._run_test(request, workspace, editor, test_module, batch_mode=False, autotest_mode=False,
|
|
use_null_renderer=False)
|
|
|
|
def test_EntityOutlienr_EntityOrdering(self, request, workspace, editor, launcher_platform):
|
|
from .EditorScripts import EntityOutliner_EntityOrdering as test_module
|
|
self._run_test(
|
|
request,
|
|
workspace,
|
|
editor,
|
|
test_module,
|
|
batch_mode=False,
|
|
autotest_mode=True,
|
|
extra_cmdline_args=["--regset=/Amazon/Preferences/EnablePrefabSystem=true"]
|
|
)
|