Merging latest dev

Signed-off-by: kberg-amzn <karlberg@amazon.com>
monroegm-disable-blank-issue-2
kberg-amzn 4 years ago
commit 79b41686c4

@ -54,6 +54,30 @@ def get_mesh_node_names(sceneGraph):
return meshDataList, paths
def add_material_component(entity_id):
# Create an override AZ::Render::EditorMaterialComponent
editor_material_component = azlmbr.entity.EntityUtilityBus(
azlmbr.bus.Broadcast,
"GetOrAddComponentByTypeName",
entity_id,
"EditorMaterialComponent")
# this fills out the material asset to a known product AZMaterial asset relative path
json_update = json.dumps({
"Controller": { "Configuration": { "materials": [
{
"Key": {},
"Value": { "MaterialAsset":{
"assetHint": "materials/basic_grey.azmaterial"
}}
}]
}}
});
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, editor_material_component, json_update)
if not result:
raise RuntimeError("UpdateComponentForEntity for editor_material_component failed")
def update_manifest(scene):
import json
import uuid, os
@ -74,6 +98,8 @@ def update_manifest(scene):
source_filename_only = os.path.basename(clean_filename)
created_entities = []
previous_entity_id = azlmbr.entity.InvalidEntityId
first_mesh = True
# Loop every mesh node in the scene
for activeMeshIndex in range(len(mesh_name_list)):
@ -102,14 +128,38 @@ def update_manifest(scene):
# The MeshGroup we created will be output as a product in the asset's path named mesh_group_name.azmodel
# The assetHint will be converted to an AssetId later during prefab loading
json_update = json.dumps({
"Controller": { "Configuration": { "ModelAsset": {
"assetHint": os.path.join(source_relative_path, mesh_group_name) + ".azmodel" }}}
});
"Controller": { "Configuration": { "ModelAsset": {
"assetHint": os.path.join(source_relative_path, mesh_group_name) + ".azmodel" }}}
});
# Apply the JSON above to the component we created
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, editor_mesh_component, json_update)
if not result:
raise RuntimeError("UpdateComponentForEntity failed")
raise RuntimeError("UpdateComponentForEntity failed for Mesh component")
# an example of adding a material component to override the default material
if previous_entity_id is not None and first_mesh:
first_mesh = False
add_material_component(entity_id)
# Get the transform component
transform_component = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "GetOrAddComponentByTypeName", entity_id, "27F1E1A1-8D9D-4C3B-BD3A-AFB9762449C0")
# Set this entity to be a child of the last entity we created
# This is just an example of how to do parenting and isn't necessarily useful to parent everything like this
if previous_entity_id is not None:
transform_json = json.dumps({
"Parent Entity" : previous_entity_id.to_json()
});
# Apply the JSON update
result = azlmbr.entity.EntityUtilityBus(azlmbr.bus.Broadcast, "UpdateComponentForEntity", entity_id, transform_component, transform_json)
if not result:
raise RuntimeError("UpdateComponentForEntity failed for Transform component")
# Update the last entity id for next time
previous_entity_id = entity_id
# Keep track of the entity we set up, we'll add them all to the prefab we're creating later
created_entities.append(entity_id)
@ -147,6 +197,8 @@ def on_update_manifest(args):
except RuntimeError as err:
print (f'ERROR - {err}')
log_exception_traceback()
except:
log_exception_traceback()
global sceneJobHandler
sceneJobHandler = None

@ -54,4 +54,5 @@ set(ENABLED_GEMS
AWSMetrics
PrefabBuilder
AudioSystem
Profiler
)

@ -204,7 +204,7 @@ namespace PythonCoverage
return coveringModuleOutputNames;
}
void PythonCoverageEditorSystemComponent::OnStartExecuteByFilenameAsTest(AZStd::string_view filename, AZStd::string_view testCase, [[maybe_unused]] const AZStd::vector<AZStd::string_view>& args)
void PythonCoverageEditorSystemComponent::OnStartExecuteByFilenameAsTest([[maybe_unused]]AZStd::string_view filename, AZStd::string_view testCase, [[maybe_unused]] const AZStd::vector<AZStd::string_view>& args)
{
if (m_coverageState == CoverageState::Disabled)
{
@ -226,8 +226,7 @@ namespace PythonCoverage
return;
}
const AZStd::string scriptName = AZ::IO::Path(filename).Stem().Native();
const auto coverageFile = m_coverageDir / AZStd::string::format("%s.pycoverage", scriptName.c_str());
const auto coverageFile = m_coverageDir / AZStd::string::format("%.*s.pycoverage", AZ_STRING_ARG(testCase));
// If this is a different python script we clear the existing entity components and start afresh
if (m_coverageFile != coverageFile)

@ -71,5 +71,9 @@ class TestAutomation(EditorTestSuite):
class AtomEditorComponents_PostFXShapeWeightModifierAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_PostFxShapeWeightModifierAdded as test_module
@pytest.mark.test_case_id("C36525664")
class AtomEditorComponents_PostFXGradientWeightModifierAdded(EditorSharedTest):
from Atom.tests import hydra_AtomEditorComponents_PostFXGradientWeightModifierAdded as test_module
class ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges(EditorSharedTest):
from Atom.tests import hydra_ShaderAssetBuilder_RecompilesShaderAsChainOfDependenciesChanges as test_module

@ -0,0 +1,179 @@
"""
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
"""
class Tests:
creation_undo = (
"UNDO Entity creation success",
"UNDO Entity creation failed")
creation_redo = (
"REDO Entity creation success",
"REDO Entity creation failed")
postfx_gradient_weight_creation = (
"PostFX Gradient Weight Modifier Entity successfully created",
"PostFX Gradient Weight Modifier Entity failed to be created")
postfx_gradient_weight_component = (
"Entity has a PostFX Gradient Weight Modifier component",
"Entity failed to find PostFX Gradient Weight Modifier component")
postfx_gradient_weight_disabled = (
"PostFX Gradient Weight Modifier component disabled",
"PostFX Gradient Weight Modifier component was not disabled.")
postfx_layer_component = (
"Entity has a PostFX Layer component",
"Entity did not have an PostFX Layer component")
postfx_gradient_weight_enabled = (
"PostFX Gradient Weight Modifier component enabled",
"PostFX Gradient Weight Modifier component was not enabled.")
enter_game_mode = (
"Entered game mode",
"Failed to enter game mode")
exit_game_mode = (
"Exited game mode",
"Couldn't exit game mode")
is_visible = (
"Entity is visible",
"Entity was not visible")
is_hidden = (
"Entity is hidden",
"Entity was not hidden")
entity_deleted = (
"Entity deleted",
"Entity was not deleted")
deletion_undo = (
"UNDO deletion success",
"UNDO deletion failed")
deletion_redo = (
"REDO deletion success",
"REDO deletion failed")
def AtomEditorComponents_PostFXGradientWeightModifier_AddedToEntity():
"""
Summary:
Tests the PostFX Gradient Weight Modifier component can be added to an entity and has the expected functionality.
Test setup:
- Wait for Editor idle loop.
- Open the "Base" level.
Expected Behavior:
The component can be added, used in game mode, hidden/shown, deleted, and has accurate required components.
Creation and deletion undo/redo should also work.
Test Steps:
1) Create a PostFX Gradient Weight Modifier entity with no components.
2) Add a PostFX Gradient Weight Modifier component to PostFX Gradient Weight Modifier entity.
3) UNDO the entity creation and component addition.
4) REDO the entity creation and component addition.
5) Verify PostFX Gradient Weight Modifier component not enabled.
6) Add PostFX Layer component since it is required by the PostFX Gradient Weight Modifier component.
7) Verify PostFX Gradient Weight Modifier component is enabled.
8) Enter/Exit game mode.
9) Test IsHidden.
10) Test IsVisible.
11) Delete PostFX Gradient Weight Modifier entity.
12) UNDO deletion.
13) REDO deletion.
14) Look for errors.
:return: None
"""
import azlmbr.legacy.general as general
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report, Tracer, TestHelper
with Tracer() as error_tracer:
# Test setup begins.
# Setup: Wait for Editor idle loop before executing Python hydra scripts then open "Base" level.
TestHelper.init_idle()
TestHelper.open_level("", "Base")
# Test steps begin.
# 1. Create a PostFX Gradient Weight Modifier entity with no components.
postfx_gradient_weight_name = "PostFX Gradient Weight Modifier"
postfx_gradient_weight_entity = EditorEntity.create_editor_entity(postfx_gradient_weight_name)
Report.critical_result(Tests.postfx_gradient_weight_creation, postfx_gradient_weight_entity.exists())
# 2. Add a PostFX Gradient Weight Modifier component to PostFX Gradient Weight Modifier entity.
postfx_gradient_weight_component = postfx_gradient_weight_entity.add_component(postfx_gradient_weight_name)
Report.critical_result(
Tests.postfx_gradient_weight_component,
postfx_gradient_weight_entity.has_component(postfx_gradient_weight_name))
# 3. UNDO the entity creation and component addition.
# -> UNDO component addition.
general.undo()
# -> UNDO naming entity.
general.undo()
# -> UNDO selecting entity.
general.undo()
# -> UNDO entity creation.
general.undo()
general.idle_wait_frames(1)
Report.result(Tests.creation_undo, not postfx_gradient_weight_entity.exists())
# 4. REDO the entity creation and component addition.
# -> REDO entity creation.
general.redo()
# -> REDO selecting entity.
general.redo()
# -> REDO naming entity.
general.redo()
# -> REDO component addition.
general.redo()
general.idle_wait_frames(1)
Report.result(Tests.creation_redo, postfx_gradient_weight_entity.exists())
# 5. Verify PostFX Gradient Weight Modifier component not enabled.
Report.result(Tests.postfx_gradient_weight_disabled, not postfx_gradient_weight_component.is_enabled())
# 6. Add PostFX Layer component since it is required by the PostFX Gradient Weight Modifier component.
postfx_layer_name = "PostFX Layer"
postfx_gradient_weight_entity.add_component(postfx_layer_name)
Report.result(Tests.postfx_layer_component, postfx_gradient_weight_entity.has_component(postfx_layer_name))
# 7. Verify PostFX Gradient Weight Modifier component is enabled.
Report.result(Tests.postfx_gradient_weight_enabled, postfx_gradient_weight_component.is_enabled())
# 8. Enter/Exit game mode.
TestHelper.enter_game_mode(Tests.enter_game_mode)
general.idle_wait_frames(1)
TestHelper.exit_game_mode(Tests.exit_game_mode)
# 9. Test IsHidden.
postfx_gradient_weight_entity.set_visibility_state(False)
Report.result(Tests.is_hidden, postfx_gradient_weight_entity.is_hidden() is True)
# 10. Test IsVisible.
postfx_gradient_weight_entity.set_visibility_state(True)
general.idle_wait_frames(1)
Report.result(Tests.is_visible, postfx_gradient_weight_entity.is_visible() is True)
# 11. Delete PostFX Gradient Weight Modifier entity.
postfx_gradient_weight_entity.delete()
Report.result(Tests.entity_deleted, not postfx_gradient_weight_entity.exists())
# 12. UNDO deletion.
general.undo()
Report.result(Tests.deletion_undo, postfx_gradient_weight_entity.exists())
# 13. REDO deletion.
general.redo()
Report.result(Tests.deletion_redo, not postfx_gradient_weight_entity.exists())
# 14. Look for errors or asserts.
TestHelper.wait_for_condition(lambda: error_tracer.has_errors or error_tracer.has_asserts, 1.0)
for error_info in error_tracer.errors:
Report.info(f"Error: {error_info.filename} {error_info.function} | {error_info.message}")
for assert_info in error_tracer.asserts:
Report.info(f"Assert: {assert_info.filename} {assert_info.function} | {assert_info.message}")
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(AtomEditorComponents_PostFXGradientWeightModifier_AddedToEntity)

@ -33,7 +33,7 @@ add_subdirectory(WhiteBox)
add_subdirectory(NvCloth)
## Prefab ##
add_subdirectory(prefab)
add_subdirectory(Prefab)
## Editor Python Bindings ##
add_subdirectory(EditorPythonBindings)

@ -122,17 +122,32 @@ class EditorEntity:
# Creation functions
@classmethod
def find_editor_entity(cls, entity_name: str) -> EditorEntity:
def find_editor_entity(cls, entity_name: str, must_be_unique : bool = False) -> EditorEntity:
"""
Given Entity name, outputs entity object
:param entity_name: Name of entity to find
:return: EditorEntity class object
"""
entity_id = general.find_editor_entity(entity_name)
assert entity_id.IsValid(), f"Failure: Couldn't find entity with name: '{entity_name}'"
entity = cls(entity_id)
entities = cls.find_editor_entities([entity_name])
assert len(entities) != 0, f"Failure: Couldn't find entity with name: '{entity_name}'"
if must_be_unique:
assert len(entities) == 1, f"Failure: Multiple entities with name: '{entity_name}' when expected only one"
entity = cls(entities[0])
return entity
@classmethod
def find_editor_entities(cls, entity_names: List[str]) -> EditorEntity:
"""
Given Entities names, returns a list of EditorEntity
:param entity_name: Name of entity to find
:return: List[EditorEntity] class object
"""
searchFilter = azlmbr.entity.SearchFilter()
searchFilter.names = entity_names
ids = azlmbr.entity.SearchBus(bus.Broadcast, 'SearchEntities', searchFilter)
return [cls(id) for id in ids]
@classmethod
def create_editor_entity(cls, name: str = None, parent_id=None) -> EditorEntity:
"""
@ -157,8 +172,7 @@ class EditorEntity:
cls,
entity_position: Union[List, Tuple, math.Vector3],
name: str = None,
parent_id: azlmbr.entity.EntityId = None,
) -> EditorEntity:
parent_id: azlmbr.entity.EntityId = None) -> EditorEntity:
"""
Used to create entity at position using 'CreateNewEntityAtPosition' Bus.
:param entity_position: World Position(X, Y, Z) of entity in viewport.
@ -227,6 +241,12 @@ class EditorEntity:
"""
return editor.EditorEntityInfoRequestBus(bus.Event, "GetChildren", self.id)
def get_children(self) -> List[EditorEntity]:
"""
:return: List of EditorEntity children. Type: [EditorEntity]
"""
return [EditorEntity(child_id) for child_id in self.get_children_ids()]
def add_component(self, component_name: str) -> EditorComponent:
"""
Used to add new component to Entity.

@ -51,7 +51,7 @@ def launch_and_validate_results(request, test_directory, editor, editor_script,
logger.debug("Running automated test: {}".format(editor_script))
editor.args.extend(["--skipWelcomeScreenDialog", "--regset=/Amazon/Settings/EnableSourceControl=false",
"--regset=/Amazon/Preferences/EnablePrefabSystem=false", run_python, test_case,
f"--pythontestcase={request.node.originalname}", "--runpythonargs", " ".join(cfg_args)])
f"--pythontestcase={request.node.name}", "--runpythonargs", " ".join(cfg_args)])
if auto_test_mode:
editor.args.extend(["--autotest_mode"])
if null_renderer:

@ -12,20 +12,39 @@ from os import path
from PySide2 import QtWidgets
import azlmbr.legacy.general as general
from azlmbr.entity import EntityId
from azlmbr.math import Vector3
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report
import azlmbr.entity as entity
import azlmbr.bus as bus
import azlmbr.prefab as prefab
import editor_python_test_tools.pyside_utils as pyside_utils
import prefab.Prefab_Test_Utils as prefab_test_utils
def get_prefab_file_path(prefab_path):
if not path.isabs(prefab_path):
prefab_path = path.join(general.get_file_alias("@projectroot@"), prefab_path)
# Append prefab if it doesn't contain .prefab on it
name, ext = path.splitext(prefab_path)
if ext != ".prefab":
prefab_path = name + ".prefab"
return prefab_path
def get_all_entity_ids():
return entity.SearchBus(bus.Broadcast, 'SearchEntities', entity.SearchFilter())
def wait_for_propagation():
general.idle_wait_frames(1)
# This is a helper class which contains some of the useful information about a prefab instance.
class PrefabInstance:
def __init__(self, prefab_file_name: str=None, container_entity: EditorEntity=EntityId()):
def __init__(self, prefab_file_name: str = None, container_entity: EditorEntity = None):
self.prefab_file_name: str = prefab_file_name
self.container_entity: EditorEntity = container_entity
@ -42,7 +61,7 @@ class PrefabInstance:
See if this instance is valid to be used with other prefab operations.
:return: Whether the target instance is valid or not.
"""
def is_valid() -> bool:
def is_valid(self) -> bool:
return self.container_entity.id.IsValid() and self.prefab_file_name in Prefab.existing_prefabs
"""
@ -60,7 +79,7 @@ class PrefabInstance:
new_parent_before_reparent_children_ids = set(new_parent.get_children_ids())
pyside_utils.run_soon(lambda: self.container_entity.set_parent_entity(parent_entity_id))
pyside_utils.run_soon(lambda: prefab_test_utils.wait_for_propagation())
pyside_utils.run_soon(lambda: wait_for_propagation())
try:
active_modal_widget = await pyside_utils.wait_for_modal_widget()
@ -94,19 +113,18 @@ class Prefab:
existing_prefabs = {}
def __init__(self, file_name: str):
self.file_name:str = file_name
self.file_path: str = prefab_test_utils.get_prefab_file_path(file_name)
def __init__(self, file_path: str):
self.file_path: str = get_prefab_file_path(file_path)
self.instances: set[PrefabInstance] = set()
"""
Check if a prefab is ready to be used to generate its instances.
:param file_name: A unique file name of the target prefab.
:param file_path: A unique file path of the target prefab.
:return: Whether the target prefab is loaded or not.
"""
@classmethod
def is_prefab_loaded(cls, file_name: str) -> bool:
return file_name in Prefab.existing_prefabs
def is_prefab_loaded(cls, file_path: str) -> bool:
return file_path in Prefab.existing_prefabs
"""
Check if a prefab exists in the directory for files of prefab tests.
@ -114,9 +132,8 @@ class Prefab:
:return: Whether the target prefab exists or not.
"""
@classmethod
def prefab_exists(cls, file_name: str) -> bool:
file_path = prefab_test_utils.get_prefab_file_path(file_name)
return path.exists(file_path)
def prefab_exists(cls, file_path: str) -> bool:
return path.exists(get_prefab_file_path(file_path))
"""
Return a prefab which can be used immediately.
@ -125,10 +142,11 @@ class Prefab:
"""
@classmethod
def get_prefab(cls, file_name: str) -> Prefab:
assert file_name, "Received an empty file_name"
if Prefab.is_prefab_loaded(file_name):
return Prefab.existing_prefabs[file_name]
else:
assert Prefab.prefab_exists(file_name), f"Attempted to get a prefab {file_name} that doesn't exist"
assert Prefab.prefab_exists(file_name), f"Attempted to get a prefab \"{file_name}\" that doesn't exist"
new_prefab = Prefab(file_name)
Prefab.existing_prefabs[file_name] = Prefab(file_name)
return new_prefab
@ -141,7 +159,7 @@ class Prefab:
:return: Created Prefab object and the very first PrefabInstance object owned by the prefab.
"""
@classmethod
def create_prefab(cls, entities: list[EditorEntity], file_name: str, prefab_instance_name: str=None) -> (Prefab, PrefabInstance):
def create_prefab(cls, entities: list[EditorEntity], file_name: str, prefab_instance_name: str=None) -> tuple(Prefab, PrefabInstance):
assert not Prefab.is_prefab_loaded(file_name), f"Can't create Prefab '{file_name}' since the prefab already exists"
new_prefab = Prefab(file_name)
@ -155,7 +173,7 @@ class Prefab:
if prefab_instance_name:
container_entity.set_name(prefab_instance_name)
prefab_test_utils.wait_for_propagation()
wait_for_propagation()
new_prefab_instance = PrefabInstance(file_name, EditorEntity(container_entity_id))
new_prefab.instances.add(new_prefab_instance)
@ -182,12 +200,13 @@ class Prefab:
delete_prefab_result = prefab.PrefabPublicRequestBus(bus.Broadcast, 'DeleteEntitiesAndAllDescendantsInInstance', container_entity_ids)
assert delete_prefab_result.IsSuccess(), f"Prefab operation 'DeleteEntitiesAndAllDescendantsInInstance' failed. Error: {delete_prefab_result.GetError()}"
prefab_test_utils.wait_for_propagation()
wait_for_propagation()
entity_ids_after_delete = set(prefab_test_utils.get_all_entities())
entity_ids_after_delete = set(get_all_entity_ids())
for entity_id_removed in entity_ids_to_remove:
if entity_id_removed in entity_ids_after_delete:
assert prefab_entities_deleted, "Not all entities and descendants in target prefabs are deleted."
assert False, "Not all entities and descendants in target prefabs are deleted."
for instance in prefab_instances:
instance_deleted_prefab = Prefab.get_prefab(instance.prefab_file_name)
@ -215,12 +234,10 @@ class Prefab:
if name:
container_entity.set_name(name)
prefab_test_utils.wait_for_propagation()
wait_for_propagation()
new_prefab_instance = PrefabInstance(self.file_name, EditorEntity(container_entity_id))
new_prefab_instance = PrefabInstance(self.file_path, EditorEntity(container_entity_id))
assert not new_prefab_instance in self.instances, "This prefab instance is already existed before this instantiation."
self.instances.add(new_prefab_instance)
prefab_test_utils.check_entity_at_position(container_entity_id, prefab_position)
return new_prefab_instance

@ -126,7 +126,7 @@ def ForceRegion_LinearDampingForceOnRigidBodies():
# Constants
CLOSE_ENOUGH = 0.001
TIME_OUT = 3.0
TIME_OUT = 10.0
INITIAL_VELOCITY = azmath.Vector3(0.0, 0.0, -10.0)
# 1) Open level / Enter game mode

@ -29,21 +29,21 @@ class TestAutomation(TestAutomationBase):
autotest_mode=autotest_mode)
def test_PrefabLevel_OpensLevelWithEntities(self, request, workspace, editor, launcher_platform):
from . import PrefabLevel_OpensLevelWithEntities as test_module
from .tests import PrefabLevel_OpensLevelWithEntities as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Prefab_BasicWorkflow_CreatePrefab(self, request, workspace, editor, launcher_platform):
from . import Prefab_BasicWorkflow_CreatePrefab as test_module
def test_PrefabBasicWorkflow_CreatePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreatePrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Prefab_BasicWorkflow_InstantiatePrefab(self, request, workspace, editor, launcher_platform):
from . import Prefab_BasicWorkflow_InstantiatePrefab as test_module
def test_PrefabBasicWorkflow_InstantiatePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_InstantiatePrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Prefab_BasicWorkflow_CreateAndDeletePrefab(self, request, workspace, editor, launcher_platform):
from . import Prefab_BasicWorkflow_CreateAndDeletePrefab as test_module
def test_PrefabBasicWorkflow_CreateAndDeletePrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreateAndDeletePrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module)
def test_Prefab_BasicWorkflow_CreateAndReparentPrefab(self, request, workspace, editor, launcher_platform):
from . import Prefab_BasicWorkflow_CreateAndReparentPrefab as test_module
def test_PrefabBasicWorkflow_CreateAndReparentPrefab(self, request, workspace, editor, launcher_platform):
from .tests import PrefabBasicWorkflow_CreateAndReparentPrefab as test_module
self._run_prefab_test(request, workspace, editor, test_module, autotest_mode=False)

@ -5,14 +5,14 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def Prefab_BasicWorkflow_CreateAndDeletePrefab():
def PrefabBasicWorkflow_CreateAndDeletePrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
from editor_python_test_tools.editor_entity_utils import EditorEntity
from prefab.Prefab import Prefab
from editor_python_test_tools.prefab_utils import Prefab
import prefab.Prefab_Test_Utils as prefab_test_utils
import PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@ -21,13 +21,13 @@ def Prefab_BasicWorkflow_CreateAndDeletePrefab():
car_entity = EditorEntity.create_editor_entity()
car_prefab_entities = [car_entity]
# Checks for prefab creation passed or not
# Asserts if prefab creation doesn't succeeds
_, car = Prefab.create_prefab(
car_prefab_entities, CAR_PREFAB_FILE_NAME)
# Checks for prefab deletion passed or not
# Asserts if prefab deletion fails
Prefab.remove_prefabs([car])
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Prefab_BasicWorkflow_CreateAndDeletePrefab)
Report.start_test(PrefabBasicWorkflow_CreateAndDeletePrefab)

@ -5,7 +5,7 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def Prefab_BasicWorkflow_CreateAndReparentPrefab():
def PrefabBasicWorkflow_CreateAndReparentPrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
WHEEL_PREFAB_FILE_NAME = 'wheel_prefab'
@ -16,9 +16,9 @@ def Prefab_BasicWorkflow_CreateAndReparentPrefab():
async def run_test():
from editor_python_test_tools.editor_entity_utils import EditorEntity
from prefab.Prefab import Prefab
from editor_python_test_tools.prefab_utils import Prefab
import prefab.Prefab_Test_Utils as prefab_test_utils
import PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@ -46,4 +46,4 @@ def Prefab_BasicWorkflow_CreateAndReparentPrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Prefab_BasicWorkflow_CreateAndReparentPrefab)
Report.start_test(PrefabBasicWorkflow_CreateAndReparentPrefab)

@ -5,15 +5,15 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def Prefab_BasicWorkflow_CreatePrefab():
def PrefabBasicWorkflow_CreatePrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
from editor_python_test_tools.editor_entity_utils import EditorEntity
from editor_python_test_tools.utils import Report
from prefab.Prefab import Prefab
from editor_python_test_tools.prefab_utils import Prefab
import prefab.Prefab_Test_Utils as prefab_test_utils
import PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@ -27,4 +27,4 @@ def Prefab_BasicWorkflow_CreatePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Prefab_BasicWorkflow_CreatePrefab)
Report.start_test(PrefabBasicWorkflow_CreatePrefab)

@ -5,17 +5,17 @@ For complete copyright and license terms please see the LICENSE at the root of t
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def Prefab_BasicWorkflow_InstantiatePrefab():
def PrefabBasicWorkflow_InstantiatePrefab():
from azlmbr.math import Vector3
EXISTING_TEST_PREFAB_FILE_NAME = "Test"
EXISTING_TEST_PREFAB_FILE_NAME = "Gem/PythonTests/Prefab/data/Test.prefab"
INSTANTIATED_TEST_PREFAB_POSITION = Vector3(10.00, 20.0, 30.0)
EXPECTED_TEST_PREFAB_CHILDREN_COUNT = 1
from prefab.Prefab import Prefab
from editor_python_test_tools.prefab_utils import Prefab
import prefab.Prefab_Test_Utils as prefab_test_utils
import PrefabTestUtils as prefab_test_utils
prefab_test_utils.open_base_tests_level()
@ -31,4 +31,4 @@ def Prefab_BasicWorkflow_InstantiatePrefab():
if __name__ == "__main__":
from editor_python_test_tools.utils import Report
Report.start_test(Prefab_BasicWorkflow_InstantiatePrefab)
Report.start_test(PrefabBasicWorkflow_InstantiatePrefab)

@ -7,9 +7,9 @@ SPDX-License-Identifier: Apache-2.0 OR MIT
# fmt:off
class Tests():
find_empty_entity = ("Entity: 'EmptyEntity' found", "Entity: 'EmptyEntity' *not* found in level")
empty_entity_pos = ("'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position")
find_pxentity = ("Entity: 'EntityWithPxCollider' found", "Entity: 'EntityWithPxCollider' *not* found in level")
find_empty_entity = ("Entity: 'EmptyEntity' found", "Entity: 'EmptyEntity' *not* found in level")
empty_entity_pos = ("'EmptyEntity' position is at the expected position", "'EmptyEntity' position is *not* at the expected position")
find_pxentity = ("Entity: 'EntityWithPxCollider' found", "Entity: 'EntityWithPxCollider' *not* found in level")
pxentity_component = ("Entity: 'EntityWithPxCollider' has a Physx Collider", "Entity: 'EntityWithPxCollider' does *not* have a Physx Collider")
# fmt:on

@ -18,20 +18,6 @@ import azlmbr.components as components
import azlmbr.entity as entity
import azlmbr.legacy.general as general
def get_prefab_file_name(prefab_name):
return prefab_name + ".prefab"
def get_prefab_file_path(prefab_name):
return os.path.join(os.path.dirname(os.path.abspath(__file__)), get_prefab_file_name(prefab_name))
def find_entities_by_name(entity_name):
searchFilter = entity.SearchFilter()
searchFilter.names = [entity_name]
return entity.SearchBus(bus.Broadcast, 'SearchEntities', searchFilter)
def get_all_entities():
return entity.SearchBus(bus.Broadcast, 'SearchEntities', entity.SearchFilter())
def check_entity_at_position(entity_id, expected_entity_position):
entity_at_expected_position_result = (
"entity is at expected position",
@ -74,9 +60,6 @@ def get_children_ids_by_name(entity_id, entity_name):
return result
def wait_for_propagation():
general.idle_wait_frames(1)
def open_base_tests_level():
helper.init_idle()
helper.open_level("Prefab", "Base")

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c3384e88cd0f47ab8ec81eb75101b02ff9675c76dc070c726a9f3f39f1b2b2df
size 4994448

@ -1,16 +1,34 @@
ProductName: single_mesh_multiple_materials.dbgsg
debugSceneGraphVersion: 1
single_mesh_multiple_materials
Node Name: Torus
Node Path: RootNode.Torus
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Torus_1
Node Path: RootNode.Torus.Torus_1
Node Type: MeshData
Positions: Count 2304. Hash: 12560656679477605282
Normals: Count 2304. Hash: 14915939258818888021
FaceList: Count 1152. Hash: 3035560221708475304
FaceMaterialIds: Count 1152. Hash: 2033667258170256242
Node Name: Torus_optimized
Node Path: RootNode.Torus_optimized
Node Name: Torus_2
Node Path: RootNode.Torus.Torus_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Torus_1_optimized
Node Path: RootNode.Torus.Torus_1_optimized
Node Type: MeshData
Positions: Count 2304. Hash: 12560656679477605282
Normals: Count 2304. Hash: 14915939258818888021
@ -18,7 +36,7 @@ Node Type: MeshData
FaceMaterialIds: Count 1152. Hash: 2033667258170256242
Node Name: transform
Node Path: RootNode.Torus.transform
Node Path: RootNode.Torus.Torus_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -27,13 +45,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UV0
Node Path: RootNode.Torus.UV0
Node Path: RootNode.Torus.Torus_1.UV0
Node Type: MeshVertexUVData
UVs: Count 2304. Hash: 6069930558565069665
UVCustomName: UV0
Node Name: OrangeMaterial
Node Path: RootNode.Torus.OrangeMaterial
Node Path: RootNode.Torus.Torus_1.OrangeMaterial
Node Type: MaterialData
MaterialName: OrangeMaterial
UniqueId: 10937477720113828524
@ -63,7 +81,7 @@ Node Type: MaterialData
BaseColorTexture:
Node Name: SecondTextureMaterial
Node Path: RootNode.Torus.SecondTextureMaterial
Node Path: RootNode.Torus.Torus_1.SecondTextureMaterial
Node Type: MaterialData
MaterialName: SecondTextureMaterial
UniqueId: 16601413836225607467
@ -93,7 +111,7 @@ Node Type: MaterialData
BaseColorTexture: OneMeshMultipleMaterials/FBXSecondTestTexture.png
Node Name: FirstTextureMaterial
Node Path: RootNode.Torus.FirstTextureMaterial
Node Path: RootNode.Torus.Torus_1.FirstTextureMaterial
Node Type: MaterialData
MaterialName: FirstTextureMaterial
UniqueId: 2580020563915538382
@ -122,40 +140,145 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: OneMeshMultipleMaterials/FBXTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Torus.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Torus.Torus_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 2304. Hash: 17641066831235827929
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Torus.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Torus.Torus_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 2304. Hash: 6274616552656695154
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Torus.Torus_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UV0
Node Path: RootNode.Torus.Torus_2.UV0
Node Type: MeshVertexUVData
UVs: Count 2304. Hash: 6069930558565069665
UVCustomName: UV0
Node Name: OrangeMaterial
Node Path: RootNode.Torus.Torus_2.OrangeMaterial
Node Type: MaterialData
MaterialName: OrangeMaterial
UniqueId: 10937477720113828524
IsNoDraw: false
DiffuseColor: < 0.800000, 0.113346, 0.000000>
SpecularColor: < 0.800000, 0.113346, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: SecondTextureMaterial
Node Path: RootNode.Torus.Torus_2.SecondTextureMaterial
Node Type: MaterialData
MaterialName: SecondTextureMaterial
UniqueId: 16601413836225607467
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: OneMeshMultipleMaterials/FBXSecondTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: OneMeshMultipleMaterials/FBXSecondTestTexture.png
Node Name: FirstTextureMaterial
Node Path: RootNode.Torus.Torus_2.FirstTextureMaterial
Node Type: MaterialData
MaterialName: FirstTextureMaterial
UniqueId: 2580020563915538382
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: OneMeshMultipleMaterials/FBXTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: OneMeshMultipleMaterials/FBXTestTexture.png
Node Name: UV0
Node Path: RootNode.Torus_optimized.UV0
Node Path: RootNode.Torus.Torus_1_optimized.UV0
Node Type: MeshVertexUVData
UVs: Count 2304. Hash: 6069930558565069665
UVCustomName: UV0
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Torus_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Torus.Torus_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 2304. Hash: 17641066831235827929
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Torus_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Torus.Torus_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 2304. Hash: 6274616552656695154
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Torus_optimized.transform
Node Path: RootNode.Torus.Torus_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -164,7 +287,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: OrangeMaterial
Node Path: RootNode.Torus_optimized.OrangeMaterial
Node Path: RootNode.Torus.Torus_1_optimized.OrangeMaterial
Node Type: MaterialData
MaterialName: OrangeMaterial
UniqueId: 10937477720113828524
@ -194,7 +317,7 @@ Node Type: MaterialData
BaseColorTexture:
Node Name: SecondTextureMaterial
Node Path: RootNode.Torus_optimized.SecondTextureMaterial
Node Path: RootNode.Torus.Torus_1_optimized.SecondTextureMaterial
Node Type: MaterialData
MaterialName: SecondTextureMaterial
UniqueId: 16601413836225607467
@ -224,7 +347,7 @@ Node Type: MaterialData
BaseColorTexture: OneMeshMultipleMaterials/FBXSecondTestTexture.png
Node Name: FirstTextureMaterial
Node Path: RootNode.Torus_optimized.FirstTextureMaterial
Node Path: RootNode.Torus.Torus_1_optimized.FirstTextureMaterial
Node Type: MaterialData
MaterialName: FirstTextureMaterial
UniqueId: 2580020563915538382
@ -252,4 +375,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: OneMeshMultipleMaterials/FBXTestTexture.png

@ -1,16 +1,34 @@
ProductName: OneMeshOneMaterial.dbgsg
debugSceneGraphVersion: 1
OneMeshOneMaterial
Node Name: Cube
Node Path: RootNode.Cube
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1
Node Path: RootNode.Cube.Cube_1
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cube_optimized
Node Path: RootNode.Cube_optimized
Node Name: Cube_2
Node Path: RootNode.Cube.Cube_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1_optimized
Node Path: RootNode.Cube.Cube_1_optimized
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
@ -18,7 +36,7 @@ Node Type: MeshData
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: transform
Node Path: RootNode.Cube.transform
Node Path: RootNode.Cube.Cube_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -27,13 +45,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube.UVMap
Node Path: RootNode.Cube.Cube_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: CubeMaterial
Node Path: RootNode.Cube.CubeMaterial
Node Path: RootNode.Cube.Cube_1.CubeMaterial
Node Type: MaterialData
MaterialName: CubeMaterial
UniqueId: 973942033197978066
@ -62,40 +80,85 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: OneMeshOneMaterial/FBXTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube.Cube_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube.Cube_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: CubeMaterial
Node Path: RootNode.Cube.Cube_2.CubeMaterial
Node Type: MaterialData
MaterialName: CubeMaterial
UniqueId: 973942033197978066
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 36.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: OneMeshOneMaterial/FBXTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: OneMeshOneMaterial/FBXTestTexture.png
Node Name: UVMap
Node Path: RootNode.Cube_optimized.UVMap
Node Path: RootNode.Cube.Cube_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube_optimized.transform
Node Path: RootNode.Cube.Cube_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -104,7 +167,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: CubeMaterial
Node Path: RootNode.Cube_optimized.CubeMaterial
Node Path: RootNode.Cube.Cube_1_optimized.CubeMaterial
Node Type: MaterialData
MaterialName: CubeMaterial
UniqueId: 973942033197978066

@ -1,64 +1,109 @@
ProductName: lodtest.dbgsg
debugSceneGraphVersion: 1
lodtest
Node Name: lodtest
Node Path: RootNode.lodtest
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: lodtest_1
Node Path: RootNode.lodtest.lodtest_1
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: lodtest_lod3
Node Path: RootNode.lodtest_lod3
Node Type: MeshData
Positions: Count 1984. Hash: 6600975913707260286
Normals: Count 1984. Hash: 2708036977889843831
FaceList: Count 960. Hash: 10390417165025722786
FaceMaterialIds: Count 960. Hash: 12510609185544665964
Node Name: lodtest_lod2
Node Path: RootNode.lodtest_lod2
Node Type: MeshData
Positions: Count 240. Hash: 219362421205407416
Normals: Count 240. Hash: 11195242321181199939
FaceList: Count 80. Hash: 11130917988116538993
FaceMaterialIds: Count 80. Hash: 4190892684086530065
Node Name: lodtest_lod1
Node Path: RootNode.lodtest_lod1
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: lodtest_2
Node Path: RootNode.lodtest.lodtest_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: lodtest_optimized
Node Path: RootNode.lodtest_optimized
Node Name: lodtest_1_optimized
Node Path: RootNode.lodtest.lodtest_1_optimized
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: lodtest_lod3_optimized
Node Path: RootNode.lodtest_lod3_optimized
Node Name: lodtest_lod3_1
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1
Node Type: MeshData
Positions: Count 1984. Hash: 6600975913707260286
Normals: Count 1984. Hash: 2708036977889843831
FaceList: Count 960. Hash: 10390417165025722786
FaceMaterialIds: Count 960. Hash: 12510609185544665964
Node Name: lodtest_lod2_optimized
Node Path: RootNode.lodtest_lod2_optimized
Node Name: lodtest_lod3_2
Node Path: RootNode.lodtest_lod3.lodtest_lod3_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 2.298166, 0.000000>
Node Name: lodtest_lod3_1_optimized
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1_optimized
Node Type: MeshData
Positions: Count 1984. Hash: 6600975913707260286
Normals: Count 1984. Hash: 2708036977889843831
FaceList: Count 960. Hash: 10390417165025722786
FaceMaterialIds: Count 960. Hash: 12510609185544665964
Node Name: lodtest_lod2_1
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1
Node Type: MeshData
Positions: Count 240. Hash: 219362421205407416
Normals: Count 240. Hash: 11195242321181199939
FaceList: Count 80. Hash: 11130917988116538993
FaceMaterialIds: Count 80. Hash: 4190892684086530065
Node Name: lodtest_lod1_optimized
Node Path: RootNode.lodtest_lod1_optimized
Node Name: lodtest_lod2_2
Node Path: RootNode.lodtest_lod2.lodtest_lod2_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, -0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, -2.211498, 0.000000>
Node Name: lodtest_lod2_1_optimized
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1_optimized
Node Type: MeshData
Positions: Count 240. Hash: 219362421205407416
Normals: Count 240. Hash: 11195242321181199939
FaceList: Count 80. Hash: 11130917988116538993
FaceMaterialIds: Count 80. Hash: 4190892684086530065
Node Name: lodtest_lod1_1
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: lodtest_lod1_2
Node Path: RootNode.lodtest_lod1.lodtest_lod1_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 2.410331, 0.000000, 0.000000>
Node Name: lodtest_lod1_1_optimized
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1_optimized
Node Type: MeshData
Positions: Count 192. Hash: 7921557352486854444
Normals: Count 192. Hash: 1873340970602844856
@ -66,7 +111,7 @@ Node Type: MeshData
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: transform
Node Path: RootNode.lodtest.transform
Node Path: RootNode.lodtest.lodtest_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -75,13 +120,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest.UVMap
Node Path: RootNode.lodtest.lodtest_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: Material
Node Path: RootNode.lodtest.Material
Node Path: RootNode.lodtest.lodtest_1.Material
Node Type: MaterialData
MaterialName: Material
UniqueId: 11127505492038345244
@ -110,45 +155,45 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.lodtest.lodtest_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest.lodtest_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod3.transform
Node Path: RootNode.lodtest.lodtest_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 2.298166, 0.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod3.UVMap
Node Path: RootNode.lodtest.lodtest_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 1984. Hash: 14119273880200542497
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod3.DefaultMaterial
Node Name: Material
Node Path: RootNode.lodtest.lodtest_2.Material
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
MaterialName: Material
UniqueId: 11127505492038345244
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 0.000000
Shininess: 36.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
@ -168,36 +213,81 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_lod3.TangentSet_MikkT_0
Node Name: UVMap
Node Path: RootNode.lodtest.lodtest_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: TangentSet_0
Node Path: RootNode.lodtest.lodtest_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 1984. Hash: 5664494957869921957
TangentSpace: 1
Tangents: Count 24. Hash: 13438447437797057049
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_lod3.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest.lodtest_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 1984. Hash: 5048878728906162461
TangentSpace: 1
Bitangents: Count 24. Hash: 11372562338897179017
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod2.transform
Node Path: RootNode.lodtest.lodtest_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, -0.000000, 0.000000>
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, -2.211498, 0.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Material
Node Path: RootNode.lodtest.lodtest_1_optimized.Material
Node Type: MaterialData
MaterialName: Material
UniqueId: 11127505492038345244
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 36.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: transform
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 2.298166, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod2.UVMap
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 240. Hash: 13702273589593616598
UVs: Count 1984. Hash: 14119273880200542497
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod2.DefaultMaterial
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -226,36 +316,36 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_lod2.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 240. Hash: 1390901212717410749
TangentSpace: 1
Tangents: Count 1984. Hash: 5664494957869921957
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_lod2.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 240. Hash: 1379238632949267281
TangentSpace: 1
Bitangents: Count 1984. Hash: 5048878728906162461
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod1.transform
Node Path: RootNode.lodtest_lod3.lodtest_lod3_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 2.410331, 0.000000, 0.000000>
Transl: < 0.000000, 2.298166, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod1.UVMap
Node Path: RootNode.lodtest_lod3.lodtest_lod3_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVs: Count 1984. Hash: 14119273880200542497
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod1.DefaultMaterial
Node Path: RootNode.lodtest_lod3.lodtest_lod3_2.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -284,58 +374,45 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_lod1.TangentSet_MikkT_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
TangentSpace: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_lod1.BitangentSet_MikkT_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
TangentSpace: 1
Node Name: UVMap
Node Path: RootNode.lodtest_optimized.UVMap
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVs: Count 1984. Hash: 14119273880200542497
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
Tangents: Count 1984. Hash: 5664494957869921957
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
Bitangents: Count 1984. Hash: 5048878728906162461
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_optimized.transform
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Transl: < 0.000000, 2.298166, 0.000000>
Node Name: Material
Node Path: RootNode.lodtest_optimized.Material
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod3.lodtest_lod3_1_optimized.DefaultMaterial
Node Type: MaterialData
MaterialName: Material
UniqueId: 11127505492038345244
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 36.000000
Shininess: 0.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
@ -355,36 +432,81 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: transform
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, -0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, -2.211498, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod3_optimized.UVMap
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 1984. Hash: 14119273880200542497
UVs: Count 240. Hash: 13702273589593616598
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_lod3_optimized.TangentSet_MikkT_0
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 0.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_0
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 1984. Hash: 5664494957869921957
TangentSpace: 1
Tangents: Count 240. Hash: 1390901212717410749
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_lod3_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 1984. Hash: 5048878728906162461
TangentSpace: 1
Bitangents: Count 240. Hash: 1379238632949267281
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod3_optimized.transform
Node Path: RootNode.lodtest_lod2.lodtest_lod2_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisX: < 100.000000, -0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 2.298166, 0.000000>
Transl: < 0.000000, -2.211498, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod2.lodtest_lod2_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 240. Hash: 13702273589593616598
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod3_optimized.DefaultMaterial
Node Path: RootNode.lodtest_lod2.lodtest_lod2_2.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -414,26 +536,26 @@ Node Type: MaterialData
BaseColorTexture:
Node Name: UVMap
Node Path: RootNode.lodtest_lod2_optimized.UVMap
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 240. Hash: 13702273589593616598
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_lod2_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 240. Hash: 1390901212717410749
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_lod2_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 240. Hash: 1379238632949267281
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod2_optimized.transform
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, -0.000000, 0.000000>
@ -442,7 +564,7 @@ Node Type: TransformData
Transl: < 0.000000, -2.211498, 0.000000>
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod2_optimized.DefaultMaterial
Node Path: RootNode.lodtest_lod2.lodtest_lod2_1_optimized.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -471,27 +593,130 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: transform
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 2.410331, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod1_optimized.UVMap
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 0.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_0
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod1.lodtest_lod1_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 2.410331, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.lodtest_lod1.lodtest_lod1_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod1.lodtest_lod1_2.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 0.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: UVMap
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 13790301632763350589
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.lodtest_lod1_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 7293001660047850407
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.lodtest_lod1_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 2874689498270494796
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.lodtest_lod1_optimized.transform
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -500,7 +725,7 @@ Node Type: TransformData
Transl: < 2.410331, 0.000000, 0.000000>
Node Name: DefaultMaterial
Node Path: RootNode.lodtest_lod1_optimized.DefaultMaterial
Node Path: RootNode.lodtest_lod1.lodtest_lod1_1_optimized.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -528,4 +753,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:

@ -1,32 +1,59 @@
ProductName: physicstest.dbgsg
debugSceneGraphVersion: 1
physicstest
Node Name: Cone
Node Path: RootNode.Cone
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cone_1
Node Path: RootNode.Cone.Cone_1
Node Type: MeshData
Positions: Count 128. Hash: 7714223793259938211
Normals: Count 128. Hash: 2352668179264002707
FaceList: Count 62. Hash: 14563017593520122982
FaceMaterialIds: Count 62. Hash: 12234218120113875284
Node Name: Cube_phys
Node Path: RootNode.Cube_phys
Node Type: MeshData
Positions: Count 24. Hash: 3478903613105670818
Normals: Count 24. Hash: 7251512570672401149
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cone_2
Node Path: RootNode.Cone.Cone_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cone_optimized
Node Path: RootNode.Cone_optimized
Node Name: Cone_1_optimized
Node Path: RootNode.Cone.Cone_1_optimized
Node Type: MeshData
Positions: Count 128. Hash: 10174710861731544050
Normals: Count 128. Hash: 2352668179264002707
FaceList: Count 62. Hash: 11332459830831720586
FaceMaterialIds: Count 62. Hash: 12234218120113875284
Node Name: Cube_phys_1
Node Path: RootNode.Cube_phys.Cube_phys_1
Node Type: MeshData
Positions: Count 24. Hash: 3478903613105670818
Normals: Count 24. Hash: 7251512570672401149
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cube_phys_2
Node Path: RootNode.Cube_phys.Cube_phys_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: transform
Node Path: RootNode.Cone.transform
Node Path: RootNode.Cone.Cone_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -35,13 +62,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cone.UVMap
Node Path: RootNode.Cone.Cone_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 10171083346831193808
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.Cone.DefaultMaterial
Node Path: RootNode.Cone.Cone_1.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -70,21 +97,21 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cone.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cone.Cone_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 128. Hash: 14351734474754285313
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cone.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cone.Cone_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 128. Hash: 15997251922861304891
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube_phys.transform
Node Path: RootNode.Cone.Cone_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -93,13 +120,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube_phys.UVMap
Node Path: RootNode.Cone.Cone_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 13623018071435219250
UVs: Count 128. Hash: 10171083346831193808
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.Cube_phys.DefaultMaterial
Node Path: RootNode.Cone.Cone_2.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -128,40 +155,124 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_phys.TangentSet_MikkT_0
Node Name: UVMap
Node Path: RootNode.Cone.Cone_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 7873368003484215433
UVCustomName: UVMap
Node Name: TangentSet_0
Node Path: RootNode.Cone.Cone_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 11965897353301448436
TangentSpace: 1
Tangents: Count 128. Hash: 12937806066914201637
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_phys.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cone.Cone_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 17515781720544086759
TangentSpace: 1
Bitangents: Count 128. Hash: 873786942732834087
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cone.Cone_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: DefaultMaterial
Node Path: RootNode.Cone.Cone_1_optimized.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 0.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: transform
Node Path: RootNode.Cube_phys.Cube_phys_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cone_optimized.UVMap
Node Path: RootNode.Cube_phys.Cube_phys_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 7873368003484215433
UVs: Count 24. Hash: 13623018071435219250
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cone_optimized.TangentSet_MikkT_0
Node Name: DefaultMaterial
Node Path: RootNode.Cube_phys.Cube_phys_1.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 0.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_0
Node Path: RootNode.Cube_phys.Cube_phys_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 128. Hash: 12937806066914201637
TangentSpace: 1
Tangents: Count 24. Hash: 11965897353301448436
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cone_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube_phys.Cube_phys_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 128. Hash: 873786942732834087
TangentSpace: 1
Bitangents: Count 24. Hash: 17515781720544086759
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cone_optimized.transform
Node Path: RootNode.Cube_phys.Cube_phys_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -169,8 +280,14 @@ Node Type: TransformData
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube_phys.Cube_phys_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 13623018071435219250
UVCustomName: UVMap
Node Name: DefaultMaterial
Node Path: RootNode.Cone_optimized.DefaultMaterial
Node Path: RootNode.Cube_phys.Cube_phys_2.DefaultMaterial
Node Type: MaterialData
MaterialName: DefaultMaterial
UniqueId: 3809502407269006983
@ -198,4 +315,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:

@ -1,32 +1,59 @@
ProductName: multiple_mesh_linked_materials.dbgsg
debugSceneGraphVersion: 1
multiple_mesh_linked_materials
Node Name: Cube
Node Path: RootNode.Cube
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1
Node Path: RootNode.Cube.Cube_1
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7113802799051126666
Node Name: Cone
Node Path: RootNode.Cone
Node Type: MeshData
Positions: Count 128. Hash: 12506421592104186200
Normals: Count 128. Hash: 367461522682321485
FaceList: Count 62. Hash: 13208951979626973193
FaceMaterialIds: Count 62. Hash: 15454348664434923102
Node Name: Cube_2
Node Path: RootNode.Cube.Cube_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_optimized
Node Path: RootNode.Cube_optimized
Node Name: Cube_1_optimized
Node Path: RootNode.Cube.Cube_1_optimized
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7113802799051126666
Node Name: Cone_optimized
Node Path: RootNode.Cone_optimized
Node Name: Cone_1
Node Path: RootNode.Cone.Cone_1
Node Type: MeshData
Positions: Count 128. Hash: 12506421592104186200
Normals: Count 128. Hash: 367461522682321485
FaceList: Count 62. Hash: 13208951979626973193
FaceMaterialIds: Count 62. Hash: 15454348664434923102
Node Name: Cone_2
Node Path: RootNode.Cone.Cone_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 2.000000>
Node Name: Cone_1_optimized
Node Path: RootNode.Cone.Cone_1_optimized
Node Type: MeshData
Positions: Count 128. Hash: 14946490408303214595
Normals: Count 128. Hash: 367461522682321485
@ -34,7 +61,7 @@ Node Type: MeshData
FaceMaterialIds: Count 62. Hash: 15454348664434923102
Node Name: transform
Node Path: RootNode.Cube.transform
Node Path: RootNode.Cube.Cube_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -43,13 +70,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UV0
Node Path: RootNode.Cube.UV0
Node Path: RootNode.Cube.Cube_1.UV0
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UV0
Node Name: SharedBlack
Node Path: RootNode.Cube.SharedBlack
Node Path: RootNode.Cube.Cube_1.SharedBlack
Node Type: MaterialData
MaterialName: SharedBlack
UniqueId: 5248829540156873090
@ -79,7 +106,7 @@ Node Type: MaterialData
BaseColorTexture:
Node Name: SharedOrange
Node Path: RootNode.Cube.SharedOrange
Node Path: RootNode.Cube.Cube_1.SharedOrange
Node Type: MaterialData
MaterialName: SharedOrange
UniqueId: 9470651048605569128
@ -108,42 +135,42 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cone.transform
Node Path: RootNode.Cube.Cube_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 2.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UV0
Node Path: RootNode.Cone.UV0
Node Path: RootNode.Cube.Cube_2.UV0
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 10291654057525777310
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UV0
Node Name: SharedOrange
Node Path: RootNode.Cone.SharedOrange
Node Name: SharedBlack
Node Path: RootNode.Cube.Cube_2.SharedBlack
Node Type: MaterialData
MaterialName: SharedOrange
UniqueId: 9470651048605569128
MaterialName: SharedBlack
UniqueId: 5248829540156873090
IsNoDraw: false
DiffuseColor: < 0.800000, 0.139382, 0.014429>
SpecularColor: < 0.800000, 0.139382, 0.014429>
DiffuseColor: < 0.000000, 0.000000, 0.000000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
@ -166,14 +193,14 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: SharedBlack
Node Path: RootNode.Cone.SharedBlack
Node Name: SharedOrange
Node Path: RootNode.Cube.Cube_2.SharedOrange
Node Type: MaterialData
MaterialName: SharedBlack
UniqueId: 5248829540156873090
MaterialName: SharedOrange
UniqueId: 9470651048605569128
IsNoDraw: false
DiffuseColor: < 0.000000, 0.000000, 0.000000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
DiffuseColor: < 0.800000, 0.139382, 0.014429>
SpecularColor: < 0.800000, 0.139382, 0.014429>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
@ -196,40 +223,27 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cone.TangentSet_MikkT_0
Node Type: MeshVertexTangentData
Tangents: Count 128. Hash: 12695232913942738512
TangentSpace: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cone.BitangentSet_MikkT_0
Node Type: MeshVertexBitangentData
Bitangents: Count 128. Hash: 9034210764777745751
TangentSpace: 1
Node Name: UV0
Node Path: RootNode.Cube_optimized.UV0
Node Path: RootNode.Cube.Cube_1_optimized.UV0
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UV0
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube_optimized.transform
Node Path: RootNode.Cube.Cube_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -238,7 +252,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: SharedBlack
Node Path: RootNode.Cube_optimized.SharedBlack
Node Path: RootNode.Cube.Cube_1_optimized.SharedBlack
Node Type: MaterialData
MaterialName: SharedBlack
UniqueId: 5248829540156873090
@ -268,7 +282,7 @@ Node Type: MaterialData
BaseColorTexture:
Node Name: SharedOrange
Node Path: RootNode.Cube_optimized.SharedOrange
Node Path: RootNode.Cube.Cube_1_optimized.SharedOrange
Node Type: MaterialData
MaterialName: SharedOrange
UniqueId: 9470651048605569128
@ -297,27 +311,190 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: transform
Node Path: RootNode.Cone.Cone_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 2.000000>
Node Name: UV0
Node Path: RootNode.Cone_optimized.UV0
Node Path: RootNode.Cone.Cone_1.UV0
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 10291654057525777310
UVCustomName: UV0
Node Name: SharedOrange
Node Path: RootNode.Cone.Cone_1.SharedOrange
Node Type: MaterialData
MaterialName: SharedOrange
UniqueId: 9470651048605569128
IsNoDraw: false
DiffuseColor: < 0.800000, 0.139382, 0.014429>
SpecularColor: < 0.800000, 0.139382, 0.014429>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: SharedBlack
Node Path: RootNode.Cone.Cone_1.SharedBlack
Node Type: MaterialData
MaterialName: SharedBlack
UniqueId: 5248829540156873090
IsNoDraw: false
DiffuseColor: < 0.000000, 0.000000, 0.000000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_0
Node Path: RootNode.Cone.Cone_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 128. Hash: 12695232913942738512
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_0
Node Path: RootNode.Cone.Cone_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 128. Hash: 9034210764777745751
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cone.Cone_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 2.000000>
Node Name: UV0
Node Path: RootNode.Cone.Cone_2.UV0
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 10291654057525777310
UVCustomName: UV0
Node Name: SharedOrange
Node Path: RootNode.Cone.Cone_2.SharedOrange
Node Type: MaterialData
MaterialName: SharedOrange
UniqueId: 9470651048605569128
IsNoDraw: false
DiffuseColor: < 0.800000, 0.139382, 0.014429>
SpecularColor: < 0.800000, 0.139382, 0.014429>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: SharedBlack
Node Path: RootNode.Cone.Cone_2.SharedBlack
Node Type: MaterialData
MaterialName: SharedBlack
UniqueId: 5248829540156873090
IsNoDraw: false
DiffuseColor: < 0.000000, 0.000000, 0.000000>
SpecularColor: < 0.000000, 0.000000, 0.000000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: UV0
Node Path: RootNode.Cone.Cone_1_optimized.UV0
Node Type: MeshVertexUVData
UVs: Count 128. Hash: 7173974213247584731
UVCustomName: UV0
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cone_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cone.Cone_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 128. Hash: 10740776669168782230
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cone_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cone.Cone_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 128. Hash: 6990068477421150065
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cone_optimized.transform
Node Path: RootNode.Cone.Cone_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -326,7 +503,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 2.000000>
Node Name: SharedOrange
Node Path: RootNode.Cone_optimized.SharedOrange
Node Path: RootNode.Cone.Cone_1_optimized.SharedOrange
Node Type: MaterialData
MaterialName: SharedOrange
UniqueId: 9470651048605569128
@ -356,7 +533,7 @@ Node Type: MaterialData
BaseColorTexture:
Node Name: SharedBlack
Node Path: RootNode.Cone_optimized.SharedBlack
Node Path: RootNode.Cone.Cone_1_optimized.SharedBlack
Node Type: MaterialData
MaterialName: SharedBlack
UniqueId: 5248829540156873090
@ -384,4 +561,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:

@ -1,32 +1,59 @@
ProductName: multiple_mesh_one_material.dbgsg
debugSceneGraphVersion: 1
multiple_mesh_one_material
Node Name: Cube
Node Path: RootNode.Cube
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1
Node Path: RootNode.Cube.Cube_1
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cylinder
Node Path: RootNode.Cylinder
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: Cube_2
Node Path: RootNode.Cube.Cube_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_optimized
Node Path: RootNode.Cube_optimized
Node Name: Cube_1_optimized
Node Path: RootNode.Cube.Cube_1_optimized
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cylinder_optimized
Node Path: RootNode.Cylinder_optimized
Node Name: Cylinder_1
Node Path: RootNode.Cylinder.Cylinder_1
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: Cylinder_2
Node Path: RootNode.Cylinder.Cylinder_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: Cylinder_1_optimized
Node Path: RootNode.Cylinder.Cylinder_1_optimized
Node Type: MeshData
Positions: Count 192. Hash: 7921557352486854444
Normals: Count 192. Hash: 1873340970602844856
@ -34,7 +61,7 @@ Node Type: MeshData
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: transform
Node Path: RootNode.Cube.transform
Node Path: RootNode.Cube.Cube_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -43,13 +70,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube.UVMap
Node Path: RootNode.Cube.Cube_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: SingleMaterial
Node Path: RootNode.Cube.SingleMaterial
Node Path: RootNode.Cube.Cube_1.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -78,36 +105,36 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: TwoMeshOneMaterial/FBXTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder.transform
Node Path: RootNode.Cube.Cube_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.UVMap
Node Path: RootNode.Cube.Cube_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: SingleMaterial
Node Path: RootNode.Cylinder.SingleMaterial
Node Path: RootNode.Cube.Cube_2.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -136,49 +163,139 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: TwoMeshOneMaterial/FBXTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cylinder.TangentSet_MikkT_0
Node Name: UVMap
Node Path: RootNode.Cube.Cube_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
TangentSpace: 1
Tangents: Count 24. Hash: 13438447437797057049
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cylinder.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
TangentSpace: 1
Bitangents: Count 24. Hash: 11372562338897179017
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube.Cube_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: SingleMaterial
Node Path: RootNode.Cube.Cube_1_optimized.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
IsNoDraw: false
DiffuseColor: < 0.814049, 0.814049, 0.814049>
SpecularColor: < 0.814049, 0.814049, 0.814049>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshOneMaterial/FBXTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshOneMaterial/FBXTestTexture.png
Node Name: transform
Node Path: RootNode.Cylinder.Cylinder_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube_optimized.UVMap
Node Path: RootNode.Cylinder.Cylinder_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.TangentSet_MikkT_0
Node Name: SingleMaterial
Node Path: RootNode.Cylinder.Cylinder_1.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
IsNoDraw: false
DiffuseColor: < 0.814049, 0.814049, 0.814049>
SpecularColor: < 0.814049, 0.814049, 0.814049>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshOneMaterial/FBXTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshOneMaterial/FBXTestTexture.png
Node Name: TangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
Tangents: Count 192. Hash: 11165448242141781141
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
Bitangents: Count 192. Hash: 7987814487334449536
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube_optimized.transform
Node Path: RootNode.Cylinder.Cylinder_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.Cylinder_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: SingleMaterial
Node Path: RootNode.Cube_optimized.SingleMaterial
Node Path: RootNode.Cylinder.Cylinder_2.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -208,26 +325,26 @@ Node Type: MaterialData
BaseColorTexture: TwoMeshOneMaterial/FBXTestTexture.png
Node Name: UVMap
Node Path: RootNode.Cylinder_optimized.UVMap
Node Path: RootNode.Cylinder.Cylinder_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 13790301632763350589
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cylinder_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 7293001660047850407
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cylinder_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 2874689498270494796
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder_optimized.transform
Node Path: RootNode.Cylinder.Cylinder_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -236,7 +353,7 @@ Node Type: TransformData
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: SingleMaterial
Node Path: RootNode.Cylinder_optimized.SingleMaterial
Node Path: RootNode.Cylinder.Cylinder_1_optimized.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -264,4 +381,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshOneMaterial/FBXTestTexture.png

@ -1,32 +1,59 @@
ProductName: multiple_mesh_multiple_material.dbgsg
debugSceneGraphVersion: 1
multiple_mesh_multiple_material
Node Name: Cube
Node Path: RootNode.Cube
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1
Node Path: RootNode.Cube.Cube_1
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cylinder
Node Path: RootNode.Cylinder
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: Cube_2
Node Path: RootNode.Cube.Cube_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_optimized
Node Path: RootNode.Cube_optimized
Node Name: Cube_1_optimized
Node Path: RootNode.Cube.Cube_1_optimized
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cylinder_optimized
Node Path: RootNode.Cylinder_optimized
Node Name: Cylinder_1
Node Path: RootNode.Cylinder.Cylinder_1
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: Cylinder_2
Node Path: RootNode.Cylinder.Cylinder_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: Cylinder_1_optimized
Node Path: RootNode.Cylinder.Cylinder_1_optimized
Node Type: MeshData
Positions: Count 192. Hash: 7921557352486854444
Normals: Count 192. Hash: 1873340970602844856
@ -34,7 +61,7 @@ Node Type: MeshData
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: transform
Node Path: RootNode.Cube.transform
Node Path: RootNode.Cube.Cube_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -43,13 +70,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube.UVMap
Node Path: RootNode.Cube.Cube_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: SingleMaterial
Node Path: RootNode.Cube.SingleMaterial
Node Path: RootNode.Cube.Cube_1.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -78,42 +105,42 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder.transform
Node Path: RootNode.Cube.Cube_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.UVMap
Node Path: RootNode.Cube.Cube_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: SecondMaterial
Node Path: RootNode.Cylinder.SecondMaterial
Node Name: SingleMaterial
Node Path: RootNode.Cube.Cube_2.SingleMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
DiffuseColor: < 0.814049, 0.814049, 0.814049>
SpecularColor: < 0.814049, 0.814049, 0.814049>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
@ -126,7 +153,7 @@ Node Type: MaterialData
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
DiffuseTexture: TwoMeshTwoMaterial/FBXTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
@ -134,42 +161,29 @@ Node Type: MaterialData
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cylinder.TangentSet_MikkT_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
TangentSpace: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cylinder.BitangentSet_MikkT_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
TangentSpace: 1
BaseColorTexture: TwoMeshTwoMaterial/FBXTestTexture.png
Node Name: UVMap
Node Path: RootNode.Cube_optimized.UVMap
Node Path: RootNode.Cube.Cube_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube_optimized.transform
Node Path: RootNode.Cube.Cube_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -178,7 +192,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: SingleMaterial
Node Path: RootNode.Cube_optimized.SingleMaterial
Node Path: RootNode.Cube.Cube_1_optimized.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -207,27 +221,130 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXTestTexture.png
Node Name: transform
Node Path: RootNode.Cylinder.Cylinder_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder_optimized.UVMap
Node Path: RootNode.Cylinder.Cylinder_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: SecondMaterial
Node Path: RootNode.Cylinder.Cylinder_1.SecondMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
Node Name: TangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder.Cylinder_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.Cylinder_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: SecondMaterial
Node Path: RootNode.Cylinder.Cylinder_2.SecondMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
Node Name: UVMap
Node Path: RootNode.Cylinder.Cylinder_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 13790301632763350589
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cylinder_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 7293001660047850407
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cylinder_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 2874689498270494796
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder_optimized.transform
Node Path: RootNode.Cylinder.Cylinder_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -236,7 +353,7 @@ Node Type: TransformData
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: SecondMaterial
Node Path: RootNode.Cylinder_optimized.SecondMaterial
Node Path: RootNode.Cylinder.Cylinder_1_optimized.SecondMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
@ -264,4 +381,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png

@ -1,32 +1,59 @@
ProductName: multiple_mesh_multiple_material.dbgsg
debugSceneGraphVersion: 1
multiple_mesh_multiple_material
Node Name: Cube
Node Path: RootNode.Cube
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1
Node Path: RootNode.Cube.Cube_1
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cylinder
Node Path: RootNode.Cylinder
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: Cube_2
Node Path: RootNode.Cube.Cube_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_optimized
Node Path: RootNode.Cube_optimized
Node Name: Cube_1_optimized
Node Path: RootNode.Cube.Cube_1_optimized
Node Type: MeshData
Positions: Count 24. Hash: 8661923109306356285
Normals: Count 24. Hash: 5807525742165000561
FaceList: Count 12. Hash: 9888799799190757436
FaceMaterialIds: Count 12. Hash: 7110546404675862471
Node Name: Cylinder_1
Node Path: RootNode.Cylinder.Cylinder_1
Node Type: MeshData
Positions: Count 192. Hash: 1283526254311745349
Normals: Count 192. Hash: 1873340970602844856
FaceList: Count 124. Hash: 3728991722746136013
FaceMaterialIds: Count 124. Hash: 2372486708814455910
Node Name: Cylinder_2
Node Path: RootNode.Cylinder.Cylinder_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: transform
Node Path: RootNode.Cube.transform
Node Path: RootNode.Cube.Cube_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -35,13 +62,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube.UVMap
Node Path: RootNode.Cube.Cube_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: SingleMaterial
Node Path: RootNode.Cube.SingleMaterial
Node Path: RootNode.Cube.Cube_1.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -70,42 +97,42 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder.transform
Node Path: RootNode.Cube.Cube_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.UVMap
Node Path: RootNode.Cube.Cube_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: SecondMaterial
Node Path: RootNode.Cylinder.SecondMaterial
Node Name: SingleMaterial
Node Path: RootNode.Cube.Cube_2.SingleMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
DiffuseColor: < 0.814049, 0.814049, 0.814049>
SpecularColor: < 0.814049, 0.814049, 0.814049>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
@ -118,7 +145,7 @@ Node Type: MaterialData
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
DiffuseTexture: TwoMeshTwoMaterial/FBXTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
@ -126,42 +153,29 @@ Node Type: MaterialData
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cylinder.TangentSet_MikkT_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
TangentSpace: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cylinder.BitangentSet_MikkT_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
TangentSpace: 1
BaseColorTexture: TwoMeshTwoMaterial/FBXTestTexture.png
Node Name: UVMap
Node Path: RootNode.Cube_optimized.UVMap
Node Path: RootNode.Cube.Cube_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 24. Hash: 1622169145591646736
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24. Hash: 13438447437797057049
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24. Hash: 11372562338897179017
TangentSpace: 1
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cube_optimized.transform
Node Path: RootNode.Cube.Cube_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -170,7 +184,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: SingleMaterial
Node Path: RootNode.Cube_optimized.SingleMaterial
Node Path: RootNode.Cube.Cube_1_optimized.SingleMaterial
Node Type: MaterialData
MaterialName: SingleMaterial
UniqueId: 14432700632681398127
@ -199,3 +213,105 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXTestTexture.png
Node Name: transform
Node Path: RootNode.Cylinder.Cylinder_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.Cylinder_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: SecondMaterial
Node Path: RootNode.Cylinder.Cylinder_1.SecondMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
Node Name: TangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 192. Hash: 11165448242141781141
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_0
Node Path: RootNode.Cylinder.Cylinder_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 192. Hash: 7987814487334449536
GenerationMethod: 1
Node Name: transform
Node Path: RootNode.Cylinder.Cylinder_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: <-4.388482, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cylinder.Cylinder_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 192. Hash: 27253578623892681
UVCustomName: UVMap
Node Name: SecondMaterial
Node Path: RootNode.Cylinder.Cylinder_2.SecondMaterial
Node Type: MaterialData
MaterialName: SecondMaterial
UniqueId: 5229255358802505087
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 25.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture: TwoMeshTwoMaterial/FBXSecondTestTexture.png

@ -1,30 +1,48 @@
ProductName: vertexcolor.dbgsg
debugSceneGraphVersion: 1
vertexcolor
Node Name: Cube
Node Path: RootNode.Cube
Node Name: RootNode
Node Path: RootNode
Node Type: RootBoneData
WorldTransform:
BasisX: < 1.000000, 0.000000, 0.000000>
BasisY: < 0.000000, 1.000000, 0.000000>
BasisZ: < 0.000000, 0.000000, 1.000000>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1
Node Path: RootNode.Cube.Cube_1
Node Type: MeshData
Positions: Count 24576. Hash: 7031773714680283213
Normals: Count 24576. Hash: 8968157737282745201
FaceList: Count 12288. Hash: 13183441914179219962
FaceMaterialIds: Count 12288. Hash: 12545154121625736090
Node Name: Cube_optimized
Node Path: RootNode.Cube_optimized
Node Name: Cube_2
Node Path: RootNode.Cube.Cube_2
Node Type: BoneData
WorldTransform:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Cube_1_optimized
Node Path: RootNode.Cube.Cube_1_optimized
Node Type: MeshData
Positions: Count 24576. Hash: 7031773714680283213
Normals: Count 24576. Hash: 8968157737282745201
FaceList: Count 12288. Hash: 13183441914179219962
Positions: Count 6376. Hash: 10806296444120211070
Normals: Count 6376. Hash: 3814626075063770280
FaceList: Count 12288. Hash: 15242182080304859208
FaceMaterialIds: Count 12288. Hash: 12545154121625736090
Node Name: Col0
Node Path: RootNode.Cube.Col0
Node Path: RootNode.Cube.Cube_1.Col0
Node Type: MeshVertexColorData
Colors: Count 24576. Hash: 17169952715183318502
ColorsCustomName:
Node Name: transform
Node Path: RootNode.Cube.transform
Node Path: RootNode.Cube.Cube_1.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -33,13 +51,13 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube.UVMap
Node Path: RootNode.Cube.Cube_1.UVMap
Node Type: MeshVertexUVData
UVs: Count 24576. Hash: 4554678369329207802
UVCustomName: UVMap
Node Name: Material
Node Path: RootNode.Cube.Material
Node Path: RootNode.Cube.Cube_1.Material
Node Type: MaterialData
MaterialName: Material
UniqueId: 11127505492038345244
@ -68,46 +86,97 @@ Node Type: MaterialData
EmissiveTexture:
BaseColorTexture:
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube.TangentSet_MikkT_0
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24576. Hash: 13321090379606717973
TangentSpace: 1
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24576. Hash: 17217515414004886507
TangentSpace: 1
GenerationMethod: 1
Node Name: Col0
Node Path: RootNode.Cube.Cube_2.Col0
Node Type: MeshVertexColorData
Colors: Count 24576. Hash: 17169952715183318502
ColorsCustomName:
Node Name: transform
Node Path: RootNode.Cube.Cube_2.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
BasisY: < 0.000000, -0.000016, 100.000000>
BasisZ: < 0.000000, -100.000000, -0.000016>
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: UVMap
Node Path: RootNode.Cube_optimized.UVMap
Node Path: RootNode.Cube.Cube_2.UVMap
Node Type: MeshVertexUVData
UVs: Count 24576. Hash: 4554678369329207802
UVCustomName: UVMap
Node Name: TangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.TangentSet_MikkT_0
Node Name: Material
Node Path: RootNode.Cube.Cube_2.Material
Node Type: MaterialData
MaterialName: Material
UniqueId: 11127505492038345244
IsNoDraw: false
DiffuseColor: < 0.800000, 0.800000, 0.800000>
SpecularColor: < 0.800000, 0.800000, 0.800000>
EmissiveColor: < 0.000000, 0.000000, 0.000000>
Opacity: 1.000000
Shininess: 36.000000
UseColorMap: Not set
BaseColor: Not set
UseMetallicMap: Not set
MetallicFactor: Not set
UseRoughnessMap: Not set
RoughnessFactor: Not set
UseEmissiveMap: Not set
EmissiveIntensity: Not set
UseAOMap: Not set
DiffuseTexture:
SpecularTexture:
BumpTexture:
NormalTexture:
MetallicTexture:
RoughnessTexture:
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:
Node Name: UVMap
Node Path: RootNode.Cube.Cube_1_optimized.UVMap
Node Type: MeshVertexUVData
UVs: Count 6376. Hash: 12957930967905951851
UVCustomName: UVMap
Node Name: TangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.TangentSet_0
Node Type: MeshVertexTangentData
Tangents: Count 24576. Hash: 13321090379606717973
TangentSpace: 1
Tangents: Count 6376. Hash: 7712841033379094373
GenerationMethod: 1
SetIndex: 0
Node Name: BitangentSet_MikkT_0
Node Path: RootNode.Cube_optimized.BitangentSet_MikkT_0
Node Name: BitangentSet_0
Node Path: RootNode.Cube.Cube_1_optimized.BitangentSet_0
Node Type: MeshVertexBitangentData
Bitangents: Count 24576. Hash: 17217515414004886507
TangentSpace: 1
Bitangents: Count 6376. Hash: 12547048737213169362
GenerationMethod: 1
Node Name: Col0
Node Path: RootNode.Cube_optimized.Col0
Node Path: RootNode.Cube.Cube_1_optimized.Col0
Node Type: MeshVertexColorData
Colors: Count 24576. Hash: 17169952715183318502
Colors: Count 6376. Hash: 8761962599807935159
ColorsCustomName:
Node Name: transform
Node Path: RootNode.Cube_optimized.transform
Node Path: RootNode.Cube.Cube_1_optimized.transform
Node Type: TransformData
Matrix:
BasisX: < 100.000000, 0.000000, 0.000000>
@ -116,7 +185,7 @@ Node Type: TransformData
Transl: < 0.000000, 0.000000, 0.000000>
Node Name: Material
Node Path: RootNode.Cube_optimized.Material
Node Path: RootNode.Cube.Cube_1_optimized.Material
Node Type: MaterialData
MaterialName: Material
UniqueId: 11127505492038345244
@ -144,4 +213,3 @@ Node Type: MaterialData
AmbientOcclusionTexture:
EmissiveTexture:
BaseColorTexture:

@ -67,7 +67,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=1,
products = [
asset_db_utils.DBProduct(
product_name='onemeshonematerial/onemeshonematerial.dbgsg',
@ -99,7 +99,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=9,
warning_count=22,
products = [
asset_db_utils.DBProduct(
product_name='softnaminglod/lodtest.dbgsg',
@ -131,7 +131,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=6,
warning_count=14,
products = [
asset_db_utils.DBProduct(
product_name='softnamingphysics/physicstest.dbgsg',
@ -165,7 +165,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=2,
products = [
asset_db_utils.DBProduct(
product_name='twomeshonematerial/multiple_mesh_one_material.dbgsg',
@ -197,7 +197,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=2,
products= [
asset_db_utils.DBProduct(
product_name='twomeshlinkedmaterials/multiple_mesh_linked_materials.dbgsg',
@ -230,7 +230,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=1,
products = [
asset_db_utils.DBProduct(
product_name='onemeshmultiplematerials/single_mesh_multiple_materials.dbgsg',
@ -260,7 +260,7 @@ blackbox_fbx_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=1,
products=[
asset_db_utils.DBProduct(
product_name='vertexcolor/vertexcolor.dbgsg',
@ -275,6 +275,38 @@ blackbox_fbx_tests = [
id="35796285",
marks=pytest.mark.test_case_id("C35796285"),
),
pytest.param(
BlackboxAssetTest(
test_name= "MotionTest_RunAP_SuccessWithMatchingProducts",
asset_folder= "Motion",
scene_debug_file="Jack_Idle_Aim_ZUp.dbgsg",
assets = [
asset_db_utils.DBSourceAsset(
source_file_name = "Jack_Idle_Aim_ZUp.fbx",
uuid = b"eda904ae0e145f8b973d57fc5809918b",
jobs = [
asset_db_utils.DBJob(
job_key= "Scene compilation",
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
products = [
asset_db_utils.DBProduct(
product_name='motion/jack_idle_aim_zup.dbgsg',
sub_id=-517610290,
asset_type=b'07f289d14dc74c4094b40a53bbcb9f0b'),
asset_db_utils.DBProduct(
product_name='motion/jack_idle_aim_zup.motion',
sub_id=186392073,
asset_type=b'00494b8e75784ba28b28272e90680787')
]
),
]
)
]
),
),
]
@ -296,7 +328,7 @@ blackbox_fbx_special_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=2,
products = [
asset_db_utils.DBProduct(
product_name='twomeshtwomaterial/multiple_mesh_multiple_material.dbgsg',
@ -317,7 +349,7 @@ blackbox_fbx_special_tests = [
builder_guid=b"bd8bf65894854fe3830e8ec3a23c35f3",
status=4,
error_count=0,
warning_count=0,
warning_count=2,
products = [
asset_db_utils.DBProduct(
product_name='twomeshtwomaterial/multiple_mesh_multiple_material.dbgsg',
@ -387,7 +419,6 @@ class TestsFBX_AllPlatforms(object):
self.run_fbx_test(workspace, ap_setup_fixture,
asset_processor, project, blackbox_param, True)
def populateAssetInfo(self, workspace, project, assets):
# Check that each given source asset resulted in the expected jobs and products.
@ -398,7 +429,6 @@ class TestsFBX_AllPlatforms(object):
product.product_name = job.platform + "/" \
+ product.product_name
def run_fbx_test(self, workspace, ap_setup_fixture, asset_processor,
project, blackbox_params: BlackboxAssetTest, overrideAsset = False):
"""

@ -90,7 +90,7 @@ class TestAutomationBase:
editor_starttime = time.time()
self.logger.debug("Running automated test")
testcase_module_filepath = self._get_testcase_module_filepath(testcase_module)
pycmd = ["--runpythontest", testcase_module_filepath, f"-pythontestcase={request.node.originalname}"]
pycmd = ["--runpythontest", testcase_module_filepath, f"-pythontestcase={request.node.name}"]
if use_null_renderer:
pycmd += ["-rhi=null"]
if batch_mode:

@ -1,44 +0,0 @@
"""
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
UI Apps: AutomatedTesting.GameLauncher
Launch AutomatedTesting.GameLauncher with Simple level
Test should run in both gpu and non gpu
"""
import pytest
import psutil
import ly_test_tools.environment.waiter as waiter
import editor_python_test_tools.hydra_test_utils as editor_test_utils
from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
from ly_remote_console.remote_console_commands import (
send_command_and_expect_response as send_command_and_expect_response,
)
@pytest.mark.parametrize("launcher_platform", ["windows"])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("level", ["Simple"])
@pytest.mark.SUITE_smoke
class TestRemoteConsoleLoadLevelWorks(object):
@pytest.fixture
def remote_console_instance(self, request):
console = RemoteConsole()
def teardown():
if console.connected:
console.stop()
request.addfinalizer(teardown)
return console
def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
expected_lines = ['Level system is loading "Simple"']
editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=True)

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e4937547ca4c486ef59656314401933217e0e0401fec103e1fb91c25ec60a177
size 2806
oid sha256:a5f9e27e0f22c31ca61d866fb594c6fde5b8ceb891e17dda075fa1e0033ec2b9
size 1666

@ -17,13 +17,6 @@
"Gems/PhysicsEntities"
]
},
"PhysXSamples":
{
"SourcePaths":
[
"Gems/PhysXSamples"
]
},
"PrimitiveAssets":
{
"SourcePaths":

@ -19,10 +19,16 @@ namespace Editor
if (GetIEditor()->IsInGameMode())
{
#ifdef PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
AzFramework::XcbEventHandlerBus::Broadcast(&AzFramework::XcbEventHandler::HandleXcbEvent, static_cast<xcb_generic_event_t*>(message));
// We need to handle RAW Input events in a separate loop. This is a workaround to enable XInput2 RAW Inputs using Editor mode.
// TODO To have this call here might be not be perfect.
AzFramework::XcbEventHandlerBus::Broadcast(&AzFramework::XcbEventHandler::PollSpecialEvents);
// Now handle the rest of the events.
AzFramework::XcbEventHandlerBus::Broadcast(
&AzFramework::XcbEventHandler::HandleXcbEvent, static_cast<xcb_generic_event_t*>(message));
#endif
return true;
}
return false;
}
}
} // namespace Editor

@ -287,21 +287,22 @@ bool CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT n
return false;
}
CCryEditDoc* CCryDocManager::OpenDocumentFile(const char* lpszFileName, bool bAddToMRU)
CCryEditDoc* CCryDocManager::OpenDocumentFile(const char* filename, bool addToMostRecentFileList, COpenSameLevelOptions openSameLevelOptions)
{
assert(lpszFileName != nullptr);
assert(filename != nullptr);
const bool reopenIfSame = openSameLevelOptions == COpenSameLevelOptions::ReopenLevelIfSame;
// find the highest confidence
auto pos = m_templateList.begin();
CCrySingleDocTemplate::Confidence bestMatch = CCrySingleDocTemplate::noAttempt;
CCrySingleDocTemplate* pBestTemplate = nullptr;
CCryEditDoc* pOpenDocument = nullptr;
if (lpszFileName[0] == '\"')
if (filename[0] == '\"')
{
++lpszFileName;
++filename;
}
QString szPath = QString::fromUtf8(lpszFileName);
QString szPath = QString::fromUtf8(filename);
if (szPath.endsWith('"'))
{
szPath.remove(szPath.length() - 1, 1);
@ -325,7 +326,7 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(const char* lpszFileName, bool bAd
}
}
if (pOpenDocument != nullptr)
if (!reopenIfSame && pOpenDocument != nullptr)
{
return pOpenDocument;
}
@ -336,7 +337,7 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(const char* lpszFileName, bool bAd
return nullptr;
}
return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, false);
return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), addToMostRecentFileList, false);
}
//////////////////////////////////////////////////////////////////////////////
@ -513,7 +514,7 @@ public:
QString m_appRoot;
QString m_logFile;
QString m_pythonArgs;
QString m_pythontTestCase;
QString m_pythonTestCase;
QString m_execFile;
QString m_execLineCmd;
@ -562,7 +563,7 @@ public:
const std::vector<std::pair<CommandLineStringOption, QString&> > stringOptions = {
{{"logfile", "File name of the log file to write out to.", "logfile"}, m_logFile},
{{"runpythonargs", "Command-line argument string to pass to the python script if --runpython or --runpythontest was used.", "runpythonargs"}, m_pythonArgs},
{{"pythontestcase", "Test case name of python test script if --runpythontest was used.", "pythontestcase"}, m_pythontTestCase},
{{"pythontestcase", "Test case name of python test script if --runpythontest was used.", "pythontestcase"}, m_pythonTestCase},
{{"exec", "cfg file to run on startup, used for systems like automation", "exec"}, m_execFile},
{{"rhi", "Command-line argument to force which rhi to use", "dummyString"}, dummyString },
{{"rhi-device-validation", "Command-line argument to configure rhi validation", "dummyString"}, dummyString },
@ -818,7 +819,7 @@ CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(const char* lpszPathName, b
return OpenDocumentFile(lpszPathName, true, bMakeVisible);
}
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(const char* lpszPathName, bool bAddToMRU, [[maybe_unused]] bool bMakeVisible)
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(const char* lpszPathName, bool addToMostRecentFileList, [[maybe_unused]] bool bMakeVisible)
{
CCryEditDoc* pCurDoc = GetIEditor()->GetDocument();
@ -848,7 +849,7 @@ CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(const char* lpszPathName, b
{
pCurDoc->OnOpenDocument(lpszPathName);
pCurDoc->SetPathName(lpszPathName);
if (bAddToMRU)
if (addToMostRecentFileList)
{
CCryEditApp::instance()->AddToRecentFileList(lpszPathName);
}
@ -1535,11 +1536,12 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
{
// Multiple testcases can be specified them with ';', these should match the files to run
AZStd::vector<AZStd::string_view> testcaseList;
QByteArray pythonTestCase = cmdInfo.m_pythonTestCase.toUtf8();
testcaseList.resize(fileList.size());
{
int i = 0;
AzFramework::StringFunc::TokenizeVisitor(
fileStr.constData(),
pythonTestCase.constData(),
[&i, &testcaseList](AZStd::string_view elem)
{
testcaseList[i++] = (elem);
@ -2630,7 +2632,7 @@ void CCryEditApp::OnShowHelpers()
void CCryEditApp::OnEditLevelData()
{
auto dir = QFileInfo(GetIEditor()->GetDocument()->GetLevelPathName()).dir();
CFileUtil::EditTextFile(dir.absoluteFilePath("LevelData.xml").toUtf8().data());
CFileUtil::EditTextFile(dir.absoluteFilePath("leveldata.xml").toUtf8().data());
}
//////////////////////////////////////////////////////////////////////////
@ -3364,7 +3366,7 @@ void CCryEditApp::OnOpenSlice()
}
//////////////////////////////////////////////////////////////////////////
CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* lpszFileName)
CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* filename, bool addToMostRecentFileList, COpenSameLevelOptions openSameLevelOptions)
{
if (m_openingLevel)
{
@ -3404,9 +3406,9 @@ CCryEditDoc* CCryEditApp::OpenDocumentFile(const char* lpszFileName)
openDocTraceHandler.SetShowWindow(false);
}
// in this case, we set bAddToMRU to always be true because adding files to the MRU list
// in this case, we set addToMostRecentFileList to always be true because adding files to the MRU list
// automatically culls duplicate and normalizes paths anyway
m_pDocManager->OpenDocumentFile(lpszFileName, true);
m_pDocManager->OpenDocumentFile(filename, addToMostRecentFileList, openSameLevelOptions);
if (openDocTraceHandler.HasAnyErrors())
{

@ -85,6 +85,12 @@ public:
using EditorIdleProcessingBus = AZ::EBus<EditorIdleProcessing>;
enum class COpenSameLevelOptions
{
ReopenLevelIfSame,
NotReopenIfSame
};
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
class SANDBOX_API CCryEditApp
@ -174,7 +180,9 @@ public:
virtual bool InitInstance();
virtual int ExitInstance(int exitCode = 0);
virtual bool OnIdle(LONG lCount);
virtual CCryEditDoc* OpenDocumentFile(const char* lpszFileName);
virtual CCryEditDoc* OpenDocumentFile(const char* filename,
bool addToMostRecentFileList=true,
COpenSameLevelOptions openSameLevelOptions = COpenSameLevelOptions::NotReopenIfSame);
CCryDocManager* GetDocManager() { return m_pDocManager; }
@ -448,7 +456,7 @@ public:
~CCrySingleDocTemplate() {};
// avoid creating another CMainFrame
// close other type docs before opening any things
virtual CCryEditDoc* OpenDocumentFile(const char* lpszPathName, bool bAddToMRU, bool bMakeVisible);
virtual CCryEditDoc* OpenDocumentFile(const char* lpszPathName, bool addToMostRecentFileList, bool bMakeVisible);
virtual CCryEditDoc* OpenDocumentFile(const char* lpszPathName, bool bMakeVisible = TRUE);
virtual Confidence MatchDocType(const char* lpszPathName, CCryEditDoc*& rpDocMatch);
@ -468,7 +476,7 @@ public:
virtual void OnFileNew();
virtual bool DoPromptFileName(QString& fileName, UINT nIDSTitle,
DWORD lFlags, bool bOpenFileDialog, CDocTemplate* pTemplate);
virtual CCryEditDoc* OpenDocumentFile(const char* lpszFileName, bool bAddToMRU);
virtual CCryEditDoc* OpenDocumentFile(const char* filename, bool addToMostRecentFileList, COpenSameLevelOptions openSameLevelOptions = COpenSameLevelOptions::NotReopenIfSame);
QVector<CCrySingleDocTemplate*> m_templateList;
};

@ -143,20 +143,11 @@ namespace
return false;
}
}
const bool addToMostRecentFileList = false;
auto newDocument = CCryEditApp::instance()->OpenDocumentFile(levelPath.toUtf8().data(),
addToMostRecentFileList, COpenSameLevelOptions::ReopenLevelIfSame);
auto previousDocument = GetIEditor()->GetDocument();
QString previousPathName = (previousDocument != nullptr) ? previousDocument->GetLevelPathName() : "";
auto newDocument = CCryEditApp::instance()->OpenDocumentFile(levelPath.toUtf8().data());
// the underlying document pointer doesn't change, so we can't check that; use the path name's instead
bool result = true;
if (newDocument == nullptr || newDocument->IsLevelLoadFailed() || (newDocument->GetLevelPathName() == previousPathName))
{
result = false;
}
return result;
return newDocument != nullptr && !newDocument->IsLevelLoadFailed();
}
bool PyOpenLevelNoPrompt(const char* pLevelName)
@ -407,6 +398,11 @@ inline namespace Commands
{
return AZ::Debug::Trace::WaitForDebugger(timeoutSeconds);
}
AZStd::string PyGetFileAlias(AZStd::string alias)
{
return AZ::IO::FileIOBase::GetInstance()->GetAlias(alias.c_str());
}
}
namespace AzToolsFramework
@ -457,6 +453,8 @@ namespace AzToolsFramework
addLegacyGeneral(behaviorContext->Method("attach_debugger", PyAttachDebugger, nullptr, "Prompts for attaching the debugger"));
addLegacyGeneral(behaviorContext->Method("wait_for_debugger", PyWaitForDebugger, behaviorContext->MakeDefaultValues(-1.f), "Pauses this thread execution until the debugger has been attached"));
addLegacyGeneral(behaviorContext->Method("get_file_alias", PyGetFileAlias, nullptr, "Retrieves path for IO alias"));
// this will put these methods into the 'azlmbr.legacy.checkout_dialog' module
auto addCheckoutDialog = [](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
{

@ -264,6 +264,9 @@ void EditorPreferencesDialog::SetFilter(const QString& filter)
else if (m_currentPageItem)
{
m_currentPageItem->UpdateEditorFilter(ui->propertyEditor, m_filter);
// Refresh the Stylesheet - when using search functionality.
AzQtComponents::StyleManager::repolishStyleSheet(this);
}
}

@ -14,6 +14,7 @@
// Editor
#include "Settings.h"
#include "EditorViewportSettings.h"
@ -43,17 +44,16 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Field("MaxCount", &AutoBackup::m_maxCount)
->Field("RemindTime", &AutoBackup::m_remindTime);
serialize.Class<AssetBrowserSearch>()
serialize.Class<AssetBrowserSettings>()
->Version(1)
->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
->Field("MaxEntriesShownCount", &AssetBrowserSettings::m_maxNumberOfItemsShownInSearch);
serialize.Class<CEditorPreferencesPage_Files>()
->Version(1)
->Field("Files", &CEditorPreferencesPage_Files::m_files)
->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup)
->Field("AssetBrowserSearch", &CEditorPreferencesPage_Files::m_assetBrowserSearch);
->Field("AssetBrowserSettings", &CEditorPreferencesPage_Files::m_assetBrowserSettings);
AZ::EditContext* editContext = serialize.GetEditContext();
if (editContext)
@ -85,9 +85,10 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Attribute(AZ::Edit::Attributes::Max, 100)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
"Maximum number of displayed items displayed in the Search View")
editContext->Class<AssetBrowserSettings>("Asset Browser Settings", "Asset Browser Settings")
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSettings::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
"Maximum number of items to display in the Search View.")
->Attribute(AZ::Edit::Attributes::Min, 50)
->Attribute(AZ::Edit::Attributes::Max, 5000);
@ -97,7 +98,7 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSearch, "Asset Browser Search", "Asset Browser Search");
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSettings, "Asset Browser Settings","Asset Browser Settings");
}
}
@ -117,6 +118,7 @@ QIcon& CEditorPreferencesPage_Files::GetIcon()
void CEditorPreferencesPage_Files::OnApply()
{
using namespace AzToolsFramework::SliceUtilities;
auto sliceSettings = AZ::UserSettings::CreateFind<SliceUserSettings>(AZ_CRC("SliceUserSettings", 0x055b32eb), AZ::UserSettings::CT_LOCAL);
sliceSettings->m_autoNumber = m_files.m_autoNumberSlices;
sliceSettings->m_saveLocation = m_files.m_saveLocation;
@ -137,7 +139,7 @@ void CEditorPreferencesPage_Files::OnApply()
gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
gSettings.autoRemindTime = m_autoBackup.m_remindTime;
gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
SandboxEditor::SetMaxItemsShownInAssetBrowserSearch(m_assetBrowserSettings.m_maxNumberOfItemsShownInSearch);
}
void CEditorPreferencesPage_Files::InitializeSettings()
@ -163,5 +165,5 @@ void CEditorPreferencesPage_Files::InitializeSettings()
m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
m_autoBackup.m_remindTime = gSettings.autoRemindTime;
m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
m_assetBrowserSettings.m_maxNumberOfItemsShownInSearch = SandboxEditor::MaxItemsShownInAssetBrowserSearch();
}

@ -69,18 +69,15 @@ private:
int m_remindTime;
};
struct AssetBrowserSearch
struct AssetBrowserSettings
{
AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
int m_maxNumberOfItemsShownInSearch;
AZ_TYPE_INFO(AssetBrowserSettings, "{5F407EC4-BBD1-4A87-92DB-D938D7127BB0}")
AZ::u64 m_maxNumberOfItemsShownInSearch;
};
Files m_files;
ExternalEditors m_editors;
AutoBackup m_autoBackup;
AssetBrowserSearch m_assetBrowserSearch;
AssetBrowserSettings m_assetBrowserSettings;
QIcon m_icon;
};

@ -75,7 +75,10 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook)
->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted)
->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX)
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY);
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY)
->Field("DefaultPositionX", &CameraMovementSettings::m_defaultCameraPositionX)
->Field("DefaultPositionY", &CameraMovementSettings::m_defaultCameraPositionY)
->Field("DefaultPositionZ", &CameraMovementSettings::m_defaultCameraPositionZ);
serialize.Class<CameraInputSettings>()
->Version(2)
@ -154,7 +157,16 @@ void CEditorPreferencesPage_ViewportCamera::Reflect(AZ::SerializeContext& serial
"Invert direction of pan in local Y axis")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor",
"Should the cursor be captured (hidden) while performing free look");
"Should the cursor be captured (hidden) while performing free look")
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionX, "Default X Camera Position",
"Default X Camera Position when a level is opened")
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionY, "Default Y Camera Position",
"Default Y Camera Position when a level is opened")
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_defaultCameraPositionZ, "Default Z Camera Position",
"Default Z Camera Position when a level is opened");
editContext->Class<CameraInputSettings>("Camera Input Settings", "")
->DataElement(
@ -271,6 +283,12 @@ void CEditorPreferencesPage_ViewportCamera::OnApply()
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted);
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX);
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY);
SandboxEditor::SetDefaultCameraEditorPosition(
AZ::Vector3(
m_cameraMovementSettings.m_defaultCameraPositionX,
m_cameraMovementSettings.m_defaultCameraPositionY,
m_cameraMovementSettings.m_defaultCameraPositionZ
));
SandboxEditor::SetCameraTranslateForwardChannelId(m_cameraInputSettings.m_translateForwardChannelId);
SandboxEditor::SetCameraTranslateBackwardChannelId(m_cameraInputSettings.m_translateBackwardChannelId);
@ -308,6 +326,11 @@ void CEditorPreferencesPage_ViewportCamera::InitializeSettings()
m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX();
m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY();
AZ::Vector3 defaultCameraPosition = SandboxEditor::DefaultEditorCameraPosition();
m_cameraMovementSettings.m_defaultCameraPositionX = defaultCameraPosition.GetX();
m_cameraMovementSettings.m_defaultCameraPositionY = defaultCameraPosition.GetY();
m_cameraMovementSettings.m_defaultCameraPositionZ = defaultCameraPosition.GetZ();
m_cameraInputSettings.m_translateForwardChannelId = SandboxEditor::CameraTranslateForwardChannelId().GetName();
m_cameraInputSettings.m_translateBackwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId().GetName();
m_cameraInputSettings.m_translateLeftChannelId = SandboxEditor::CameraTranslateLeftChannelId().GetName();

@ -57,6 +57,9 @@ private:
bool m_orbitYawRotationInverted;
bool m_panInvertedX;
bool m_panInvertedY;
float m_defaultCameraPositionX;
float m_defaultCameraPositionY;
float m_defaultCameraPositionZ;
AZ::Crc32 RotateSmoothingVisibility() const
{

@ -15,6 +15,7 @@
namespace SandboxEditor
{
constexpr AZStd::string_view AssetBrowserMaxItemsShownInSearchSetting = "/Amazon/Preferences/Editor/AssetBrowser/MaxItemsShowInSearch";
constexpr AZStd::string_view GridSnappingSetting = "/Amazon/Preferences/Editor/GridSnapping";
constexpr AZStd::string_view GridSizeSetting = "/Amazon/Preferences/Editor/GridSize";
constexpr AZStd::string_view AngleSnappingSetting = "/Amazon/Preferences/Editor/AngleSnapping";
@ -51,6 +52,9 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraOrbitDollyIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitDollyId";
constexpr AZStd::string_view CameraOrbitPanIdSetting = "/Amazon/Preferences/Editor/Camera/OrbitPanId";
constexpr AZStd::string_view CameraFocusIdSetting = "/Amazon/Preferences/Editor/Camera/FocusId";
constexpr AZStd::string_view CameraDefaultStartingPositionX = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/x";
constexpr AZStd::string_view CameraDefaultStartingPositionY = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/y";
constexpr AZStd::string_view CameraDefaultStartingPositionZ = "/Amazon/Preferences/Editor/Camera/DefaultStartingPosition/z";
template<typename T>
void SetRegistry(const AZStd::string_view setting, T&& value)
@ -110,6 +114,31 @@ namespace SandboxEditor
return AZStd::make_unique<EditorViewportSettingsCallbacksImpl>();
}
AZ::Vector3 DefaultEditorCameraPosition()
{
float xPosition = aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionX, 0.0));
float yPosition = aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionY, -10.0));
float zPosition = aznumeric_cast<float>(GetRegistry(CameraDefaultStartingPositionZ, 4.0));
return AZ::Vector3(xPosition, yPosition, zPosition);
}
void SetDefaultCameraEditorPosition(const AZ::Vector3 defaultCameraPosition)
{
SetRegistry(CameraDefaultStartingPositionX, defaultCameraPosition.GetX());
SetRegistry(CameraDefaultStartingPositionY, defaultCameraPosition.GetY());
SetRegistry(CameraDefaultStartingPositionZ, defaultCameraPosition.GetZ());
}
AZ::u64 MaxItemsShownInAssetBrowserSearch()
{
return GetRegistry(AssetBrowserMaxItemsShownInSearchSetting, aznumeric_cast<AZ::u64>(50));
}
void SetMaxItemsShownInAssetBrowserSearch(const AZ::u64 numberOfItemsShown)
{
SetRegistry(AssetBrowserMaxItemsShownInSearchSetting, numberOfItemsShown);
}
bool GridSnappingEnabled()
{
return GetRegistry(GridSnappingSetting, false);

@ -12,6 +12,7 @@
#include <AzCore/Settings/SettingsRegistry.h>
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzCore/Math/Vector3.h>
#include <AzFramework/Input/Channels/InputChannelId.h>
namespace SandboxEditor
@ -32,6 +33,12 @@ namespace SandboxEditor
//! event will fire when a value in the settings registry (editorpreferences.setreg) is modified.
SANDBOX_API AZStd::unique_ptr<EditorViewportSettingsCallbacks> CreateEditorViewportSettingsCallbacks();
SANDBOX_API AZ::Vector3 DefaultEditorCameraPosition();
SANDBOX_API void SetDefaultCameraEditorPosition(AZ::Vector3 defaultCameraPosition);
SANDBOX_API AZ::u64 MaxItemsShownInAssetBrowserSearch();
SANDBOX_API void SetMaxItemsShownInAssetBrowserSearch(AZ::u64 numberOfItemsShown);
SANDBOX_API bool GridSnappingEnabled();
SANDBOX_API void SetGridSnapping(bool enabled);

@ -112,7 +112,6 @@ void StartFixedCursorMode(QObject *viewport);
#define RENDER_MESH_TEST_DISTANCE (0.2f)
#define CURSOR_FONT_HEIGHT 8.0f
namespace AZ::ViewportHelpers
{
static const char TextCantCreateCameraNoLevel[] = "Cannot create camera when no level is loaded.";
@ -623,16 +622,10 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
PopDisableRendering();
{
AZ::Aabb terrainAabb = AZ::Aabb::CreateFromPoint(AZ::Vector3::CreateZero());
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainAabb, &AzFramework::Terrain::TerrainDataRequests::GetTerrainAabb);
float sx = terrainAabb.GetXExtent();
float sy = terrainAabb.GetYExtent();
Matrix34 viewTM;
viewTM.SetIdentity();
// Initial camera will be at middle of the map at the height of 2
// meters above the terrain (default terrain height is 32)
viewTM.SetTranslation(Vec3(sx * 0.5f, sy * 0.5f, 34.0f));
viewTM.SetTranslation(Vec3(m_editorViewportSettings.DefaultEditorCameraPosition()));
SetViewTM(viewTM);
UpdateScene();
@ -647,16 +640,10 @@ void EditorViewportWidget::OnEditorNotifyEvent(EEditorNotifyEvent event)
PopDisableRendering();
{
AZ::Aabb terrainAabb = AZ::Aabb::CreateFromPoint(AZ::Vector3::CreateZero());
AzFramework::Terrain::TerrainDataRequestBus::BroadcastResult(terrainAabb, &AzFramework::Terrain::TerrainDataRequests::GetTerrainAabb);
float sx = terrainAabb.GetXExtent();
float sy = terrainAabb.GetYExtent();
Matrix34 viewTM;
viewTM.SetIdentity();
// Initial camera will be at middle of the map at the height of 2
// meters above the terrain (default terrain height is 32)
viewTM.SetTranslation(Vec3(sx * 0.5f, sy * 0.5f, 34.0f));
viewTM.SetTranslation(Vec3(m_editorViewportSettings.DefaultEditorCameraPosition()));
SetViewTM(viewTM);
}
break;
@ -1345,10 +1332,6 @@ void EditorViewportWidget::keyPressEvent(QKeyEvent* event)
void EditorViewportWidget::SetViewTM(const Matrix34& tm)
{
if (m_viewSourceType == ViewSourceType::None)
{
m_defaultViewTM = tm;
}
SetViewTM(tm, false);
}
@ -1445,6 +1428,10 @@ void EditorViewportWidget::SetViewTM(const Matrix34& camMatrix, bool bMoveOnly)
"Please report this as a bug."
);
}
else if (shouldUpdateObject == ShouldUpdateObject::No)
{
GetCurrentAtomView()->SetCameraTransform(LYTransformToAZMatrix3x4(camMatrix));
}
if (m_pressedKeyState == KeyPressedState::PressedThisFrame)
{
@ -2028,6 +2015,9 @@ void EditorViewportWidget::SetDefaultCamera()
m_viewSourceType = ViewSourceType::None;
GetViewManager()->SetCameraObjectId(GUID_NULL);
SetName(m_defaultViewName);
// Set the default Editor Camera position.
m_defaultViewTM.SetTranslation(Vec3(m_editorViewportSettings.DefaultEditorCameraPosition()));
SetViewTM(m_defaultViewTM);
// Synchronize the configured editor viewport FOV to the default camera
@ -2530,6 +2520,11 @@ bool EditorViewportSettings::StickySelectEnabled() const
return SandboxEditor::StickySelectEnabled();
}
AZ::Vector3 EditorViewportSettings::DefaultEditorCameraPosition() const
{
return SandboxEditor::DefaultEditorCameraPosition();
}
AZ_CVAR_EXTERNED(bool, ed_previewGameInFullscreen_once);
bool EditorViewportWidget::ShouldPreviewFullscreen() const
@ -2641,5 +2636,4 @@ void EditorViewportWidget::StopFullscreenPreview()
// Show the main window
MainWindow::instance()->show();
}
#include <moc_EditorViewportWidget.cpp>

@ -78,6 +78,7 @@ struct EditorViewportSettings : public AzToolsFramework::ViewportInteraction::Vi
float ManipulatorLineBoundWidth() const override;
float ManipulatorCircleBoundWidth() const override;
bool StickySelectEnabled() const override;
AZ::Vector3 DefaultEditorCameraPosition() const override;
};
// EditorViewportWidget window

@ -31,11 +31,11 @@
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
//////////////////////////////////////////////////////////////////////////
#define MUSIC_LEVEL_LIBRARY_FILE "Music.xml"
#define MATERIAL_LEVEL_LIBRARY_FILE "Materials.xml"
#define RESOURCE_LIST_FILE "ResourceList.txt"
#define USED_RESOURCE_LIST_FILE "UsedResourceList.txt"
#define SHADER_LIST_FILE "ShadersList.txt"
#define MUSIC_LEVEL_LIBRARY_FILE "music.xml"
#define MATERIAL_LEVEL_LIBRARY_FILE "materials.xml"
#define RESOURCE_LIST_FILE "resourcelist.txt"
#define USED_RESOURCE_LIST_FILE "usedresourcelist.txt"
#define SHADER_LIST_FILE "shaderslist.txt"
#define GetAValue(rgb) ((BYTE)((rgb) >> 24))
@ -185,9 +185,9 @@ bool CGameExporter::Export(unsigned int flags, [[maybe_unused]] EEndian eExportE
ExportOcclusionMesh(sLevelPath.toUtf8().data());
//! Export Level data.
CLogFile::WriteLine("Exporting LevelData.xml");
CLogFile::WriteLine("Exporting leveldata.xml");
ExportLevelData(sLevelPath);
CLogFile::WriteLine("Exporting LevelData.xml done.");
CLogFile::WriteLine("Exporting leveldata.xml done.");
ExportLevelInfo(sLevelPath);
@ -266,26 +266,26 @@ void CGameExporter::ExportOcclusionMesh(const char* pszGamePath)
void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/)
{
IEditor* pEditor = GetIEditor();
pEditor->SetStatusText(QObject::tr("Exporting LevelData.xml..."));
pEditor->SetStatusText(QObject::tr("Exporting leveldata.xml..."));
char versionString[256];
pEditor->GetFileVersion().ToString(versionString);
XmlNodeRef root = XmlHelpers::CreateXmlNode("LevelData");
XmlNodeRef root = XmlHelpers::CreateXmlNode("leveldata");
root->setAttr("SandboxVersion", versionString);
XmlNodeRef rootAction = XmlHelpers::CreateXmlNode("LevelDataAction");
XmlNodeRef rootAction = XmlHelpers::CreateXmlNode("leveldataaction");
rootAction->setAttr("SandboxVersion", versionString);
//////////////////////////////////////////////////////////////////////////
// Save Level Data XML
//////////////////////////////////////////////////////////////////////////
QString levelDataFile = path + "LevelData.xml";
QString levelDataFile = path + "leveldata.xml";
XmlString xmlData = root->getXML();
CCryMemFile file;
file.Write(xmlData.c_str(), static_cast<unsigned int>(xmlData.length()));
m_levelPak.m_pakFile.UpdateFile(levelDataFile.toUtf8().data(), file);
QString levelDataActionFile = path + "LevelDataAction.xml";
QString levelDataActionFile = path + "leveldataaction.xml";
XmlString xmlDataAction = rootAction->getXML();
CCryMemFile fileAction;
fileAction.Write(xmlDataAction.c_str(), static_cast<unsigned int>(xmlDataAction.length()));
@ -298,7 +298,7 @@ void CGameExporter::ExportLevelData(const QString& path, bool /*bExportMission*/
if (savedEntities)
{
QString entitiesFile;
entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "Mission0");
entitiesFile = QStringLiteral("%1%2.entities_xml").arg(path, "mission0");
m_levelPak.m_pakFile.UpdateFile(entitiesFile.toUtf8().data(), entitySaveBuffer.begin(), static_cast<int>(entitySaveBuffer.size()));
}
}
@ -326,7 +326,7 @@ void CGameExporter::ExportLevelInfo(const QString& path)
//////////////////////////////////////////////////////////////////////////
// Save LevelInfo file.
//////////////////////////////////////////////////////////////////////////
QString filename = path + "LevelInfo.xml";
QString filename = path + "levelinfo.xml";
XmlString xmlData = root->getXML();
CCryMemFile file;

@ -38,6 +38,8 @@ namespace UnitTest
void BeginCursorCapture() override;
void EndCursorCapture() override;
bool IsMouseOver() const override;
void SetOverrideCursor(AzToolsFramework::ViewportInteraction::CursorStyleOverride cursorStyleOverride) override;
void ClearOverrideCursor() override;
private:
AzToolsFramework::QtEventToAzInputMapper* m_inputChannelMapper = nullptr;
@ -58,6 +60,17 @@ namespace UnitTest
return true;
}
void ViewportMouseCursorRequestImpl::SetOverrideCursor(
[[maybe_unused]] AzToolsFramework::ViewportInteraction::CursorStyleOverride cursorStyleOverride)
{
// noop
}
void ViewportMouseCursorRequestImpl::ClearOverrideCursor()
{
// noop
}
class ModularViewportCameraControllerFixture : public AllocatorsTestFixture
{
public:

@ -108,15 +108,11 @@ CObjectManager::CObjectManager()
m_objectsByName.reserve(1024);
LoadRegistry();
AzToolsFramework::ViewportEditorModeNotificationsBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId());
}
//////////////////////////////////////////////////////////////////////////
CObjectManager::~CObjectManager()
{
AzToolsFramework::ViewportEditorModeNotificationsBus::Handler::BusDisconnect();
m_bExiting = true;
SaveRegistry();
DeleteAllObjects();
@ -2307,37 +2303,6 @@ void CObjectManager::SelectObjectInRect(CBaseObject* pObj, CViewport* view, HitC
}
}
void CObjectManager::OnEditorModeActivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
// hide current gizmo for entity (translate/rotate/scale)
IGizmoManager* gizmoManager = GetGizmoManager();
const size_t gizmoCount = static_cast<size_t>(gizmoManager->GetGizmoCount());
for (size_t i = 0; i < gizmoCount; ++i)
{
gizmoManager->RemoveGizmo(gizmoManager->GetGizmoByIndex(static_cast<int>(i)));
}
}
}
void CObjectManager::OnEditorModeDeactivated(
[[maybe_unused]] const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode)
{
if (mode == AzToolsFramework::ViewportEditorMode::Component)
{
// show translate/rotate/scale gizmo again
if (IGizmoManager* gizmoManager = GetGizmoManager())
{
if (CBaseObject* selectedObject = GetIEditor()->GetSelectedObject())
{
gizmoManager->AddGizmo(new CAxisGizmo(selectedObject));
}
}
}
}
//////////////////////////////////////////////////////////////////////////
namespace
{

@ -20,7 +20,6 @@
#include "ObjectManagerEventBus.h"
#include <AzCore/std/smart_ptr/unique_ptr.h>
#include <AzToolsFramework/API/ViewportEditorModeTrackerNotificationBus.h>
#include <AzCore/EBus/EBus.h>
#include <AzCore/Component/Component.h>
#include <Include/SandboxAPI.h>
@ -59,7 +58,6 @@ public:
*/
class CObjectManager
: public IObjectManager
, private AzToolsFramework::ViewportEditorModeNotificationsBus::Handler
{
public:
//! Selection functor callback.
@ -330,12 +328,6 @@ private:
void FindDisplayableObjects(DisplayContext& dc, bool bDisplay);
// ViewportEditorModeNotificationsBus overrides ...
void OnEditorModeActivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
void OnEditorModeDeactivated(
const AzToolsFramework::ViewportEditorModesInterface& editorModeState, AzToolsFramework::ViewportEditorMode mode) override;
private:
typedef std::map<GUID, CBaseObjectPtr, guid_less_predicate> Objects;
Objects m_objects;

@ -10,6 +10,7 @@
#include "EditorDefs.h"
#include "Settings.h"
#include "EditorViewportSettings.h"
// Qt
#include <QGuiApplication>
@ -487,7 +488,6 @@ void SEditorSettings::Save()
SaveValue("Settings", "AutoBackupTime", autoBackupTime);
SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
SaveValue("Settings", "AutoRemindTime", autoRemindTime);
SaveValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
SaveValue("Settings", "StylusMode", stylusMode);
@ -682,7 +682,6 @@ void SEditorSettings::Load()
LoadValue("Settings", "AutoBackupTime", autoBackupTime);
LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
LoadValue("Settings", "AutoRemindTime", autoRemindTime);
LoadValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
LoadValue("Settings", "StylusMode", stylusMode);
@ -1174,7 +1173,7 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
return consoleBackgroundColorTheme;
}
int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
AZ::u64 SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
{
return SEditorSettings::maxNumberOfItemsShownInSearch;
return SandboxEditor::MaxItemsShownInAssetBrowserSearch();
}

@ -279,7 +279,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
SettingOutcome GetValue(const AZStd::string_view path) override;
SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
int GetMaxNumberOfItemsShownInSearchView() const override;
AZ::u64 GetMaxNumberOfItemsShownInSearchView() const override;
void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);
@ -353,14 +353,6 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
int autoRemindTime;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Asset Browser Search View.
//////////////////////////////////////////////////////////////////////////
//! Current maximum number of items that can be displayed in the AssetBrowser Search View.
int maxNumberOfItemsShownInSearch;
//////////////////////////////////////////////////////////////////////////
//! If true preview windows is displayed when browsing geometries.
bool bPreviewGeometryWindow;

@ -192,82 +192,101 @@ namespace AZ
};
//! SettingsRegistry notifier handler which updates relevant registry settings based
//! on an update to '/Amazon/AzCore/Bootstrap/project_path' key.
struct UpdateProjectSettingsEventHandler
//! SettingsRegistry notifier handler which is responsible for loading
//! the project.json file at the new project path
//! if an update to '<BootstrapSettingsRootKey>/project_path' key occurs.
struct ProjectPathChangedEventHandler
{
UpdateProjectSettingsEventHandler(AZ::SettingsRegistryInterface& registry, AZ::CommandLine& commandLine)
ProjectPathChangedEventHandler(AZ::SettingsRegistryInterface& registry)
: m_registry{ registry }
, m_commandLine{ commandLine }
{
}
void operator()(AZStd::string_view path, AZ::SettingsRegistryInterface::Type)
{
// Update the project settings when the project path is set
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;
// #1 Update the project settings when the project path is set
const auto projectPathKey = FixedValueString(AZ::SettingsRegistryMergeUtils::BootstrapSettingsRootKey) + "/project_path";
AZ::IO::FixedMaxPath newProjectPath;
if (SettingsRegistryMergeUtils::IsPathAncestorDescendantOrEqual(projectPathKey, path)
&& m_registry.Get(newProjectPath.Native(), projectPathKey) && newProjectPath != m_oldProjectPath)
{
UpdateProjectSettingsFromProjectPath(AZ::IO::PathView(newProjectPath));
// Update old Project path before attempting to merge in new Settings Registry values in order to prevent recursive calls
m_oldProjectPath = newProjectPath;
// Merge the project.json file into settings registry under ProjectSettingsRootKey path.
AZ::IO::FixedMaxPath projectMetadataFile{ AZ::SettingsRegistryMergeUtils::FindEngineRoot(m_registry) / newProjectPath };
projectMetadataFile /= "project.json";
m_registry.MergeSettingsFile(projectMetadataFile.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch, AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey);
// Update all the runtime file paths based on the new "project_path" value.
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry);
}
}
private:
AZ::IO::FixedMaxPath m_oldProjectPath;
AZ::SettingsRegistryInterface& m_registry;
};
// #2 Update the project specialization when the project name is set
//! SettingsRegistry notifier handler which adds the project name as a specialization tag
//! to the registry
//! if an update to '<ProjectSettingsRootKey>/project_name' key occurs.
struct ProjectNameChangedEventHandler
{
ProjectNameChangedEventHandler(AZ::SettingsRegistryInterface& registry)
: m_registry{ registry }
{
}
void operator()(AZStd::string_view path, AZ::SettingsRegistryInterface::Type)
{
// Update the project specialization when the project name is set
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;
const auto projectNameKey = FixedValueString(AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey) + "/project_name";
FixedValueString newProjectName;
if (SettingsRegistryMergeUtils::IsPathAncestorDescendantOrEqual(projectNameKey, path)
&& m_registry.Get(newProjectName, projectNameKey) && newProjectName != m_oldProjectName)
{
UpdateProjectSpecializationFromProjectName(newProjectName);
}
// #3 Update the ComponentApplication CommandLine instance when the command line settings are merged into the Settings Registry
if (path == AZ::SettingsRegistryMergeUtils::CommandLineValueChangedKey)
{
UpdateCommandLine();
// Add the project_name as a specialization for loading the build system dependency .setreg files
auto newProjectNameSpecialization = FixedValueString::format("%s/%.*s", AZ::SettingsRegistryMergeUtils::SpecializationsRootKey,
aznumeric_cast<int>(newProjectName.size()), newProjectName.data());
auto oldProjectNameSpecialization = FixedValueString::format("%s/%s", AZ::SettingsRegistryMergeUtils::SpecializationsRootKey,
m_oldProjectName.c_str());
m_registry.Remove(oldProjectNameSpecialization);
m_oldProjectName = newProjectName;
m_registry.Set(newProjectNameSpecialization, true);
}
}
//! Add the project name as a specialization underneath the /Amazon/AzCore/Settings/Specializations path
//! and remove the current project name specialization if one exists.
void UpdateProjectSpecializationFromProjectName(AZStd::string_view newProjectName)
{
using FixedValueString = AZ::SettingsRegistryInterface::FixedValueString;
// Add the project_name as a specialization for loading the build system dependency .setreg files
auto newProjectNameSpecialization = FixedValueString::format("%s/%.*s", AZ::SettingsRegistryMergeUtils::SpecializationsRootKey,
aznumeric_cast<int>(newProjectName.size()), newProjectName.data());
auto oldProjectNameSpecialization = FixedValueString::format("%s/%s", AZ::SettingsRegistryMergeUtils::SpecializationsRootKey,
m_oldProjectName.c_str());
m_registry.Remove(oldProjectNameSpecialization);
m_oldProjectName = newProjectName;
m_registry.Set(newProjectNameSpecialization, true);
}
private:
AZ::SettingsRegistryInterface::FixedValueString m_oldProjectName;
AZ::SettingsRegistryInterface& m_registry;
};
void UpdateProjectSettingsFromProjectPath(AZ::IO::PathView newProjectPath)
//! SettingsRegistry notifier handler which updates relevant registry settings based
//! on an update to '/Amazon/AzCore/Bootstrap/project_path' key.
struct UpdateCommandLineEventHandler
{
UpdateCommandLineEventHandler(AZ::SettingsRegistryInterface& registry, AZ::CommandLine& commandLine)
: m_registry{ registry }
, m_commandLine{ commandLine }
{
// Update old Project path before attempting to merge in new Settings Registry values in order to prevent recursive calls
m_oldProjectPath = newProjectPath;
// Merge the project.json file into settings registry under ProjectSettingsRootKey path.
AZ::IO::FixedMaxPath projectMetadataFile{ AZ::SettingsRegistryMergeUtils::FindEngineRoot(m_registry) / newProjectPath };
projectMetadataFile /= "project.json";
m_registry.MergeSettingsFile(projectMetadataFile.Native(),
AZ::SettingsRegistryInterface::Format::JsonMergePatch, AZ::SettingsRegistryMergeUtils::ProjectSettingsRootKey);
// Update all the runtime file paths based on the new "project_path" value.
AZ::SettingsRegistryMergeUtils::MergeSettingsToRegistry_AddRuntimeFilePaths(m_registry);
}
void UpdateCommandLine()
void operator()(AZStd::string_view path, AZ::SettingsRegistryInterface::Type)
{
AZ::SettingsRegistryMergeUtils::GetCommandLineFromRegistry(m_registry, m_commandLine);
// Update the ComponentApplication CommandLine instance when the command line settings are merged into the Settings Registry
if (path == AZ::SettingsRegistryMergeUtils::CommandLineValueChangedKey)
{
AZ::SettingsRegistryMergeUtils::GetCommandLineFromRegistry(m_registry, m_commandLine);
}
}
private:
AZ::IO::FixedMaxPath m_oldProjectPath;
AZ::SettingsRegistryInterface::FixedValueString m_oldProjectName;
AZ::SettingsRegistryInterface& m_registry;
AZ::CommandLine& m_commandLine;
};
@ -462,7 +481,12 @@ namespace AZ
// 1. The 'project_path' key changes
// 2. The project specialization when the 'project-name' key changes
// 3. The ComponentApplication command line when the command line is stored to the registry
m_projectChangedHandler = m_settingsRegistry->RegisterNotifier(UpdateProjectSettingsEventHandler{ *m_settingsRegistry, m_commandLine });
m_projectPathChangedHandler = m_settingsRegistry->RegisterNotifier(ProjectPathChangedEventHandler{
*m_settingsRegistry });
m_projectNameChangedHandler = m_settingsRegistry->RegisterNotifier(ProjectNameChangedEventHandler{
*m_settingsRegistry });
m_commandLineUpdatedHandler = m_settingsRegistry->RegisterNotifier(UpdateCommandLineEventHandler{
*m_settingsRegistry, m_commandLine });
// Merge Command Line arguments
constexpr bool executeRegDumpCommands = false;
@ -515,11 +539,12 @@ namespace AZ
Destroy();
}
// The m_projectChangedHandler stores an AZStd::function internally
// which allocates using the AZ SystemAllocator
// m_projectChangedHandler is being default value initialized
// to clear out the AZStd::function
m_projectChangedHandler = {};
// The SettingsRegistry Notify handlers stores an AZStd::function internally
// which may allocates using the AZ SystemAllocator(if the functor > 16 bytes)
// The handlers are being default value initialized to clear out the AZStd::function
m_commandLineUpdatedHandler = {};
m_projectNameChangedHandler = {};
m_projectPathChangedHandler = {};
// Delete the AZ::IConsole if it was created by this application instance
if (m_ownsConsole)

@ -390,7 +390,9 @@ namespace AZ
AZ::IO::FixedMaxPath m_engineRoot;
AZ::IO::FixedMaxPath m_appRoot;
AZ::SettingsRegistryInterface::NotifyEventHandler m_projectChangedHandler;
AZ::SettingsRegistryInterface::NotifyEventHandler m_projectPathChangedHandler;
AZ::SettingsRegistryInterface::NotifyEventHandler m_projectNameChangedHandler;
AZ::SettingsRegistryInterface::NotifyEventHandler m_commandLineUpdatedHandler;
// ConsoleFunctorHandle is responsible for unregistering the Settings Registry Console
// from the m_console member when it goes out of scope

@ -225,8 +225,16 @@ namespace AZ
ConsoleCommandContainer commandSubset;
for (ConsoleFunctorBase* curr = m_head; curr != nullptr; curr = curr->m_next)
for (const auto& functor : m_commands)
{
if (functor.second.empty())
{
continue;
}
// Filter functors registered with the same name
const ConsoleFunctorBase* curr = functor.second.front();
if ((curr->GetFlags() & ConsoleFunctorFlags::IsInvisible) == ConsoleFunctorFlags::IsInvisible)
{
// Filter functors marked as invisible
@ -236,7 +244,12 @@ namespace AZ
if (StringFunc::StartsWith(curr->m_name, command, false))
{
AZLOG_INFO("- %s : %s\n", curr->m_name, curr->m_desc);
commandSubset.push_back(curr->m_name);
if (commandSubset.size() < MaxConsoleCommandPlusArgsLength)
{
commandSubset.push_back(curr->m_name);
}
if (matches)
{
matches->push_back(curr->m_name);
@ -271,7 +284,10 @@ namespace AZ
{
for (auto& curr : m_commands)
{
visitor(curr.second.front());
if (!curr.second.empty())
{
visitor(curr.second.front());
}
}
}
@ -336,6 +352,11 @@ namespace AZ
{
iter->second.erase(iter2);
}
if (iter->second.empty())
{
m_commands.erase(iter);
}
}
functor->Unlink(m_head);
functor->m_console = nullptr;
@ -618,9 +639,10 @@ namespace AZ
{
// Make sure the there is a JSON object at the ConsoleRuntimeCommandKey or ConsoleAutoexecKey
// So that JSON Patch is able to add values underneath that object (JSON Patch doesn't create intermediate objects)
settingsRegistry.MergeSettings(R"({ "Amazon": { "AzCore": { "Runtime": { "ConsoleCommands": {} } } })"
R"(,"O3DE": { "Autoexec": { "ConsoleCommands": {} } } })",
SettingsRegistryInterface::Format::JsonMergePatch);
settingsRegistry.MergeSettings(R"({})", SettingsRegistryInterface::Format::JsonMergePatch,
IConsole::ConsoleRuntimeCommandKey);
settingsRegistry.MergeSettings(R"({})", SettingsRegistryInterface::Format::JsonMergePatch,
IConsole::ConsoleAutoexecCommandKey);
m_consoleCommandKeyHandler = settingsRegistry.RegisterNotifier(ConsoleCommandKeyNotificationHandler{ settingsRegistry, *this });
JsonApplyPatchSettings applyPatchSettings;

@ -40,6 +40,12 @@ namespace AZ
static unsigned int Record(StackFrame* frames, unsigned int maxNumOfFrames, unsigned int suppressCount = 0, void* nativeThread = 0);
};
class StackConverter
{
public:
static unsigned int FromNative(StackFrame* frames, unsigned int maxNumOfFrames, void* nativeContext);
};
class SymbolStorage
{
public:

@ -31,6 +31,8 @@ namespace AZ
{
namespace Debug
{
struct StackFrame;
namespace Platform
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
@ -551,17 +553,19 @@ namespace AZ
{
StackFrame frames[25];
// Without StackFrame explicit alignment frames array is aligned to 4 bytes
// which causes the stack tracing to fail.
//size_t bla = AZStd::alignment_of<StackFrame>::value;
//printf("Alignment value %d address 0x%08x : 0x%08x\n",bla,frames);
SymbolStorage::StackLine lines[AZ_ARRAY_SIZE(frames)];
unsigned int numFrames = 0;
if (!nativeContext)
{
suppressCount += 1; /// If we don't provide a context we will capture in the RecordFunction, so skip us (Trace::PrinCallstack).
suppressCount += 1; /// If we don't provide a context we will capture in the RecordFunction, so skip us (Trace::PrintCallstack).
numFrames = StackRecorder::Record(frames, AZ_ARRAY_SIZE(frames), suppressCount);
}
unsigned int numFrames = StackRecorder::Record(frames, AZ_ARRAY_SIZE(frames), suppressCount, nativeContext);
else
{
numFrames = StackConverter::FromNative(frames, AZ_ARRAY_SIZE(frames), nativeContext);
}
if (numFrames)
{
SymbolStorage::DecodeFrames(frames, numFrames, lines);
@ -573,7 +577,9 @@ namespace AZ
}
azstrcat(lines[i], AZ_ARRAY_SIZE(lines[i]), "\n");
AZ_Printf(window, "%s", lines[i]); // feed back into the trace system so that listeners can get it.
// Use Output instead of AZ_Printf to be consistent with the exception output code and avoid
// this accidentally being suppressed as a normal message
Output(window, lines[i]);
}
}
}

@ -192,26 +192,34 @@ namespace AZ
//! @param path An offset at which traversal should start.
//! @return Whether or not entries could be visited.
virtual bool Visit(const VisitorCallback& callback, AZStd::string_view path) const = 0;
//! Register a callback that will be called whenever an entry gets a new/updated value.
//!
//! @callback The function to call when an entry gets a new/updated value.
[[nodiscard]] virtual NotifyEventHandler RegisterNotifier(const NotifyCallback& callback) = 0;
//! Register a callback that will be called whenever an entry gets a new/updated value.
//! @callback The function to call when an entry gets a new/updated value.
[[nodiscard]] virtual NotifyEventHandler RegisterNotifier(NotifyCallback&& callback) = 0;
//! @return NotifyEventHandler instance which must persist to receive event signal
[[nodiscard]] virtual NotifyEventHandler RegisterNotifier(NotifyCallback callback) = 0;
//! Register a notify event handler with the NotifyEvent.
//! The handler will be called whenever an entry gets a new/updated value.
//! @param handler The handler to register with the NotifyEvent.
virtual void RegisterNotifier(NotifyEventHandler& handler) = 0;
//! Register a function that will be called before a file is merged.
//! @callback The function to call before a file is merged.
[[nodiscard]] virtual PreMergeEventHandler RegisterPreMergeEvent(const PreMergeEventCallback& callback) = 0;
//! Register a function that will be called before a file is merged.
//! @callback The function to call before a file is merged.
[[nodiscard]] virtual PreMergeEventHandler RegisterPreMergeEvent(PreMergeEventCallback&& callback) = 0;
//! @param callback The function to call before a file is merged.
//! @return PreMergeEventHandler instance which must persist to receive event signal
[[nodiscard]] virtual PreMergeEventHandler RegisterPreMergeEvent(PreMergeEventCallback callback) = 0;
//! Register a pre-merge handler with the PreMergeEvent.
//! The handler will be called before a file is merged.
//! @param handler The hanlder to register with the PreMergeEvent.
virtual void RegisterPreMergeEvent(PreMergeEventHandler& handler) = 0;
//! Register a function that will be called after a file is merged.
//! @callback The function to call after a file is merged.
[[nodiscard]] virtual PostMergeEventHandler RegisterPostMergeEvent(const PostMergeEventCallback& callback) = 0;
//! Register a function that will be called after a file is merged.
//! @callback The function to call after a file is merged.
[[nodiscard]] virtual PostMergeEventHandler RegisterPostMergeEvent(PostMergeEventCallback&& callback) = 0;
//! @param callback The function to call after a file is merged.
//! @return PostMergeEventHandler instance which must persist to receive event signal
[[nodiscard]] virtual PostMergeEventHandler RegisterPostMergeEvent(PostMergeEventCallback callback) = 0;
//! Register a post-merge hahndler with the PostMergeEvent.
//! The handler will be called after a file is merged.
//! @param handler The handler to register with the PostmergeEVent.
virtual void RegisterPostMergeEvent(PostMergeEventHandler& hanlder) = 0;
//! Gets the boolean value at the provided path.
//! @param result The target to write the result to.
@ -326,23 +334,25 @@ namespace AZ
//! - all digits and dot -> floating point number
//! - Everything else is considered a string.
//! @param argument The command line argument.
//! @param structure which contains functors which determine what characters are delimiters
//! @param anchorKey The key where the merged command line argument will be anchored under
//! @param commandLineSettings structure which contains functors which determine what characters are delimiters
//! @return True if the command line argument could be parsed, otherwise false.
virtual bool MergeCommandLineArgument(AZStd::string_view argument, AZStd::string_view rootKey = "",
virtual bool MergeCommandLineArgument(AZStd::string_view argument, AZStd::string_view anchorKey = "",
const CommandLineArgumentSettings& commandLineSettings = {}) = 0;
//! Merges the json data provided into the settings registry.
//! @param data The json data stored in a string.
//! @param format The format of the provided data.
//! @param anchorKey The key where the merged json content will be anchored under.
//! @return True if the data was successfully merged, otherwise false.
virtual bool MergeSettings(AZStd::string_view data, Format format) = 0;
virtual bool MergeSettings(AZStd::string_view data, Format format, AZStd::string_view anchorKey = "") = 0;
//! Loads a settings file and merges it into the registry.
//! @param path The path to the registry file.
//! @param format The format of the text data in the file at the provided path.
//! @param rootKey The key where the root of the settings file will be stored under.
//! @param anchorKey The key where the content of the settings file will be anchored.
//! @param scratchBuffer An optional buffer that's used to load the file into. Use this when loading multiple patches to
//! reduce the number of intermediate memory allocations.
//! @return True if the registry file was successfully merged, otherwise false.
virtual bool MergeSettingsFile(AZStd::string_view path, Format format, AZStd::string_view rootKey = "",
virtual bool MergeSettingsFile(AZStd::string_view path, Format format, AZStd::string_view anchorKey = "",
AZStd::vector<char>* scratchBuffer = nullptr) = 0;
//! Loads all settings files in a folder and merges them into the registry.
//! With the specializations "a" and "b" and platform "c" the files would be loaded in the order:
@ -357,11 +367,12 @@ namespace AZ
//! @param platform An optional name of a platform. Platform overloads are located at <path>/Platform/<platform>/
//! Files in a platform are applied in the same order as for the main folder but always after the same file
//! in the main folder.
//! @param anchorKey The registry path location where the settings will be anchored
//! @param scratchBuffer An optional buffer that's used to load the file into. Use this when loading multiple patches to
//! reduce the number of intermediate memory allocations.
//! @return True if the registry folder was successfully merged, otherwise false.
virtual bool MergeSettingsFolder(AZStd::string_view path, const Specializations& specializations,
AZStd::string_view platform = {}, AZStd::string_view rootKey = "", AZStd::vector<char>* scratchBuffer = nullptr) = 0;
AZStd::string_view platform = {}, AZStd::string_view anchorKey = "", AZStd::vector<char>* scratchBuffer = nullptr) = 0;
//! Stores the settings structure which is used when merging settings to the Settings Registry
//! using JSON Merge Patch or JSON Merge Patch.

@ -13,7 +13,7 @@
#include <AzCore/IO/FileReader.h>
#include <AzCore/IO/Path/Path.h>
#include <AzCore/JSON/error/en.h>
#include <AzCore/NativeUI//NativeUIRequests.h>
#include <AzCore/NativeUI/NativeUIRequests.h>
#include <AzCore/Serialization/Json/JsonSerialization.h>
#include <AzCore/Serialization/Json/StackedString.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
@ -21,6 +21,34 @@
#include <AzCore/std/sort.h>
#include <AzCore/std/parallel/scoped_lock.h>
namespace AZ::SettingsRegistryImplInternal
{
AZ::SettingsRegistryInterface::Type RapidjsonToSettingsRegistryType(const rapidjson::Value& value)
{
using Type = AZ::SettingsRegistryInterface::Type;
switch (value.GetType())
{
case rapidjson::Type::kNullType:
return Type::Null;
case rapidjson::Type::kFalseType:
return Type::Boolean;
case rapidjson::Type::kTrueType:
return Type::Boolean;
case rapidjson::Type::kObjectType:
return Type::Object;
case rapidjson::Type::kArrayType:
return Type::Array;
case rapidjson::Type::kStringType:
return Type::String;
case rapidjson::Type::kNumberType:
return value.IsDouble() ? Type::FloatingPoint :
Type::Integer;
}
return Type::NoType;
}
}
namespace AZ
{
template<typename T>
@ -28,7 +56,7 @@ namespace AZ
{
if (path.empty())
{
// rapidjson::Pointer assets that the supplied string
// rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
@ -70,7 +98,7 @@ namespace AZ
{
if (path.empty())
{
// rapidjson::Pointer assets that the supplied string
// rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
@ -161,7 +189,7 @@ namespace AZ
{
if (path.empty())
{
// rapidjson::Pointer assets that the supplied string
// rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
@ -212,9 +240,9 @@ namespace AZ
return Visit(visitor, path);
}
auto SettingsRegistryImpl::RegisterNotifier(const NotifyCallback& callback) -> NotifyEventHandler
auto SettingsRegistryImpl::RegisterNotifier(NotifyCallback callback) -> NotifyEventHandler
{
NotifyEventHandler notifyHandler{ callback };
NotifyEventHandler notifyHandler{ AZStd::move(callback) };
{
AZStd::scoped_lock lock(m_notifierMutex);
notifyHandler.Connect(m_notifiers);
@ -222,14 +250,10 @@ namespace AZ
return notifyHandler;
}
auto SettingsRegistryImpl::RegisterNotifier(NotifyCallback&& callback) -> NotifyEventHandler
auto SettingsRegistryImpl::RegisterNotifier(NotifyEventHandler& notifyHandler) -> void
{
NotifyEventHandler notifyHandler{ AZStd::move(callback) };
{
AZStd::scoped_lock lock(m_notifierMutex);
notifyHandler.Connect(m_notifiers);
}
return notifyHandler;
AZStd::scoped_lock lock(m_notifierMutex);
notifyHandler.Connect(m_notifiers);
}
void SettingsRegistryImpl::ClearNotifiers()
@ -238,9 +262,9 @@ namespace AZ
m_notifiers.DisconnectAllHandlers();
}
auto SettingsRegistryImpl::RegisterPreMergeEvent(const PreMergeEventCallback& callback) -> PreMergeEventHandler
auto SettingsRegistryImpl::RegisterPreMergeEvent(PreMergeEventCallback callback) -> PreMergeEventHandler
{
PreMergeEventHandler preMergeHandler{ callback };
PreMergeEventHandler preMergeHandler{ AZStd::move(callback) };
{
AZStd::scoped_lock lock(m_settingMutex);
preMergeHandler.Connect(m_preMergeEvent);
@ -248,19 +272,15 @@ namespace AZ
return preMergeHandler;
}
auto SettingsRegistryImpl::RegisterPreMergeEvent(PreMergeEventCallback&& callback) -> PreMergeEventHandler
auto SettingsRegistryImpl::RegisterPreMergeEvent(PreMergeEventHandler& preMergeHandler) -> void
{
PreMergeEventHandler preMergeHandler{ AZStd::move(callback) };
{
AZStd::scoped_lock lock(m_settingMutex);
preMergeHandler.Connect(m_preMergeEvent);
}
return preMergeHandler;
AZStd::scoped_lock lock(m_settingMutex);
preMergeHandler.Connect(m_preMergeEvent);
}
auto SettingsRegistryImpl::RegisterPostMergeEvent(const PostMergeEventCallback& callback) -> PostMergeEventHandler
auto SettingsRegistryImpl::RegisterPostMergeEvent(PostMergeEventCallback callback) -> PostMergeEventHandler
{
PostMergeEventHandler postMergeHandler{ callback };
PostMergeEventHandler postMergeHandler{ AZStd::move(callback) };
{
AZStd::scoped_lock lock(m_settingMutex);
postMergeHandler.Connect(m_postMergeEvent);
@ -268,14 +288,10 @@ namespace AZ
return postMergeHandler;
}
auto SettingsRegistryImpl::RegisterPostMergeEvent(PostMergeEventCallback&& callback) -> PostMergeEventHandler
auto SettingsRegistryImpl::RegisterPostMergeEvent(PostMergeEventHandler& postMergeHandler) -> void
{
PostMergeEventHandler postMergeHandler{ AZStd::move(callback) };
{
AZStd::scoped_lock lock(m_settingMutex);
postMergeHandler.Connect(m_postMergeEvent);
}
return postMergeHandler;
AZStd::scoped_lock lock(m_settingMutex);
postMergeHandler.Connect(m_postMergeEvent);
}
void SettingsRegistryImpl::ClearMergeEvents()
@ -297,7 +313,36 @@ namespace AZ
localNotifierEvent = AZStd::move(m_notifiers);
}
localNotifierEvent.Signal(jsonPath, type);
// Signal the NotifyEvent for each queued argument
decltype(m_signalNotifierQueue) localNotifierQueue;
{
AZStd::scoped_lock signalLock(m_signalMutex);
m_signalNotifierQueue.push_back({ FixedValueString{jsonPath}, type });
// If the signal count was 0, then a dispatch is in progress
if (m_signalCount++ == 0)
{
AZStd::swap(localNotifierQueue, m_signalNotifierQueue);
}
}
while (!localNotifierQueue.empty())
{
for (SignalNotifierArgs notifierArgs : localNotifierQueue)
{
localNotifierEvent.Signal(notifierArgs.m_jsonPath, notifierArgs.m_type);
}
// Clear the local notifier queue and check if more notifiers have been added
localNotifierQueue = {};
{
AZStd::scoped_lock signalLock(m_signalMutex);
AZStd::swap(localNotifierQueue, m_signalNotifierQueue);
}
}
{
AZStd::scoped_lock signalLock(m_signalMutex);
--m_signalCount;
}
{
// Swap the local handlers with the current m_notifiers which
@ -314,39 +359,19 @@ namespace AZ
{
if (path.empty())
{
//rapidjson::Pointer assets that the supplied string
//rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
}
rapidjson::Pointer pointer(path.data(), path.length());
if (pointer.IsValid())
{
AZStd::scoped_lock lock(m_settingMutex);
const rapidjson::Value* value = pointer.Get(m_settings);
if (value)
if (const rapidjson::Value* value = pointer.Get(m_settings); value != nullptr)
{
switch (value->GetType())
{
case rapidjson::Type::kNullType:
return Type::Null;
case rapidjson::Type::kFalseType:
return Type::Boolean;
case rapidjson::Type::kTrueType:
return Type::Boolean;
case rapidjson::Type::kObjectType:
return Type::Object;
case rapidjson::Type::kArrayType:
return Type::Array;
case rapidjson::Type::kStringType:
return Type::String;
case rapidjson::Type::kNumberType:
return
value->IsDouble() ? Type::FloatingPoint :
Type::Integer;
}
return SettingsRegistryImplInternal::RapidjsonToSettingsRegistryType(*value);
}
}
return Type::NoType;
@ -392,7 +417,7 @@ namespace AZ
{
if (path.empty())
{
// rapidjson::Pointer assets that the supplied string
// rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
@ -471,13 +496,12 @@ namespace AZ
{
if (path.empty())
{
//rapidjson::Pointer assets that the supplied string
// rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
}
rapidjson::Pointer pointer(path.data(), path.length());
if (pointer.IsValid())
{
@ -486,10 +510,14 @@ namespace AZ
value, nullptr, valueTypeID, m_serializationSettings);
if (jsonResult.GetProcessing() != JsonSerializationResult::Processing::Halted)
{
AZStd::scoped_lock lock(m_settingMutex);
rapidjson::Value& setting = pointer.Create(m_settings, m_settings.GetAllocator());
setting = AZStd::move(store);
SignalNotifier(path, Type::Object);
auto anchorType = Type::NoType;
{
AZStd::scoped_lock lock(m_settingMutex);
rapidjson::Value& setting = pointer.Create(m_settings, m_settings.GetAllocator());
setting = AZStd::move(store);
anchorType = SettingsRegistryImplInternal::RapidjsonToSettingsRegistryType(setting);
}
SignalNotifier(path, anchorType);
return true;
}
}
@ -500,7 +528,7 @@ namespace AZ
{
if (path.empty())
{
// rapidjson::Pointer assets that the supplied string
// rapidjson::Pointer asserts that the supplied string
// is not nullptr even if the supplied size is 0
// Setting to empty string to prevent assert
path = "";
@ -605,7 +633,7 @@ namespace AZ
return Set(key, value);
}
bool SettingsRegistryImpl::MergeSettings(AZStd::string_view data, Format format)
bool SettingsRegistryImpl::MergeSettings(AZStd::string_view data, Format format, AZStd::string_view anchorKey)
{
rapidjson::Document jsonPatch;
constexpr int flags = rapidjson::kParseStopWhenDoneFlag | rapidjson::kParseCommentsFlag | rapidjson::kParseTrailingCommasFlag;
@ -631,17 +659,43 @@ namespace AZ
return false;
}
AZStd::scoped_lock lock(m_settingMutex);
rapidjson::Pointer anchorPath;
if (!anchorKey.empty())
{
anchorPath = rapidjson::Pointer(anchorKey.data(), anchorKey.size());
if (!anchorPath.IsValid())
{
rapidjson::Pointer pointer(AZ_SETTINGS_REGISTRY_HISTORY_KEY "/-");
AZ_Error("Settings Registry", false, R"(Anchor path "%.*s" is invalid.)", AZ_STRING_ARG(anchorKey));
AZStd::scoped_lock lock(m_settingMutex);
pointer.Create(m_settings, m_settings.GetAllocator()).SetObject()
.AddMember(rapidjson::StringRef("Error"), rapidjson::StringRef("Invalid anchor key."), m_settings.GetAllocator())
.AddMember(rapidjson::StringRef("Path"),
rapidjson::Value(anchorKey.data(), aznumeric_caster(anchorKey.size()), m_settings.GetAllocator()),
m_settings.GetAllocator());
return false;
}
}
JsonSerializationResult::ResultCode mergeResult =
JsonSerialization::ApplyPatch(m_settings, m_settings.GetAllocator(), jsonPatch, mergeApproach);
if (mergeResult.GetProcessing() != JsonSerializationResult::Processing::Completed)
auto anchorType = AZ::SettingsRegistryInterface::Type::NoType;
{
AZ_Error("Settings Registry", false, "Failed to fully merge data into registry.");
return false;
AZStd::scoped_lock lock(m_settingMutex);
rapidjson::Value& anchorRoot = anchorPath.IsValid() ? anchorPath.Create(m_settings, m_settings.GetAllocator())
: m_settings;
JsonSerializationResult::ResultCode mergeResult =
JsonSerialization::ApplyPatch(anchorRoot, m_settings.GetAllocator(), jsonPatch, mergeApproach);
if (mergeResult.GetProcessing() != JsonSerializationResult::Processing::Completed)
{
AZ_Error("Settings Registry", false, "Failed to fully merge data into registry.");
return false;
}
// The settings have been successfully merged, query the type at the anchor key
anchorType = SettingsRegistryImplInternal::RapidjsonToSettingsRegistryType(anchorRoot);
}
SignalNotifier("", Type::Object);
SignalNotifier(anchorKey, anchorType);
return true;
}
@ -1225,10 +1279,12 @@ namespace AZ
ScopedMergeEvent scopedMergeEvent(m_preMergeEvent, m_postMergeEvent, path, rootKey);
JsonSerializationResult::ResultCode mergeResult(JsonSerializationResult::Tasks::Merge);
auto anchorType = Type::NoType;
if (rootKey.empty())
{
AZStd::scoped_lock lock(m_settingMutex);
mergeResult = JsonSerialization::ApplyPatch(m_settings, m_settings.GetAllocator(), jsonPatch, mergeApproach, m_applyPatchSettings);
anchorType = SettingsRegistryImplInternal::RapidjsonToSettingsRegistryType(m_settings);
}
else
{
@ -1238,6 +1294,7 @@ namespace AZ
AZStd::scoped_lock lock(m_settingMutex);
Value& rootValue = root.Create(m_settings, m_settings.GetAllocator());
mergeResult = JsonSerialization::ApplyPatch(rootValue, m_settings.GetAllocator(), jsonPatch, mergeApproach, m_applyPatchSettings);
anchorType = SettingsRegistryImplInternal::RapidjsonToSettingsRegistryType(rootValue);
}
else
{
@ -1265,7 +1322,7 @@ namespace AZ
pointer.Create(m_settings, m_settings.GetAllocator()).SetString(path, m_settings.GetAllocator());
}
SignalNotifier("", Type::Object);
SignalNotifier(rootKey, anchorType);
return true;
}

@ -48,14 +48,14 @@ namespace AZ
Type GetType(AZStd::string_view path) const override;
bool Visit(Visitor& visitor, AZStd::string_view path) const override;
bool Visit(const VisitorCallback& callback, AZStd::string_view path) const override;
[[nodiscard]] NotifyEventHandler RegisterNotifier(const NotifyCallback& callback) override;
[[nodiscard]] NotifyEventHandler RegisterNotifier(NotifyCallback&& callback) override;
[[nodiscard]] NotifyEventHandler RegisterNotifier(NotifyCallback callback) override;
void RegisterNotifier(NotifyEventHandler& hanlder) override;
void ClearNotifiers();
[[nodiscard]] PreMergeEventHandler RegisterPreMergeEvent(const PreMergeEventCallback& callback) override;
[[nodiscard]] PreMergeEventHandler RegisterPreMergeEvent(PreMergeEventCallback&& callback) override;
[[nodiscard]] PostMergeEventHandler RegisterPostMergeEvent(const PostMergeEventCallback& callback) override;
[[nodiscard]] PostMergeEventHandler RegisterPostMergeEvent(PostMergeEventCallback&& callback) override;
[[nodiscard]] PreMergeEventHandler RegisterPreMergeEvent(PreMergeEventCallback callback) override;
void RegisterPreMergeEvent(PreMergeEventHandler& handler) override;
[[nodiscard]] PostMergeEventHandler RegisterPostMergeEvent(PostMergeEventCallback callback) override;
void RegisterPostMergeEvent(PostMergeEventHandler& handler) override;
void ClearMergeEvents();
bool Get(bool& result, AZStd::string_view path) const override;
@ -76,13 +76,13 @@ namespace AZ
bool Remove(AZStd::string_view path) override;
bool MergeCommandLineArgument(AZStd::string_view argument, AZStd::string_view rootKey,
bool MergeCommandLineArgument(AZStd::string_view argument, AZStd::string_view anchorKey,
const CommandLineArgumentSettings& commandLineSettings) override;
bool MergeSettings(AZStd::string_view data, Format format) override;
bool MergeSettingsFile(AZStd::string_view path, Format format, AZStd::string_view rootKey,
bool MergeSettings(AZStd::string_view data, Format format, AZStd::string_view anchorKey = "") override;
bool MergeSettingsFile(AZStd::string_view path, Format format, AZStd::string_view anchorKey = "",
AZStd::vector<char>* scratchBuffer = nullptr) override;
bool MergeSettingsFolder(AZStd::string_view path, const Specializations& specializations,
AZStd::string_view platform, AZStd::string_view rootKey = "", AZStd::vector<char>* scratchBuffer = nullptr) override;
AZStd::string_view platform, AZStd::string_view anchorKey = "", AZStd::vector<char>* scratchBuffer = nullptr) override;
void SetApplyPatchSettings(const AZ::JsonApplyPatchSettings& applyPatchSettings) override;
void GetApplyPatchSettings(AZ::JsonApplyPatchSettings& applyPatchSettings) override;
@ -121,6 +121,19 @@ namespace AZ
PreMergeEvent m_preMergeEvent;
PostMergeEvent m_postMergeEvent;
//! NOTE: During SignalNotifier, the registered notify event handlers are moved to a local NotifyEvent
//! Therefore setting a value within the registry during signaling will queue future SignalNotifer calls
//! These calls will then be invoked after the current signaling has completex
//! This is done to avoid deadlock if another thread attempts to access register a notifier or signal one
mutable AZStd::mutex m_signalMutex;
struct SignalNotifierArgs
{
FixedValueString m_jsonPath;
Type m_type;
};
AZStd::deque<SignalNotifierArgs> m_signalNotifierQueue;
AZStd::atomic_int m_signalCount{};
rapidjson::Document m_settings;
JsonSerializerSettings m_serializationSettings;
JsonDeserializerSettings m_deserializationSettings;

@ -23,12 +23,12 @@ namespace AZ
MOCK_CONST_METHOD1(GetType, Type(AZStd::string_view));
MOCK_CONST_METHOD2(Visit, bool(Visitor&, AZStd::string_view));
MOCK_CONST_METHOD2(Visit, bool(const VisitorCallback&, AZStd::string_view));
MOCK_METHOD1(RegisterNotifier, NotifyEventHandler(const NotifyCallback&));
MOCK_METHOD1(RegisterNotifier, NotifyEventHandler(NotifyCallback&&));
MOCK_METHOD1(RegisterPreMergeEvent, PreMergeEventHandler(const PreMergeEventCallback&));
MOCK_METHOD1(RegisterPreMergeEvent, PreMergeEventHandler(PreMergeEventCallback&&));
MOCK_METHOD1(RegisterPostMergeEvent, PostMergeEventHandler(const PostMergeEventCallback&));
MOCK_METHOD1(RegisterPostMergeEvent, PostMergeEventHandler(PostMergeEventCallback&&));
MOCK_METHOD1(RegisterNotifier, NotifyEventHandler(NotifyCallback));
MOCK_METHOD1(RegisterNotifier, void(NotifyEventHandler&));
MOCK_METHOD1(RegisterPreMergeEvent, PreMergeEventHandler(PreMergeEventCallback));
MOCK_METHOD1(RegisterPreMergeEvent, void(PreMergeEventHandler&));
MOCK_METHOD1(RegisterPostMergeEvent, PostMergeEventHandler(PostMergeEventCallback));
MOCK_METHOD1(RegisterPostMergeEvent, void(PostMergeEventHandler&));
MOCK_CONST_METHOD2(Get, bool(bool&, AZStd::string_view));
MOCK_CONST_METHOD2(Get, bool(s64&, AZStd::string_view));
@ -49,7 +49,7 @@ namespace AZ
MOCK_METHOD1(Remove, bool(AZStd::string_view));
MOCK_METHOD3(MergeCommandLineArgument, bool(AZStd::string_view, AZStd::string_view, const CommandLineArgumentSettings&));
MOCK_METHOD2(MergeSettings, bool(AZStd::string_view, Format));
MOCK_METHOD3(MergeSettings, bool(AZStd::string_view, Format, AZStd::string_view));
MOCK_METHOD4(MergeSettingsFile, bool(AZStd::string_view, Format, AZStd::string_view, AZStd::vector<char>*));
MOCK_METHOD5(
MergeSettingsFolder,

@ -17,6 +17,11 @@ namespace AZ
return false;
}
unsigned int StackConverter::FromNative(StackFrame*, unsigned int, void*)
{
return 0;
}
void SymbolStorage::LoadModuleData(const void*, unsigned int)
{}

@ -78,6 +78,12 @@ StackRecorder::Record(StackFrame* frames, unsigned int maxNumOfFrames, unsigned
return count;
}
unsigned int StackConverter::FromNative([[maybe_unused]] StackFrame* frames, [[maybe_unused]] unsigned int maxNumOfFrames, [[maybe_unused]] void* nativeContext)
{
AZ_Assert(false, "StackConverter::FromNative() is not supported for UnixLike platform yet");
return 0;
}
void
SymbolStorage::DecodeFrames(const StackFrame* frames, unsigned int numFrames, StackLine* textLines)
{

@ -1048,9 +1048,9 @@ cleanup:
unsigned int
StackRecorder::Record(StackFrame* frames, unsigned int maxNumOfFrames, unsigned int suppressCount, void* nativeThread)
{
#if defined(AZ_ENABLE_DEBUG_TOOLS)
unsigned int numFrames = 0;
#if defined(AZ_ENABLE_DEBUG_TOOLS)
if (nativeThread == NULL)
{
++suppressCount; // Skip current call
@ -1079,9 +1079,8 @@ cleanup:
STACKFRAME64 sf;
memset(&sf, 0, sizeof(STACKFRAME64));
DWORD imageType;
DWORD imageType = IMAGE_FILE_MACHINE_AMD64;
imageType = IMAGE_FILE_MACHINE_AMD64;
sf.AddrPC.Offset = context.Rip;
sf.AddrPC.Mode = AddrModeFlat;
sf.AddrFrame.Offset = context.Rsp;
@ -1090,8 +1089,7 @@ cleanup:
sf.AddrStack.Mode = AddrModeFlat;
EnterCriticalSection(&g_csDbgHelpDll);
s32 frame = -(s32)suppressCount;
for (; frame < (s32)maxNumOfFrames; ++frame)
for (s32 frame = -static_cast<s32>(suppressCount); frame < static_cast<s32>(maxNumOfFrames); ++frame)
{
if (!g_StackWalk64(imageType, g_currentProcess, hThread, &sf, &context, 0, g_SymFunctionTableAccess64, g_SymGetModuleBase64, 0))
{
@ -1111,15 +1109,68 @@ cleanup:
}
LeaveCriticalSection(&g_csDbgHelpDll);
}
return numFrames;
}
#else
(void)frames;
(void)maxNumOfFrames;
(void)suppressCount;
(void)nativeThread;
return 0;
AZ_UNUSED(frames);
AZ_UNUSED(maxNumOfFrames);
AZ_UNUSED(suppressCount);
AZ_UNUSED(nativeThread);
#endif // AZ_ENABLE_DEBUG_TOOLS
return numFrames;
}
unsigned int StackConverter::FromNative(StackFrame* frames, unsigned int maxNumOfFrames, void* nativeContext)
{
unsigned int numFrames = 0;
#if defined(AZ_ENABLE_DEBUG_TOOLS)
if (!g_dbgHelpLoaded)
{
LoadDbgHelp();
}
HANDLE hThread;
DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &hThread, 0, false, DUPLICATE_SAME_ACCESS);
PCONTEXT nativeContextType = reinterpret_cast<PCONTEXT>(nativeContext);
STACKFRAME64 sf;
memset(&sf, 0, sizeof(STACKFRAME64));
DWORD imageType = IMAGE_FILE_MACHINE_AMD64;
sf.AddrPC.Offset = nativeContextType->Rip;
sf.AddrPC.Mode = AddrModeFlat;
sf.AddrFrame.Offset = nativeContextType->Rsp;
sf.AddrFrame.Mode = AddrModeFlat;
sf.AddrStack.Offset = nativeContextType->Rsp;
sf.AddrStack.Mode = AddrModeFlat;
EnterCriticalSection(&g_csDbgHelpDll);
for (unsigned int frame = 0; frame < maxNumOfFrames; ++frame)
{
if (!g_StackWalk64(imageType, g_currentProcess, hThread, &sf, nativeContext, 0, g_SymFunctionTableAccess64, g_SymGetModuleBase64, 0))
{
break;
}
if (sf.AddrPC.Offset == sf.AddrReturn.Offset)
{
// "StackWalk64-Endless-Callstack!"
break;
}
frames[numFrames++].m_programCounter = sf.AddrPC.Offset;
}
LeaveCriticalSection(&g_csDbgHelpDll);
#else
AZ_UNUSED(frames);
AZ_UNUSED(maxNumOfFrames);
AZ_UNUSED(nativeContext);
#endif
return numFrames;
}
//////////////////////////////////////////////////////////////////////////

@ -1413,7 +1413,7 @@ namespace UnitTest
>;
TYPED_TEST_CASE(HashedSetDifferentAllocatorFixture, SetTemplateConfigs);
#if GTEST_OS_SUPPORTS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TYPED_TEST(HashedSetDifferentAllocatorFixture, InsertNodeHandleWithDifferentAllocatorsLogsTraceMessages)
{
using ContainerType = typename TypeParam::ContainerType;
@ -1435,7 +1435,7 @@ namespace UnitTest
}
}, ".*");
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
template<typename ContainerType>
class HashedMapContainers
@ -1811,7 +1811,7 @@ namespace UnitTest
>;
TYPED_TEST_CASE(HashedMapDifferentAllocatorFixture, MapTemplateConfigs);
#if GTEST_OS_SUPPORTS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TYPED_TEST(HashedMapDifferentAllocatorFixture, InsertNodeHandleWithDifferentAllocatorsLogsTraceMessages)
{
using ContainerType = typename TypeParam::ContainerType;
@ -1833,7 +1833,7 @@ namespace UnitTest
}
} , ".*");
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
namespace HashedContainerTransparentTestInternal
{

@ -1095,7 +1095,7 @@ namespace UnitTest
>;
TYPED_TEST_CASE(TreeSetDifferentAllocatorFixture, SetTemplateConfigs);
#if GTEST_OS_SUPPORTS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TYPED_TEST(TreeSetDifferentAllocatorFixture, InsertNodeHandleWithDifferentAllocatorsLogsTraceMessages)
{
using ContainerType = typename TypeParam::ContainerType;
@ -1117,7 +1117,7 @@ namespace UnitTest
}
}, ".*");
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
TYPED_TEST(TreeSetDifferentAllocatorFixture, SwapMovesElementsWhenAllocatorsDiffer)
{
@ -1516,7 +1516,7 @@ namespace UnitTest
>;
TYPED_TEST_CASE(TreeMapDifferentAllocatorFixture, MapTemplateConfigs);
#if GTEST_OS_SUPPORTS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TYPED_TEST(TreeMapDifferentAllocatorFixture, InsertNodeHandleWithDifferentAllocatorsLogsTraceMessages)
{
using ContainerType = typename TypeParam::ContainerType;
@ -1538,7 +1538,7 @@ namespace UnitTest
}
}, ".*");
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
TYPED_TEST(TreeMapDifferentAllocatorFixture, SwapMovesElementsWhenAllocatorsDiffer)
{

@ -1595,7 +1595,7 @@ namespace UnitTest
}
};
#if GTEST_OS_SUPPORTS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
TEST_F(ThreadEventsDeathTest, UsingClientBus_AvoidsDeadlock)
{
EXPECT_EXIT(
@ -1608,5 +1608,5 @@ namespace UnitTest
, ::testing::ExitedWithCode(0),".*");
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
}

@ -736,7 +736,10 @@ namespace UnitTest
auto& assetManager = AssetManager::Instance();
AssetBusCallbacks callbacks{};
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
callbacks.SetOnAssetReadyCallback([&, AssetNoRefB](const Asset<AssetData>&, AssetBusCallbacks&)
AZ_POP_DISABLE_WARNING
{
// This callback should run inside the "main thread" dispatch events loop
auto loadAsset = assetManager.GetAsset<AssetWithSerializedData>(AZ::Uuid(AssetNoRefB), AssetLoadBehavior::Default);

@ -288,6 +288,21 @@ namespace AZ
AZStd::string completeCommand = console->AutoCompleteCommand("testVec3");
AZ_TEST_ASSERT(completeCommand == "testVec3");
}
// Duplicate names
{
// Register two cvars with the same name
auto id = AZ::TypeId();
auto flag = AZ::ConsoleFunctorFlags::Null;
auto signature = AZ::ConsoleFunctor<void, false>::FunctorSignature();
AZ::ConsoleFunctor<void, false> cvarOne(*console, "testAutoCompleteDuplication", "", flag, id, signature);
AZ::ConsoleFunctor<void, false> cvarTwo(*console, "testAutoCompleteDuplication", "", flag, id, signature);
// Autocomplete given name expecting one match (not two)
AZStd::vector<AZStd::string> matches;
AZStd::string completeCommand = console->AutoCompleteCommand("testAutoCompleteD", &matches);
AZ_TEST_ASSERT(matches.size() == 1 && completeCommand == "testAutoCompleteDuplication");
}
}
TEST_F(ConsoleTests, ConsoleFunctor_FreeFunctorExecutionTest)

@ -109,7 +109,10 @@ namespace AZ::Debug
AZStd::thread threads[totalThreads];
for (size_t threadIndex = 0; threadIndex < totalThreads; ++threadIndex)
{
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
threads[threadIndex] = AZStd::thread([&startLogging, &messages]()
AZ_POP_DISABLE_WARNING
{
while (!startLogging)
{
@ -226,7 +229,10 @@ namespace AZ::Debug
AZStd::thread threads[totalThreads];
for (size_t threadIndex = 0; threadIndex < totalThreads; ++threadIndex)
{
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
threads[threadIndex] = AZStd::thread([&startLogging, &message, &totalRecordsWritten]()
AZ_POP_DISABLE_WARNING
{
AZ_UNUSED(message);

@ -0,0 +1,31 @@
/*
* 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
*
*/
#include <AzCore/UnitTest/TestTypes.h>
namespace UnitTest
{
class UnhandledExceptions
: public ScopedAllocatorSetupFixture
{
public:
void causeAccessViolation()
{
int* someVariable = reinterpret_cast<int*>(0);
*someVariable = 0;
}
};
#if GTEST_HAS_DEATH_TEST
TEST_F(UnhandledExceptions, Handle)
{
EXPECT_DEATH(causeAccessViolation(), "");
}
#endif
}

@ -144,14 +144,13 @@ namespace UnitTest
}
};
#if GTEST_OS_SUPPORTS_DEATH_TEST
// SPEC-2669: Disabled since it is causing hangs on Linux
#if GTEST_HAS_DEATH_TEST
TEST_F(AllocatorsTestFixtureLeakDetectionDeathTest_SKIPCODECOVERAGE, AllocatorLeak)
{
// testing that the TraceBusHook will fail on cause the test to die
EXPECT_DEATH(TestAllocatorLeak(), "");
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Testing ScopedAllocatorSetupFixture. Testing that detects leaks

@ -597,7 +597,10 @@ namespace AZ::IO
path.InitFromAbsolutePath(m_dummyFilepath);
request->CreateRead(nullptr, buffer.get(), fileSize, path, 0, fileSize);
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [&fileSize, this](const FileRequest& request)
AZ_POP_DISABLE_WARNING
{
EXPECT_EQ(request.GetStatus(), AZ::IO::IStreamerTypes::RequestStatus::Completed);
auto& readRequest = AZStd::get<AZ::IO::FileRequest::ReadData>(request.GetCommand());
@ -639,7 +642,10 @@ namespace AZ::IO
path.InitFromAbsolutePath(m_dummyFilepath);
request->CreateRead(nullptr, buffer, unalignedSize + 4, path, unalignedOffset, unalignedSize);
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [unalignedOffset, unalignedSize, this](const FileRequest& request)
AZ_POP_DISABLE_WARNING
{
EXPECT_EQ(request.GetStatus(), AZ::IO::IStreamerTypes::RequestStatus::Completed);
auto& readRequest = AZStd::get<AZ::IO::FileRequest::ReadData>(request.GetCommand());
@ -784,7 +790,10 @@ namespace AZ::IO
requests[i] = m_context->GetNewInternalRequest();
requests[i]->CreateRead(nullptr, buffers[i].get(), chunkSize, path, i * chunkSize, chunkSize);
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [chunkSize, i](const FileRequest& request)
AZ_POP_DISABLE_WARNING
{
EXPECT_EQ(request.GetStatus(), AZ::IO::IStreamerTypes::RequestStatus::Completed);
auto& readRequest = AZStd::get<AZ::IO::FileRequest::ReadData>(request.GetCommand());
@ -970,7 +979,10 @@ namespace AZ::IO
i * chunkSize
));
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [numChunks, &numCallbacks, &waitForReads](FileRequestHandle request)
AZ_POP_DISABLE_WARNING
{
IStreamer* streamer = Interface<IStreamer>::Get();
if (streamer)
@ -1038,7 +1050,10 @@ namespace AZ::IO
i * chunkSize
));
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [numChunks, &waitForReads, &waitForSingleRead, &numReadCallbacks]([[maybe_unused]] FileRequestHandle request)
AZ_POP_DISABLE_WARNING
{
numReadCallbacks++;
if (numReadCallbacks == 1)
@ -1059,7 +1074,10 @@ namespace AZ::IO
for (size_t i = 0; i < numChunks; ++i)
{
cancels.push_back(m_streamer->Cancel(requests[numChunks - i - 1]));
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback = [&numCancelCallbacks, &waitForCancels, numChunks](FileRequestHandle request)
AZ_POP_DISABLE_WARNING
{
auto result = Interface<IStreamer>::Get()->GetRequestStatus(request);
EXPECT_EQ(result, IStreamerTypes::RequestStatus::Completed);

@ -327,7 +327,7 @@ namespace JsonSerializationTests
SerializerWithOneType::Unreflect(m_jsonRegistrationContext.get());
}
#if GTEST_OS_SUPPORTS_DEATH_TEST
#if GTEST_HAS_DEATH_TEST
using JsonSerializationDeathTests = JsonRegistrationContextTests;
TEST_F(JsonSerializationDeathTests, DoubleUnregisterSerializer_Asserts)
{
@ -338,5 +338,6 @@ namespace JsonSerializationTests
}, ".*"
);
}
#endif // GTEST_OS_SUPPORTS_DEATH_TEST
#endif // GTEST_HAS_DEATH_TEST
} //namespace JsonSerializationTests

@ -1299,6 +1299,35 @@ namespace SettingsRegistryTests
EXPECT_FALSE(m_registry->MergeCommandLineArgument(" ", {}, {}));
}
//
// MergeSettings
//
TEST_F(SettingsRegistryTest, MergeSettings_MergeJsonWithAnchorKey_StoresSettingsUnderneathKey)
{
constexpr AZStd::string_view anchorKey = "/Anchor/Root/0";
constexpr auto mergeFormat = AZ::SettingsRegistryInterface::Format::JsonMergePatch;
EXPECT_TRUE(m_registry->MergeSettings(R"({ "Test": "1" })", mergeFormat, anchorKey));
EXPECT_EQ(AZ::SettingsRegistryInterface::Type::Array, m_registry->GetType("/Anchor/Root"));
EXPECT_EQ(AZ::SettingsRegistryInterface::Type::Object, m_registry->GetType("/Anchor/Root/0"));
EXPECT_EQ(AZ::SettingsRegistryInterface::Type::String, m_registry->GetType("/Anchor/Root/0/Test"));
}
TEST_F(SettingsRegistryTest, MergeSettings_NotifierSignals_AtAnchorKeyAndStoresMergeType)
{
AZStd::string_view anchorKey = "/Anchor/Root";
bool callbackInvoked{};
auto callback = [anchorKey, &callbackInvoked](AZStd::string_view path, AZ::SettingsRegistryInterface::Type type)
{
EXPECT_EQ(anchorKey, path);
EXPECT_EQ(AZ::SettingsRegistryInterface::Type::Array, type);
callbackInvoked = true;
};
auto testNotifier1 = m_registry->RegisterNotifier(callback);
constexpr auto mergeFormat = AZ::SettingsRegistryInterface::Format::JsonMergePatch;
EXPECT_TRUE(m_registry->MergeSettings(R"([ "Test" ])", mergeFormat, anchorKey));
EXPECT_TRUE(callbackInvoked);
}
//
// MergeSettingsFile
//
@ -1331,7 +1360,7 @@ namespace SettingsRegistryTests
auto callback = [this](AZStd::string_view path, AZ::SettingsRegistryInterface::Type)
{
EXPECT_TRUE(path.empty());
EXPECT_EQ("/Path", path);
AZ::s64 value = -1;
bool result = m_registry->Get(value, "/Path/Test");
EXPECT_TRUE(result);

@ -363,7 +363,10 @@ namespace AZ
{
constexpr AZStd::array visitTokens = { "Hello", "World", "", "More", "", "", "Tokens" };
size_t visitIndex{};
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto visitor = [&visitIndex, &visitTokens](AZStd::string_view token)
AZ_POP_DISABLE_WARNING
{
if (visitIndex > visitTokens.size())
{
@ -389,7 +392,10 @@ namespace AZ
{
constexpr AZStd::array visitTokens = { "Hello", "World", "", "More", "", "", "Tokens" };
size_t visitIndex = visitTokens.size() - 1;
AZ_PUSH_DISABLE_WARNING(5233, "-Wunknown-warning-option") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto visitor = [&visitIndex, &visitTokens](AZStd::string_view token)
AZ_POP_DISABLE_WARNING
{
if (visitIndex > visitTokens.size())
{

@ -72,6 +72,7 @@ set(FILES
Debug/AssetTracking.cpp
Debug/LocalFileEventLoggerTests.cpp
Debug/Trace.cpp
Debug/UnhandledExceptions.cpp
Name/NameJsonSerializerTests.cpp
Name/NameTests.cpp
RTTI/TypeSafeIntegralTests.cpp

@ -1924,13 +1924,11 @@ namespace AZ::IO
ArchiveLocationPriority Archive::GetPakPriority() const
{
int pakPriority = aznumeric_cast<int>(ArchiveVars{}.nPriority);
#if defined(AZ_ENABLE_TRACING)
if (auto console = AZ::Interface<AZ::IConsole>::Get(); console != nullptr)
{
AZ::GetValueResult getCvarResult = console->GetCvarValue("sys_PakPriority", pakPriority);
[[maybe_unused]] AZ::GetValueResult getCvarResult = console->GetCvarValue("sys_PakPriority", pakPriority);
AZ_Error("Archive", getCvarResult == AZ::GetValueResult::Success, "Lookup of 'sys_PakPriority console variable failed with error %s", AZ::GetEnumString(getCvarResult));
}
#endif
return static_cast<ArchiveLocationPriority>(pakPriority);
}

@ -1,234 +0,0 @@
/*
* 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
*
*/
#pragma once
#include <AzCore/Math/Matrix3x3.h>
#include <AzCore/Math/Vector3.h>
#include <AzCore/Math/Aabb.h>
#include <AzFramework/Physics/WorldBody.h>
#include <AzFramework/Physics/ShapeConfiguration.h>
namespace
{
class ReflectContext;
}
namespace Physics
{
class ShapeConfiguration;
class World;
class Shape;
/// Default values used for initializing RigidBodySettings.
/// These can be modified by Physics Implementation gems. // O3DE_DEPRECATED(LY-114472) - DefaultRigidBodyConfiguration values are not shared across modules.
// Use RigidBodyConfiguration default values.
struct DefaultRigidBodyConfiguration
{
static float m_mass;
static bool m_computeInertiaTensor;
static float m_linearDamping;
static float m_angularDamping;
static float m_sleepMinEnergy;
static float m_maxAngularVelocity;
};
enum class MassComputeFlags : AZ::u8
{
NONE = 0,
//! Flags indicating whether a certain mass property should be auto-computed or not.
COMPUTE_MASS = 1,
COMPUTE_INERTIA = 1 << 1,
COMPUTE_COM = 1 << 2,
//! If set, non-simulated shapes will also be included in the mass properties calculation.
INCLUDE_ALL_SHAPES = 1 << 3,
DEFAULT = COMPUTE_COM | COMPUTE_INERTIA | COMPUTE_MASS
};
class RigidBodyConfiguration
: public WorldBodyConfiguration
{
public:
AZ_CLASS_ALLOCATOR(RigidBodyConfiguration, AZ::SystemAllocator, 0);
AZ_RTTI(RigidBodyConfiguration, "{ACFA8900-8530-4744-AF00-AA533C868A8E}", WorldBodyConfiguration);
static void Reflect(AZ::ReflectContext* context);
enum PropertyVisibility : AZ::u16
{
InitialVelocities = 1 << 0, ///< Whether the initial linear and angular velocities are visible.
InertiaProperties = 1 << 1, ///< Whether the whole category of inertia properties (mass, compute inertia,
///< inertia tensor etc) is visible.
Damping = 1 << 2, ///< Whether linear and angular damping are visible.
SleepOptions = 1 << 3, ///< Whether the sleep threshold and start asleep options are visible.
Interpolation = 1 << 4, ///< Whether the interpolation option is visible.
Gravity = 1 << 5, ///< Whether the effected by gravity option is visible.
Kinematic = 1 << 6, ///< Whether the option to make the body kinematic is visible.
ContinuousCollisionDetection = 1 << 7, ///< Whether the option to enable continuous collision detection is visible.
MaxVelocities = 1 << 8 ///< Whether upper limits on velocities are visible.
};
RigidBodyConfiguration() = default;
RigidBodyConfiguration(const RigidBodyConfiguration& settings) = default;
// Visibility functions.
AZ::Crc32 GetPropertyVisibility(PropertyVisibility property) const;
void SetPropertyVisibility(PropertyVisibility property, bool isVisible);
AZ::Crc32 GetInitialVelocitiesVisibility() const;
/// Returns whether the whole category of inertia settings (mass, inertia, center of mass offset etc) is visible.
AZ::Crc32 GetInertiaSettingsVisibility() const;
/// Returns whether the individual inertia tensor field is visible or is hidden because the compute inertia option is selected.
AZ::Crc32 GetInertiaVisibility() const;
/// Returns whether the mass field is visible or is hidden because compute mass option is selected.
AZ::Crc32 GetMassVisibility() const;
/// Returns whether the individual centre of mass offset field is visible or is hidden because compute CoM option is selected.
AZ::Crc32 GetCoMVisibility() const;
AZ::Crc32 GetDampingVisibility() const;
AZ::Crc32 GetSleepOptionsVisibility() const;
AZ::Crc32 GetInterpolationVisibility() const;
AZ::Crc32 GetGravityVisibility() const;
AZ::Crc32 GetKinematicVisibility() const;
AZ::Crc32 GetCCDVisibility() const;
AZ::Crc32 GetMaxVelocitiesVisibility() const;
MassComputeFlags GetMassComputeFlags() const;
void SetMassComputeFlags(MassComputeFlags flags);
bool IsCCDEnabled() const;
// Basic initial settings.
AZ::Vector3 m_initialLinearVelocity = AZ::Vector3::CreateZero();
AZ::Vector3 m_initialAngularVelocity = AZ::Vector3::CreateZero();
AZ::Vector3 m_centerOfMassOffset = AZ::Vector3::CreateZero();
// Simulation parameters.
float m_mass = DefaultRigidBodyConfiguration::m_mass;
AZ::Matrix3x3 m_inertiaTensor = AZ::Matrix3x3::CreateIdentity();
float m_linearDamping = DefaultRigidBodyConfiguration::m_linearDamping;
float m_angularDamping = DefaultRigidBodyConfiguration::m_angularDamping;
float m_sleepMinEnergy = DefaultRigidBodyConfiguration::m_sleepMinEnergy;
float m_maxAngularVelocity = DefaultRigidBodyConfiguration::m_maxAngularVelocity;
// Visibility settings.
AZ::u16 m_propertyVisibilityFlags = (std::numeric_limits<AZ::u16>::max)();
bool m_startAsleep = false;
bool m_interpolateMotion = false;
bool m_gravityEnabled = true;
bool m_simulated = true;
bool m_kinematic = false;
bool m_ccdEnabled = false; ///< Whether continuous collision detection is enabled.
float m_ccdMinAdvanceCoefficient = 0.15f; ///< Coefficient affecting how granularly time is subdivided in CCD.
bool m_ccdFrictionEnabled = false; ///< Whether friction is applied when resolving CCD collisions.
bool m_computeCenterOfMass = true;
bool m_computeInertiaTensor = true;
bool m_computeMass = true;
//! If set, non-simulated shapes will also be included in the mass properties calculation.
bool m_includeAllShapesInMassCalculation = false;
};
/// Dynamic rigid body.
class RigidBody
: public WorldBody
{
public:
AZ_CLASS_ALLOCATOR(RigidBody, AZ::SystemAllocator, 0);
AZ_RTTI(RigidBody, "{156E459F-7BB7-4B4E-ADA0-2130D96B7E80}", WorldBody);
public:
RigidBody() = default;
explicit RigidBody(const RigidBodyConfiguration& settings);
virtual void AddShape(AZStd::shared_ptr<Shape> shape) = 0;
virtual void RemoveShape(AZStd::shared_ptr<Shape> shape) = 0;
virtual AZ::u32 GetShapeCount() { return 0; }
virtual AZStd::shared_ptr<Shape> GetShape(AZ::u32 /*index*/) { return nullptr; }
virtual AZ::Vector3 GetCenterOfMassWorld() const = 0;
virtual AZ::Vector3 GetCenterOfMassLocal() const = 0;
virtual AZ::Matrix3x3 GetInverseInertiaWorld() const = 0;
virtual AZ::Matrix3x3 GetInverseInertiaLocal() const = 0;
virtual float GetMass() const = 0;
virtual float GetInverseMass() const = 0;
virtual void SetMass(float mass) = 0;
virtual void SetCenterOfMassOffset(const AZ::Vector3& comOffset) = 0;
/// Retrieves the velocity at center of mass; only linear velocity, no rotational velocity contribution.
virtual AZ::Vector3 GetLinearVelocity() const = 0;
virtual void SetLinearVelocity(const AZ::Vector3& velocity) = 0;
virtual AZ::Vector3 GetAngularVelocity() const = 0;
virtual void SetAngularVelocity(const AZ::Vector3& angularVelocity) = 0;
virtual AZ::Vector3 GetLinearVelocityAtWorldPoint(const AZ::Vector3& worldPoint) = 0;
virtual void ApplyLinearImpulse(const AZ::Vector3& impulse) = 0;
virtual void ApplyLinearImpulseAtWorldPoint(const AZ::Vector3& impulse, const AZ::Vector3& worldPoint) = 0;
virtual void ApplyAngularImpulse(const AZ::Vector3& angularImpulse) = 0;
virtual float GetLinearDamping() const = 0;
virtual void SetLinearDamping(float damping) = 0;
virtual float GetAngularDamping() const = 0;
virtual void SetAngularDamping(float damping) = 0;
virtual bool IsAwake() const = 0;
virtual void ForceAsleep() = 0;
virtual void ForceAwake() = 0;
virtual float GetSleepThreshold() const = 0;
virtual void SetSleepThreshold(float threshold) = 0;
virtual bool IsKinematic() const = 0;
virtual void SetKinematic(bool kinematic) = 0;
virtual void SetKinematicTarget(const AZ::Transform& targetPosition) = 0;
virtual bool IsGravityEnabled() const = 0;
virtual void SetGravityEnabled(bool enabled) = 0;
virtual void SetSimulationEnabled(bool enabled) = 0;
virtual void SetCCDEnabled(bool enabled) = 0;
//! Recalculates mass, inertia and center of mass based on the flags passed.
//! @param flags MassComputeFlags specifying which properties should be recomputed.
//! @param centerOfMassOffsetOverride Optional override of the center of mass. Note: This parameter will be ignored if COMPUTE_COM is passed in flags.
//! @param inertiaTensorOverride Optional override of the inertia. Note: This parameter will be ignored if COMPUTE_INERTIA is passed in flags.
//! @param massOverride Optional override of the mass. Note: This parameter will be ignored if COMPUTE_MASS is passed in flags.
virtual void UpdateMassProperties(MassComputeFlags flags = MassComputeFlags::DEFAULT,
const AZ::Vector3* centerOfMassOffsetOverride = nullptr,
const AZ::Matrix3x3* inertiaTensorOverride = nullptr,
const float* massOverride = nullptr) = 0;
};
/// Bitwise operators for MassComputeFlags
inline MassComputeFlags operator|(MassComputeFlags lhs, MassComputeFlags rhs)
{
return aznumeric_cast<MassComputeFlags>(aznumeric_cast<AZ::u8>(lhs) | aznumeric_cast<AZ::u8>(rhs));
}
inline MassComputeFlags operator&(MassComputeFlags lhs, MassComputeFlags rhs)
{
return aznumeric_cast<MassComputeFlags>(aznumeric_cast<AZ::u8>(lhs) & aznumeric_cast<AZ::u8>(rhs));
}
/// Static rigid body.
class RigidBodyStatic
: public WorldBody
{
public:
AZ_CLASS_ALLOCATOR(RigidBodyStatic, AZ::SystemAllocator, 0);
AZ_RTTI(RigidBodyStatic, "{13A677BB-7085-4EDB-BCC8-306548238692}", WorldBody);
virtual void AddShape(const AZStd::shared_ptr<Shape>& shape) = 0;
virtual AZ::u32 GetShapeCount() { return 0; }
virtual AZStd::shared_ptr<Shape> GetShape(AZ::u32 /*index*/) { return nullptr; }
};
} // namespace Physics

@ -89,9 +89,9 @@ namespace AzPhysics
//! @param inertiaTensorOverride Optional override of the inertia. Note: This parameter will be ignored if COMPUTE_INERTIA is passed in flags.
//! @param massOverride Optional override of the mass. Note: This parameter will be ignored if COMPUTE_MASS is passed in flags.
virtual void UpdateMassProperties(MassComputeFlags flags = MassComputeFlags::DEFAULT,
const AZ::Vector3* centerOfMassOffsetOverride = nullptr,
const AZ::Matrix3x3* inertiaTensorOverride = nullptr,
const float* massOverride = nullptr) = 0;
const AZ::Vector3& centerOfMassOffsetOverride = AZ::Vector3::CreateZero(),
const AZ::Matrix3x3& inertiaTensorOverride = AZ::Matrix3x3::CreateIdentity(),
const float massOverride = 1.0f) = 0;
};
} // namespace AzPhysics

@ -30,22 +30,42 @@ namespace AzFramework
//////////////////////////////////////////////////////////////////////////
// OnSessionHealthCheck is fired in health check process
// @return The result of all OnSessionHealthCheck
// Use this notification to perform any custom health check
// @return True if OnSessionHealthCheck succeeds, false otherwise
virtual bool OnSessionHealthCheck() = 0;
// OnCreateSessionBegin is fired at the beginning of session creation
// OnCreateSessionBegin is fired at the beginning of session creation process
// Use this notification to perform any necessary configuration or initialization before
// creating session
// @param sessionConfig The properties to describe a session
// @return The result of all OnCreateSessionBegin notifications
// @return True if OnCreateSessionBegin succeeds, false otherwise
virtual bool OnCreateSessionBegin(const SessionConfig& sessionConfig) = 0;
// OnDestroySessionBegin is fired at the beginning of session termination
// @return The result of all OnDestroySessionBegin notifications
// OnCreateSessionEnd is fired at the end of session creation process
// Use this notification to perform any follow-up operation after session is created and active
virtual void OnCreateSessionEnd() = 0;
// OnDestroySessionBegin is fired at the beginning of session termination process
// Use this notification to perform any cleanup operation before destroying session,
// like gracefully disconnect players, cleanup data, etc.
// @return True if OnDestroySessionBegin succeeds, false otherwise
virtual bool OnDestroySessionBegin() = 0;
// OnUpdateSessionBegin is fired at the beginning of session update
// OnDestroySessionEnd is fired at the end of session termination process
// Use this notification to perform any follow-up operation after session is destroyed,
// like shutdown application process, etc.
virtual void OnDestroySessionEnd() = 0;
// OnUpdateSessionBegin is fired at the beginning of session update process
// Use this notification to perform any configuration or initialization to handle
// the session settings changing
// @param sessionConfig The properties to describe a session
// @param updateReason The reason for session update
virtual void OnUpdateSessionBegin(const SessionConfig& sessionConfig, const AZStd::string& updateReason) = 0;
// OnUpdateSessionBegin is fired at the end of session update process
// Use this notification to perform any follow-up operations after session is updated
virtual void OnUpdateSessionEnd() = 0;
};
using SessionNotificationBus = AZ::EBus<SessionNotifications>;
} // namespace AzFramework

@ -23,10 +23,12 @@ namespace AzFramework
virtual ~XcbEventHandler() = default;
virtual void HandleXcbEvent(xcb_generic_event_t* event) = 0;
// ATTN This is used as a workaround for RAW Input events when using the Editor.
virtual void PollSpecialEvents(){};
};
class XcbEventHandlerBusTraits
: public AZ::EBusTraits
class XcbEventHandlerBusTraits : public AZ::EBusTraits
{
public:
//////////////////////////////////////////////////////////////////////////

@ -0,0 +1,652 @@
/*
* 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
*
*/
#include <AzCore/std/typetraits/integral_constant.h>
#include <AzFramework/API/ApplicationAPI_Linux.h>
#include <AzFramework/XcbConnectionManager.h>
#include <AzFramework/XcbInputDeviceMouse.h>
namespace AzFramework
{
xcb_window_t GetSystemCursorFocusWindow()
{
void* systemCursorFocusWindow = nullptr;
AzFramework::InputSystemCursorConstraintRequestBus::BroadcastResult(
systemCursorFocusWindow, &AzFramework::InputSystemCursorConstraintRequests::GetSystemCursorConstraintWindow);
if (!systemCursorFocusWindow)
{
return XCB_NONE;
}
// TODO Clang compile error because cast .... loses information. On GNU/Linux HWND is void* and on 64-bit
// machines its obviously 64 bit but we receive the window id from m_renderOverlay.winId() which is xcb_window_t 32-bit.
return static_cast<xcb_window_t>(reinterpret_cast<uint64_t>(systemCursorFocusWindow));
}
xcb_connection_t* XcbInputDeviceMouse::s_xcbConnection = nullptr;
xcb_screen_t* XcbInputDeviceMouse::s_xcbScreen = nullptr;
bool XcbInputDeviceMouse::m_xfixesInitialized = false;
bool XcbInputDeviceMouse::m_xInputInitialized = false;
XcbInputDeviceMouse::XcbInputDeviceMouse(InputDeviceMouse& inputDevice)
: InputDeviceMouse::Implementation(inputDevice)
, m_systemCursorState(SystemCursorState::Unknown)
, m_systemCursorPositionNormalized(0.5f, 0.5f)
, m_prevConstraintWindow(XCB_NONE)
, m_focusWindow(XCB_NONE)
, m_cursorShown(true)
{
XcbEventHandlerBus::Handler::BusConnect();
SetSystemCursorState(SystemCursorState::Unknown);
}
XcbInputDeviceMouse::~XcbInputDeviceMouse()
{
XcbEventHandlerBus::Handler::BusDisconnect();
SetSystemCursorState(SystemCursorState::Unknown);
}
InputDeviceMouse::Implementation* XcbInputDeviceMouse::Create(InputDeviceMouse& inputDevice)
{
auto* interface = AzFramework::XcbConnectionManagerInterface::Get();
if (!interface)
{
AZ_Warning("XcbInput", false, "XCB interface not available");
return nullptr;
}
s_xcbConnection = AzFramework::XcbConnectionManagerInterface::Get()->GetXcbConnection();
if (!s_xcbConnection)
{
AZ_Warning("XcbInput", false, "XCB connection not available");
return nullptr;
}
const xcb_setup_t* xcbSetup = xcb_get_setup(s_xcbConnection);
s_xcbScreen = xcb_setup_roots_iterator(xcbSetup).data;
if (!s_xcbScreen)
{
AZ_Warning("XcbInput", false, "XCB screen not available");
return nullptr;
}
// Initialize XFixes extension which we use to create pointer barriers.
if (!InitializeXFixes())
{
AZ_Warning("XcbInput", false, "XCB XFixes initialization failed");
return nullptr;
}
// Initialize XInput extension which is used to get RAW Input events.
if (!InitializeXInput())
{
AZ_Warning("XcbInput", false, "XCB XInput initialization failed");
return nullptr;
}
return aznew XcbInputDeviceMouse(inputDevice);
}
bool XcbInputDeviceMouse::IsConnected() const
{
return true;
}
void XcbInputDeviceMouse::CreateBarriers(xcb_window_t window, bool create)
{
// Don't create any barriers if we are debugging. This will cause artifacts but better then
// a confined cursor during debugging.
if (AZ::Debug::Trace::IsDebuggerPresent())
{
AZ_Warning("XcbInput", false, "Debugger running. Barriers will not be created.");
return;
}
if (create)
{
// Destroy barriers if they are active already.
if (!m_activeBarriers.empty())
{
for (const auto& barrier : m_activeBarriers)
{
xcb_xfixes_delete_pointer_barrier_checked(s_xcbConnection, barrier.id);
}
m_activeBarriers.clear();
}
// Get window information.
const XcbStdFreePtr<xcb_get_geometry_reply_t> xcbGeometryReply{ xcb_get_geometry_reply(
s_xcbConnection, xcb_get_geometry(s_xcbConnection, window), NULL) };
if (!xcbGeometryReply)
{
return;
}
const xcb_translate_coordinates_cookie_t translate_coord =
xcb_translate_coordinates(s_xcbConnection, window, s_xcbScreen->root, 0, 0);
const XcbStdFreePtr<xcb_translate_coordinates_reply_t> xkbTranslateCoordReply{ xcb_translate_coordinates_reply(
s_xcbConnection, translate_coord, NULL) };
if (!xkbTranslateCoordReply)
{
return;
}
const int16_t x0 = xkbTranslateCoordReply->dst_x < 0 ? 0 : xkbTranslateCoordReply->dst_x;
const int16_t y0 = xkbTranslateCoordReply->dst_y < 0 ? 0 : xkbTranslateCoordReply->dst_y;
const int16_t x1 = xkbTranslateCoordReply->dst_x + xcbGeometryReply->width;
const int16_t y1 = xkbTranslateCoordReply->dst_y + xcbGeometryReply->height;
// ATTN For whatever reason, when making an exact rectangle the pointer will escape the top right corner in some cases. Adding
// an offset to the lines so that they cross each other prevents that.
const int16_t offset = 30;
// Create the left barrier info.
m_activeBarriers.push_back({ xcb_generate_id(s_xcbConnection), XCB_XFIXES_BARRIER_DIRECTIONS_POSITIVE_X, x0, Clamp(y0 - offset),
x0, Clamp(y1 + offset) });
// Create the right barrier info.
m_activeBarriers.push_back({ xcb_generate_id(s_xcbConnection), XCB_XFIXES_BARRIER_DIRECTIONS_NEGATIVE_X, x1, Clamp(y0 - offset),
x1, Clamp(y1 + offset) });
// Create the top barrier info.
m_activeBarriers.push_back({ xcb_generate_id(s_xcbConnection), XCB_XFIXES_BARRIER_DIRECTIONS_POSITIVE_Y, Clamp(x0 - offset), y0,
Clamp(x1 + offset), y0 });
// Create the bottom barrier info.
m_activeBarriers.push_back({ xcb_generate_id(s_xcbConnection), XCB_XFIXES_BARRIER_DIRECTIONS_NEGATIVE_Y, Clamp(x0 - offset), y1,
Clamp(x1 + offset), y1 });
// Create the xfixes barriers.
for (const auto& barrier : m_activeBarriers)
{
xcb_void_cookie_t cookie = xcb_xfixes_create_pointer_barrier_checked(
s_xcbConnection, barrier.id, window, barrier.x0, barrier.y0, barrier.x1, barrier.y1, barrier.direction, 0, NULL);
const XcbStdFreePtr<xcb_generic_error_t> xkbError{ xcb_request_check(s_xcbConnection, cookie) };
AZ_Warning(
"XcbInput", !xkbError, "XFixes, failed to create barrier %d at (%d %d %d %d)", barrier.id, barrier.x0, barrier.y0,
barrier.x1, barrier.y1);
}
}
else
{
for (const auto& barrier : m_activeBarriers)
{
xcb_xfixes_delete_pointer_barrier_checked(s_xcbConnection, barrier.id);
}
m_activeBarriers.clear();
}
xcb_flush(s_xcbConnection);
}
bool XcbInputDeviceMouse::InitializeXFixes()
{
m_xfixesInitialized = false;
// We don't have to free query_extension_reply according to xcb documentation.
const xcb_query_extension_reply_t* query_extension_reply = xcb_get_extension_data(s_xcbConnection, &xcb_xfixes_id);
if (!query_extension_reply || !query_extension_reply->present)
{
return m_xfixesInitialized;
}
const xcb_xfixes_query_version_cookie_t query_cookie = xcb_xfixes_query_version(s_xcbConnection, 5, 0);
xcb_generic_error_t* error = NULL;
const XcbStdFreePtr<xcb_xfixes_query_version_reply_t> xkbQueryRequestReply{ xcb_xfixes_query_version_reply(
s_xcbConnection, query_cookie, &error) };
if (!xkbQueryRequestReply || error)
{
if (error)
{
AZ_Warning("XcbInput", false, "Retrieving XFixes version failed : Error code %d", error->error_code);
free(error);
}
return m_xfixesInitialized;
}
else if (xkbQueryRequestReply->major_version < 5)
{
AZ_Warning("XcbInput", false, "XFixes version fails the minimum version check (%d<5)", xkbQueryRequestReply->major_version);
return m_xfixesInitialized;
}
m_xfixesInitialized = true;
return m_xfixesInitialized;
}
bool XcbInputDeviceMouse::InitializeXInput()
{
m_xInputInitialized = false;
// We don't have to free query_extension_reply according to xcb documentation.
const xcb_query_extension_reply_t* query_extension_reply = xcb_get_extension_data(s_xcbConnection, &xcb_input_id);
if (!query_extension_reply || !query_extension_reply->present)
{
return m_xInputInitialized;
}
const xcb_input_xi_query_version_cookie_t query_version_cookie = xcb_input_xi_query_version(s_xcbConnection, 2, 2);
xcb_generic_error_t* error = NULL;
const XcbStdFreePtr<xcb_input_xi_query_version_reply_t> xkbQueryRequestReply{ xcb_input_xi_query_version_reply(
s_xcbConnection, query_version_cookie, &error) };
if (!xkbQueryRequestReply || error)
{
if (error)
{
AZ_Warning("XcbInput", false, "Retrieving XInput version failed : Error code %d", error->error_code);
free(error);
}
return m_xInputInitialized;
}
else if (xkbQueryRequestReply->major_version < 2)
{
AZ_Warning("XcbInput", false, "XInput version fails the minimum version check (%d<5)", xkbQueryRequestReply->major_version);
return m_xInputInitialized;
}
m_xInputInitialized = true;
return m_xInputInitialized;
}
void XcbInputDeviceMouse::SetEnableXInput(bool enable)
{
struct
{
xcb_input_event_mask_t head;
int mask;
} mask;
mask.head.deviceid = XCB_INPUT_DEVICE_ALL;
mask.head.mask_len = 1;
if (enable)
{
mask.mask = XCB_INPUT_XI_EVENT_MASK_RAW_MOTION | XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_PRESS |
XCB_INPUT_XI_EVENT_MASK_RAW_BUTTON_RELEASE | XCB_INPUT_XI_EVENT_MASK_MOTION | XCB_INPUT_XI_EVENT_MASK_BUTTON_PRESS |
XCB_INPUT_XI_EVENT_MASK_BUTTON_RELEASE;
}
else
{
mask.mask = XCB_NONE;
}
xcb_input_xi_select_events(s_xcbConnection, s_xcbScreen->root, 1, &mask.head);
xcb_flush(s_xcbConnection);
}
void XcbInputDeviceMouse::SetSystemCursorState(SystemCursorState systemCursorState)
{
if (systemCursorState != m_systemCursorState)
{
m_systemCursorState = systemCursorState;
m_focusWindow = GetSystemCursorFocusWindow();
HandleCursorState(m_focusWindow, systemCursorState);
}
}
void XcbInputDeviceMouse::HandleCursorState(xcb_window_t window, SystemCursorState systemCursorState)
{
bool confined = false, cursorShown = true;
switch (systemCursorState)
{
case SystemCursorState::ConstrainedAndHidden:
{
//!< Constrained to the application's main window and hidden
confined = true;
cursorShown = false;
}
break;
case SystemCursorState::ConstrainedAndVisible:
{
//!< Constrained to the application's main window and visible
confined = true;
}
break;
case SystemCursorState::UnconstrainedAndHidden:
{
//!< Free to move outside the main window but hidden while inside
cursorShown = false;
}
break;
case SystemCursorState::UnconstrainedAndVisible:
{
//!< Free to move outside the application's main window and visible
}
case SystemCursorState::Unknown:
default:
break;
}
// ATTN GetSystemCursorFocusWindow when getting out of the play in editor will return XCB_NONE
// We need however the window id to reset the cursor.
if (XCB_NONE == window && (confined || cursorShown))
{
// Reuse the previous window to reset states.
window = m_prevConstraintWindow;
m_prevConstraintWindow = XCB_NONE;
}
else
{
// Remember the window we used to modify cursor and barrier states.
m_prevConstraintWindow = window;
}
SetEnableXInput(!cursorShown);
CreateBarriers(window, confined);
ShowCursor(window, cursorShown);
}
SystemCursorState XcbInputDeviceMouse::GetSystemCursorState() const
{
return m_systemCursorState;
}
void XcbInputDeviceMouse::SetSystemCursorPositionNormalizedInternal(xcb_window_t window, AZ::Vector2 positionNormalized)
{
// TODO Basically not done at all. Added only the basic functions needed.
const XcbStdFreePtr<xcb_get_geometry_reply_t> xkbGeometryReply{ xcb_get_geometry_reply(
s_xcbConnection, xcb_get_geometry(s_xcbConnection, window), NULL) };
if (!xkbGeometryReply)
{
return;
}
const int16_t x = static_cast<int16_t>(positionNormalized.GetX() * xkbGeometryReply->width);
const int16_t y = static_cast<int16_t>(positionNormalized.GetY() * xkbGeometryReply->height);
xcb_warp_pointer(s_xcbConnection, XCB_NONE, window, 0, 0, 0, 0, x, y);
xcb_flush(s_xcbConnection);
}
void XcbInputDeviceMouse::SetSystemCursorPositionNormalized(AZ::Vector2 positionNormalized)
{
const xcb_window_t window = GetSystemCursorFocusWindow();
if (XCB_NONE == window)
{
return;
}
SetSystemCursorPositionNormalizedInternal(window, positionNormalized);
}
AZ::Vector2 XcbInputDeviceMouse::GetSystemCursorPositionNormalizedInternal(xcb_window_t window) const
{
AZ::Vector2 position = AZ::Vector2::CreateZero();
const xcb_query_pointer_cookie_t pointer = xcb_query_pointer(s_xcbConnection, window);
const XcbStdFreePtr<xcb_query_pointer_reply_t> xkbQueryPointerReply{ xcb_query_pointer_reply(s_xcbConnection, pointer, NULL) };
if (!xkbQueryPointerReply)
{
return position;
}
const XcbStdFreePtr<xcb_get_geometry_reply_t> xkbGeometryReply{ xcb_get_geometry_reply(
s_xcbConnection, xcb_get_geometry(s_xcbConnection, window), NULL) };
if (!xkbGeometryReply)
{
return position;
}
AZ_Assert(xkbGeometryReply->width != 0, "xkbGeometry response width must be non-zero. (%d)", xkbGeometryReply->width);
const float normalizedCursorPostionX = static_cast<float>(xkbQueryPointerReply->win_x) / xkbGeometryReply->width;
AZ_Assert(xkbGeometryReply->height != 0, "xkbGeometry response height must be non-zero. (%d)", xkbGeometryReply->height);
const float normalizedCursorPostionY = static_cast<float>(xkbQueryPointerReply->win_y) / xkbGeometryReply->height;
position = AZ::Vector2(normalizedCursorPostionX, normalizedCursorPostionY);
return position;
}
AZ::Vector2 XcbInputDeviceMouse::GetSystemCursorPositionNormalized() const
{
const xcb_window_t window = GetSystemCursorFocusWindow();
if (XCB_NONE == window)
{
return AZ::Vector2::CreateZero();
}
return GetSystemCursorPositionNormalizedInternal(window);
}
void XcbInputDeviceMouse::TickInputDevice()
{
ProcessRawEventQueues();
}
void XcbInputDeviceMouse::ShowCursor(xcb_window_t window, bool show)
{
xcb_void_cookie_t cookie;
if (show)
{
cookie = xcb_xfixes_show_cursor_checked(s_xcbConnection, window);
}
else
{
cookie = xcb_xfixes_hide_cursor_checked(s_xcbConnection, window);
}
const XcbStdFreePtr<xcb_generic_error_t> xkbError{ xcb_request_check(s_xcbConnection, cookie) };
if (xkbError)
{
AZ_Warning("XcbInput", false, "ShowCursor failed: %d", xkbError->error_code);
return;
}
// ATTN In the following part we will when cursor gets hidden store the position of the cursor in screen space
// not window space. We use that to re-position when showing the cursor again. Is this the correct
// behavior?
const bool cursorWasHidden = !m_cursorShown;
m_cursorShown = show;
if (!m_cursorShown)
{
m_cursorHiddenPosition = GetSystemCursorPositionNormalizedInternal(s_xcbScreen->root);
SetSystemCursorPositionNormalized(AZ::Vector2(0.5f, 0.5f));
}
else if (cursorWasHidden)
{
SetSystemCursorPositionNormalizedInternal(s_xcbScreen->root, m_cursorHiddenPosition);
}
xcb_flush(s_xcbConnection);
}
void XcbInputDeviceMouse::HandleButtonPressEvents(uint32_t detail, bool pressed)
{
bool isWheel;
float wheelDirection;
const auto* button = InputChannelFromMouseEvent(detail, isWheel, wheelDirection);
if (button)
{
QueueRawButtonEvent(*button, pressed);
}
if (isWheel)
{
float axisValue = MAX_XI_WHEEL_SENSITIVITY * wheelDirection;
QueueRawMovementEvent(InputDeviceMouse::Movement::Z, axisValue);
}
}
void XcbInputDeviceMouse::HandlePointerMotionEvents(const xcb_generic_event_t* event)
{
const xcb_input_motion_event_t* mouseMotionEvent = reinterpret_cast<const xcb_input_motion_event_t*>(event);
m_systemCursorPosition[0] = mouseMotionEvent->event_x;
m_systemCursorPosition[1] = mouseMotionEvent->event_y;
}
void XcbInputDeviceMouse::HandleRawInputEvents(const xcb_ge_generic_event_t* event)
{
const xcb_ge_generic_event_t* genericEvent = reinterpret_cast<const xcb_ge_generic_event_t*>(event);
switch (genericEvent->event_type)
{
case XCB_INPUT_RAW_BUTTON_PRESS:
{
const xcb_input_raw_button_press_event_t* mouseButtonEvent =
reinterpret_cast<const xcb_input_raw_button_press_event_t*>(event);
HandleButtonPressEvents(mouseButtonEvent->detail, true);
}
break;
case XCB_INPUT_RAW_BUTTON_RELEASE:
{
const xcb_input_raw_button_release_event_t* mouseButtonEvent =
reinterpret_cast<const xcb_input_raw_button_release_event_t*>(event);
HandleButtonPressEvents(mouseButtonEvent->detail, false);
}
break;
case XCB_INPUT_RAW_MOTION:
{
const xcb_input_raw_motion_event_t* mouseMotionEvent = reinterpret_cast<const xcb_input_raw_motion_event_t*>(event);
int axisLen = xcb_input_raw_button_press_axisvalues_length(mouseMotionEvent);
const xcb_input_fp3232_t* axisvalues = xcb_input_raw_button_press_axisvalues_raw(mouseMotionEvent);
for (int i = 0; i < axisLen; ++i)
{
const float axisValue = fp3232ToFloat(axisvalues[i]);
switch (i)
{
case 0:
QueueRawMovementEvent(InputDeviceMouse::Movement::X, axisValue);
break;
case 1:
QueueRawMovementEvent(InputDeviceMouse::Movement::Y, axisValue);
break;
}
}
}
break;
}
}
void XcbInputDeviceMouse::PollSpecialEvents()
{
while (xcb_generic_event_t* genericEvent = xcb_poll_for_queued_event(s_xcbConnection))
{
// TODO Is the following correct? If we are showing the cursor, don't poll RAW Input events.
switch (genericEvent->response_type & ~0x80)
{
case XCB_GE_GENERIC:
{
const xcb_ge_generic_event_t* geGenericEvent = reinterpret_cast<const xcb_ge_generic_event_t*>(genericEvent);
// Only handle raw inputs if we have focus.
// Handle Raw Input events first.
if ((geGenericEvent->event_type == XCB_INPUT_RAW_BUTTON_PRESS) ||
(geGenericEvent->event_type == XCB_INPUT_RAW_BUTTON_RELEASE) ||
(geGenericEvent->event_type == XCB_INPUT_RAW_MOTION))
{
HandleRawInputEvents(geGenericEvent);
free(genericEvent);
}
}
break;
}
}
}
void XcbInputDeviceMouse::HandleXcbEvent(xcb_generic_event_t* event)
{
switch (event->response_type & ~0x80)
{
// QT5 is using by default XInput which means we do need to check for XCB_GE_GENERIC event to parse all mouse related events.
case XCB_GE_GENERIC:
{
const xcb_ge_generic_event_t* genericEvent = reinterpret_cast<const xcb_ge_generic_event_t*>(event);
// Handling RAW Inputs here works in GameMode but not in Editor mode because QT is
// not handling RAW input events and passing to.
if (!m_cursorShown)
{
// Handle Raw Input events first.
if ((genericEvent->event_type == XCB_INPUT_RAW_BUTTON_PRESS) ||
(genericEvent->event_type == XCB_INPUT_RAW_BUTTON_RELEASE) || (genericEvent->event_type == XCB_INPUT_RAW_MOTION))
{
HandleRawInputEvents(genericEvent);
}
}
else
{
switch (genericEvent->event_type)
{
case XCB_INPUT_BUTTON_PRESS:
{
const xcb_input_button_press_event_t* mouseButtonEvent =
reinterpret_cast<const xcb_input_button_press_event_t*>(genericEvent);
HandleButtonPressEvents(mouseButtonEvent->detail, true);
}
break;
case XCB_INPUT_BUTTON_RELEASE:
{
const xcb_input_button_release_event_t* mouseButtonEvent =
reinterpret_cast<const xcb_input_button_release_event_t*>(genericEvent);
HandleButtonPressEvents(mouseButtonEvent->detail, false);
}
break;
case XCB_INPUT_MOTION:
{
HandlePointerMotionEvents(event);
}
break;
}
}
}
break;
case XCB_FOCUS_IN:
{
const xcb_focus_in_event_t* focusInEvent = reinterpret_cast<const xcb_focus_in_event_t*>(event);
if (m_focusWindow != focusInEvent->event)
{
m_focusWindow = focusInEvent->event;
HandleCursorState(m_focusWindow, m_systemCursorState);
}
}
break;
case XCB_FOCUS_OUT:
{
const xcb_focus_out_event_t* focusOutEvent = reinterpret_cast<const xcb_focus_out_event_t*>(event);
HandleCursorState(focusOutEvent->event, SystemCursorState::UnconstrainedAndVisible);
ProcessRawEventQueues();
ResetInputChannelStates();
m_focusWindow = XCB_NONE;
}
break;
}
}
} // namespace AzFramework

@ -0,0 +1,193 @@
/*
* 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
*
*/
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
#include <AzFramework/XcbConnectionManager.h>
#include <AzFramework/XcbEventHandler.h>
#include <AzFramework/XcbInterface.h>
#include <xcb/xfixes.h>
#include <xcb/xinput.h>
// The maximum number of raw input axis this mouse device supports.
constexpr uint32_t MAX_XI_RAW_AXIS = 2;
// The sensitivity of the wheel.
constexpr float MAX_XI_WHEEL_SENSITIVITY = 140.0f;
namespace AzFramework
{
class XcbInputDeviceMouse
: public InputDeviceMouse::Implementation
, public XcbEventHandlerBus::Handler
{
public:
AZ_CLASS_ALLOCATOR(XcbInputDeviceMouse, AZ::SystemAllocator, 0);
////////////////////////////////////////////////////////////////////////////////////////////
//! Constructor
//! \param[in] inputDevice Reference to the input device being implemented
XcbInputDeviceMouse(InputDeviceMouse& inputDevice);
////////////////////////////////////////////////////////////////////////////////////////////
//! Destructor
virtual ~XcbInputDeviceMouse();
static XcbInputDeviceMouse::Implementation* Create(InputDeviceMouse& inputDevice);
protected:
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceMouse::Implementation::IsConnected
bool IsConnected() const override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceMouse::Implementation::SetSystemCursorState
void SetSystemCursorState(SystemCursorState systemCursorState) override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceMouse::Implementation::GetSystemCursorState
SystemCursorState GetSystemCursorState() const override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceMouse::Implementation::SetSystemCursorPositionNormalized
void SetSystemCursorPositionNormalized(AZ::Vector2 positionNormalized) override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceMouse::Implementation::GetSystemCursorPositionNormalized
AZ::Vector2 GetSystemCursorPositionNormalized() const override;
////////////////////////////////////////////////////////////////////////////////////////////
//! \ref AzFramework::InputDeviceMouse::Implementation::TickInputDevice
void TickInputDevice() override;
//! This method is called by the Editor to accommodate some events with the Editor. Never called in Game mode.
void PollSpecialEvents() override;
//! Handle X11 events.
void HandleXcbEvent(xcb_generic_event_t* event) override;
//! Initialize XFixes extension. Used for barriers.
static bool InitializeXFixes();
//! Initialize XInput extension. Used for raw input during confinement and showing/hiding the cursor.
static bool InitializeXInput();
//! Enables/Disables XInput Raw Input events.
void SetEnableXInput(bool enable);
//! Create barriers.
void CreateBarriers(xcb_window_t window, bool create);
//! Helper function.
void SystemCursorStateToLogic(SystemCursorState systemCursorState, bool& confined, bool& cursorShown);
//! Shows/Hides the cursor.
void ShowCursor(xcb_window_t window, bool show);
//! Get the normalized cursor position. The coordinates returned are relative to the specified window.
AZ::Vector2 GetSystemCursorPositionNormalizedInternal(xcb_window_t window) const;
//! Set the normalized cursor position. The normalized position will be relative to the specified window.
void SetSystemCursorPositionNormalizedInternal(xcb_window_t window, AZ::Vector2 positionNormalized);
//! Handle button press/release events.
void HandleButtonPressEvents(uint32_t detail, bool pressed);
//! Handle motion notify events.
void HandlePointerMotionEvents(const xcb_generic_event_t* event);
//! Will set cursor states and confinement modes.
void HandleCursorState(xcb_window_t window, SystemCursorState systemCursorState);
//! Will handle all raw input events.
void HandleRawInputEvents(const xcb_ge_generic_event_t* event);
//! Convert XInput fp1616 to float.
inline float fp1616ToFloat(xcb_input_fp1616_t value) const
{
return static_cast<float>((value >> 16) + (value & 0xffff) / 0xffff);
}
//! Convert XInput fp3232 to float.
inline float fp3232ToFloat(xcb_input_fp3232_t value) const
{
return static_cast<float>(value.integral) + static_cast<float>(value.frac / (float)(1ull << 32));
}
const InputChannelId* InputChannelFromMouseEvent(xcb_button_t button, bool& isWheel, float& direction) const
{
isWheel = false;
direction = 1.0f;
switch (button)
{
case XCB_BUTTON_INDEX_1:
return &InputDeviceMouse::Button::Left;
case XCB_BUTTON_INDEX_2:
return &InputDeviceMouse::Button::Right;
case XCB_BUTTON_INDEX_3:
return &InputDeviceMouse::Button::Middle;
case XCB_BUTTON_INDEX_4:
isWheel = true;
direction = 1.0f;
break;
case XCB_BUTTON_INDEX_5:
isWheel = true;
direction = -1.0f;
break;
default:
break;
}
return nullptr;
}
// Barriers work only with positive values. We clamp here to zero.
inline int16_t Clamp(int16_t value) const
{
return value < 0 ? 0 : value;
}
private:
//! The current system cursor state
SystemCursorState m_systemCursorState;
//! The cursor position before it got hidden.
AZ::Vector2 m_cursorHiddenPosition;
AZ::Vector2 m_systemCursorPositionNormalized;
uint32_t m_systemCursorPosition[MAX_XI_RAW_AXIS];
static xcb_connection_t* s_xcbConnection;
static xcb_screen_t* s_xcbScreen;
//! Will be true if the xfixes extension could be initialized.
static bool m_xfixesInitialized;
//! Will be true if the xinput2 extension could be initialized.
static bool m_xInputInitialized;
//! The window that had focus
xcb_window_t m_prevConstraintWindow;
//! The current window that has focus
xcb_window_t m_focusWindow;
//! Will be true if the cursor is shown else false.
bool m_cursorShown;
struct XFixesBarrierProperty
{
xcb_xfixes_barrier_t id;
uint32_t direction;
int16_t x0, y0, x1, y1;
};
//! Array that holds barrier information used to confine the cursor.
std::vector<XFixesBarrierProperty> m_activeBarriers;
};
} // namespace AzFramework

@ -8,25 +8,31 @@
#include <AzFramework/Application/Application.h>
#include <AzFramework/Windowing/NativeWindow.h>
#include <AzFramework/XcbNativeWindow.h>
#include <AzFramework/XcbConnectionManager.h>
#include <AzFramework/XcbInterface.h>
#include <AzFramework/XcbNativeWindow.h>
#include <xcb/xcb.h>
namespace AzFramework
{
[[maybe_unused]] const char XcbErrorWindow[] = "XcbNativeWindow";
static constexpr uint8_t s_XcbFormatDataSize = 32; // Format indicator for xcb for client messages
static constexpr uint16_t s_DefaultXcbWindowBorderWidth = 4; // The default border with in pixels if a border was specified
static constexpr uint8_t s_XcbResponseTypeMask = 0x7f; // Mask to extract the specific event type from an xcb event
static constexpr uint8_t s_XcbFormatDataSize = 32; // Format indicator for xcb for client messages
static constexpr uint16_t s_DefaultXcbWindowBorderWidth = 4; // The default border with in pixels if a border was specified
static constexpr uint8_t s_XcbResponseTypeMask = 0x7f; // Mask to extract the specific event type from an xcb event
#define _NET_WM_STATE_REMOVE 0l
#define _NET_WM_STATE_ADD 1l
#define _NET_WM_STATE_TOGGLE 2l
////////////////////////////////////////////////////////////////////////////////////////////////
XcbNativeWindow::XcbNativeWindow()
XcbNativeWindow::XcbNativeWindow()
: NativeWindow::Implementation()
, m_xcbConnection(nullptr)
, m_xcbRootScreen(nullptr)
, m_xcbWindow(XCB_NONE)
{
if (auto xcbConnectionManager = AzFramework::XcbConnectionManagerInterface::Get();
xcbConnectionManager != nullptr)
if (auto xcbConnectionManager = AzFramework::XcbConnectionManagerInterface::Get(); xcbConnectionManager != nullptr)
{
m_xcbConnection = xcbConnectionManager->GetXcbConnection();
}
@ -34,89 +40,184 @@ namespace AzFramework
}
////////////////////////////////////////////////////////////////////////////////////////////////
XcbNativeWindow::~XcbNativeWindow() = default;
XcbNativeWindow::~XcbNativeWindow()
{
if (XCB_NONE != m_xcbWindow)
{
xcb_destroy_window(m_xcbConnection, m_xcbWindow);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
void XcbNativeWindow::InitWindow(const AZStd::string& title,
const WindowGeometry& geometry,
const WindowStyleMasks& styleMasks)
void XcbNativeWindow::InitWindow(const AZStd::string& title, const WindowGeometry& geometry, const WindowStyleMasks& styleMasks)
{
// Get the parent window
// Get the parent window
const xcb_setup_t* xcbSetup = xcb_get_setup(m_xcbConnection);
xcb_screen_t* xcbRootScreen = xcb_setup_roots_iterator(xcbSetup).data;
xcb_window_t xcbParentWindow = xcbRootScreen->root;
m_xcbRootScreen = xcb_setup_roots_iterator(xcbSetup).data;
xcb_window_t xcbParentWindow = m_xcbRootScreen->root;
// Create an XCB window from the connection
m_xcbWindow = xcb_generate_id(m_xcbConnection);
uint16_t borderWidth = 0;
const uint32_t mask = styleMasks.m_platformAgnosticStyleMask;
if ((mask & WindowStyleMasks::WINDOW_STYLE_BORDERED) ||
(mask & WindowStyleMasks::WINDOW_STYLE_RESIZEABLE))
if ((mask & WindowStyleMasks::WINDOW_STYLE_BORDERED) || (mask & WindowStyleMasks::WINDOW_STYLE_RESIZEABLE))
{
borderWidth = s_DefaultXcbWindowBorderWidth;
}
uint32_t eventMask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
const uint32_t interestedEvents =
XCB_EVENT_MASK_STRUCTURE_NOTIFY
| XCB_EVENT_MASK_BUTTON_PRESS
| XCB_EVENT_MASK_BUTTON_RELEASE
| XCB_EVENT_MASK_KEY_PRESS
| XCB_EVENT_MASK_KEY_RELEASE
| XCB_EVENT_MASK_POINTER_MOTION
;
uint32_t valueList[] = { xcbRootScreen->black_pixel,
interestedEvents };
const uint32_t interestedEvents = XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
XCB_EVENT_MASK_FOCUS_CHANGE | XCB_EVENT_MASK_PROPERTY_CHANGE;
uint32_t valueList[] = { m_xcbRootScreen->black_pixel, interestedEvents };
xcb_void_cookie_t xcbCheckResult;
xcbCheckResult = xcb_create_window_checked(m_xcbConnection,
XCB_COPY_FROM_PARENT,
m_xcbWindow,
xcbParentWindow,
aznumeric_cast<int16_t>(geometry.m_posX),
aznumeric_cast<int16_t>(geometry.m_posY),
aznumeric_cast<int16_t>(geometry.m_width),
aznumeric_cast<int16_t>(geometry.m_height),
borderWidth,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
xcbRootScreen->root_visual,
eventMask,
valueList);
xcbCheckResult = xcb_create_window_checked(
m_xcbConnection, XCB_COPY_FROM_PARENT, m_xcbWindow, xcbParentWindow, aznumeric_cast<int16_t>(geometry.m_posX),
aznumeric_cast<int16_t>(geometry.m_posY), aznumeric_cast<int16_t>(geometry.m_width), aznumeric_cast<int16_t>(geometry.m_height),
borderWidth, XCB_WINDOW_CLASS_INPUT_OUTPUT, m_xcbRootScreen->root_visual, eventMask, valueList);
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to create xcb window.");
SetWindowTitle(title);
// Setup the window close event
const static char* wmProtocolString = "WM_PROTOCOLS";
xcb_intern_atom_cookie_t cookieProtocol = xcb_intern_atom(m_xcbConnection, 1, strlen(wmProtocolString), wmProtocolString);
xcb_intern_atom_reply_t* replyProtocol = xcb_intern_atom_reply(m_xcbConnection, cookieProtocol, nullptr);
AZ_Error(XcbErrorWindow, replyProtocol != nullptr, "Unable to query xcb '%s' atom", wmProtocolString);
m_xcbAtomProtocols = replyProtocol->atom;
const static char* wmDeleteWindowString = "WM_DELETE_WINDOW";
xcb_intern_atom_cookie_t cookieDeleteWindow = xcb_intern_atom(m_xcbConnection, 0, strlen(wmDeleteWindowString), wmDeleteWindowString);
xcb_intern_atom_reply_t* replyDeleteWindow = xcb_intern_atom_reply(m_xcbConnection, cookieDeleteWindow, nullptr);
AZ_Error(XcbErrorWindow, replyDeleteWindow != nullptr, "Unable to query xcb '%s' atom", wmDeleteWindowString);
m_xcbAtomDeleteWindow = replyDeleteWindow->atom;
xcbCheckResult = xcb_change_property_checked(m_xcbConnection,
XCB_PROP_MODE_REPLACE,
m_xcbWindow,
m_xcbAtomProtocols,
XCB_ATOM_ATOM,
s_XcbFormatDataSize,
1,
&m_xcbAtomDeleteWindow);
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to change the xcb atom property for WM_CLOSE event");
m_posX = geometry.m_posX;
m_posY = geometry.m_posY;
m_width = geometry.m_width;
m_height = geometry.m_height;
InitializeAtoms();
xcb_client_message_event_t event;
event.response_type = XCB_CLIENT_MESSAGE;
event.type = _NET_REQUEST_FRAME_EXTENTS;
event.window = m_xcbWindow;
event.format = 32;
event.sequence = 0;
event.data.data32[0] = 0l;
event.data.data32[1] = 0l;
event.data.data32[2] = 0l;
event.data.data32[3] = 0l;
event.data.data32[4] = 0l;
xcbCheckResult = xcb_send_event(
m_xcbConnection, 1, m_xcbRootScreen->root, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char*)&event);
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to set _NET_REQUEST_FRAME_EXTENTS");
// The WM will be able to kill the application if it gets unresponsive.
int32_t pid = getpid();
xcb_change_property(m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, _NET_WM_PID, XCB_ATOM_CARDINAL, 32, 1, &pid);
xcb_flush(m_xcbConnection);
}
xcb_atom_t XcbNativeWindow::GetAtom(const char* atomName)
{
xcb_intern_atom_cookie_t intern_atom_cookie = xcb_intern_atom(m_xcbConnection, 0, strlen(atomName), atomName);
XcbStdFreePtr<xcb_intern_atom_reply_t> xkbinternAtom{ xcb_intern_atom_reply(m_xcbConnection, intern_atom_cookie, NULL) };
if (!xkbinternAtom)
{
AZ_Error(XcbErrorWindow, xkbinternAtom != nullptr, "Unable to query xcb '%s' atom", atomName);
return XCB_NONE;
}
return xkbinternAtom->atom;
}
int XcbNativeWindow::SetAtom(xcb_window_t window, xcb_atom_t atom, xcb_atom_t type, size_t len, void* data)
{
xcb_void_cookie_t cookie = xcb_change_property_checked(m_xcbConnection, XCB_PROP_MODE_REPLACE, window, atom, type, 32, len, data);
XcbStdFreePtr<xcb_generic_error_t> xkbError{ xcb_request_check(m_xcbConnection, cookie) };
if (!xkbError)
{
return 0;
}
return xkbError->error_code;
}
////////////////////////////////////////////////////////////////////////////////////////////////
void XcbNativeWindow::InitializeAtoms()
{
AZStd::vector<xcb_atom_t> Atoms;
_NET_ACTIVE_WINDOW = GetAtom("_NET_ACTIVE_WINDOW");
_NET_WM_BYPASS_COMPOSITOR = GetAtom("_NET_WM_BYPASS_COMPOSITOR");
// ---------------------------------------------------------------------
// Handle all WM Protocols atoms.
//
WM_PROTOCOLS = GetAtom("WM_PROTOCOLS");
// This atom is used to close a window. Emitted when user clicks the close button.
WM_DELETE_WINDOW = GetAtom("WM_DELETE_WINDOW");
Atoms.push_back(WM_DELETE_WINDOW);
xcb_change_property(
m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, WM_PROTOCOLS, XCB_ATOM_ATOM, 32, Atoms.size(), Atoms.data());
xcb_flush(m_xcbConnection);
// ---------------------------------------------------------------------
// Handle all WM State atoms.
//
_NET_WM_STATE = GetAtom("_NET_WM_STATE");
_NET_WM_STATE_FULLSCREEN = GetAtom("_NET_WM_STATE_FULLSCREEN");
_NET_WM_STATE_MAXIMIZED_VERT = GetAtom("_NET_WM_STATE_MAXIMIZED_VERT");
_NET_WM_STATE_MAXIMIZED_HORZ = GetAtom("_NET_WM_STATE_MAXIMIZED_HORZ");
_NET_MOVERESIZE_WINDOW = GetAtom("_NET_MOVERESIZE_WINDOW");
_NET_REQUEST_FRAME_EXTENTS = GetAtom("_NET_REQUEST_FRAME_EXTENTS");
_NET_FRAME_EXTENTS = GetAtom("_NET_FRAME_EXTENTS");
_NET_WM_PID = GetAtom("_NET_WM_PID");
}
void XcbNativeWindow::GetWMStates()
{
xcb_get_property_cookie_t cookie = xcb_get_property(m_xcbConnection, 0, m_xcbWindow, _NET_WM_STATE, XCB_ATOM_ATOM, 0, 1024);
xcb_generic_error_t* error = nullptr;
XcbStdFreePtr<xcb_get_property_reply_t> xkbGetPropertyReply{ xcb_get_property_reply(m_xcbConnection, cookie, &error) };
if (!xkbGetPropertyReply || error || !((xkbGetPropertyReply->format == 32) && (xkbGetPropertyReply->type == XCB_ATOM_ATOM)))
{
AZ_Warning("ApplicationLinux", false, "Acquiring _NET_WM_STATE information from the WM failed.");
if (error)
{
AZ_TracePrintf("Error", "Error code %d", error->error_code);
free(error);
}
return;
}
m_fullscreenState = false;
m_horizontalyMaximized = false;
m_verticallyMaximized = false;
const xcb_atom_t* states = static_cast<const xcb_atom_t*>(xcb_get_property_value(xkbGetPropertyReply.get()));
for (int i = 0; i < xkbGetPropertyReply->length; i++)
{
if (states[i] == _NET_WM_STATE_FULLSCREEN)
{
m_fullscreenState = true;
}
else if (states[i] == _NET_WM_STATE_MAXIMIZED_HORZ)
{
m_horizontalyMaximized = true;
}
else if (states[i] == _NET_WM_STATE_MAXIMIZED_VERT)
{
m_verticallyMaximized = true;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
@ -146,7 +247,7 @@ namespace AzFramework
xcb_flush(m_xcbConnection);
}
XcbEventHandlerBus::Handler::BusDisconnect();
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
NativeWindowHandle XcbNativeWindow::GetWindowHandle() const
@ -158,14 +259,9 @@ namespace AzFramework
void XcbNativeWindow::SetWindowTitle(const AZStd::string& title)
{
xcb_void_cookie_t xcbCheckResult;
xcbCheckResult = xcb_change_property(m_xcbConnection,
XCB_PROP_MODE_REPLACE,
m_xcbWindow,
XCB_ATOM_WM_NAME,
XCB_ATOM_STRING,
8,
static_cast<uint32_t>(title.size()),
title.c_str());
xcbCheckResult = xcb_change_property(
m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, static_cast<uint32_t>(title.size()),
title.c_str());
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to set window title.");
}
@ -175,7 +271,7 @@ namespace AzFramework
const uint32_t values[] = { clientAreaSize.m_width, clientAreaSize.m_height };
xcb_configure_window(m_xcbConnection, m_xcbWindow, XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values);
m_width = clientAreaSize.m_width;
m_height = clientAreaSize.m_height;
}
@ -185,16 +281,77 @@ namespace AzFramework
{
// [GFX TODO][GHI - 2678]
// Using 60 for now until proper support is added
return 60;
}
bool XcbNativeWindow::GetFullScreenState() const
{
return m_fullscreenState;
}
void XcbNativeWindow::SetFullScreenState(bool fullScreenState)
{
// TODO This is a pretty basic full-screen implementation using WM's _NET_WM_STATE_FULLSCREEN state.
// Do we have to provide also the old way?
GetWMStates();
xcb_client_message_event_t event;
event.response_type = XCB_CLIENT_MESSAGE;
event.type = _NET_WM_STATE;
event.window = m_xcbWindow;
event.format = 32;
event.sequence = 0;
event.data.data32[0] = fullScreenState ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
event.data.data32[1] = _NET_WM_STATE_FULLSCREEN;
event.data.data32[2] = 0;
event.data.data32[3] = 1;
event.data.data32[4] = 0;
xcb_void_cookie_t xcbCheckResult = xcb_send_event(
m_xcbConnection, 1, m_xcbRootScreen->root, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char*)&event);
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to set _NET_WM_STATE_FULLSCREEN");
// Also try to disable/enable the compositor if possible. Might help in some cases.
const long _NET_WM_BYPASS_COMPOSITOR_HINT_ON = m_fullscreenState ? 1 : 0;
SetAtom(m_xcbWindow, _NET_WM_BYPASS_COMPOSITOR, XCB_ATOM_CARDINAL, 32, (char*)&_NET_WM_BYPASS_COMPOSITOR_HINT_ON);
if (!fullScreenState)
{
if (m_horizontalyMaximized || m_verticallyMaximized)
{
printf("Remove maximized state.\n");
xcb_client_message_event_t event;
event.response_type = XCB_CLIENT_MESSAGE;
event.type = _NET_WM_STATE;
event.window = m_xcbWindow;
event.format = 32;
event.sequence = 0;
event.data.data32[0] = _NET_WM_STATE_MAXIMIZED_VERT;
event.data.data32[1] = _NET_WM_STATE_MAXIMIZED_HORZ;
event.data.data32[2] = 0;
event.data.data32[3] = 0;
event.data.data32[4] = 0;
xcb_void_cookie_t xcbCheckResult = xcb_send_event(
m_xcbConnection, 1, m_xcbRootScreen->root, XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
(const char*)&event);
AZ_Assert(
ValidateXcbResult(xcbCheckResult), "Failed to remove _NET_WM_STATE_MAXIMIZED_VERT | _NET_WM_STATE_MAXIMIZED_HORZ");
}
}
xcb_flush(m_xcbConnection);
m_fullscreenState = fullScreenState;
}
////////////////////////////////////////////////////////////////////////////////////////////////
bool XcbNativeWindow::ValidateXcbResult(xcb_void_cookie_t cookie)
{
bool result = true;
if (xcb_generic_error_t* error = xcb_request_check(m_xcbConnection, cookie))
{
AZ_TracePrintf("Error","Error code %d", error->error_code);
AZ_TracePrintf("Error", "Error code %d", error->error_code);
result = false;
}
return result;
@ -205,20 +362,20 @@ namespace AzFramework
{
switch (event->response_type & s_XcbResponseTypeMask)
{
case XCB_CONFIGURE_NOTIFY:
case XCB_CONFIGURE_NOTIFY:
{
xcb_configure_notify_event_t* cne = reinterpret_cast<xcb_configure_notify_event_t*>(event);
WindowSizeChanged(aznumeric_cast<uint32_t>(cne->width),
aznumeric_cast<uint32_t>(cne->height));
if ((cne->width != m_width) || (cne->height != m_height))
{
WindowSizeChanged(aznumeric_cast<uint32_t>(cne->width), aznumeric_cast<uint32_t>(cne->height));
}
break;
}
case XCB_CLIENT_MESSAGE:
case XCB_CLIENT_MESSAGE:
{
xcb_client_message_event_t* cme = reinterpret_cast<xcb_client_message_event_t*>(event);
if ((cme->type == m_xcbAtomProtocols) &&
(cme->format == s_XcbFormatDataSize) &&
(cme->data.data32[0] == m_xcbAtomDeleteWindow))
if ((cme->type == WM_PROTOCOLS) && (cme->format == s_XcbFormatDataSize) && (cme->data.data32[0] == WM_DELETE_WINDOW))
{
Deactivate();
@ -239,7 +396,8 @@ namespace AzFramework
if (m_activated)
{
WindowNotificationBus::Event(reinterpret_cast<NativeWindowHandle>(m_xcbWindow), &WindowNotificationBus::Events::OnWindowResized, width, height);
WindowNotificationBus::Event(
reinterpret_cast<NativeWindowHandle>(m_xcbWindow), &WindowNotificationBus::Events::OnWindowResized, width, height);
}
}
}

@ -27,15 +27,16 @@ namespace AzFramework
////////////////////////////////////////////////////////////////////////////////////////////
// NativeWindow::Implementation
void InitWindow(const AZStd::string& title,
const WindowGeometry& geometry,
const WindowStyleMasks& styleMasks) override;
void InitWindow(const AZStd::string& title, const WindowGeometry& geometry, const WindowStyleMasks& styleMasks) override;
void Activate() override;
void Deactivate() override;
NativeWindowHandle GetWindowHandle() const override;
void SetWindowTitle(const AZStd::string& title) override;
void ResizeClientArea(WindowSize clientAreaSize) override;
uint32_t GetDisplayRefreshRate() const override;
uint32_t GetDisplayRefreshRate() const override;
bool GetFullScreenState() const override;
void SetFullScreenState(bool fullScreenState) override;
////////////////////////////////////////////////////////////////////////////////////////////
// XcbEventHandlerBus::Handler
@ -44,10 +45,46 @@ namespace AzFramework
private:
bool ValidateXcbResult(xcb_void_cookie_t cookie);
void WindowSizeChanged(const uint32_t width, const uint32_t height);
int SetAtom(xcb_window_t window, xcb_atom_t atom, xcb_atom_t type, size_t len, void* data);
// Initialize one atom.
xcb_atom_t GetAtom(const char* atomName);
// Initialize all used atoms.
void InitializeAtoms();
void GetWMStates();
xcb_connection_t* m_xcbConnection = nullptr;
xcb_screen_t* m_xcbRootScreen = nullptr;
xcb_window_t m_xcbWindow = 0;
int32_t m_posX;
int32_t m_posY;
bool m_fullscreenState = false;
bool m_horizontalyMaximized = false;
bool m_verticallyMaximized = false;
xcb_connection_t* m_xcbConnection = nullptr;
xcb_window_t m_xcbWindow = 0;
xcb_atom_t m_xcbAtomProtocols;
xcb_atom_t m_xcbAtomDeleteWindow;
// Use exact atom names for easy readability and usage.
xcb_atom_t WM_PROTOCOLS;
xcb_atom_t WM_DELETE_WINDOW;
// This atom is used to activate a window.
xcb_atom_t _NET_ACTIVE_WINDOW;
// This atom is use to bypass a compositor. Used during fullscreen mode.
xcb_atom_t _NET_WM_BYPASS_COMPOSITOR;
// This atom is used to change the state of a window using the WM.
xcb_atom_t _NET_WM_STATE;
// This atom is used to enable/disable fullscreen mode of a window.
xcb_atom_t _NET_WM_STATE_FULLSCREEN;
// This atom is used to extend the window to max vertically.
xcb_atom_t _NET_WM_STATE_MAXIMIZED_VERT;
// This atom is used to extend the window to max horizontally.
xcb_atom_t _NET_WM_STATE_MAXIMIZED_HORZ;
// This atom is used to position and resize a window.
xcb_atom_t _NET_MOVERESIZE_WINDOW;
// This atom is used to request the extent of the window.
xcb_atom_t _NET_REQUEST_FRAME_EXTENTS;
// This atom is used to identify the reply event for _NET_REQUEST_FRAME_EXTENTS
xcb_atom_t _NET_FRAME_EXTENTS;
// This atom is used to allow WM to kill app if not responsive anymore
xcb_atom_t _NET_WM_PID;
};
} // namespace AzFramework

@ -12,6 +12,8 @@ set(FILES
AzFramework/XcbConnectionManager.h
AzFramework/XcbInputDeviceKeyboard.cpp
AzFramework/XcbInputDeviceKeyboard.h
AzFramework/XcbInputDeviceMouse.cpp
AzFramework/XcbInputDeviceMouse.h
AzFramework/XcbInterface.h
AzFramework/XcbNativeWindow.cpp
AzFramework/XcbNativeWindow.h

@ -0,0 +1,27 @@
/*
* 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
*
*/
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
#include <AzFramework/XcbInputDeviceMouse.h>
#endif
namespace AzFramework
{
InputDeviceMouse::Implementation* InputDeviceMouse::Implementation::Create(InputDeviceMouse& inputDevice)
{
#if PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
return XcbInputDeviceMouse::Create(inputDevice);
#elif PAL_TRAIT_LINUX_WINDOW_MANAGER_WAYLAND
#error "Linux Window Manager Wayland not supported."
return nullptr;
#else
#error "Linux Window Manager not recognized."
return nullptr;
#endif // PAL_TRAIT_LINUX_WINDOW_MANAGER_XCB
}
} // namespace AzFramework

@ -22,8 +22,10 @@ if (${PAL_TRAIT_LINUX_WINDOW_MANAGER} STREQUAL "xcb")
PRIVATE
3rdParty::X11::xcb
3rdParty::X11::xcb_xkb
3rdParty::X11::xcb_xfixes
3rdParty::X11::xkbcommon
3rdParty::X11::xkbcommon_X11
xcb-xinput
)
elseif(PAL_TRAIT_LINUX_WINDOW_MANAGER STREQUAL "wayland")

@ -22,8 +22,8 @@ set(FILES
AzFramework/Windowing/NativeWindow_Linux.cpp
../Common/Unimplemented/AzFramework/Input/Devices/Gamepad/InputDeviceGamepad_Unimplemented.cpp
AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard_Linux.cpp
AzFramework/Input/Devices/Mouse/InputDeviceMouse_Linux.cpp
../Common/Unimplemented/AzFramework/Input/Devices/Motion/InputDeviceMotion_Unimplemented.cpp
../Common/Unimplemented/AzFramework/Input/Devices/Mouse/InputDeviceMouse_Unimplemented.cpp
../Common/Unimplemented/AzFramework/Input/Devices/Touch/InputDeviceTouch_Unimplemented.cpp
AzFramework/Input/User/LocalUserId_Platform.h
../Common/Default/AzFramework/Input/User/LocalUserId_Default.h

@ -569,11 +569,12 @@ namespace UnitTest
FillSpawnable(NumEntities);
CreateEntityReferences(refScheme);
AZ_PUSH_DISABLE_WARNING(5233, "-Wunused-lambda-capture") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback =
[this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities)
AZ_POP_DISABLE_WARNING
{
AZ_UNUSED(refScheme);
AZ_UNUSED(NumEntities);
ValidateEntityReferences(refScheme, NumEntities, entities);
};
@ -591,11 +592,12 @@ namespace UnitTest
FillSpawnable(NumEntities);
CreateEntityReferences(refScheme);
AZ_PUSH_DISABLE_WARNING(5233, "-Wunused-lambda-capture") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback =
[this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities)
AZ_POP_DISABLE_WARNING
{
AZ_UNUSED(refScheme);
AZ_UNUSED(NumEntities);
ValidateEntityReferences(refScheme, NumEntities, entities);
};
@ -720,11 +722,12 @@ namespace UnitTest
FillSpawnable(NumEntities);
CreateEntityReferences(refScheme);
AZ_PUSH_DISABLE_WARNING(5233, "-Wunused-lambda-capture") // Older versions of MSVC toolchain require to pass constexpr in the
// capture. Newer versions issue unused warning
auto callback =
[this, refScheme, NumEntities](AzFramework::EntitySpawnTicket::Id, AzFramework::SpawnableConstEntityContainerView entities)
AZ_POP_DISABLE_WARNING
{
AZ_UNUSED(refScheme);
AZ_UNUSED(NumEntities);
ValidateEntityReferences(refScheme, NumEntities, entities);
};

@ -46,6 +46,8 @@ namespace AzManipulatorTestFramework
virtual void UpdateVisibility() = 0;
//! Set if sticky select is enabled or not.
virtual void SetStickySelect(bool enabled) = 0;
//! Get default Editor Camera Position.
virtual AZ::Vector3 DefaultEditorCameraPosition() const = 0;
};
//! This interface is used to simulate the manipulator manager while the manipulators are under test.

@ -36,6 +36,7 @@ namespace AzManipulatorTestFramework
int GetViewportId() const override;
void UpdateVisibility() override;
void SetStickySelect(bool enabled) override;
AZ::Vector3 DefaultEditorCameraPosition() const override;
// ViewportInteractionRequestBus overrides ...
AzFramework::CameraState GetCameraState() override;

@ -120,6 +120,11 @@ namespace AzManipulatorTestFramework
m_stickySelect = enabled;
}
AZ::Vector3 ViewportInteraction::DefaultEditorCameraPosition() const
{
return {};
}
void ViewportInteraction::SetGridSize(float size)
{
m_gridSize = size;

@ -65,7 +65,7 @@ namespace AzNetworking
: m_delta(delta)
, m_dataSerializer(m_delta.GetBufferPtr(), m_delta.GetBufferCapacity())
{
m_namePrefix.reserve(128);
;
}
DeltaSerializerCreate::~DeltaSerializerCreate()
@ -73,7 +73,7 @@ namespace AzNetworking
// Delete any left over records that might be hanging around
for (auto iter : m_records)
{
delete iter.second;
delete iter;
}
m_records.clear();
}
@ -160,28 +160,13 @@ namespace AzNetworking
return SerializeHelper(buffer, bufferCapacity, isString, outSize, name);
}
AZStd::string DeltaSerializerCreate::GetNextObjectName(const char* name)
bool DeltaSerializerCreate::BeginObject([[maybe_unused]] const char* name, [[maybe_unused]] const char* typeName)
{
AZStd::string objectName = name;
objectName += ".";
objectName += AZStd::to_string(m_objectCounter);
++m_objectCounter;
return objectName;
}
bool DeltaSerializerCreate::BeginObject(const char* name, [[maybe_unused]] const char* typeName)
{
m_nameLengthStack.push_back(m_namePrefix.length());
m_namePrefix += GetNextObjectName(name);
m_namePrefix += ".";
return true;
}
bool DeltaSerializerCreate::EndObject([[maybe_unused]] const char* name, [[maybe_unused]] const char* typeName)
{
const size_t prevLen = m_nameLengthStack.back();
m_nameLengthStack.pop_back();
m_namePrefix.resize(prevLen);
return true;
}
@ -205,25 +190,15 @@ namespace AzNetworking
{
typedef AbstractValue::ValueT<T> ValueType;
const size_t prevLen = m_namePrefix.length();
m_namePrefix += GetNextObjectName(name);
const AZ::HashValue32 nameHash = AZ::TypeHash32(m_namePrefix.c_str());
m_namePrefix.resize(prevLen);
AbstractValue::BaseValue*& baseValue = m_records[nameHash];
AbstractValue::BaseValue* baseValue = m_records.size() > m_objectCounter ? m_records[m_objectCounter] : nullptr;
++m_objectCounter;
// If we are in the gather records phase, just save off the value records
if (m_gatheringRecords)
{
if (baseValue != nullptr)
{
AZ_Assert(false, "Duplicate name encountered in delta serializer. This will cause data to be serialized incorrectly.");
return false;
}
AZ_Assert(baseValue == nullptr, "Expected to create a new record but found a pre-existing one at index %d", m_objectCounter - 1);
baseValue = new ValueType(value);
m_records.push_back(baseValue);
}
else // If we are not gathering records, then we are comparing them
{

@ -90,8 +90,6 @@ namespace AzNetworking
DeltaSerializerCreate(const DeltaSerializerCreate&) = delete;
DeltaSerializerCreate& operator=(const DeltaSerializerCreate&) = delete;
AZStd::string GetNextObjectName(const char* name);
template <typename T>
bool SerializeHelper(T& value, uint32_t bufferCapacity, bool isString, uint32_t& outSize, const char* name);
@ -105,9 +103,7 @@ namespace AzNetworking
bool m_gatheringRecords = false;
uint32_t m_objectCounter = 0;
AZStd::string m_namePrefix;
AZStd::vector<size_t> m_nameLengthStack;
AZStd::unordered_map<AZ::HashValue32, AbstractValue::BaseValue*> m_records;
AZStd::vector<AbstractValue::BaseValue*> m_records;
NetworkInputSerializer m_dataSerializer;
};

@ -11,4 +11,213 @@
namespace UnitTest
{
struct DeltaDataElement
{
AzNetworking::PacketId m_packetId = AzNetworking::InvalidPacketId;
uint32_t m_id = 0;
AZ::TimeMs m_timeMs = AZ::TimeMs{ 0 };
float m_blendFactor = 0.f;
AZStd::vector<int> m_growVector, m_shrinkVector;
bool Serialize(AzNetworking::ISerializer& serializer)
{
if (!serializer.Serialize(m_packetId, "PacketId")
|| !serializer.Serialize(m_id, "Id")
|| !serializer.Serialize(m_timeMs, "TimeMs")
|| !serializer.Serialize(m_blendFactor, "BlendFactor")
|| !serializer.Serialize(m_growVector, "GrowVector")
|| !serializer.Serialize(m_shrinkVector, "ShrinkVector"))
{
return false;
}
return true;
}
};
struct DeltaDataContainer
{
AZStd::string m_containerName;
AZStd::array<DeltaDataElement, 32> m_container;
// This logic is modeled after NetworkInputArray serialization in the Multiplayer Gem
bool Serialize(AzNetworking::ISerializer& serializer)
{
// Always serialize the full first element
if(!m_container[0].Serialize(serializer))
{
return false;
}
for (uint32_t i = 1; i < m_container.size(); ++i)
{
if (serializer.GetSerializerMode() == AzNetworking::SerializerMode::WriteToObject)
{
AzNetworking::SerializerDelta deltaSerializer;
// Read out the delta
if (!deltaSerializer.Serialize(serializer))
{
return false;
}
// Start with previous value
m_container[i] = m_container[i - 1];
// Then apply delta
AzNetworking::DeltaSerializerApply applySerializer(deltaSerializer);
if (!applySerializer.ApplyDelta(m_container[i]))
{
return false;
}
}
else
{
AzNetworking::SerializerDelta deltaSerializer;
// Create the delta
AzNetworking::DeltaSerializerCreate createSerializer(deltaSerializer);
if (!createSerializer.CreateDelta(m_container[i - 1], m_container[i]))
{
return false;
}
// Then write out the delta
if (!deltaSerializer.Serialize(serializer))
{
return false;
}
}
}
return true;
}
// This logic is modeled after NetworkInputArray serialization in the Multiplayer Gem
bool SerializeNoDelta(AzNetworking::ISerializer& serializer)
{
for (uint32_t i = 0; i < m_container.size(); ++i)
{
if(!m_container[i].Serialize(serializer))
{
return false;
}
}
return true;
}
};
class DeltaSerializerTests
: public UnitTest::AllocatorsTestFixture
{
public:
void SetUp() override
{
UnitTest::AllocatorsTestFixture::SetUp();
}
void TearDown() override
{
UnitTest::AllocatorsTestFixture::TearDown();
}
};
static constexpr float BLEND_FACTOR_SCALE = 1.1f;
static constexpr uint32_t TIME_SCALE = 10;
DeltaDataContainer TestDeltaContainer()
{
DeltaDataContainer testContainer;
AZStd::vector<int> growVector, shrinkVector;
shrinkVector.resize(testContainer.m_container.array_size);
testContainer.m_containerName = "TestContainer";
for (int i = 0; i < testContainer.m_container.array_size; ++i)
{
testContainer.m_container[i].m_packetId = AzNetworking::PacketId(i);
testContainer.m_container[i].m_id = i;
testContainer.m_container[i].m_timeMs = AZ::TimeMs(i * TIME_SCALE);
testContainer.m_container[i].m_blendFactor = BLEND_FACTOR_SCALE * i;
growVector.push_back(i);
testContainer.m_container[i].m_growVector = growVector;
shrinkVector.resize(testContainer.m_container.array_size - i);
testContainer.m_container[i].m_shrinkVector = shrinkVector;
}
return testContainer;
}
TEST_F(DeltaSerializerTests, DeltaArray)
{
DeltaDataContainer inContainer = TestDeltaContainer();
AZStd::array<uint8_t, 2048> buffer;
AzNetworking::NetworkInputSerializer inSerializer(buffer.data(), static_cast<uint32_t>(buffer.size()));
// Always serialize the full first element
EXPECT_TRUE(inContainer.Serialize(inSerializer));
DeltaDataContainer outContainer;
AzNetworking::NetworkOutputSerializer outSerializer(buffer.data(), static_cast<uint32_t>(buffer.size()));
EXPECT_TRUE(outContainer.Serialize(outSerializer));
for (uint32_t i = 0; i > outContainer.m_container.size(); ++i)
{
EXPECT_EQ(inContainer.m_container[i].m_blendFactor, outContainer.m_container[i].m_blendFactor);
EXPECT_EQ(inContainer.m_container[i].m_id, outContainer.m_container[i].m_id);
EXPECT_EQ(inContainer.m_container[i].m_packetId, outContainer.m_container[i].m_packetId);
EXPECT_EQ(inContainer.m_container[i].m_timeMs, outContainer.m_container[i].m_timeMs);
EXPECT_EQ(inContainer.m_container[i].m_growVector[i], outContainer.m_container[i].m_growVector[i]);
EXPECT_EQ(inContainer.m_container[i].m_growVector.size(), outContainer.m_container[i].m_growVector.size());
EXPECT_EQ(inContainer.m_container[i].m_shrinkVector.size(), outContainer.m_container[i].m_shrinkVector.size());
}
}
TEST_F(DeltaSerializerTests, DeltaSerializerCreateUnused)
{
// Every function here should return a constant value regardless of inputs
AzNetworking::SerializerDelta deltaSerializer;
AzNetworking::DeltaSerializerCreate createSerializer(deltaSerializer);
EXPECT_EQ(createSerializer.GetCapacity(), 0);
EXPECT_EQ(createSerializer.GetSize(), 0);
EXPECT_EQ(createSerializer.GetBuffer(), nullptr);
EXPECT_EQ(createSerializer.GetSerializerMode(), AzNetworking::SerializerMode::ReadFromObject);
createSerializer.ClearTrackedChangesFlag(); //NO-OP
EXPECT_FALSE(createSerializer.GetTrackedChangesFlag());
EXPECT_TRUE(createSerializer.BeginObject("CreateSerializer", "Begin"));
EXPECT_TRUE(createSerializer.EndObject("CreateSerializer", "End"));
}
TEST_F(DeltaSerializerTests, DeltaArraySize)
{
DeltaDataContainer deltaContainer = TestDeltaContainer();
DeltaDataContainer noDeltaContainer = TestDeltaContainer();
AZStd::array<uint8_t, 2048> deltaBuffer;
AzNetworking::NetworkInputSerializer deltaSerializer(deltaBuffer.data(), static_cast<uint32_t>(deltaBuffer.size()));
AZStd::array<uint8_t, 2048> noDeltaBuffer;
AzNetworking::NetworkInputSerializer noDeltaSerializer(noDeltaBuffer.data(), static_cast<uint32_t>(noDeltaBuffer.size()));
EXPECT_TRUE(deltaContainer.Serialize(deltaSerializer));
EXPECT_FALSE(noDeltaContainer.SerializeNoDelta(noDeltaSerializer)); // Should run out of space
EXPECT_EQ(noDeltaSerializer.GetCapacity(), noDeltaSerializer.GetSize()); // Verify that the serializer filled up
EXPECT_FALSE(noDeltaSerializer.IsValid()); // and that it is no longer valid due to lack of space
}
TEST_F(DeltaSerializerTests, DeltaSerializerApplyUnused)
{
// Every function here should return a constant value regardless of inputs
AzNetworking::SerializerDelta deltaSerializer;
AzNetworking::DeltaSerializerApply applySerializer(deltaSerializer);
EXPECT_EQ(applySerializer.GetCapacity(), 0);
EXPECT_EQ(applySerializer.GetSize(), 0);
EXPECT_EQ(applySerializer.GetBuffer(), nullptr);
EXPECT_EQ(applySerializer.GetSerializerMode(), AzNetworking::SerializerMode::WriteToObject);
applySerializer.ClearTrackedChangesFlag(); //NO-OP
EXPECT_FALSE(applySerializer.GetTrackedChangesFlag());
EXPECT_TRUE(applySerializer.BeginObject("CreateSerializer", "Begin"));
EXPECT_TRUE(applySerializer.EndObject("CreateSerializer", "End"));
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save