From 70c968f82917b83528deed7cec2b316be2e5fc03 Mon Sep 17 00:00:00 2001 From: daimini Date: Fri, 14 May 2021 15:02:39 -0700 Subject: [PATCH 01/14] Fixes issue with relative positioning of children on Prefab creation. Makes CreateLink more generic to facilitate reuse. --- .../Prefab/PrefabPublicHandler.cpp | 83 ++++++++++--------- .../Prefab/PrefabPublicHandler.h | 7 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 5ecff637a1..4eb6580158 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -121,6 +121,41 @@ namespace AzToolsFramework } AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId(); + AZ::Entity* containerEntity = GetEntityById(containerEntityId); + + { + // Generate the transform for the container entity out of the top level entities, and set it + // This step needs to be done before anything is parented to the container, else children position will be wrong + Prefab::PrefabDom containerEntityDomBefore; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity); + + AZ::Vector3 containerEntityTranslation(AZ::Vector3::CreateZero()); + AZ::Quaternion containerEntityRotation(AZ::Quaternion::CreateZero()); + + // Set container entity to be child of common root + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, commonRootEntityId); + + // Set the transform (translation, rotation) of the container entity + GenerateContainerEntityTransform(topLevelEntities, containerEntityTranslation, containerEntityRotation); + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalTranslation, containerEntityTranslation); + AZ::TransformBus::Event( + containerEntityId, &AZ::TransformBus::Events::SetLocalRotationQuaternion, containerEntityRotation); + + PrefabDom containerEntityDomAfter; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity); + + PrefabDom patch; + m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter); + m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, containerEntityId); + + // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes + m_prefabUndoCache.Store(containerEntityId, AZStd::move(containerEntityDomAfter)); + + // Create a link between the templates of the newly created instance and the instance it's being parented under. + CreateLink( + instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), + undoBatch.GetUndoBatch(), patch); + } // Parent the entities to the container entity. Parenting the container entities of the instances passed to createPrefab // will be done during the creation of links below. @@ -144,16 +179,10 @@ namespace AzToolsFramework // These link creations shouldn't be undone because that would put the template in a non-usable state if a user // chooses to instantiate the template after undoing the creation. - CreateLink( - {&nestedInstanceContainerEntity->get()}, *nestedInstance, instanceToCreate->get().GetTemplateId(), - undoBatch.GetUndoBatch(), containerEntityId, false); + PrefabDom emptyPatch; + CreateLink(*nestedInstance, instanceToCreate->get().GetTemplateId(), undoBatch.GetUndoBatch(), emptyPatch, false); }); - // Create a link between the templates of the newly created instance and the instance it's being parented under. - CreateLink( - topLevelEntities, instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), - undoBatch.GetUndoBatch(), commonRootEntityId); - for (AZ::Entity* topLevelEntity : topLevelEntities) { AZ::EntityId topLevelEntityId = topLevelEntity->GetId(); @@ -227,8 +256,7 @@ namespace AzToolsFramework ScopedUndoBatch undoBatch("Instantiate Prefab"); PrefabDom instanceToParentUnderDomBeforeCreate; - m_instanceToTemplateInterface->GenerateDomForInstance( - instanceToParentUnderDomBeforeCreate, instanceToParentUnder->get()); + m_instanceToTemplateInterface->GenerateDomForInstance(instanceToParentUnderDomBeforeCreate, instanceToParentUnder->get()); // Instantiate the Prefab auto instanceToCreate = prefabEditorEntityOwnershipInterface->InstantiatePrefab(relativePath, instanceToParentUnder); @@ -242,8 +270,8 @@ namespace AzToolsFramework PrefabUndoHelpers::UpdatePrefabInstance( instanceToParentUnder->get(), "Update prefab instance", instanceToParentUnderDomBeforeCreate, undoBatch.GetUndoBatch()); - CreateLink({}, instanceToCreate->get(), instanceToParentUnder->get().GetTemplateId(), - undoBatch.GetUndoBatch(), parent); + PrefabDom emptyPatch; + CreateLink(instanceToCreate->get(), instanceToParentUnder->get().GetTemplateId(), undoBatch.GetUndoBatch(), emptyPatch); AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId(); // Apply position @@ -314,33 +342,9 @@ namespace AzToolsFramework } void PrefabPublicHandler::CreateLink( - const EntityList& topLevelEntities, Instance& sourceInstance, TemplateId targetTemplateId, - UndoSystem::URSequencePoint* undoBatch, AZ::EntityId commonRootEntityId, const bool isUndoRedoSupportNeeded) + Instance& sourceInstance, TemplateId targetTemplateId, + UndoSystem::URSequencePoint* undoBatch, PrefabDom& patch, const bool isUndoRedoSupportNeeded) { - AZ::EntityId containerEntityId = sourceInstance.GetContainerEntityId(); - AZ::Entity* containerEntity = GetEntityById(containerEntityId); - Prefab::PrefabDom containerEntityDomBefore; - m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity); - - AZ::Vector3 containerEntityTranslation(AZ::Vector3::CreateZero()); - AZ::Quaternion containerEntityRotation(AZ::Quaternion::CreateZero()); - - // Set the transform (translation, rotation) of the container entity - GenerateContainerEntityTransform(topLevelEntities, containerEntityTranslation, containerEntityRotation); - - // Set container entity to be child of common root - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, commonRootEntityId); - - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalTranslation, containerEntityTranslation); - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalRotationQuaternion, containerEntityRotation); - - PrefabDom containerEntityDomAfter; - m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity); - - PrefabDom patch; - m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter); - m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, containerEntityId); - LinkId linkId; if (isUndoRedoSupportNeeded) { @@ -356,9 +360,6 @@ namespace AzToolsFramework } sourceInstance.SetLinkId(linkId); - - // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes - m_prefabUndoCache.Store(containerEntityId, AZStd::move(containerEntityDomAfter)); } void PrefabPublicHandler::RemoveLink( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h index 138bc84aa0..95f9cb8174 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h @@ -72,16 +72,15 @@ namespace AzToolsFramework /** * Creates a link between the templates of an instance and its parent. * - * \param topLevelEntities The list of entities that are immediate children to the container entity of the instance. * \param sourceInstance The instance that corresponds to the source template of the link. * \param targetInstance The id of the target template. * \param undoBatch The undo batch to set as parent for this create link action. - * \param commonRootEntityId The id of the entity that the source instance should be parented under. + * \param patch The patch to store in the newly created link dom. * \param isUndoRedoSupportNeeded The flag indicating whether the link should be created with undo/redo support or not. */ void CreateLink( - const EntityList& topLevelEntities, Instance& sourceInstance, TemplateId targetTemplateId, - UndoSystem::URSequencePoint* undoBatch, AZ::EntityId commonRootEntityId, const bool isUndoRedoSupportNeeded = true); + Instance& sourceInstance, TemplateId targetTemplateId, UndoSystem::URSequencePoint* undoBatch, + PrefabDom& patch, const bool isUndoRedoSupportNeeded = true); /** * Removes the link between template of the sourceInstance and the template corresponding to targetTemplateId. From 12760ef6a302309ce8e658e724bb51a697f0a041 Mon Sep 17 00:00:00 2001 From: daimini Date: Fri, 14 May 2021 16:37:47 -0700 Subject: [PATCH 02/14] Remove unused container entity retrieval --- .../AzToolsFramework/Prefab/PrefabPublicHandler.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 4eb6580158..5323fd3d7f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -172,11 +172,6 @@ namespace AzToolsFramework } instanceToCreate->get().GetNestedInstances([&](AZStd::unique_ptr& nestedInstance) { - AZ_Assert(nestedInstance, "Invalid nested instance found in the new prefab created."); - EntityOptionalReference nestedInstanceContainerEntity = nestedInstance->GetContainerEntity(); - AZ_Assert( - nestedInstanceContainerEntity, "Invalid container entity found for the nested instance used in prefab creation."); - // These link creations shouldn't be undone because that would put the template in a non-usable state if a user // chooses to instantiate the template after undoing the creation. PrefabDom emptyPatch; From bcaf4209d59a5aa054c0fb2d5030b09d57655ee9 Mon Sep 17 00:00:00 2001 From: daimini Date: Mon, 17 May 2021 15:39:25 -0700 Subject: [PATCH 03/14] Move some logic to a helper function. Revert order of link creation operations as they are not necessary to fix the bug, so it is preferred to leave them untouched. --- .../Prefab/PrefabPublicHandler.cpp | 84 ++++++++++--------- .../Prefab/PrefabPublicHandler.h | 5 +- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 47642e90f3..53bf515860 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -121,41 +121,9 @@ namespace AzToolsFramework } AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId(); - AZ::Entity* containerEntity = GetEntityById(containerEntityId); - { - // Generate the transform for the container entity out of the top level entities, and set it - // This step needs to be done before anything is parented to the container, else children position will be wrong - Prefab::PrefabDom containerEntityDomBefore; - m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity); - - AZ::Vector3 containerEntityTranslation(AZ::Vector3::CreateZero()); - AZ::Quaternion containerEntityRotation(AZ::Quaternion::CreateZero()); - - // Set container entity to be child of common root - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, commonRootEntityId); - - // Set the transform (translation, rotation) of the container entity - GenerateContainerEntityTransform(topLevelEntities, containerEntityTranslation, containerEntityRotation); - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalTranslation, containerEntityTranslation); - AZ::TransformBus::Event( - containerEntityId, &AZ::TransformBus::Events::SetLocalRotationQuaternion, containerEntityRotation); - - PrefabDom containerEntityDomAfter; - m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity); - - PrefabDom patch; - m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter); - m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, containerEntityId); - - // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes - m_prefabUndoCache.Store(containerEntityId, AZStd::move(containerEntityDomAfter)); - - // Create a link between the templates of the newly created instance and the instance it's being parented under. - CreateLink( - instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), - undoBatch.GetUndoBatch(), patch); - } + // Apply the correct transform to the container for the new instance, and store the patch for use when creating the link. + PrefabDom patch = ApplyContainerTransformAndGeneratePatch(containerEntityId, commonRootEntityId, topLevelEntities); // Parent the entities to the container entity. Parenting the container entities of the instances passed to createPrefab // will be done during the creation of links below. @@ -172,12 +140,18 @@ namespace AzToolsFramework } instanceToCreate->get().GetNestedInstances([&](AZStd::unique_ptr& nestedInstance) { + AZ_Assert(nestedInstance, "Invalid nested instance found in the new prefab created."); + // These link creations shouldn't be undone because that would put the template in a non-usable state if a user // chooses to instantiate the template after undoing the creation. - PrefabDom emptyPatch; - CreateLink(*nestedInstance, instanceToCreate->get().GetTemplateId(), undoBatch.GetUndoBatch(), emptyPatch, false); + CreateLink(*nestedInstance, instanceToCreate->get().GetTemplateId(), undoBatch.GetUndoBatch(), {}, false); }); + // Create a link between the templates of the newly created instance and the instance it's being parented under. + CreateLink( + instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(), + AZStd::move(patch)); + for (AZ::Entity* topLevelEntity : topLevelEntities) { AZ::EntityId topLevelEntityId = topLevelEntity->GetId(); @@ -206,6 +180,39 @@ namespace AzToolsFramework return AZ::Success(); } + PrefabDom PrefabPublicHandler::ApplyContainerTransformAndGeneratePatch(AZ::EntityId containerEntityId, AZ::EntityId commonRootEntityId, const EntityList& topLevelEntities) + { + AZ::Entity* containerEntity = GetEntityById(containerEntityId); + + // Generate the transform for the container entity out of the top level entities, and set it + // This step needs to be done before anything is parented to the container, else children position will be wrong + Prefab::PrefabDom containerEntityDomBefore; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity); + + AZ::Vector3 containerEntityTranslation(AZ::Vector3::CreateZero()); + AZ::Quaternion containerEntityRotation(AZ::Quaternion::CreateZero()); + + // Set container entity to be child of common root + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, commonRootEntityId); + + // Set the transform (translation, rotation) of the container entity + GenerateContainerEntityTransform(topLevelEntities, containerEntityTranslation, containerEntityRotation); + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalTranslation, containerEntityTranslation); + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalRotationQuaternion, containerEntityRotation); + + PrefabDom containerEntityDomAfter; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity); + + PrefabDom patch; + m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter); + m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, containerEntityId); + + // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes + m_prefabUndoCache.Store(containerEntityId, AZStd::move(containerEntityDomAfter)); + + return AZStd::move(patch); + } + PrefabOperationResult PrefabPublicHandler::InstantiatePrefab( AZStd::string_view filePath, AZ::EntityId parent, const AZ::Vector3& position) { @@ -271,8 +278,7 @@ namespace AzToolsFramework PrefabUndoHelpers::UpdatePrefabInstance( instanceToParentUnder->get(), "Update prefab instance", instanceToParentUnderDomBeforeCreate, undoBatch.GetUndoBatch()); - PrefabDom emptyPatch; - CreateLink(instanceToCreate->get(), instanceToParentUnder->get().GetTemplateId(), undoBatch.GetUndoBatch(), emptyPatch); + CreateLink(instanceToCreate->get(), instanceToParentUnder->get().GetTemplateId(), undoBatch.GetUndoBatch(), {}); AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId(); // Apply position @@ -344,7 +350,7 @@ namespace AzToolsFramework void PrefabPublicHandler::CreateLink( Instance& sourceInstance, TemplateId targetTemplateId, - UndoSystem::URSequencePoint* undoBatch, PrefabDom& patch, const bool isUndoRedoSupportNeeded) + UndoSystem::URSequencePoint* undoBatch, PrefabDom patch, const bool isUndoRedoSupportNeeded) { LinkId linkId; if (isUndoRedoSupportNeeded) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h index 583def2219..d6763cab40 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h @@ -69,6 +69,9 @@ namespace AzToolsFramework InstanceOptionalReference GetOwnerInstanceByEntityId(AZ::EntityId entityId) const; bool EntitiesBelongToSameInstance(const EntityIdList& entityIds) const; + PrefabDom ApplyContainerTransformAndGeneratePatch( + AZ::EntityId containerEntityId, AZ::EntityId commonRootEntityId, const EntityList& topLevelEntities); + /** * Creates a link between the templates of an instance and its parent. * @@ -80,7 +83,7 @@ namespace AzToolsFramework */ void CreateLink( Instance& sourceInstance, TemplateId targetTemplateId, UndoSystem::URSequencePoint* undoBatch, - PrefabDom& patch, const bool isUndoRedoSupportNeeded = true); + PrefabDom patch, const bool isUndoRedoSupportNeeded = true); /** * Removes the link between template of the sourceInstance and the template corresponding to targetTemplateId. From bb458254a2645ca75b4b1be216d82bc54c889fe6 Mon Sep 17 00:00:00 2001 From: daimini Date: Tue, 18 May 2021 14:52:30 -0700 Subject: [PATCH 04/14] Polish pass - rename arguments to be more generic, add comments, restore patches to links during instantiation that were mistakenly removed in previous changes. --- .../Prefab/PrefabPublicHandler.cpp | 34 +++++++++++++++---- .../Prefab/PrefabPublicHandler.h | 14 ++++++-- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 53bf515860..7ddd9f16e1 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -180,9 +180,10 @@ namespace AzToolsFramework return AZ::Success(); } - PrefabDom PrefabPublicHandler::ApplyContainerTransformAndGeneratePatch(AZ::EntityId containerEntityId, AZ::EntityId commonRootEntityId, const EntityList& topLevelEntities) + PrefabDom PrefabPublicHandler::ApplyContainerTransformAndGeneratePatch(AZ::EntityId containerEntityId, AZ::EntityId parentEntityId, const EntityList& childEntities) { AZ::Entity* containerEntity = GetEntityById(containerEntityId); + AZ_Assert(containerEntity, "Invalid container entity passed to ApplyContainerTransformAndGeneratePatch."); // Generate the transform for the container entity out of the top level entities, and set it // This step needs to be done before anything is parented to the container, else children position will be wrong @@ -193,10 +194,10 @@ namespace AzToolsFramework AZ::Quaternion containerEntityRotation(AZ::Quaternion::CreateZero()); // Set container entity to be child of common root - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, commonRootEntityId); + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, parentEntityId); // Set the transform (translation, rotation) of the container entity - GenerateContainerEntityTransform(topLevelEntities, containerEntityTranslation, containerEntityRotation); + GenerateContainerEntityTransform(childEntities, containerEntityTranslation, containerEntityRotation); AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalTranslation, containerEntityTranslation); AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetLocalRotationQuaternion, containerEntityRotation); @@ -263,10 +264,10 @@ namespace AzToolsFramework // Initialize Undo Batch object ScopedUndoBatch undoBatch("Instantiate Prefab"); + // Instantiate the Prefab PrefabDom instanceToParentUnderDomBeforeCreate; m_instanceToTemplateInterface->GenerateDomForInstance(instanceToParentUnderDomBeforeCreate, instanceToParentUnder->get()); - // Instantiate the Prefab auto instanceToCreate = prefabEditorEntityOwnershipInterface->InstantiatePrefab(relativePath, instanceToParentUnder); if (!instanceToCreate) @@ -278,11 +279,32 @@ namespace AzToolsFramework PrefabUndoHelpers::UpdatePrefabInstance( instanceToParentUnder->get(), "Update prefab instance", instanceToParentUnderDomBeforeCreate, undoBatch.GetUndoBatch()); - CreateLink(instanceToCreate->get(), instanceToParentUnder->get().GetTemplateId(), undoBatch.GetUndoBatch(), {}); + // Create Link with correct container patches AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId(); + AZ::Entity* containerEntity = GetEntityById(containerEntityId); + AZ_Assert(containerEntity, "Invalid container entity detected in InstantiatePrefab."); - // Apply position + Prefab::PrefabDom containerEntityDomBefore; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity); + + // Set container entity's parent + AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, parent); + + // Set the position of the container entity AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetWorldTranslation, position); + + PrefabDom containerEntityDomAfter; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity); + + // Generate patch to be stored in the link + PrefabDom patch; + m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter); + m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, containerEntityId); + + CreateLink(instanceToCreate->get(), instanceToParentUnder->get().GetTemplateId(), undoBatch.GetUndoBatch(), AZStd::move(patch)); + + // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes + m_prefabUndoCache.Store(containerEntityId, AZStd::move(containerEntityDomAfter)); } return AZ::Success(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h index d6763cab40..5ad5b4a9cf 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h @@ -68,9 +68,19 @@ namespace AzToolsFramework InstanceOptionalReference GetOwnerInstanceByEntityId(AZ::EntityId entityId) const; bool EntitiesBelongToSameInstance(const EntityIdList& entityIds) const; - + + /** + * Applies the correct transform changes to the container entity based on the parent and child entities provided, and returns an appropriate patch. + * The container will be parented to parentId, moved to the average transform of the future direct children and its cache will be updated. + * This helper function won't support undo/redo, update the templates or create any links. All that needs to be done by the caller. + * + * \param containerEntityId The container to apply the changes to. + * \param parentEntityId The id of the entity the container should be parented to. + * \param childEntities A list of entities that will subsequently be parented to this container. + * \return The PrefabDom containing the patches that should be stored in the parent link. + */ PrefabDom ApplyContainerTransformAndGeneratePatch( - AZ::EntityId containerEntityId, AZ::EntityId commonRootEntityId, const EntityList& topLevelEntities); + AZ::EntityId containerEntityId, AZ::EntityId parentEntityId, const EntityList& childEntities); /** * Creates a link between the templates of an instance and its parent. From 977030a27ab1fe1a0367c238e30045f3129aecbf Mon Sep 17 00:00:00 2001 From: daimini Date: Tue, 18 May 2021 17:53:27 -0700 Subject: [PATCH 05/14] On prefab creation, inherit the patches when moving the nested prefab instances and then update the link with the new parent if necessary. --- .../Prefab/PrefabPublicHandler.cpp | 56 +++++++++++++++---- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 394349c378..dc9f34b0cb 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -84,6 +84,7 @@ namespace AzToolsFramework AZStd::vector entities; AZStd::vector> instances; + AZStd::unordered_map nestedInstanceLinkPatches; // Retrieve all entities affected and identify Instances if (!RetrieveAndSortPrefabEntitiesAndInstances(inputEntityList, commonRootEntityOwningInstance->get(), entities, instances)) @@ -96,6 +97,16 @@ namespace AzToolsFramework // target templates of the other instances. for (auto& nestedInstance : instances) { + auto linkRef = m_prefabSystemComponentInterface->FindLink(nestedInstance->GetLinkId()); + + if (linkRef.has_value()) + { + PrefabDom oldLinkPatches; + oldLinkPatches.CopyFrom(linkRef->get().GetLinkDom(), oldLinkPatches.GetAllocator()); + + nestedInstanceLinkPatches.emplace(nestedInstance.get(), AZStd::move(oldLinkPatches)); + } + RemoveLink(nestedInstance, commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch()); } @@ -145,23 +156,48 @@ namespace AzToolsFramework instanceToCreate->get().GetNestedInstances([&](AZStd::unique_ptr& nestedInstance) { AZ_Assert(nestedInstance, "Invalid nested instance found in the new prefab created."); - AZ::EntityId parentId; - AZ::TransformBus::EventResult( - parentId, nestedInstanceContainerEntity->get().GetId(), &AZ::TransformBus::Events::GetParentId); + EntityOptionalReference nestedInstanceContainerEntity = nestedInstance->GetContainerEntity(); + AZ_Assert( + nestedInstanceContainerEntity, "Invalid container entity found for the nested instance used in prefab creation."); - auto entityIterator = AZStd::find_if( - entities.begin(), entities.end(), [parentId](AZ::Entity* entity) { return entity->GetId() == parentId; }); + AZ::EntityId nestedInstanceContainerEntityId = nestedInstanceContainerEntity->get().GetId(); + PrefabDom previousPatch; - // If the previous parent entity of the nested instance is not part of the entities of the newly created prefab, - // then set the parent of the nested prefab as the container entity of the newly created prefab. - if (entityIterator == entities.end()) + // Retrieve the previous patch if it exists + if (nestedInstanceLinkPatches.contains(nestedInstance.get())) { - parentId = containerEntityId; + previousPatch = AZStd::move(nestedInstanceLinkPatches[nestedInstance.get()]); } // These link creations shouldn't be undone because that would put the template in a non-usable state if a user // chooses to instantiate the template after undoing the creation. - CreateLink(*nestedInstance, instanceToCreate->get().GetTemplateId(), undoBatch.GetUndoBatch(), {}, false); + CreateLink(*nestedInstance, instanceToCreate->get().GetTemplateId(), undoBatch.GetUndoBatch(), AZStd::move(previousPatch), false); + + // If this nested instance's container is a top level entity in the new prefab, re-parent it and apply the change. + if (AZStd::find(topLevelEntities.begin(), topLevelEntities.end(), &nestedInstanceContainerEntity->get()) != topLevelEntities.end()) + { + Prefab::PrefabDom containerEntityDomBefore; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *nestedInstanceContainerEntity); + + AZ::TransformBus::Event(nestedInstanceContainerEntityId, &AZ::TransformBus::Events::SetParent, containerEntityId); + + PrefabDom containerEntityDomAfter; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *nestedInstanceContainerEntity); + + PrefabDom reparentPatch; + m_instanceToTemplateInterface->GeneratePatch(reparentPatch, containerEntityDomBefore, containerEntityDomAfter); + m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(reparentPatch, nestedInstanceContainerEntityId); + + // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes as a separate step + m_prefabUndoCache.Store(nestedInstanceContainerEntityId, AZStd::move(containerEntityDomAfter)); + + // Save these changes as patches to the link + PrefabUndoLinkUpdate* linkUpdate = aznew PrefabUndoLinkUpdate(AZStd::to_string(static_cast(nestedInstanceContainerEntityId))); + linkUpdate->SetParent(undoBatch.GetUndoBatch()); + linkUpdate->Capture(reparentPatch, nestedInstance->GetLinkId()); + + linkUpdate->Redo(); + } }); // Create a link between the templates of the newly created instance and the instance it's being parented under. From d5122b2829235a03c2d64b753a3b08cc089c1984 Mon Sep 17 00:00:00 2001 From: abrmich Date: Fri, 14 May 2021 12:53:03 -0700 Subject: [PATCH 06/14] Add image builder processing bus --- .../Atom/ImageProcessing/ImageProcessingBus.h | 41 ++++++++++ .../ImageProcessingEditorBus.h | 7 +- .../Code/Source/ImageBuilderComponent.cpp | 78 +++++++++++++++++++ .../Code/Source/ImageBuilderComponent.h | 20 +++++ 4 files changed, 145 insertions(+), 1 deletion(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h index b8deb50cc5..9f6b6e629f 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingBus.h @@ -13,8 +13,14 @@ #pragma once #include +#include #include +namespace AssetBuilderSDK +{ + struct JobProduct; +} + namespace ImageProcessingAtom { class ImageProcessingRequests @@ -35,4 +41,39 @@ namespace ImageProcessingAtom virtual IImageObjectPtr LoadImagePreview(const AZStd::string& filePath) = 0; }; using ImageProcessingRequestBus = AZ::EBus; + + class ImageBuilderRequests + : public AZ::EBusTraits + { + public: + ////////////////////////////////////////////////////////////////////////// + // EBusTraits overrides + static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single; + static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; + ///////////////////////////////////////////////////////////////////////// + + //! Create an image object + virtual IImageObjectPtr CreateImage( + AZ::u32 width, + AZ::u32 height, + AZ::u32 maxMipCount, + EPixelFormat pixelFormat) = 0; + + //! Convert an image and save its products to the specified folder + virtual AZStd::vector ConvertImageObject( + IImageObjectPtr imageObject, + const AZStd::string& presetName, + const AZStd::string& platformName, + const AZStd::string& outputDir, + const AZ::Data::AssetId& sourceAssetId, + const AZStd::string& sourceAssetName) = 0; + + //! Return whether the specified platform is supported by the image builder + virtual bool DoesSupportPlatform(const AZStd::string& platformId) = 0; + + //! Return whether the specified preset requires an image to be square and a power of 2 + virtual bool IsPresetFormatSquarePow2(const AZStd::string& presetName, const AZStd::string& platformName) = 0; + }; + + using ImageBuilderRequestBus = AZ::EBus; } // namespace ImageProcessingAtom diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h index acd1d7a2da..5340b0d380 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h @@ -13,10 +13,15 @@ #include -class QString; +namespace ImageProcessingAtom +{ + class IImageObject; +} namespace ImageProcessingAtomEditor { + typedef AZStd::shared_ptr IImageObjectPtr; + class ImageProcessingEditorRequests : public AZ::EBusTraits { diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp index 59c799a601..a17c094fc7 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp @@ -88,11 +88,13 @@ namespace ImageProcessingAtom m_assetHandlers.emplace_back(AZ::RPI::MakeAssetHandler()); ImageProcessingRequestBus::Handler::BusConnect(); + ImageBuilderRequestBus::Handler::BusConnect(); } void BuilderPluginComponent::Deactivate() { ImageProcessingRequestBus::Handler::BusDisconnect(); + ImageBuilderRequestBus::Handler::BusDisconnect(); m_imageBuilder.BusDisconnect(); BuilderSettingManager::DestroyInstance(); CPixelFormats::DestroyInstance(); @@ -146,6 +148,82 @@ namespace ImageProcessingAtom return image; } + IImageObjectPtr BuilderPluginComponent::CreateImage( + AZ::u32 width, + AZ::u32 height, + AZ::u32 maxMipCount, + EPixelFormat pixelFormat) + { + IImageObjectPtr image(IImageObject::CreateImage(width, height, maxMipCount, pixelFormat)); + return image; + } + + AZStd::vector BuilderPluginComponent::ConvertImageObject( + IImageObjectPtr imageObject, + const AZStd::string& presetName, + const AZStd::string& platformName, + const AZStd::string& outputDir, + const AZ::Data::AssetId& sourceAssetId, + const AZStd::string& sourceAssetName) + { + AZStd::vector outProducts; + + AZStd::string_view presetFilePath; + const PresetSettings* preset = BuilderSettingManager::Instance()->GetPreset(presetName, platformName, &presetFilePath); + if (preset == nullptr) + { + AZ_Assert(false, "Cannot find preset with name %s.", presetName.c_str()); + return outProducts; + } + + AZStd::unique_ptr desc = AZStd::make_unique(); + TextureSettings& textureSettings = desc->m_textureSetting; + textureSettings.m_preset = preset->m_uuid; + desc->m_inputImage = imageObject; + desc->m_presetSetting = *preset; + desc->m_isPreview = false; + desc->m_platform = platformName; + desc->m_filePath = presetFilePath; + desc->m_isStreaming = BuilderSettingManager::Instance()->GetBuilderSetting(platformName)->m_enableStreaming; + desc->m_imageName = sourceAssetName; + desc->m_outputFolder = outputDir; + desc->m_sourceAssetId = sourceAssetId; + + // Create an image convert process + ImageConvertProcess* process = new ImageConvertProcess(AZStd::move(desc)); + if (process) + { + process->ProcessAll(); + bool result = process->IsSucceed(); + if (result) + { + process->GetAppendOutputProducts(outProducts); + } + delete process; + } + + return outProducts; + } + + bool BuilderPluginComponent::DoesSupportPlatform(const AZStd::string& platformId) + { + return ImageProcessingAtom::BuilderSettingManager::Instance()->DoesSupportPlatform(platformId); + } + + bool BuilderPluginComponent::IsPresetFormatSquarePow2(const AZStd::string& presetName, const AZStd::string& platformName) + { + AZStd::string_view filePath; + const PresetSettings* preset = BuilderSettingManager::Instance()->GetPreset(presetName, platformName, &filePath); + if (preset == nullptr) + { + AZ_Assert(false, "Cannot find preset with name %s.", presetName.c_str()); + return false; + } + + const PixelFormatInfo* info = CPixelFormats::GetInstance().GetPixelFormatInfo(preset->m_pixelFormat); + return info->bSquarePow2; + } + void ImageBuilderWorker::ShutDown() { // it is important to note that this will be called on a different thread than your process job thread diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h index fd099eb08a..9723278380 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h @@ -17,6 +17,7 @@ #include #include #include +#include namespace ImageProcessingAtom { @@ -47,6 +48,7 @@ namespace ImageProcessingAtom class BuilderPluginComponent : public AZ::Component , protected ImageProcessingRequestBus::Handler + , protected ImageBuilderRequestBus::Handler { public: AZ_COMPONENT(BuilderPluginComponent, "{A227F803-D2E4-406E-93EC-121EF45A64A1}") @@ -71,6 +73,24 @@ namespace ImageProcessingAtom IImageObjectPtr LoadImagePreview(const AZStd::string& filePath) override; //////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// + // ImageBuilderRequestBus interface implementation + IImageObjectPtr CreateImage( + AZ::u32 width, + AZ::u32 height, + AZ::u32 maxMipCount, + EPixelFormat pixelFormat) override; + AZStd::vector ConvertImageObject( + IImageObjectPtr imageObject, + const AZStd::string& presetName, + const AZStd::string& platformName, + const AZStd::string& outputDir, + const AZ::Data::AssetId& sourceAssetId, + const AZStd::string& sourceAssetName) override; + bool DoesSupportPlatform(const AZStd::string& platformId) override; + bool IsPresetFormatSquarePow2(const AZStd::string& presetName, const AZStd::string& platformName) override; + //////////////////////////////////////////////////////////////////////// + private: BuilderPluginComponent(const BuilderPluginComponent&) = delete; From 1127235715f15ec981c22cb6d3a3ee1d6813c726 Mon Sep 17 00:00:00 2001 From: abrmich Date: Wed, 19 May 2021 11:36:44 -0700 Subject: [PATCH 07/14] Remove unnecessary heap allocation --- .../Code/Source/ImageBuilderComponent.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp index a17c094fc7..34d18a26eb 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp @@ -190,16 +190,12 @@ namespace ImageProcessingAtom desc->m_sourceAssetId = sourceAssetId; // Create an image convert process - ImageConvertProcess* process = new ImageConvertProcess(AZStd::move(desc)); - if (process) + ImageConvertProcess process(AZStd::move(desc)); + process.ProcessAll(); + bool result = process.IsSucceed(); + if (result) { - process->ProcessAll(); - bool result = process->IsSucceed(); - if (result) - { - process->GetAppendOutputProducts(outProducts); - } - delete process; + process.GetAppendOutputProducts(outProducts); } return outProducts; From bd74835f30eff9c705152f3f9f31ea7b346135d9 Mon Sep 17 00:00:00 2001 From: abrmich Date: Wed, 19 May 2021 11:46:02 -0700 Subject: [PATCH 08/14] Remove leftover code that's no longer needed --- .../Atom/ImageProcessing/ImageProcessingEditorBus.h | 7 ------- .../Code/Source/ImageBuilderComponent.h | 1 - 2 files changed, 8 deletions(-) diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h index 5340b0d380..bf5289bc45 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Include/Atom/ImageProcessing/ImageProcessingEditorBus.h @@ -13,15 +13,8 @@ #include -namespace ImageProcessingAtom -{ - class IImageObject; -} - namespace ImageProcessingAtomEditor { - typedef AZStd::shared_ptr IImageObjectPtr; - class ImageProcessingEditorRequests : public AZ::EBusTraits { diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h index 9723278380..a88ad3f587 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.h @@ -17,7 +17,6 @@ #include #include #include -#include namespace ImageProcessingAtom { From 2112d67b6b9b2e490adf14d9fc1d5375ebcd77d2 Mon Sep 17 00:00:00 2001 From: daimini Date: Wed, 19 May 2021 16:15:18 -0700 Subject: [PATCH 09/14] Rename variable to make it clearer it's a map --- .../AzToolsFramework/Prefab/PrefabPublicHandler.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index dc9f34b0cb..571aea5875 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -84,7 +84,7 @@ namespace AzToolsFramework AZStd::vector entities; AZStd::vector> instances; - AZStd::unordered_map nestedInstanceLinkPatches; + AZStd::unordered_map nestedInstanceLinkPatchesMap; // Retrieve all entities affected and identify Instances if (!RetrieveAndSortPrefabEntitiesAndInstances(inputEntityList, commonRootEntityOwningInstance->get(), entities, instances)) @@ -104,7 +104,7 @@ namespace AzToolsFramework PrefabDom oldLinkPatches; oldLinkPatches.CopyFrom(linkRef->get().GetLinkDom(), oldLinkPatches.GetAllocator()); - nestedInstanceLinkPatches.emplace(nestedInstance.get(), AZStd::move(oldLinkPatches)); + nestedInstanceLinkPatchesMap.emplace(nestedInstance.get(), AZStd::move(oldLinkPatches)); } RemoveLink(nestedInstance, commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch()); @@ -164,9 +164,9 @@ namespace AzToolsFramework PrefabDom previousPatch; // Retrieve the previous patch if it exists - if (nestedInstanceLinkPatches.contains(nestedInstance.get())) + if (nestedInstanceLinkPatchesMap.contains(nestedInstance.get())) { - previousPatch = AZStd::move(nestedInstanceLinkPatches[nestedInstance.get()]); + previousPatch = AZStd::move(nestedInstanceLinkPatchesMap[nestedInstance.get()]); } // These link creations shouldn't be undone because that would put the template in a non-usable state if a user From 8d4fb4d67dcd3c9c617036170c6e71b4f77476f1 Mon Sep 17 00:00:00 2001 From: nvsickle Date: Wed, 19 May 2021 19:11:23 -0700 Subject: [PATCH 10/14] Fix dummy rendering pipeline being created for the Editor -This ensures OnBootstrapSceneReady still fires even if the bootstrap system component doesn't create a default scene -This also disables default scene creation for non-game projects by default to ease tools development Tested with the Editor, AtomSampleViewer, the Material Editor, and the AtomTest launcher --- Code/Sandbox/Editor/EditorViewportWidget.cpp | 9 --------- .../Code/Source/BootstrapSystemComponent.cpp | 20 ++++++++++++++++--- .../Code/Source/BootstrapSystemComponent.h | 1 + 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Code/Sandbox/Editor/EditorViewportWidget.cpp b/Code/Sandbox/Editor/EditorViewportWidget.cpp index 436d4bba63..6214ede3cc 100644 --- a/Code/Sandbox/Editor/EditorViewportWidget.cpp +++ b/Code/Sandbox/Editor/EditorViewportWidget.cpp @@ -456,15 +456,6 @@ void EditorViewportWidget::Update() return; } - static bool sentOnWindowCreated = false; - if (!sentOnWindowCreated && windowHandle()->isActive()) - { - sentOnWindowCreated = true; - AzFramework::WindowSystemNotificationBus::Broadcast( - &AzFramework::WindowSystemNotificationBus::Handler::OnWindowCreated, - reinterpret_cast(winId())); - } - m_updatingCameraPosition = true; if (!ed_useNewCameraSystem) { diff --git a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp index e3bdb28046..012a229fe8 100644 --- a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp +++ b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.cpp @@ -123,6 +123,12 @@ namespace AZ m_windowHandle = m_nativeWindow->GetWindowHandle(); } + else + { + // Disable default scene creation for non-games projects + // This can be manually overridden via the DefaultWindowBus. + m_createDefaultScene = false; + } AzFramework::AssetCatalogEventBus::Handler::BusConnect(); TickBus::Handler::BusConnect(); @@ -351,6 +357,17 @@ namespace AZ scene->AddRenderPipeline(brdfTexturePipeline); } + // Send notification when the scene and its pipeline are ready. + // Use the first created pipeline's scene as our default scene for now to allow + // consumers waiting on scene availability to initialize. + if (!m_defaultSceneReady) + { + m_defaultScene = scene; + Render::Bootstrap::NotificationBus::Broadcast( + &Render::Bootstrap::NotificationBus::Handler::OnBootstrapSceneReady, m_defaultScene.get()); + m_defaultSceneReady = true; + } + return true; } @@ -364,9 +381,6 @@ namespace AZ { m_renderPipelineId = pipeline->GetId(); } - - // Send notification when the scene and its pipeline are ready - Render::Bootstrap::NotificationBus::Broadcast(&Render::Bootstrap::NotificationBus::Handler::OnBootstrapSceneReady, m_defaultScene.get()); } void BootstrapSystemComponent::DestroyDefaultScene() diff --git a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h index 7323a54221..65390ff153 100644 --- a/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h +++ b/Gems/Atom/Bootstrap/Code/Source/BootstrapSystemComponent.h @@ -125,6 +125,7 @@ namespace AZ Data::Instance m_brdfTexture; bool m_createDefaultScene = true; + bool m_defaultSceneReady = false; // Maps AZ scenes to RPI scene weak pointers to allow looking up a ScenePtr instead of a raw Scene* AZStd::unordered_map> m_azSceneToAtomSceneMap; From 1f45e03a0c46c3995ddf81886a632417af959ec9 Mon Sep 17 00:00:00 2001 From: abrmich Date: Wed, 19 May 2021 22:25:07 -0700 Subject: [PATCH 11/14] Added Gem::AtomFont to tool and runtime dependencies --- AutomatedTesting/Gem/Code/runtime_dependencies.cmake | 1 + AutomatedTesting/Gem/Code/tool_dependencies.cmake | 1 + 2 files changed, 2 insertions(+) diff --git a/AutomatedTesting/Gem/Code/runtime_dependencies.cmake b/AutomatedTesting/Gem/Code/runtime_dependencies.cmake index 33c2bf8d5f..15715f2136 100644 --- a/AutomatedTesting/Gem/Code/runtime_dependencies.cmake +++ b/AutomatedTesting/Gem/Code/runtime_dependencies.cmake @@ -43,6 +43,7 @@ set(GEM_DEPENDENCIES Gem::GradientSignal Gem::Vegetation Gem::Atom_AtomBridge + Gem::AtomFont Gem::NvCloth Gem::Blast Gem::AWSCore diff --git a/AutomatedTesting/Gem/Code/tool_dependencies.cmake b/AutomatedTesting/Gem/Code/tool_dependencies.cmake index c8eccab947..1c0db5753b 100644 --- a/AutomatedTesting/Gem/Code/tool_dependencies.cmake +++ b/AutomatedTesting/Gem/Code/tool_dependencies.cmake @@ -55,6 +55,7 @@ set(GEM_DEPENDENCIES Gem::Atom_RHI.Private Gem::Atom_Feature_Common.Editor Gem::Atom_AtomBridge.Editor + Gem::AtomFont Gem::NvCloth.Editor Gem::Blast.Editor Gem::AWSCore.Editor From 525840fb2a77feb24d5b365d8fad4116825858cb Mon Sep 17 00:00:00 2001 From: amzn-hdoke <61443753+hdoke@users.noreply.github.com> Date: Thu, 20 May 2021 09:29:44 -0700 Subject: [PATCH 12/14] Adding password 1 factor sign in (#830) AWS automation test --- .../client_auth/test_password_signin.py | 97 + .../resource_mappings/resource_mappings.py | 5 + .../ClientAuthPasswordSignIn.ly | 3 + .../PasswordSignIn.scriptcanvas | 6642 +++++++++++++++++ .../AWS/ClientAuthPasswordSignIn/filelist.xml | 6 + .../AWS/ClientAuthPasswordSignIn/level.pak | 3 + .../AWS/ClientAuthPasswordSignIn/tags.txt | 12 + .../ClientAuthPasswordSignUp.ly | 3 + .../PasswordSignUp.scriptcanvas | 4408 +++++++++++ .../AWS/ClientAuthPasswordSignUp/filelist.xml | 6 + .../AWS/ClientAuthPasswordSignUp/level.pak | 3 + .../AWS/ClientAuthPasswordSignUp/tags.txt | 12 + .../Registry/authenticationProvider.setreg | 5 + .../cdk/cognito/cognito_user_pool.py | 2 +- 14 files changed, 11206 insertions(+), 1 deletion(-) create mode 100644 AutomatedTesting/Gem/PythonTests/AWS/Windows/client_auth/test_password_signin.py create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/ClientAuthPasswordSignIn.ly create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/filelist.xml create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/level.pak create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/tags.txt create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/ClientAuthPasswordSignUp.ly create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/filelist.xml create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/level.pak create mode 100644 AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/tags.txt create mode 100644 AutomatedTesting/Registry/authenticationProvider.setreg diff --git a/AutomatedTesting/Gem/PythonTests/AWS/Windows/client_auth/test_password_signin.py b/AutomatedTesting/Gem/PythonTests/AWS/Windows/client_auth/test_password_signin.py new file mode 100644 index 0000000000..da4898b8a9 --- /dev/null +++ b/AutomatedTesting/Gem/PythonTests/AWS/Windows/client_auth/test_password_signin.py @@ -0,0 +1,97 @@ +""" +All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or +its licensors. +For complete copyright and license terms please see the LICENSE at the root of this +distribution (the "License"). All use of this software is governed by the License, +or, if provided, by the license below or the license accompanying this file. Do not +remove or modify any license notices. This file is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +""" +import pytest +import os +import logging +import ly_test_tools.log.log_monitor + +from AWS.Windows.resource_mappings.resource_mappings import resource_mappings +from AWS.Windows.cdk.cdk import cdk +from AWS.common.aws_utils import aws_utils +from assetpipeline.ap_fixtures.asset_processor_fixture import asset_processor as asset_processor + +AWS_PROJECT_NAME = 'AWS-AutomationTest' +AWS_CLIENT_AUTH_FEATURE_NAME = 'AWSClientAuth' +AWS_CLIENT_AUTH_DEFAULT_PROFILE_NAME = 'default' + +GAME_LOG_NAME = 'Game.log' + +logger = logging.getLogger(__name__) + + +@pytest.mark.SUITE_periodic +@pytest.mark.usefixtures('automatic_process_killer') +@pytest.mark.usefixtures('asset_processor') +@pytest.mark.usefixtures('workspace') +@pytest.mark.parametrize('project', ['AutomatedTesting']) +@pytest.mark.usefixtures('cdk') +@pytest.mark.parametrize('feature_name', [AWS_CLIENT_AUTH_FEATURE_NAME]) +@pytest.mark.usefixtures('resource_mappings') +@pytest.mark.parametrize('resource_mappings_filename', ['aws_resource_mappings.json']) +@pytest.mark.usefixtures('aws_utils') +@pytest.mark.parametrize('region_name', ['us-west-2']) +@pytest.mark.parametrize('assume_role_arn', ['arn:aws:iam::645075835648:role/o3de-automation-tests']) +@pytest.mark.parametrize('session_name', ['o3de-Automation-session']) +class TestAWSClientAuthPasswordSignIn(object): + """ + Test class to verify AWS Cognito IDP Password sign in and Cognito Identity pool authenticated authorization. + """ + + def test_password_signin_credentials(self, + launcher: pytest.fixture, + cdk: pytest.fixture, + resource_mappings: pytest.fixture, + workspace: pytest.fixture, + asset_processor: pytest.fixture, + aws_utils: pytest.fixture + ): + """ + Setup: Deploys cdk and updates resource mapping file. + Tests: Sign up new test user, admin confirm the user, sign in and get aws credentials. + Verification: Log monitor looks for success credentials log. + """ + logger.info(f'Cdk stack names:\n{cdk.list()}') + stacks = cdk.deploy() + resource_mappings.populate_output_keys(stacks) + asset_processor.start() + asset_processor.wait_for_idle() + + file_to_monitor = os.path.join(launcher.workspace.paths.project_log(), GAME_LOG_NAME) + log_monitor = ly_test_tools.log.log_monitor.LogMonitor(launcher=launcher, log_file_path=file_to_monitor) + + launcher.args = ['+LoadLevel', 'AWS/ClientAuthPasswordSignUp'] + + with launcher.start(launch_ap=False): + result = log_monitor.monitor_log_for_lines( + expected_lines=['(Script) - Signup Success'], + unexpected_lines=['(Script) - Signup Fail'], + halt_on_unexpected=True, + ) + assert result, 'Sign Up Success.' + + launcher.stop() + + cognito_idp = aws_utils.client('cognito-idp') + user_pool_id = resource_mappings.get_resource_name_id(f'{AWS_CLIENT_AUTH_FEATURE_NAME}.CognitoUserPoolId') + print(f'UserPoolId:{user_pool_id}') + cognito_idp.admin_confirm_sign_up( + UserPoolId=user_pool_id, + Username='test1' + ) + + launcher.args = ['+LoadLevel', 'AWS/ClientAuthPasswordSignIn'] + + with launcher.start(launch_ap=False): + result = log_monitor.monitor_log_for_lines( + expected_lines=['(Script) - SignIn Success', '(Script) - Success credentials'], + unexpected_lines=['(Script) - SignIn Fail', '(Script) - Fail credentials'], + halt_on_unexpected=True, + ) + assert result, 'Sign in Success, fetched authenticated AWS temp credentials.' diff --git a/AutomatedTesting/Gem/PythonTests/AWS/Windows/resource_mappings/resource_mappings.py b/AutomatedTesting/Gem/PythonTests/AWS/Windows/resource_mappings/resource_mappings.py index c8d8cff828..b3fa3011ce 100644 --- a/AutomatedTesting/Gem/PythonTests/AWS/Windows/resource_mappings/resource_mappings.py +++ b/AutomatedTesting/Gem/PythonTests/AWS/Windows/resource_mappings/resource_mappings.py @@ -39,6 +39,7 @@ class ResourceMappings: self._region = region self._feature_name = feature_name self._account_id = account_id + self._resource_mappings = {} assert os.path.exists(self._resource_mapping_file_path), \ f'Invalid resource mapping file path {self._resource_mapping_file_path}' @@ -79,6 +80,7 @@ class ResourceMappings: resource_mappings[AWS_RESOURCE_MAPPINGS_KEY][resource_key]['Name/ID'] = output.get('OutputValue', 'InvalidId') + self._resource_mappings = resource_mappings with open(self._resource_mapping_file_path, 'w') as file_content: json.dump(resource_mappings, file_content, indent=4) @@ -103,6 +105,9 @@ class ResourceMappings: self._region = '' self._client = None + def get_resource_name_id(self, resource_key: str): + return self._resource_mappings[AWS_RESOURCE_MAPPINGS_KEY][resource_key]['Name/ID'] + @pytest.fixture(scope='function') def resource_mappings( diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/ClientAuthPasswordSignIn.ly b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/ClientAuthPasswordSignIn.ly new file mode 100644 index 0000000000..24fe4f2482 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/ClientAuthPasswordSignIn.ly @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:43b1a23b62fe2ffa05545ac99524f40b6fff49d6e35925b9d6138c00d8082e86 +size 9073 diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas new file mode 100644 index 0000000000..ffc3064084 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/PasswordSignIn.scriptcanvas @@ -0,0 +1,6642 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/filelist.xml b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/filelist.xml new file mode 100644 index 0000000000..454b94a80a --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/filelist.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/level.pak b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/level.pak new file mode 100644 index 0000000000..14e6b3274b --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/level.pak @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f583e0b1b7016a11583383e6c6fcd29f9e796c1a9cd4b6ddb10f7dc91deec17a +size 3557 diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/tags.txt b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/tags.txt new file mode 100644 index 0000000000..0d6c1880e7 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignIn/tags.txt @@ -0,0 +1,12 @@ +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/ClientAuthPasswordSignUp.ly b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/ClientAuthPasswordSignUp.ly new file mode 100644 index 0000000000..f853ec3890 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/ClientAuthPasswordSignUp.ly @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3b948461412d201b3a80abafa60e916f860e46e28109333fbd263a2d5fc53c5a +size 9103 diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas new file mode 100644 index 0000000000..632d27d5b0 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/PasswordSignUp.scriptcanvas @@ -0,0 +1,4408 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/filelist.xml b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/filelist.xml new file mode 100644 index 0000000000..5e47a51414 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/filelist.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/level.pak b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/level.pak new file mode 100644 index 0000000000..72ac9c767f --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/level.pak @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8cdb456f6eb348be27249d80e9d2262e1e0bdabf2c1ff02c1a64a5609dcd823c +size 3553 diff --git a/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/tags.txt b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/tags.txt new file mode 100644 index 0000000000..0d6c1880e7 --- /dev/null +++ b/AutomatedTesting/Levels/AWS/ClientAuthPasswordSignUp/tags.txt @@ -0,0 +1,12 @@ +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 +0,0,0,0,0,0 diff --git a/AutomatedTesting/Registry/authenticationProvider.setreg b/AutomatedTesting/Registry/authenticationProvider.setreg new file mode 100644 index 0000000000..c90433468c --- /dev/null +++ b/AutomatedTesting/Registry/authenticationProvider.setreg @@ -0,0 +1,5 @@ +{ + "AWS": + { + } +} \ No newline at end of file diff --git a/Gems/AWSClientAuth/cdk/cognito/cognito_user_pool.py b/Gems/AWSClientAuth/cdk/cognito/cognito_user_pool.py index a903217f40..f0a2acf208 100755 --- a/Gems/AWSClientAuth/cdk/cognito/cognito_user_pool.py +++ b/Gems/AWSClientAuth/cdk/cognito/cognito_user_pool.py @@ -76,7 +76,7 @@ class CognitoUserPool: scope, 'CognitoUserPoolId', description="Cognito User pool id", - value=self._user_pool.attr_provider_name) + value=self._user_pool.ref) core.CfnOutput( scope, From 03b41b620d64564130876a691432e536fe6c9761 Mon Sep 17 00:00:00 2001 From: Benjamin Jillich <43751992+amzn-jillich@users.noreply.github.com> Date: Thu, 20 May 2021 18:42:37 +0200 Subject: [PATCH 13/14] [LYN-2522] Preparation work for the filter pane (#799) * [LYN-2522] Preparation work for the filter pane * Added arrow up/down icons. * Extended the gem info with the type (Asset, Code, Tool). * Extended the model with the type and a helper for converting gem uuids into display names. * Extended the link widget to be clickable with a custom action, needed for the "Show all/less" for the filters. * Converting the uuids we get from Python to AZ::Uuids and then back to strings to have them all in the same format. --- .../Resources/ArrowDownLine.svg | 3 ++ .../ProjectManager/Resources/ArrowUpLine.svg | 3 ++ .../Source/GemCatalog/GemCatalogScreen.cpp | 7 --- .../Source/GemCatalog/GemInfo.cpp | 25 ++++++++-- .../Source/GemCatalog/GemInfo.h | 12 +++++ .../Source/GemCatalog/GemModel.cpp | 48 +++++++++++++++++-- .../Source/GemCatalog/GemModel.h | 12 ++++- .../ProjectManager/Source/LinkWidget.cpp | 7 ++- Code/Tools/ProjectManager/Source/LinkWidget.h | 8 +++- .../ProjectManager/Source/PythonBindings.cpp | 5 +- Code/Tools/ProjectManager/project_manager.qrc | 2 + 11 files changed, 111 insertions(+), 21 deletions(-) create mode 100644 Code/Tools/ProjectManager/Resources/ArrowDownLine.svg create mode 100644 Code/Tools/ProjectManager/Resources/ArrowUpLine.svg diff --git a/Code/Tools/ProjectManager/Resources/ArrowDownLine.svg b/Code/Tools/ProjectManager/Resources/ArrowDownLine.svg new file mode 100644 index 0000000000..8418431f11 --- /dev/null +++ b/Code/Tools/ProjectManager/Resources/ArrowDownLine.svg @@ -0,0 +1,3 @@ + + + diff --git a/Code/Tools/ProjectManager/Resources/ArrowUpLine.svg b/Code/Tools/ProjectManager/Resources/ArrowUpLine.svg new file mode 100644 index 0000000000..d7f26fdad5 --- /dev/null +++ b/Code/Tools/ProjectManager/Resources/ArrowUpLine.svg @@ -0,0 +1,3 @@ + + + diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp index 5737a188de..3c221d6055 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemCatalogScreen.cpp @@ -58,13 +58,6 @@ namespace O3DE::ProjectManager hLayout->addWidget(m_gemListView); hLayout->addWidget(m_gemInspector); - - - // Select the first entry after everything got correctly sized - QTimer::singleShot(100, [=]{ - QModelIndex firstModelIndex = m_gemListView->model()->index(0,0); - m_gemListView->selectionModel()->select(firstModelIndex, QItemSelectionModel::ClearAndSelect); - }); } QVector GemCatalogScreen::GenerateTestData() diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.cpp index 729935fc8e..5b7127bdbe 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.cpp @@ -32,21 +32,36 @@ namespace O3DE::ProjectManager { switch (platform) { - case O3DE::ProjectManager::GemInfo::Android: + case Android: return "Android"; - case O3DE::ProjectManager::GemInfo::iOS: + case iOS: return "iOS"; - case O3DE::ProjectManager::GemInfo::Linux: + case Linux: return "Linux"; - case O3DE::ProjectManager::GemInfo::macOS: + case macOS: return "macOS"; - case O3DE::ProjectManager::GemInfo::Windows: + case Windows: return "Windows"; default: return ""; } } + QString GemInfo::GetTypeString(Type type) + { + switch (type) + { + case Asset: + return "Asset"; + case Code: + return "Code"; + case Tool: + return "Tool"; + default: + return ""; + } + } + bool GemInfo::IsPlatformSupported(Platform platform) const { return (m_platforms & platform); diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.h index 7ee619702f..28b2fab451 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemInfo.h @@ -36,6 +36,16 @@ namespace O3DE::ProjectManager Q_DECLARE_FLAGS(Platforms, Platform) static QString GetPlatformString(Platform platform); + enum Type + { + Asset = 1 << 0, + Code = 1 << 1, + Tool = 1 << 2, + NumTypes = 3 + }; + Q_DECLARE_FLAGS(Types, Type) + static QString GetTypeString(Type type); + GemInfo() = default; GemInfo(const QString& name, const QString& creator, const QString& summary, Platforms platforms, bool isAdded); bool IsPlatformSupported(Platform platform) const; @@ -50,6 +60,7 @@ namespace O3DE::ProjectManager bool m_isAdded = false; //! Is the gem currently added and enabled in the project? QString m_summary; Platforms m_platforms; + Types m_types; //! Asset and/or Code and/or Tool QStringList m_features; QString m_directoryLink; QString m_documentationLink; @@ -62,3 +73,4 @@ namespace O3DE::ProjectManager } // namespace O3DE::ProjectManager Q_DECLARE_OPERATORS_FOR_FLAGS(O3DE::ProjectManager::GemInfo::Platforms) +Q_DECLARE_OPERATORS_FOR_FLAGS(O3DE::ProjectManager::GemInfo::Types) diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.cpp b/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.cpp index 1112c656f3..addf59783d 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.cpp +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.cpp @@ -10,7 +10,8 @@ * */ -#include "GemModel.h" +#include +#include namespace O3DE::ProjectManager { @@ -32,8 +33,11 @@ namespace O3DE::ProjectManager item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); item->setData(gemInfo.m_name, RoleName); + const QString uuidString = gemInfo.m_uuid.ToString().c_str(); + item->setData(uuidString, RoleUuid); item->setData(gemInfo.m_creator, RoleCreator); - item->setData(static_cast(gemInfo.m_platforms), RolePlatforms); + item->setData(aznumeric_cast(gemInfo.m_platforms), RolePlatforms); + item->setData(aznumeric_cast(gemInfo.m_types), RoleTypes); item->setData(gemInfo.m_summary, RoleSummary); item->setData(gemInfo.m_isAdded, RoleIsAdded); @@ -48,6 +52,8 @@ namespace O3DE::ProjectManager item->setData(gemInfo.m_features, RoleFeatures); appendRow(item); + + m_uuidToNameMap[uuidString] = gemInfo.m_displayName; } void GemModel::Clear() @@ -65,11 +71,21 @@ namespace O3DE::ProjectManager return modelIndex.data(RoleCreator).toString(); } + QString GemModel::GetUuidString(const QModelIndex& modelIndex) + { + return modelIndex.data(RoleUuid).toString(); + } + GemInfo::Platforms GemModel::GetPlatforms(const QModelIndex& modelIndex) { return static_cast(modelIndex.data(RolePlatforms).toInt()); } + GemInfo::Types GemModel::GetTypes(const QModelIndex& modelIndex) + { + return static_cast(modelIndex.data(RoleTypes).toInt()); + } + QString GemModel::GetSummary(const QModelIndex& modelIndex) { return modelIndex.data(RoleSummary).toString(); @@ -90,9 +106,35 @@ namespace O3DE::ProjectManager return modelIndex.data(RoleDocLink).toString(); } + AZ::Outcome GemModel::FindGemNameByUuidString(const QString& uuidString) const + { + const auto iterator = m_uuidToNameMap.find(uuidString); + if (iterator != m_uuidToNameMap.end()) + { + return AZ::Success(iterator.value()); + } + + return AZ::Failure(); + } + QStringList GemModel::GetDependingGems(const QModelIndex& modelIndex) { - return modelIndex.data(RoleDependingGems).toStringList(); + QStringList result = modelIndex.data(RoleDependingGems).toStringList(); + if (result.isEmpty()) + { + return {}; + } + + for (QString& dependingGemString : result) + { + AZ::Outcome gemNameOutcome = FindGemNameByUuidString(dependingGemString); + if (gemNameOutcome.IsSuccess()) + { + dependingGemString = gemNameOutcome.GetValue(); + } + } + + return result; } QStringList GemModel::GetConflictingGems(const QModelIndex& modelIndex) diff --git a/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.h b/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.h index fba65e7009..76211b1f22 100644 --- a/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.h +++ b/Code/Tools/ProjectManager/Source/GemCatalog/GemModel.h @@ -13,7 +13,8 @@ #pragma once #if !defined(Q_MOC_RUN) -#include "GemInfo.h" +#include +#include #include #include #include @@ -33,14 +34,18 @@ namespace O3DE::ProjectManager void AddGem(const GemInfo& gemInfo); void Clear(); + AZ::Outcome FindGemNameByUuidString(const QString& uuidString) const; + QStringList GetDependingGems(const QModelIndex& modelIndex); + static QString GetName(const QModelIndex& modelIndex); static QString GetCreator(const QModelIndex& modelIndex); + static QString GetUuidString(const QModelIndex& modelIndex); static GemInfo::Platforms GetPlatforms(const QModelIndex& modelIndex); + static GemInfo::Types GetTypes(const QModelIndex& modelIndex); static QString GetSummary(const QModelIndex& modelIndex); static bool IsAdded(const QModelIndex& modelIndex); static QString GetDirectoryLink(const QModelIndex& modelIndex); static QString GetDocLink(const QModelIndex& modelIndex); - static QStringList GetDependingGems(const QModelIndex& modelIndex); static QStringList GetConflictingGems(const QModelIndex& modelIndex); static QString GetVersion(const QModelIndex& modelIndex); static QString GetLastUpdated(const QModelIndex& modelIndex); @@ -51,6 +56,7 @@ namespace O3DE::ProjectManager enum UserRole { RoleName = Qt::UserRole, + RoleUuid, RoleCreator, RolePlatforms, RoleSummary, @@ -63,8 +69,10 @@ namespace O3DE::ProjectManager RoleLastUpdated, RoleBinarySize, RoleFeatures, + RoleTypes }; + QHash m_uuidToNameMap; QItemSelectionModel* m_selectionModel = nullptr; }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/LinkWidget.cpp b/Code/Tools/ProjectManager/Source/LinkWidget.cpp index fddc4cd8c9..a6308f6c62 100644 --- a/Code/Tools/ProjectManager/Source/LinkWidget.cpp +++ b/Code/Tools/ProjectManager/Source/LinkWidget.cpp @@ -27,7 +27,12 @@ namespace O3DE::ProjectManager void LinkLabel::mousePressEvent([[maybe_unused]] QMouseEvent* event) { - QDesktopServices::openUrl(m_url); + if (m_url.isValid()) + { + QDesktopServices::openUrl(m_url); + } + + emit clicked(); } void LinkLabel::enterEvent([[maybe_unused]] QEvent* event) diff --git a/Code/Tools/ProjectManager/Source/LinkWidget.h b/Code/Tools/ProjectManager/Source/LinkWidget.h index 7055dce2af..b3a34cd63a 100644 --- a/Code/Tools/ProjectManager/Source/LinkWidget.h +++ b/Code/Tools/ProjectManager/Source/LinkWidget.h @@ -26,10 +26,16 @@ namespace O3DE::ProjectManager class LinkLabel : public QLabel { + Q_OBJECT // AUTOMOC + public: - LinkLabel(const QString& text, const QUrl& url = {}, QWidget* parent = nullptr); + LinkLabel(const QString& text = {}, const QUrl& url = {}, QWidget* parent = nullptr); void SetUrl(const QUrl& url); + + signals: + void clicked(); + private: void mousePressEvent(QMouseEvent* event) override; void enterEvent(QEvent* event) override; diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index e925c81032..2c2c143845 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -426,7 +426,7 @@ namespace O3DE::ProjectManager { // required gemInfo.m_name = Py_To_String(data["Name"]); - gemInfo.m_uuid = AZ::Uuid(Py_To_String(data["Uuid"])); + gemInfo.m_uuid = AZ::Uuid(Py_To_String(data["Uuid"])); // optional gemInfo.m_displayName = Py_To_String_Optional(data, "DisplayName", gemInfo.m_name); @@ -437,7 +437,8 @@ namespace O3DE::ProjectManager { for (auto dependency : data["Dependencies"]) { - gemInfo.m_dependingGemUuids.push_back(Py_To_String(dependency["Uuid"])); + const AZ::Uuid uuid = Py_To_String(dependency["Uuid"]); + gemInfo.m_dependingGemUuids.push_back(uuid.ToString().c_str()); } } if (data.contains("Tags")) diff --git a/Code/Tools/ProjectManager/project_manager.qrc b/Code/Tools/ProjectManager/project_manager.qrc index 3c23bc24ff..f36633142f 100644 --- a/Code/Tools/ProjectManager/project_manager.qrc +++ b/Code/Tools/ProjectManager/project_manager.qrc @@ -9,6 +9,8 @@ Resources/iOS.svg Resources/Linux.svg Resources/macOS.svg + Resources/ArrowDownLine.svg + Resources/ArrowUpLine.svg Resources/Backgrounds/FirstTimeBackgroundImage.jpg From c47c45724a7883a5c9ccd49492be3c1c1891cac9 Mon Sep 17 00:00:00 2001 From: AMZN-stankowi Date: Thu, 20 May 2021 11:28:34 -0700 Subject: [PATCH 14/14] LYN-3772 : For non-PBR materials, apply the diffuse color to the base color field on the Atom material, so a color value set in the DCC tool still comes through. (#733) --- .../Material/MaterialConverterSystemComponent.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp index dbbf666967..8397dcf9b3 100644 --- a/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp +++ b/Gems/Atom/Feature/Common/Code/Source/Material/MaterialConverterSystemComponent.cpp @@ -77,12 +77,16 @@ namespace AZ } }; + // If PBR material properties aren't in use, fall back to legacy properties. Don't do that if some PBR material properties are set, though. + bool anyPBRInUse = false; + handleTexture("specularF0", SceneAPI::DataTypes::IMaterialData::TextureMapType::Specular); handleTexture("normal", SceneAPI::DataTypes::IMaterialData::TextureMapType::Normal); AZStd::optional useColorMap = materialData.GetUseColorMap(); // If the useColorMap property exists, this is a PBR material and the color should be set to baseColor. if (useColorMap.has_value()) { + anyPBRInUse = true; handleTexture("baseColor", SceneAPI::DataTypes::IMaterialData::TextureMapType::BaseColor); } else @@ -97,17 +101,19 @@ namespace AZ AZStd::optional baseColor = materialData.GetBaseColor(); if (baseColor.has_value()) { + anyPBRInUse = true; sourceData.m_properties["baseColor"]["color"].m_value = toColor(baseColor.value()); } sourceData.m_properties["opacity"]["factor"].m_value = materialData.GetOpacity(); - auto applyOptionalPropertiesFunc = [&sourceData](const auto& propertyGroup, const auto& propertyName, const auto& propertyOptional) + auto applyOptionalPropertiesFunc = [&sourceData, &anyPBRInUse](const auto& propertyGroup, const auto& propertyName, const auto& propertyOptional) { // Only set PBR settings if they were specifically set in the scene's data. // Otherwise, leave them unset so the data driven default properties are used. if (propertyOptional.has_value()) { + anyPBRInUse = true; sourceData.m_properties[propertyGroup][propertyName].m_value = propertyOptional.value(); } }; @@ -127,6 +133,13 @@ namespace AZ handleTexture("ambientOcclusion", SceneAPI::DataTypes::IMaterialData::TextureMapType::AmbientOcclusion); applyOptionalPropertiesFunc("ambientOcclusion", "useTexture", materialData.GetUseAOMap()); + + if (!anyPBRInUse) + { + // If it doesn't have the useColorMap property, then it's a non-PBR material and the baseColor + // texture needs to be set to the diffuse color. + sourceData.m_properties["baseColor"]["color"].m_value = toColor(materialData.GetDiffuseColor()); + } return true; }