Integrating github/staging through commit ab87ed9

This commit is contained in:
alexpete
2021-04-09 11:27:37 -07:00
parent ae62a97894
commit 1044dc3da1
1582 changed files with 29374 additions and 519051 deletions
@@ -119,7 +119,6 @@ class EditorTestHelper:
general.set_viewport_expansion_policy("AutoExpand")
general.set_view_pane_layout(self.viewport_layout)
general.update_viewport()
general.idle_wait(1.0)
self.log("test finished")
@@ -162,10 +161,10 @@ class EditorTestHelper:
def create_level(
self,
level_name: str,
heightmap_resolution: int,
heightmap_meters_per_pixel: int,
terrain_texture_resolution: int,
use_terrain: bool,
heightmap_resolution: int = 1024,
heightmap_meters_per_pixel: int = 1,
terrain_texture_resolution: int = 4096,
use_terrain: bool = False,
bypass_viewport_resize: bool = False,
) -> bool:
self.log(f"Creating level {level_name}")
@@ -88,6 +88,13 @@ def add_component(componentName, entityId):
return componentOutcome.GetValue()[0]
def add_component_of_type(componentTypeId, entityId):
typeIdsList = [componentTypeId]
componentOutcome = editor.EditorComponentAPIBus(
azlmbr.bus.Broadcast, 'AddComponentsOfType', entityId, typeIdsList)
return componentOutcome.GetValue()[0]
def remove_component(component_name, entity_id):
"""
Removes the specified component from the specified entity.
@@ -213,6 +220,10 @@ class Entity:
new_component = add_component(component, self.id)
self.components.append(new_component)
def add_component_of_type(self, componentTypeId):
new_component = add_component_of_type(componentTypeId, self.id)
self.components.append(new_component)
def remove_component(self, component):
removed_component = remove_component(component, self.id)
if removed_component is not None:
@@ -32,7 +32,7 @@ def teardown_editor(editor):
def launch_and_validate_results(request, test_directory, editor, editor_script, expected_lines, unexpected_lines=[],
halt_on_unexpected=False, run_python="--runpythontest", auto_test_mode=True, null_renderer=True, cfg_args=[],
halt_on_unexpected=False, run_python="--runpythontest", auto_test_mode=True, null_renderer=False, cfg_args=[],
timeout=300):
"""
Runs the Editor with the specified script, and monitors for expected log lines.
@@ -0,0 +1,84 @@
"""
All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
its licensors.
For complete copyright and license terms please see the LICENSE at the root of this
distribution (the "License"). All use of this software is governed by the License,
or, if provided, by the license below or the license accompanying this file. Do not
remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
import logging
import winreg
logger = logging.getLogger(__name__)
LUMBERYARD_SETTINGS_PATH = r'Software\Amazon\Lumberyard\Settings'
def set_ly_registry_value(reg_path, value_name, new_value, value_type=winreg.REG_DWORD):
"""
Sets the specified value for the specified value_name in the LY registry key.
:param reg_path: A string that identifies the registry path to the desired key (e.g. Software\Amazon\Lumberyard\Settings)
:param value_name: A string that identifies the value name (e.g. UndoLevels, ViewportInteractionModel)
:param new_value: Value to set on the specified value_name
:param value_type: The type of value set. Defaults to a 32-bit number.
:return: None
"""
# Open LY Registry key
try:
key = winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, reg_path, 0, access=winreg.KEY_ALL_ACCESS)
except OSError as err:
logger.error(err)
# Set value_name to the specified value
winreg.SetValueEx(key, value_name, 0, value_type, new_value)
# Verify the value set to the specified value_name
value = winreg.QueryValueEx(key, value_name)
if new_value == value[0]:
logger.debug(f'Successfully set {value_name} to {value[0]}')
else:
logger.debug(f'Failed to set {value_name} to {new_value}. Current value is {value[0]}.')
def get_ly_registry_value(reg_path, value_name):
"""
Gets the current value for an existing value_name in the LY registry key.
:param reg_path: A string that identifies the registry path to the desired key (e.g. Software\Amazon\Lumberyard\Settings)
:param value_name: A string that identifies the value name (e.g. UndoLevels, ViewportInteractionModel)
:return: Value set for the specified value_name
"""
# Open LY Registry key
try:
key = winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, reg_path, 0, access=winreg.KEY_ALL_ACCESS)
except OSError as err:
logger.error(err)
# Check if value name is present and return current value
try:
value_name_value = winreg.QueryValueEx(key, value_name)
logger.debug(f'{value_name} is {value_name_value[0]}')
return value_name_value[0]
except OSError as err:
logger.error(err)
def delete_ly_registry_value(reg_path, value_name):
"""
Deletes the specific registry value_name found in the reg_path key.
:param reg_path: A string that identifies the registry path to the desired key (e.g. Software\Amazon\Lumberyard\Settings)
:param value_name: A string that identifies the value name (e.g. UndoLevels, ViewportInteractionModel)
:return: None
"""
# Open LY Registry key
try:
key = winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, reg_path, 0, access=winreg.KEY_ALL_ACCESS)
except OSError as err:
logger.error(err)
# Attempt to delete the specified key/value
try:
winreg.DeleteValue(key, value_name)
except OSError as err:
logger.error(err)