diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp index a3af2648cf..c55f565615 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.cpp @@ -341,6 +341,16 @@ namespace AZ ; } } + + if (auto behaviorContext = azrtti_cast(context)) + { + behaviorContext->EBus("ComponentApplicationBus") + ->Attribute(AZ::Script::Attributes::Scope, AZ::Script::Attributes::ScopeFlags::Common) + ->Attribute(AZ::Script::Attributes::Category, "Components") + + ->Event("GetEntityName", &ComponentApplicationBus::Events::GetEntityName) + ->Event("SetEntityName", &ComponentApplicationBus::Events::SetEntityName); + } } //========================================================================= @@ -1050,6 +1060,20 @@ namespace AZ return AZStd::string(); } + //========================================================================= + // SetEntityName + //========================================================================= + bool ComponentApplication::SetEntityName(const EntityId& id, const AZStd::string_view name) + { + Entity* entity = FindEntity(id); + if (entity) + { + entity->SetName(name); + return true; + } + return false; + } + //========================================================================= // EnumerateEntities //========================================================================= diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h index ef5c813573..3ebcf39d95 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplication.h @@ -209,6 +209,7 @@ namespace AZ bool DeleteEntity(const EntityId& id) override; Entity* FindEntity(const EntityId& id) override; AZStd::string GetEntityName(const EntityId& id) override; + bool SetEntityName(const EntityId& id, const AZStd::string_view name) override; void EnumerateEntities(const ComponentApplicationRequests::EntityCallback& callback) override; ComponentApplication* GetApplication() override { return this; } /// Returns the serialize context that has been registered with the app, if there is one. diff --git a/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h b/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h index d0f161aa39..3582e6ebb8 100644 --- a/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h +++ b/Code/Framework/AzCore/AzCore/Component/ComponentApplicationBus.h @@ -130,7 +130,13 @@ namespace AZ //! @param entity A reference to the entity whose name you are seeking. //! @return The name of the entity with the specified entity ID. //! If no entity is found for the specified ID, it returns an empty string. - virtual AZStd::string GetEntityName(const EntityId& id) { (void)id; return AZStd::string(); }; + virtual AZStd::string GetEntityName(const EntityId& id) { (void)id; return AZStd::string(); } + + //! Sets the name of the entity that has the specified entity ID. + //! Entity names are not enforced to be unique. + //! @param entityId A reference to the entity whose name you want to change. + //! @return True if the name was changed successfully, false if it wasn't. + virtual bool SetEntityName([[maybe_unused]] const EntityId& id, [[maybe_unused]] const AZStd::string_view name) { return false; } //! The type that AZ::ComponentApplicationRequests::EnumerateEntities uses to //! pass entity callbacks to the application for enumeration. diff --git a/Code/Framework/AzCore/AzCore/Math/Quaternion.cpp b/Code/Framework/AzCore/AzCore/Math/Quaternion.cpp index ca09f8b453..143fe59ca7 100644 --- a/Code/Framework/AzCore/AzCore/Math/Quaternion.cpp +++ b/Code/Framework/AzCore/AzCore/Math/Quaternion.cpp @@ -258,7 +258,8 @@ namespace AZ Method("CreateFromMatrix3x3", &Quaternion::CreateFromMatrix3x3)-> Method("CreateFromMatrix4x4", &Quaternion::CreateFromMatrix4x4)-> Method("CreateFromAxisAngle", &Quaternion::CreateFromAxisAngle)-> - Method("CreateShortestArc", &Quaternion::CreateShortestArc) + Method("CreateShortestArc", &Quaternion::CreateShortestArc)-> + Method("CreateFromEulerAnglesDegrees", &Quaternion::CreateFromEulerAnglesDegrees) ; } } diff --git a/Code/Framework/AzCore/AzCore/Math/Transform.cpp b/Code/Framework/AzCore/AzCore/Math/Transform.cpp index 77d8658d0f..bb3f764492 100644 --- a/Code/Framework/AzCore/AzCore/Math/Transform.cpp +++ b/Code/Framework/AzCore/AzCore/Math/Transform.cpp @@ -250,6 +250,7 @@ namespace AZ Attribute(Script::Attributes::ExcludeFrom, Script::Attributes::ExcludeFlags::All)-> Attribute(Script::Attributes::Storage, Script::Attributes::StorageType::Value)-> Attribute(Script::Attributes::GenericConstructorOverride, &Internal::TransformDefaultConstructor)-> + Constructor()-> Method("GetBasis", &Transform::GetBasis)-> Method("GetBasisX", &Transform::GetBasisX)-> Method("GetBasisY", &Transform::GetBasisY)-> diff --git a/Code/Framework/AzCore/CMakeLists.txt b/Code/Framework/AzCore/CMakeLists.txt index c77205a760..db2c79f0c9 100644 --- a/Code/Framework/AzCore/CMakeLists.txt +++ b/Code/Framework/AzCore/CMakeLists.txt @@ -40,14 +40,13 @@ ly_add_target( ${common_dir} ${AZ_CORE_RADTELEMETRY_INCLUDE_DIRECTORIES} BUILD_DEPENDENCIES - PRIVATE - 3rdParty::zlib - 3rdParty::zstd - 3rdParty::cityhash PUBLIC 3rdParty::Lua 3rdParty::RapidJSON 3rdParty::RapidXML + 3rdParty::zlib + 3rdParty::zstd + 3rdParty::cityhash ${AZ_CORE_RADTELEMETRY_BUILD_DEPENDENCIES} ) ly_add_source_properties( diff --git a/Code/Framework/AzFramework/CMakeLists.txt b/Code/Framework/AzFramework/CMakeLists.txt index f62f205efd..50e1fcb5a4 100644 --- a/Code/Framework/AzFramework/CMakeLists.txt +++ b/Code/Framework/AzFramework/CMakeLists.txt @@ -33,12 +33,12 @@ ly_add_target( BUILD_DEPENDENCIES PRIVATE AZ::AzCore + PUBLIC + AZ::GridMate 3rdParty::md5 3rdParty::zlib 3rdParty::zstd 3rdParty::lz4 - PUBLIC - AZ::GridMate ) if(LY_ENABLE_STATISTICAL_PROFILING) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp index 4b23b46ffd..cb16e0c099 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.cpp @@ -94,6 +94,7 @@ namespace AzToolsFramework m_prefabSystemComponent->RemoveTemplate(templateId); } m_rootInstance->Reset(); + m_rootInstance->SetContainerEntityName("Level"); AzFramework::EntityOwnershipServiceNotificationBus::Event( m_entityContextId, &AzFramework::EntityOwnershipServiceNotificationBus::Events::OnEntityOwnershipServiceReset); @@ -198,6 +199,7 @@ namespace AzToolsFramework m_rootInstance->SetTemplateId(templateId); m_rootInstance->SetTemplateSourcePath(m_loaderInterface->GetRelativePathToProject(filename)); + m_rootInstance->SetContainerEntityName("Level"); m_prefabSystemComponent->PropagateTemplateChanges(templateId); return true; @@ -279,18 +281,29 @@ namespace AzToolsFramework AZStd::unique_ptr createdPrefabInstance = m_prefabSystemComponent->CreatePrefab(entities, AZStd::move(nestedPrefabInstances), filePath); - if (!instanceToParentUnder) - { - instanceToParentUnder = *m_rootInstance; - } - if (createdPrefabInstance) { + if (!instanceToParentUnder) + { + instanceToParentUnder = *m_rootInstance; + } + Prefab::Instance& addedInstance = instanceToParentUnder->get().AddInstance(AZStd::move(createdPrefabInstance)); - HandleEntitiesAdded({addedInstance.m_containerEntity.get()}); + AZ::Entity* containerEntity = addedInstance.m_containerEntity.get(); + containerEntity->AddComponent(aznew Prefab::EditorPrefabComponent()); + HandleEntitiesAdded({containerEntity}); + HandleEntitiesAdded(entities); + + // Update the template of the instance since we modified the entities of the instance by calling HandleEntitiesAdded. + Prefab::PrefabDom serializedInstance; + if (Prefab::PrefabDomUtils::StoreInstanceInPrefabDom(addedInstance, serializedInstance)) + { + m_prefabSystemComponent->UpdatePrefabTemplate(addedInstance.GetTemplateId(), serializedInstance); + } + return addedInstance; } - HandleEntitiesAdded(entities); + return AZStd::nullopt; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h index ad11547506..36a60cc501 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h @@ -186,7 +186,7 @@ namespace AzToolsFramework PlayInEditorData m_playInEditorData; ////////////////////////////////////////////////////////////////////////// - // PrefabSystemComponentInterface interface implementation + // PrefabEditorEntityOwnershipInterface implementation Prefab::InstanceOptionalReference CreatePrefab( const AZStd::vector& entities, AZStd::vector>&& nestedPrefabInstances, AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder) override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.cpp index 0a5b43482e..c1eee62dbc 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.cpp @@ -123,7 +123,11 @@ namespace AzToolsFramework void Instance::SetTemplateSourcePath(AZ::IO::PathView sourcePath) { m_templateSourcePath = sourcePath; - m_containerEntity->SetName(sourcePath.Filename().Native()); + } + + void Instance::SetContainerEntityName(AZStd::string_view containerName) + { + m_containerEntity->SetName(containerName); } bool Instance::AddEntity(AZ::Entity& entity) @@ -563,7 +567,7 @@ namespace AzToolsFramework AZ::EntityId Instance::GetContainerEntityId() const { - return m_containerEntity->GetId(); + return m_containerEntity ? m_containerEntity->GetId() : AZ::EntityId(); } bool Instance::HasContainerEntity() const diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.h index d1c7a4d853..186dce0f50 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/Instance.h @@ -80,6 +80,7 @@ namespace AzToolsFramework const AZ::IO::Path& GetTemplateSourcePath() const; void SetTemplateSourcePath(AZ::IO::PathView sourcePath); + void SetContainerEntityName(AZStd::string_view containerName); bool AddEntity(AZ::Entity& entity); bool AddEntity(AZ::Entity& entity, EntityAlias entityAlias); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp index 65de6b713c..71b1e04ec8 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -116,10 +117,24 @@ namespace AzToolsFramework "Could not find Template using Id '%llu'. Unable to update Instance.", currentTemplateId); + // Remove the instance from update queue if its corresponding template couldn't be found isUpdateSuccessful = false; + m_instancesUpdateQueue.pop(); + continue; } } + auto findInstancesResult = m_templateInstanceMapperInterface->FindInstancesOwnedByTemplate(instanceTemplateId)->get(); + + if (findInstancesResult.find(instanceToUpdate) == findInstancesResult.end()) + { + // Since nested instances get reconstructed during propagation, remove any nested instance that no longer + // maps to a template. + isUpdateSuccessful = false; + m_instancesUpdateQueue.pop(); + continue; + } + Template& currentTemplate = currentTemplateReference->get(); Instance::EntityList newEntities; if (PrefabDomUtils::LoadInstanceFromPrefabDom(*instanceToUpdate, newEntities, currentTemplate.GetPrefabDom())) @@ -139,9 +154,18 @@ namespace AzToolsFramework } m_instancesUpdateQueue.pop(); - } + for (auto entityIdIterator = selectedEntityIds.begin(); entityIdIterator != selectedEntityIds.end(); entityIdIterator++) + { + // Since entities get recreated during propagation, we need to check whether the entities correspoding to the list + // of selected entity ids are present or not. + AZ::Entity* entity = GetEntityById(*entityIdIterator); + if (entity == nullptr) + { + selectedEntityIds.erase(entityIdIterator--); + } + } ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, selectedEntityIds); // Enable the Outliner diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index c64a9491c5..772e0ae52e 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -15,15 +15,16 @@ #include #include +#include #include #include #include #include -#include #include #include #include #include +#include #include #include #include @@ -37,12 +38,14 @@ namespace AzToolsFramework void PrefabPublicHandler::RegisterPrefabPublicHandlerInterface() { m_instanceEntityMapperInterface = AZ::Interface::Get(); - AZ_Assert( - m_instanceEntityMapperInterface, "PrefabPublicHandler - Could not retrieve instance of InstanceEntityMapperInterface"); + AZ_Assert(m_instanceEntityMapperInterface, "PrefabPublicHandler - Could not retrieve instance of InstanceEntityMapperInterface"); m_instanceToTemplateInterface = AZ::Interface::Get(); AZ_Assert(m_instanceToTemplateInterface, "PrefabPublicHandler - Could not retrieve instance of InstanceToTemplateInterface"); + m_prefabLoaderInterface = AZ::Interface::Get(); + AZ_Assert(m_prefabLoaderInterface, "Could not get PrefabLoaderInterface on PrefabPublicHandler construction."); + m_prefabSystemComponentInterface = AZ::Interface::Get(); AZ_Assert(m_prefabSystemComponentInterface, "Could not get PrefabSystemComponentInterface on PrefabPublicHandler construction."); @@ -59,91 +62,160 @@ namespace AzToolsFramework } PrefabOperationResult PrefabPublicHandler::CreatePrefab(const AZStd::vector& entityIds, AZ::IO::PathView filePath) + { + EntityList inputEntityList, topLevelEntities; + AZ::EntityId commonRootEntityId; + InstanceOptionalReference commonRootEntityOwningInstance; + PrefabOperationResult findCommonRootOutcome = FindCommonRootOwningInstance( + entityIds, inputEntityList, topLevelEntities, commonRootEntityId, commonRootEntityOwningInstance); + if (!findCommonRootOutcome.IsSuccess()) + { + return findCommonRootOutcome; + } + + InstanceOptionalReference instanceToCreate; + { + // Initialize Undo Batch object + ScopedUndoBatch undoBatch("Create Prefab"); + + PrefabDom commonRootInstanceDomBeforeCreate; + m_instanceToTemplateInterface->GenerateDomForInstance( + commonRootInstanceDomBeforeCreate, commonRootEntityOwningInstance->get()); + + AZStd::vector entities; + AZStd::vector> instances; + + // Retrieve all entities affected and identify Instances + if (!RetrieveAndSortPrefabEntitiesAndInstances(inputEntityList, commonRootEntityOwningInstance->get(), entities, instances)) + { + return AZ::Failure( + AZStd::string("Could not create a new prefab out of the entities provided - entities do not share a common root.")); + } + + // When we create a prefab with other prefab instances, we have to remove the existing links between the source and + // target templates of the other instances. + for (auto& nestedInstance : instances) + { + PrefabUndoHelpers::RemoveLink( + nestedInstance->GetTemplateId(), commonRootEntityOwningInstance->get().GetTemplateId(), + nestedInstance->GetInstanceAlias(), nestedInstance->GetLinkId(), undoBatch.GetUndoBatch()); + } + + auto prefabEditorEntityOwnershipInterface = AZ::Interface::Get(); + if (!prefabEditorEntityOwnershipInterface) + { + return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - internal error " + "(PrefabEditorEntityOwnershipInterface unavailable).")); + } + + // Create the Prefab + instanceToCreate = prefabEditorEntityOwnershipInterface->CreatePrefab( + entities, AZStd::move(instances), filePath, commonRootEntityOwningInstance); + + if (!instanceToCreate) + { + return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - internal error " + "(A null instance is returned).")); + } + + PrefabUndoHelpers::UpdatePrefabInstance( + commonRootEntityOwningInstance->get(), "Update prefab instance", commonRootInstanceDomBeforeCreate, undoBatch.GetUndoBatch()); + + CreateLink( + topLevelEntities, instanceToCreate->get(), commonRootEntityOwningInstance->get().GetTemplateId(), undoBatch.GetUndoBatch(), + commonRootEntityId); + AZ::EntityId containerEntityId = instanceToCreate->get().GetContainerEntityId(); + + // Change top level entities to be parented to the container entity + // Mark them as dirty so this change is correctly applied to the template + for (AZ::Entity* topLevelEntity : topLevelEntities) + { + m_prefabUndoCache.UpdateCache(topLevelEntity->GetId()); + undoBatch.MarkEntityDirty(topLevelEntity->GetId()); + AZ::TransformBus::Event(topLevelEntity->GetId(), &AZ::TransformBus::Events::SetParent, containerEntityId); + } + + // Select Container Entity + { + auto selectionUndo = aznew SelectionCommand({containerEntityId}, "Select Prefab Container Entity"); + selectionUndo->SetParent(undoBatch.GetUndoBatch()); + ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequestBus::Events::RunRedoSeparately, selectionUndo); + } + } + + // Save Template to file + m_prefabLoaderInterface->SaveTemplate(instanceToCreate->get().GetTemplateId()); + + return AZ::Success(); + } + + PrefabOperationResult PrefabPublicHandler::FindCommonRootOwningInstance( + const AZStd::vector& entityIds, EntityList& inputEntityList, EntityList& topLevelEntities, + AZ::EntityId& commonRootEntityId, InstanceOptionalReference& commonRootEntityOwningInstance) { // Retrieve entityList from entityIds - EntityList inputEntityList = EntityIdListToEntityList(entityIds); + inputEntityList = EntityIdListToEntityList(entityIds); // Find common root and top level entities bool entitiesHaveCommonRoot = false; - AZ::EntityId commonRootEntityId; - EntityList topLevelEntities; AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult( - entitiesHaveCommonRoot, - &AzToolsFramework::ToolsApplicationRequests::FindCommonRootInactive, - inputEntityList, - commonRootEntityId, - &topLevelEntities - ); + entitiesHaveCommonRoot, &AzToolsFramework::ToolsApplicationRequests::FindCommonRootInactive, inputEntityList, + commonRootEntityId, &topLevelEntities); // Bail if entities don't share a common root if (!entitiesHaveCommonRoot) { - return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - entities do not share a common root.")); - } - - AZ::Entity* commonRootEntity = nullptr; - if (commonRootEntityId.IsValid()) - { - commonRootEntity = GetEntityById(commonRootEntityId); + return AZ::Failure(AZStd::string("Failed to create a prefab: Provided entities do not share a common root.")); } // Retrieve the owning instance of the common root entity, which will be our new instance's parent instance. - InstanceOptionalReference commonRootEntityOwningInstance = GetOwnerInstanceByEntityId(commonRootEntityId); - AZ_Assert(commonRootEntityOwningInstance.has_value(), "Failed to create prefab : " - "Couldn't get a valid owning instance for the common root entity of the enities provided"); - - AZStd::vector entities; - AZStd::vector> instances; - - // Retrieve all entities affected and identify Instances - if (!RetrieveAndSortPrefabEntitiesAndInstances(inputEntityList, commonRootEntityOwningInstance->get(), entities, instances)) + commonRootEntityOwningInstance = GetOwnerInstanceByEntityId(commonRootEntityId); + if (!commonRootEntityOwningInstance) { - return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - entities do not share a common root.")); + AZ_Assert( + false, + "Failed to create prefab : Couldn't get a valid owning instance for the common root entity of the enities provided"); + return AZ::Failure(AZStd::string( + "Failed to create prefab : Couldn't get a valid owning instance for the common root entity of the enities provided")); } + return AZ::Success(); + } - auto prefabEditorEntityOwnershipInterface = AZ::Interface::Get(); - if (!prefabEditorEntityOwnershipInterface) - { - return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - internal error " - "(PrefabEditorEntityOwnershipInterface unavailable).")); - } + void PrefabPublicHandler::CreateLink( + const EntityList& topLevelEntities, Instance& sourceInstance, TemplateId targetTemplateId, + UndoSystem::URSequencePoint* undoBatch, AZ::EntityId commonRootEntityId) + { + AZ::EntityId containerEntityId = sourceInstance.GetContainerEntityId(); + AZ::Entity* containerEntity = GetEntityById(containerEntityId); + Prefab::PrefabDom containerEntityDomBefore; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomBefore, *containerEntity); - InstanceOptionalReference instance = prefabEditorEntityOwnershipInterface->CreatePrefab( - entities, AZStd::move(instances), filePath, commonRootEntityOwningInstance); - - if (!instance) - { - return AZ::Failure(AZStd::string("Could not create a new prefab out of the entities provided - internal error " - "(A null instance is returned).")); - } - - AZ::EntityId containerEntityId = instance->get().GetContainerEntityId(); 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); - // Set container entity to be child of common root - AZ::TransformBus::Event(containerEntityId, &AZ::TransformBus::Events::SetParent, commonRootEntityId); - - // Assign the EditorPrefabComponent to the instance container - EntityCompositionRequests::AddComponentsOutcome outcome; - EntityCompositionRequestBus::BroadcastResult( - outcome, &EntityCompositionRequests::AddComponentsToEntities, EntityIdList{containerEntityId}, - AZ::ComponentTypeList{azrtti_typeid()}); - - // Change top level entities to be parented to the container entity - for (AZ::Entity* topLevelEntity : topLevelEntities) - { - AZ::TransformBus::Event(topLevelEntity->GetId(), &AZ::TransformBus::Events::SetParent, containerEntityId); - } - - return AZ::Success(); + PrefabDom containerEntityDomAfter; + m_instanceToTemplateInterface->GenerateDomForEntity(containerEntityDomAfter, *containerEntity); + + PrefabDom patch; + m_instanceToTemplateInterface->GeneratePatch(patch, containerEntityDomBefore, containerEntityDomAfter); + m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(patch, containerEntityId); + + PrefabUndoHelpers::CreateLink( + sourceInstance.GetTemplateId(), targetTemplateId, patch, sourceInstance.GetInstanceAlias(), + undoBatch); + + // Update the cache - this prevents these changes from being stored in the regular undo/redo nodes + m_prefabUndoCache.Store(containerEntityId, AZStd::move(containerEntityDomAfter)); } PrefabOperationResult PrefabPublicHandler::InstantiatePrefab(AZStd::string_view /*filePath*/, AZ::EntityId /*parent*/, AZ::Vector3 /*position*/) @@ -173,14 +245,7 @@ namespace AzToolsFramework AZStd::string("SavePrefab - Path error. Path could be invalid, or the prefab may not be loaded in this level.")); } - auto prefabLoaderInterface = AZ::Interface::Get(); - if (prefabLoaderInterface == nullptr) - { - return AZ::Failure(AZStd::string( - "Could not save prefab - internal error (PrefabLoaderInterface unavailable).")); - } - - if (!prefabLoaderInterface->SaveTemplate(templateId)) + if (!m_prefabLoaderInterface->SaveTemplate(templateId)) { return AZ::Failure(AZStd::string("Could not save prefab - internal error (Json write operation failure).")); } @@ -261,13 +326,13 @@ namespace AzToolsFramework if (instanceOptionalReference.has_value()) { - PrefabDom beforeState; - m_prefabUndoCache.Retrieve(entityId, beforeState); - PrefabDom afterState; AZ::Entity* entity = GetEntityById(entityId); if (entity) { + PrefabDom beforeState; + m_prefabUndoCache.Retrieve(entityId, beforeState); + m_instanceToTemplateInterface->GenerateDomForEntity(afterState, *entity); PrefabDom patch; @@ -286,7 +351,10 @@ namespace AzToolsFramework // Update the cache m_prefabUndoCache.Store(entityId, AZStd::move(afterState)); } - + else + { + m_prefabUndoCache.PurgeCache(entityId); + } } } @@ -653,7 +721,7 @@ namespace AzToolsFramework InstanceOptionalReference owningInstance = m_instanceEntityMapperInterface->FindOwningInstance(entity->GetId()); AZ_Assert( owningInstance.has_value(), - "An error occored while retrieving entities and prefab instances : " + "An error occurred while retrieving entities and prefab instances : " "Owning instance of entity with id '%llu' couldn't be found", entity->GetId()); @@ -737,7 +805,7 @@ namespace AzToolsFramework { AZ_Assert( false, - "An error occored in function EntitiesBelongToSameInstance: " + "An error occurred in function EntitiesBelongToSameInstance: " "Owning instance of entity with id '%llu' couldn't be found", entityId); return false; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h index d9dba2a32e..19985bbf51 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h @@ -27,8 +27,10 @@ namespace AzToolsFramework namespace Prefab { class Instance; + class InstanceEntityMapperInterface; class InstanceToTemplateInterface; + class PrefabLoaderInterface; class PrefabSystemComponentInterface; class PrefabPublicHandler final @@ -67,12 +69,40 @@ namespace AzToolsFramework InstanceOptionalReference GetOwnerInstanceByEntityId(AZ::EntityId entityId) const; bool EntitiesBelongToSameInstance(const EntityIdList& entityIds) const; + /** + * 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. + */ + void CreateLink( + const EntityList& topLevelEntities, Instance& sourceInstance, TemplateId targetTemplateId, + UndoSystem::URSequencePoint* undoBatch, AZ::EntityId commonRootEntityId); + + /** + * Given a list of entityIds, finds the prefab instance that owns the common root entity of the entityIds. + * + * \param entityIds The list of entity ids. + * \param inputEntityList The list of entities corresponding to the entity ids. + * \param topLevelEntities The list of entities that are immediate children of the common root entity. + * \param commonRootEntityId The entity id of the common root entity of all the entityIds. + * \param commonRootEntityOwningInstance The owning instance of the common root entity. + * \return PrefabOperationResult indicating whether the action was successful or not. + */ + PrefabOperationResult FindCommonRootOwningInstance( + const AZStd::vector& entityIds, EntityList& inputEntityList, EntityList& topLevelEntities, + AZ::EntityId& commonRootEntityId, InstanceOptionalReference& commonRootEntityOwningInstance); + static Instance* GetParentInstance(Instance* instance); static Instance* GetAncestorOfInstanceThatIsChildOfRoot(const Instance* ancestor, Instance* descendant); static void GenerateContainerEntityTransform(const EntityList& topLevelEntities, AZ::Vector3& translation, AZ::Quaternion& rotation); InstanceEntityMapperInterface* m_instanceEntityMapperInterface = nullptr; InstanceToTemplateInterface* m_instanceToTemplateInterface = nullptr; + PrefabLoaderInterface* m_prefabLoaderInterface = nullptr; PrefabSystemComponentInterface* m_prefabSystemComponentInterface = nullptr; // Caches entity states for undo/redo purposes diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp index bf9fd658c6..54e99c9416 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp @@ -104,7 +104,6 @@ namespace AzToolsFramework return nullptr; } - AZStd::unique_ptr newInstance = AZStd::make_unique(AZStd::move(containerEntity)); for (AZ::Entity* entity : entities) @@ -122,6 +121,7 @@ namespace AzToolsFramework } newInstance->SetTemplateSourcePath(relativeFilePath); + newInstance->SetContainerEntityName(relativeFilePath.Stem().Native()); TemplateId newTemplateId = CreateTemplateFromInstance(*newInstance); if (newTemplateId == InvalidTemplateId) @@ -142,7 +142,6 @@ namespace AzToolsFramework void PrefabSystemComponent::PropagateTemplateChanges(TemplateId templateId) { - UpdatePrefabInstances(templateId); auto templateIdToLinkIdsIterator = m_templateToLinkIdsMap.find(templateId); if (templateIdToLinkIdsIterator != m_templateToLinkIdsMap.end()) { @@ -153,15 +152,24 @@ namespace AzToolsFramework templateIdToLinkIdsIterator->second.end())); UpdateLinkedInstances(linkIdsToUpdateQueue); } + else + { + UpdatePrefabInstances(templateId); + } } void PrefabSystemComponent::UpdatePrefabTemplate(TemplateId templateId, const PrefabDom& updatedDom) { - PrefabDom& templateDomToUpdate = FindTemplateDom(templateId); - if (AZ::JsonSerialization::Compare(templateDomToUpdate, updatedDom) != AZ::JsonSerializerCompareResult::Equal) + auto templateToUpdate = FindTemplate(templateId); + if (templateToUpdate) { - templateDomToUpdate.CopyFrom(updatedDom, templateDomToUpdate.GetAllocator()); - PropagateTemplateChanges(templateId); + PrefabDom& templateDomToUpdate = templateToUpdate->get().GetPrefabDom(); + if (AZ::JsonSerialization::Compare(templateDomToUpdate, updatedDom) != AZ::JsonSerializerCompareResult::Equal) + { + templateDomToUpdate.CopyFrom(updatedDom, templateDomToUpdate.GetAllocator()); + templateToUpdate->get().MarkAsDirty(true); + PropagateTemplateChanges(templateId); + } } } @@ -615,7 +623,12 @@ namespace AzToolsFramework instancesValue = memberFound->value; } - instancesValue->get().AddMember(rapidjson::StringRef(instanceAlias.c_str()), PrefabDomValue(), targetTemplateDom.GetAllocator()); + // Only add the instance if it's not there already + if (instancesValue->get().FindMember(rapidjson::StringRef(instanceAlias.c_str())) == instancesValue->get().MemberEnd()) + { + instancesValue->get().AddMember( + rapidjson::StringRef(instanceAlias.c_str()), PrefabDomValue(), targetTemplateDom.GetAllocator()); + } Template& sourceTemplate = sourceTemplateRef->get(); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp index 0d9f9f72a5..ea3fa5d84d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp @@ -124,7 +124,7 @@ namespace AzToolsFramework const TemplateId& targetId, const TemplateId& sourceId, const InstanceAlias& instanceAlias, - const PrefabDomReference linkDom, + PrefabDomReference linkDom, const LinkId linkId) { m_targetId = targetId; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h index 7a765c5db7..0d15d707d2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h @@ -101,7 +101,7 @@ namespace AzToolsFramework const TemplateId& targetId, const TemplateId& sourceId, const InstanceAlias& instanceAlias, - const PrefabDomReference linkDom = PrefabDomReference(), + PrefabDomReference linkDom = PrefabDomReference(), const LinkId linkId = InvalidLinkId); void Undo() override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.cpp index da41635d03..c9b6c88a97 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.cpp @@ -32,6 +32,28 @@ namespace AzToolsFramework state->SetParent(undoBatch); state->Redo(); } + + void CreateLink( + TemplateId sourceTemplateId, TemplateId targetTemplateId, PrefabDomReference patch, + const InstanceAlias& instanceAlias, UndoSystem::URSequencePoint* undoBatch) + { + auto linkAddUndo = aznew PrefabUndoInstanceLink("Create Link"); + linkAddUndo->Capture(targetTemplateId, sourceTemplateId, instanceAlias, patch, InvalidLinkId); + linkAddUndo->SetParent(undoBatch); + linkAddUndo->Redo(); + } + + void RemoveLink( + TemplateId sourceTemplateId, TemplateId targetTemplateId, const InstanceAlias& instanceAlias, + LinkId linkId, UndoSystem::URSequencePoint* undoBatch) + { + auto linkRemoveUndo = aznew PrefabUndoInstanceLink("Remove Link"); + PrefabDom emptyLinkDom; + linkRemoveUndo->Capture( + targetTemplateId, sourceTemplateId, instanceAlias, emptyLinkDom, linkId); + linkRemoveUndo->SetParent(undoBatch); + linkRemoveUndo->Redo(); + } } } // namespace Prefab } // namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.h index 81d0048e9e..5f81ef14a8 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndoHelpers.h @@ -21,6 +21,12 @@ namespace AzToolsFramework void UpdatePrefabInstance( const Instance& instance, AZStd::string_view undoMessage, const PrefabDom& instanceDomBeforeUpdate, UndoSystem::URSequencePoint* undoBatch); + void CreateLink( + TemplateId sourceTemplateId, TemplateId targetTemplateId, PrefabDomReference patch, + const InstanceAlias& instanceAlias, UndoSystem::URSequencePoint* undoBatch); + void RemoveLink( + TemplateId sourceTemplateId, TemplateId targetTemplateId, const InstanceAlias& instanceAlias, + LinkId linkId, UndoSystem::URSequencePoint* undoBatch); } } // namespace Prefab } // namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.cpp index 98edd26f88..84266d3707 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.cpp @@ -61,6 +61,11 @@ namespace AzToolsFramework return true; } + bool EditorEntityUiHandlerBase::CanRename(AZ::EntityId /*entityId*/) const + { + return true; + } + void EditorEntityUiHandlerBase::PaintItemBackground(QPainter* /*painter*/, const QStyleOptionViewItem& /*option*/, const QModelIndex& /*index*/) const { } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.h index 7360e7ff0b..1aa5e5720f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/EditorEntityUi/EditorEntityUiHandlerBase.h @@ -47,6 +47,8 @@ namespace AzToolsFramework virtual QPixmap GenerateItemIcon(AZ::EntityId entityId) const; //! Returns whether the element's lock and visibility state should be accessible in the Outliner virtual bool CanToggleLockVisibility(AZ::EntityId entityId) const; + //! Returns whether the element's name should be editable + virtual bool CanRename(AZ::EntityId entityId) const; //! Paints the background of the item in the Outliner. virtual void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp index de10ae18b4..5b44594398 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerListModel.cpp @@ -945,6 +945,12 @@ namespace AzToolsFramework return false; } + // Disable reparenting to the root level + if (!newParentId.IsValid()) + { + return false; + } + // Ignore entities not owned by the editor context. It is assumed that all entities belong // to the same context since multiple selection doesn't span across views. for (const AZ::EntityId& entityId : selectedEntityIds) @@ -974,39 +980,33 @@ namespace AzToolsFramework } } - if (newParentId.IsValid()) + bool isLayerEntity = false; + Layers::EditorLayerComponentRequestBus::EventResult( + isLayerEntity, + entityId, + &Layers::EditorLayerComponentRequestBus::Events::HasLayer); + // Layers can only have other layers as parents, or have no parent. + if (isLayerEntity) { - bool isLayerEntity = false; + bool newParentIsLayer = false; Layers::EditorLayerComponentRequestBus::EventResult( - isLayerEntity, - entityId, + newParentIsLayer, + newParentId, &Layers::EditorLayerComponentRequestBus::Events::HasLayer); - // Layers can only have other layers as parents, or have no parent. - if (isLayerEntity) + if (!newParentIsLayer) { - bool newParentIsLayer = false; - Layers::EditorLayerComponentRequestBus::EventResult( - newParentIsLayer, - newParentId, - &Layers::EditorLayerComponentRequestBus::Events::HasLayer); - if (!newParentIsLayer) - { - return false; - } + return false; } } } //Only check the entity pointer if the entity id is valid because //we want to allow dragging items to unoccupied parts of the tree to un-parent them - if (newParentId.IsValid()) + AZ::Entity* newParentEntity = nullptr; + AZ::ComponentApplicationBus::BroadcastResult(newParentEntity, &AZ::ComponentApplicationRequests::FindEntity, newParentId); + if (!newParentEntity) { - AZ::Entity* newParentEntity = nullptr; - AZ::ComponentApplicationBus::BroadcastResult(newParentEntity, &AZ::ComponentApplicationRequests::FindEntity, newParentId); - if (!newParentEntity) - { - return false; - } + return false; } //reject dragging on to yourself or your children diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp index 08fc764507..3ee8a14285 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -271,6 +272,12 @@ namespace AzToolsFramework m_listModel->Initialize(); + m_editorEntityUiInterface = AZ::Interface::Get(); + + AZ_Assert( + m_editorEntityUiInterface != nullptr, + "EntityOutlinerWidget requires a EditorEntityUiInterface instance on Initialize."); + EditorPickModeNotificationBus::Handler::BusConnect(GetEntityContextId()); EntityHighlightMessages::Bus::Handler::BusConnect(); EntityOutlinerModelNotificationBus::Handler::BusConnect(); @@ -562,7 +569,13 @@ namespace AzToolsFramework if (m_selectedEntityIds.size() == 1) { - contextMenu->addAction(m_actionToRenameSelection); + auto entityId = m_selectedEntityIds.front(); + auto entityUiHandler = m_editorEntityUiInterface->GetHandler(entityId); + + if (!entityUiHandler || entityUiHandler->CanRename(entityId)) + { + contextMenu->addAction(m_actionToRenameSelection); + } } if (m_selectedEntityIds.size() == 1) @@ -688,11 +701,17 @@ namespace AzToolsFramework if (m_selectedEntityIds.size() == 1) { - const QModelIndex proxyIndex = GetIndexFromEntityId(m_selectedEntityIds.front()); - if (proxyIndex.isValid()) + auto entityId = m_selectedEntityIds.front(); + auto entityUiHandler = m_editorEntityUiInterface->GetHandler(entityId); + + if (!entityUiHandler || entityUiHandler->CanRename(entityId)) { - m_gui->m_objectTree->setCurrentIndex(proxyIndex); - m_gui->m_objectTree->QTreeView::edit(proxyIndex); + const QModelIndex proxyIndex = GetIndexFromEntityId(entityId); + if (proxyIndex.isValid()) + { + m_gui->m_objectTree->setCurrentIndex(proxyIndex); + m_gui->m_objectTree->QTreeView::edit(proxyIndex); + } } } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx index cf8c55abd1..f225bb49b8 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Outliner/EntityOutlinerWidget.hxx @@ -42,6 +42,7 @@ namespace Ui namespace AzToolsFramework { + class EditorEntityUiInterface; class EntityOutlinerListModel; class EntityOutlinerSortFilterProxyModel; @@ -193,6 +194,8 @@ namespace AzToolsFramework EntityIdSet m_entitiesToSort; EntityOutliner::DisplaySortMode m_sortMode; bool m_sortContentQueued; + + EditorEntityUiInterface* m_editorEntityUiInterface = nullptr; }; } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.cpp index 828a49ef94..7915403c0a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.cpp @@ -50,11 +50,31 @@ namespace AzToolsFramework return QPixmap(m_levelRootIconPath); } + QString LevelRootUiHandler::GenerateItemInfoString(AZ::EntityId entityId) const + { + QString infoString; + + AZ::IO::Path path = m_prefabPublicInterface->GetOwningInstancePrefabPath(entityId); + + if (!path.empty()) + { + infoString = + QObject::tr("(%1)").arg(path.Filename().Native().data()); + } + + return infoString; + } + bool LevelRootUiHandler::CanToggleLockVisibility(AZ::EntityId /*entityId*/) const { return false; } + bool LevelRootUiHandler::CanRename(AZ::EntityId /*entityId*/) const + { + return false; + } + void LevelRootUiHandler::PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& /*index*/) const { if (!painter) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.h index a8b2e4a4f8..19c1244040 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/Prefab/LevelRootUiHandler.h @@ -34,7 +34,9 @@ namespace AzToolsFramework // EditorEntityUiHandler... QPixmap GenerateItemIcon(AZ::EntityId entityId) const override; + QString GenerateItemInfoString(AZ::EntityId entityId) const override; bool CanToggleLockVisibility(AZ::EntityId entityId) const override; + bool CanRename(AZ::EntityId entityId) const override; void PaintItemBackground(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; private: diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp index 55c7fb3f65..181f5b9a9d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.cpp @@ -310,6 +310,9 @@ namespace AzToolsFramework { initEntityPropertyEditorResources(); + m_prefabPublicInterface = AZ::Interface::Get(); + AZ_Assert(m_prefabPublicInterface != nullptr, "EntityPropertyEditor requires a PrefabPublicInterface instance on Initialize."); + setObjectName("EntityPropertyEditor"); setAcceptDrops(true); @@ -405,8 +408,6 @@ namespace AzToolsFramework CreateActions(); UpdateContents(); - m_prefabPublicInterface = AZ::Interface::Get(); - EditorEntityContextNotificationBus::Handler::BusConnect(); //forced to register global event filter with application for selection @@ -693,11 +694,38 @@ namespace AzToolsFramework m_gui->m_entityIcon->repaint(); } + EntityPropertyEditor::InspectorLayout EntityPropertyEditor::GetCurrentInspectorLayout() const + { + if (!m_prefabsAreEnabled) + { + return m_isLevelEntityEditor ? InspectorLayout::LEVEL : InspectorLayout::ENTITY; + } + + AZ::EntityId levelContainerEntityId = m_prefabPublicInterface->GetLevelInstanceContainerEntityId(); + if (AZStd::find(m_selectedEntityIds.begin(), m_selectedEntityIds.end(), levelContainerEntityId) != m_selectedEntityIds.end()) + { + if (m_selectedEntityIds.size() > 1) + { + return InspectorLayout::INVALID; + } + else + { + return InspectorLayout::LEVEL; + } + } + else + { + return InspectorLayout::ENTITY; + } + } + void EntityPropertyEditor::UpdateEntityDisplay() { UpdateStatusComboBox(); - if (m_isLevelEntityEditor) + InspectorLayout layout = GetCurrentInspectorLayout(); + + if (layout == InspectorLayout::LEVEL) { AZStd::string levelName; AzToolsFramework::EditorRequestBus::BroadcastResult(levelName, &AzToolsFramework::EditorRequests::GetLevelName); @@ -737,13 +765,20 @@ namespace AzToolsFramework AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); SelectionEntityTypeInfo result = SelectionEntityTypeInfo::None; - if (m_isLevelEntityEditor) + InspectorLayout layout = GetCurrentInspectorLayout(); + + if (layout == InspectorLayout::LEVEL) { // The Level Inspector should only have a list of selectable components after the // level entity itself is valid (i.e. "selected"). return selection.empty() ? SelectionEntityTypeInfo::None : SelectionEntityTypeInfo::LevelEntity; } + if (layout == InspectorLayout::INVALID) + { + return SelectionEntityTypeInfo::Mixed; + } + for (AZ::EntityId selectedEntityId : selection) { bool isLayerEntity = false; @@ -909,16 +944,18 @@ namespace AzToolsFramework } } + bool isLevelLayout = GetCurrentInspectorLayout() == InspectorLayout::LEVEL; + m_gui->m_entityDetailsLabel->setText(entityDetailsLabelText); m_gui->m_entityDetailsLabel->setVisible(entityDetailsVisible); m_gui->m_entityNameEditor->setVisible(hasEntitiesDisplayed); m_gui->m_entityNameLabel->setVisible(hasEntitiesDisplayed); m_gui->m_entityIcon->setVisible(hasEntitiesDisplayed); - m_gui->m_pinButton->setVisible(m_overrideSelectedEntityIds.empty() && hasEntitiesDisplayed && !m_isSystemEntityEditor && !m_isLevelEntityEditor); - m_gui->m_statusLabel->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !m_isLevelEntityEditor); - m_gui->m_statusComboBox->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !m_isLevelEntityEditor); - m_gui->m_entityIdLabel->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !m_isLevelEntityEditor); - m_gui->m_entityIdText->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !m_isLevelEntityEditor); + m_gui->m_pinButton->setVisible(m_overrideSelectedEntityIds.empty() && hasEntitiesDisplayed && !m_isSystemEntityEditor); + m_gui->m_statusLabel->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout); + m_gui->m_statusComboBox->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout); + m_gui->m_entityIdLabel->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout); + m_gui->m_entityIdText->setVisible(hasEntitiesDisplayed && !m_isSystemEntityEditor && !isLevelLayout); bool displayComponentSearchBox = hasEntitiesDisplayed; if (hasEntitiesDisplayed) @@ -941,7 +978,7 @@ namespace AzToolsFramework UpdateEntityDisplay(); } - m_gui->m_darkBox->setVisible(displayComponentSearchBox && !m_isSystemEntityEditor && !m_isLevelEntityEditor); + m_gui->m_darkBox->setVisible(displayComponentSearchBox && !m_isSystemEntityEditor && !isLevelLayout); m_gui->m_entitySearchBox->setVisible(displayComponentSearchBox); bool displayAddComponentMenu = CanAddComponentsToSelection(selectionEntityTypeInfo); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx index fed9c55f15..677dc98277 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/EntityPropertyEditor.hxx @@ -521,6 +521,15 @@ namespace AzToolsFramework bool m_isSystemEntityEditor; bool m_isLevelEntityEditor = false; + enum class InspectorLayout + { + ENTITY = 0, // All selected entities are regular entities + LEVEL, // The selected entity is the level prefab container entity + INVALID // Other entities are selected alongside the level prefab container entity + }; + + InspectorLayout GetCurrentInspectorLayout() const; + // the spacer's job is to make sure that its always at the end of the list of components. QSpacerItem* m_spacer; bool m_isAlreadyQueuedRefresh; diff --git a/Code/Framework/GridMate/CMakeLists.txt b/Code/Framework/GridMate/CMakeLists.txt index f326bda179..20ce582307 100644 --- a/Code/Framework/GridMate/CMakeLists.txt +++ b/Code/Framework/GridMate/CMakeLists.txt @@ -28,8 +28,9 @@ ly_add_target( ${pal_dir} BUILD_DEPENDENCIES PRIVATE - 3rdParty::OpenSSL AZ::AzCore + PUBLIC + 3rdParty::OpenSSL ) ly_add_source_properties( diff --git a/Code/Sandbox/Editor/EditorViewportWidget.cpp b/Code/Sandbox/Editor/EditorViewportWidget.cpp index 695a0fa5f1..91c70b720f 100644 --- a/Code/Sandbox/Editor/EditorViewportWidget.cpp +++ b/Code/Sandbox/Editor/EditorViewportWidget.cpp @@ -276,9 +276,6 @@ void EditorViewportWidget::paintEvent([[maybe_unused]] QPaintEvent* event) if ((ge && ge->IsLevelLoaded()) || (GetType() != ET_ViewportCamera)) { setRenderOverlayVisible(true); - m_isOnPaint = true; - Update(); - m_isOnPaint = false; } else { @@ -809,6 +806,10 @@ void EditorViewportWidget::OnBeginPrepareRender() return; } + m_isOnPaint = true; + Update(); + m_isOnPaint = false; + float fNearZ = GetIEditor()->GetConsoleVar("cl_DefaultNearPlane"); float fFarZ = m_Camera.GetFarPlane(); @@ -880,6 +881,11 @@ void EditorViewportWidget::OnBeginPrepareRender() GetIEditor()->GetSystem()->SetViewCamera(m_Camera); + if (GetIEditor()->IsInGameMode()) + { + return; + } + PreWidgetRendering(); RenderAll(); @@ -905,11 +911,6 @@ void EditorViewportWidget::OnBeginPrepareRender() m_debugDisplay->DepthTestOn(); PostWidgetRendering(); - - if (!m_renderer->IsStereoEnabled()) - { - GetIEditor()->GetSystem()->RenderStatistics(); - } } ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Sandbox/Editor/LayoutWnd.cpp b/Code/Sandbox/Editor/LayoutWnd.cpp index 56c0bcb849..34a96bca53 100644 --- a/Code/Sandbox/Editor/LayoutWnd.cpp +++ b/Code/Sandbox/Editor/LayoutWnd.cpp @@ -418,8 +418,11 @@ void CLayoutWnd::CreateLayout(EViewLayout layout, bool bBindViewports, EViewport QRect rcView = rect(); rcView.setBottom(rcView.bottom() - m_infoBar->height()); + // Ensure we delete our old view immediately so it can relinquish its backing ViewportContext if (m_maximizedView) - m_maximizedView->deleteLater(); + { + delete m_maximizedView; + } m_maximizedView = new CLayoutViewPane(this); m_maximizedView->SetId(0); diff --git a/Code/Sandbox/Editor/QtViewPaneManager.cpp b/Code/Sandbox/Editor/QtViewPaneManager.cpp index ad33eecfee..b242f3d914 100644 --- a/Code/Sandbox/Editor/QtViewPaneManager.cpp +++ b/Code/Sandbox/Editor/QtViewPaneManager.cpp @@ -36,6 +36,8 @@ #include #include +#include + #include #include #include @@ -983,6 +985,11 @@ bool QtViewPaneManager::ClosePanesWithRollback(const QVector& panesToKe */ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings) { + // Get whether the prefab system is enabled + bool isPrefabSystemEnabled = false; + AzFramework::ApplicationRequests::Bus::BroadcastResult( + isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled); + if (resetSettings) { // We're going to do something destructive (removing all of the viewpane settings). Better confirm with the user @@ -1022,7 +1029,11 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings) state.viewPanes.push_back(LyViewPane::EntityInspector); state.viewPanes.push_back(LyViewPane::AssetBrowser); state.viewPanes.push_back(LyViewPane::Console); - state.viewPanes.push_back(LyViewPane::LevelInspector); + + if (!isPrefabSystemEnabled) + { + state.viewPanes.push_back(LyViewPane::LevelInspector); + } state.mainWindowState = m_defaultMainWindowState; @@ -1047,7 +1058,12 @@ void QtViewPaneManager::RestoreDefaultLayout(bool resetSettings) const QtViewPane* assetBrowserViewPane = OpenPane(LyViewPane::AssetBrowser, QtViewPane::OpenMode::UseDefaultState); const QtViewPane* entityInspectorViewPane = OpenPane(LyViewPane::EntityInspector, QtViewPane::OpenMode::UseDefaultState); const QtViewPane* consoleViewPane = OpenPane(LyViewPane::Console, QtViewPane::OpenMode::UseDefaultState); - const QtViewPane* levelInspectorPane = OpenPane(LyViewPane::LevelInspector, QtViewPane::OpenMode::UseDefaultState); + + const QtViewPane* levelInspectorPane = nullptr; + if (!isPrefabSystemEnabled) + { + levelInspectorPane = OpenPane(LyViewPane::LevelInspector, QtViewPane::OpenMode::UseDefaultState); + } // This class does all kinds of behind the scenes magic to make docking / restore work, especially with groups // so instead of doing our special default layout attach / docking right now, we want to make it happen diff --git a/Code/Sandbox/Editor/ViewportManipulatorController.cpp b/Code/Sandbox/Editor/ViewportManipulatorController.cpp index 910d037670..8ce2ea1cd9 100644 --- a/Code/Sandbox/Editor/ViewportManipulatorController.cpp +++ b/Code/Sandbox/Editor/ViewportManipulatorController.cpp @@ -95,6 +95,11 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram AZStd::optional overrideButton; AZStd::optional eventType; + // Because we receive events multiple times at separate priorities for manipulator events and + // viewport interaction events, we want to avoid updating our "last tick state" until we're on our last event, + // which currently is the low priority Interaction processor. + const bool finishedProcessingEvents = event.m_priority == InteractionPriority; + if (IsMouseMove(event.m_inputChannel)) { // Cache the ray trace results when doing manipulator interaction checks, no need to recalculate after @@ -120,10 +125,11 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram } else if (auto mouseButton = GetMouseButton(event.m_inputChannel); mouseButton != MouseButton::None) { + const AZ::u32 mouseButtonValue = static_cast(mouseButton); overrideButton = mouseButton; if (event.m_inputChannel.GetState() == InputChannel::State::Began) { - m_state.m_mouseButtons.m_mouseButtons |= static_cast(mouseButton); + m_state.m_mouseButtons.m_mouseButtons |= mouseButtonValue; if (IsDoubleClick(mouseButton)) { // Only remove the double click flag once we're done processing both Manipulator and Interaction events @@ -135,8 +141,8 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram } else { - // Only insert the double click timing once we're done processing both Manipulator and Interaction events, to avoid a false IsDoubleClick positive - if (event.m_priority == InteractionPriority) + // Only insert the double click timing once we're done processing events, to avoid a false IsDoubleClick positive + if (finishedProcessingEvents) { m_pendingDoubleClicks[mouseButton] = m_curTime; } @@ -145,8 +151,18 @@ bool ViewportManipulatorControllerInstance::HandleInputChannelEvent(const AzFram } else if (event.m_inputChannel.GetState() == InputChannel::State::Ended) { - m_state.m_mouseButtons.m_mouseButtons &= ~static_cast(mouseButton); - eventType = MouseEvent::Up; + // If we've actually logged a mouse down event, forward a mouse up event. + // This prevents corner cases like the context menu thinking it should be opened even though no one clicked in this viewport, + // due to RenderViewportWidget ensuring all controllers get InputChannel::State::Ended events. + if (m_state.m_mouseButtons.m_mouseButtons & mouseButtonValue) + { + // Erase the button from our state if we're done processing events. + if (event.m_priority == InteractionPriority) + { + m_state.m_mouseButtons.m_mouseButtons &= ~mouseButtonValue; + } + eventType = MouseEvent::Up; + } } } else if (auto keyboardModifier = GetKeyboardModifier(event.m_inputChannel); keyboardModifier != KeyboardModifier::None) diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin.cpp b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin.cpp index 17face523b..e5ad2a2872 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin.cpp +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin.cpp @@ -143,15 +143,6 @@ ComponentEntityEditorPlugin::ComponentEntityEditorPlugin([[maybe_unused]] IEdito LyViewPane::CategoryTools, pinnedInspectorOptions); - ViewPaneOptions levelInspectorOptions; - levelInspectorOptions.canHaveMultipleInstances = false; - levelInspectorOptions.preferedDockingArea = Qt::RightDockWidgetArea; - levelInspectorOptions.paneRect = QRect(50, 50, 400, 700); - RegisterViewPane( - LyViewPane::LevelInspector, - LyViewPane::CategoryTools, - levelInspectorOptions); - bool prefabSystemEnabled = false; AzFramework::ApplicationRequests::Bus::BroadcastResult(prefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled); @@ -170,8 +161,14 @@ ComponentEntityEditorPlugin::ComponentEntityEditorPlugin([[maybe_unused]] IEdito } else { - // Add the Legacy Outliner to the Tools Menu + ViewPaneOptions levelInspectorOptions; + levelInspectorOptions.canHaveMultipleInstances = false; + levelInspectorOptions.preferedDockingArea = Qt::RightDockWidgetArea; + levelInspectorOptions.paneRect = QRect(50, 50, 400, 700); + RegisterViewPane( + LyViewPane::LevelInspector, LyViewPane::CategoryTools, levelInspectorOptions); + // Add the Legacy Outliner to the Tools Menu ViewPaneOptions outlinerOptions; outlinerOptions.canHaveMultipleInstances = true; outlinerOptions.preferedDockingArea = Qt::LeftDockWidgetArea; diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/BuilderSettings/BuilderSettingManager.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/BuilderSettings/BuilderSettingManager.cpp index e30fb9c6a2..3b6c906c10 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/BuilderSettings/BuilderSettingManager.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/BuilderSettings/BuilderSettingManager.cpp @@ -524,6 +524,10 @@ namespace ImageProcessingAtom { return outPreset; } + else + { + AZ_Warning("Image Processing", false, "Image dimensions are not compatible with preset '%s'. The default preset will be used.", presetInfo->m_name.c_str()); + } } //uncompressed one which could be used for almost everything diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp index 4de024c088..5d5fd21b44 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageBuilderComponent.cpp @@ -79,7 +79,7 @@ namespace ImageProcessingAtom builderDescriptor.m_busId = azrtti_typeid(); builderDescriptor.m_createJobFunction = AZStd::bind(&ImageBuilderWorker::CreateJobs, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2); builderDescriptor.m_processJobFunction = AZStd::bind(&ImageBuilderWorker::ProcessJob, &m_imageBuilder, AZStd::placeholders::_1, AZStd::placeholders::_2); - builderDescriptor.m_version = 19; // [ATOM-14459] + builderDescriptor.m_version = 22; // [ATOM-14765] builderDescriptor.m_analysisFingerprint = ImageProcessingAtom::BuilderSettingManager::Instance()->GetAnalysisFingerprint(); m_imageBuilder.BusConnect(builderDescriptor.m_busId); AssetBuilderSDK::AssetBuilderBus::Broadcast(&AssetBuilderSDK::AssetBuilderBusTraits::RegisterBuilderInformation, builderDescriptor); diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/Albedo.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/Albedo.preset index d81fefede2..c00185e255 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/Albedo.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/Albedo.preset @@ -11,6 +11,7 @@ "_basecolor", "_diff", "_color", + "_col", "_albedo", "_alb", "_bc", @@ -31,6 +32,7 @@ "FileMasks": [ "_diff", "_color", + "_col", "_albedo", "_alb", "_basecolor", @@ -51,6 +53,7 @@ "FileMasks": [ "_diff", "_color", + "_col", "_albedo", "_alb", "_basecolor", @@ -71,6 +74,7 @@ "FileMasks": [ "_diff", "_color", + "_col", "_albedo", "_alb", "_basecolor", @@ -91,6 +95,7 @@ "FileMasks": [ "_diff", "_color", + "_col", "_albedo", "_alb", "_basecolor", diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/AmbientOcclusion.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/AmbientOcclusion.preset index 222a1d4c7b..6b1197e28d 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/AmbientOcclusion.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/AmbientOcclusion.preset @@ -9,7 +9,10 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ao" + "_ao", + "_ambocc", + "_amb", + "_ambientocclusion" ], "PixelFormat": "BC4" }, @@ -33,7 +36,10 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ao" + "_ao", + "_ambocc", + "_amb", + "_ambientocclusion" ], "PixelFormat": "EAC_R11" }, @@ -43,7 +49,10 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ao" + "_ao", + "_ambocc", + "_amb", + "_ambientocclusion" ], "PixelFormat": "BC4" }, @@ -53,7 +62,10 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ao" + "_ao", + "_ambocc", + "_amb", + "_ambientocclusion" ], "PixelFormat": "BC4" } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/Displacement.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/Displacement.preset index 1cac9c1d3a..569ff6ce23 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/Displacement.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/Displacement.preset @@ -9,12 +9,20 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_displ" + "_displ", + "_disp", + "_dsp", + "_d", + "_dm", + "_displacement", + "_height", + "_hm", + "_ht", + "_h" ], "PixelFormat": "BC4", "DiscardAlpha": true, "IsPowerOf2": true, - "Swizzle": "aaa1", "MipMapSetting": { "MipGenType": "Box" } @@ -26,13 +34,21 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_displ" + "_displ", + "_disp", + "_dsp", + "_d", + "_dm", + "_displacement", + "_height", + "_hm", + "_ht", + "_h" ], "PixelFormat": "EAC_R11", "DiscardAlpha": true, "IsPowerOf2": true, "SizeReduceLevel": 3, - "Swizzle": "aaa1", "MipMapSetting": { "MipGenType": "Box" } @@ -57,7 +73,6 @@ "PixelFormat": "EAC_R11", "DiscardAlpha": true, "IsPowerOf2": true, - "Swizzle": "aaa1", "MipMapSetting": { "MipGenType": "Box" } @@ -68,12 +83,20 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_displ" + "_displ", + "_disp", + "_dsp", + "_d", + "_dm", + "_displacement", + "_height", + "_hm", + "_ht", + "_h" ], "PixelFormat": "BC4", "DiscardAlpha": true, "IsPowerOf2": true, - "Swizzle": "aaa1", "MipMapSetting": { "MipGenType": "Box" } @@ -84,12 +107,20 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_displ" + "_displ", + "_disp", + "_dsp", + "_d", + "_dm", + "_displacement", + "_height", + "_hm", + "_ht", + "_h" ], "PixelFormat": "BC4", "DiscardAlpha": true, "IsPowerOf2": true, - "Swizzle": "aaa1", "MipMapSetting": { "MipGenType": "Box" } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/Emissive.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/Emissive.preset index d3290eb469..5dc75397a0 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/Emissive.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/Emissive.preset @@ -8,7 +8,11 @@ "Name": "Emissive", "RGB_Weight": "CIEXYZ", "FileMasks": [ - "_emissive" + "_emissive", + "_e", + "_glow", + "_em", + "_emit" ], "PixelFormat": "BC7", "DiscardAlpha": true @@ -33,7 +37,11 @@ "Name": "Emissive", "RGB_Weight": "CIEXYZ", "FileMasks": [ - "_emissive" + "_emissive", + "_e", + "_glow", + "_em", + "_emit" ], "PixelFormat": "ASTC_6x6", "DiscardAlpha": true @@ -43,7 +51,11 @@ "Name": "Emissive", "RGB_Weight": "CIEXYZ", "FileMasks": [ - "_emissive" + "_emissive", + "_e", + "_glow", + "_em", + "_emit" ], "PixelFormat": "BC7", "DiscardAlpha": true @@ -53,7 +65,11 @@ "Name": "Emissive", "RGB_Weight": "CIEXYZ", "FileMasks": [ - "_emissive" + "_emissive", + "_e", + "_glow", + "_em", + "_emit" ], "PixelFormat": "BC7", "DiscardAlpha": true diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/IBLSkybox.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/IBLSkybox.preset index 867fc73959..fef756e354 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/IBLSkybox.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/IBLSkybox.preset @@ -27,7 +27,7 @@ }, "PlatformsPresets": { "es3": { - "UUID": "{E6441EAC-9843-484B-8EFC-C03B2935B48D}", + "UUID": "{E6441EAC-9843-484B-8EFC-C03B2935B48D}", "Name": "IBLSkybox", "FileMasks": [ "_iblskyboxcm" @@ -61,7 +61,7 @@ "MinTextureSize": 256, "IsPowerOf2": true, "CubemapSettings": { - "RequiresConvolve": false, + "RequiresConvolve": false, "GenerateIBLSpecular": true, "IBLSpecularPreset": "{908DA68C-97FB-4C4A-97BC-5A55F30F14FA}", "GenerateIBLDiffuse": true, @@ -69,7 +69,7 @@ } }, "osx_gl": { - "UUID": "{E6441EAC-9843-484B-8EFC-C03B2935B48D}", + "UUID": "{E6441EAC-9843-484B-8EFC-C03B2935B48D}", "Name": "IBLSkybox", "FileMasks": [ "_iblskyboxcm" diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/LayerMask.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/LayerMask.preset index 363a6f9f9d..66927b175c 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/LayerMask.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/LayerMask.preset @@ -9,7 +9,8 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_layers" + "_layers", + "_rgbmask" ], "PixelFormat": "R8G8B8X8" }, @@ -20,7 +21,8 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_layers" + "_layers", + "_rgbmask" ], "PixelFormat": "R8G8B8X8" }, @@ -30,7 +32,8 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_layers" + "_layers", + "_rgbmask" ], "PixelFormat": "R8G8B8X8" }, @@ -40,7 +43,8 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_layers" + "_layers", + "_rgbmask" ], "PixelFormat": "R8G8B8X8" }, @@ -50,7 +54,8 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_layers" + "_layers", + "_rgbmask" ], "PixelFormat": "R8G8B8X8" } diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/NormalsWithSmoothness.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/NormalsWithSmoothness.preset index fb8b1da6a4..2c61d6f5a6 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/NormalsWithSmoothness.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/NormalsWithSmoothness.preset @@ -9,7 +9,11 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ddna" + "_ddna", + "_normala", + "_nrma", + "_nma", + "_na" ], "PixelFormat": "BC5s", "PixelFormatAlpha": "BC4", @@ -48,7 +52,11 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ddna" + "_ddna", + "_normala", + "_nrma", + "_nma", + "_na" ], "PixelFormat": "ASTC_4x4", "PixelFormatAlpha": "ASTC_4x4", @@ -65,7 +73,11 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ddna" + "_ddna", + "_normala", + "_nrma", + "_nma", + "_na" ], "PixelFormat": "BC5s", "PixelFormatAlpha": "BC4", @@ -82,7 +94,11 @@ "SourceColor": "Linear", "DestColor": "Linear", "FileMasks": [ - "_ddna" + "_ddna", + "_normala", + "_nrma", + "_nma", + "_na" ], "PixelFormat": "BC5s", "PixelFormatAlpha": "BC4", diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/Opacity.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/Opacity.preset index bd9299d71d..79fb235508 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/Opacity.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/Opacity.preset @@ -11,7 +11,14 @@ "FileMasks": [ "_sss", "_trans", - "_opac" + "_opac", + "_opacity", + "_o", + "_opac", + "_op", + "_mask", + "_msk", + "_blend" ], "PixelFormat": "BC4", "IsPowerOf2": true, @@ -28,7 +35,14 @@ "FileMasks": [ "_sss", "_trans", - "_opac" + "_opac", + "_opacity", + "_o", + "_opac", + "_op", + "_mask", + "_msk", + "_blend" ], "PixelFormat": "EAC_R11", "IsPowerOf2": true, @@ -67,7 +81,14 @@ "FileMasks": [ "_sss", "_trans", - "_opac" + "_opac", + "_opacity", + "_o", + "_opac", + "_op", + "_mask", + "_msk", + "_blend" ], "PixelFormat": "BC4", "IsPowerOf2": true, @@ -83,7 +104,14 @@ "FileMasks": [ "_sss", "_trans", - "_opac" + "_opac", + "_opacity", + "_o", + "_opac", + "_op", + "_mask", + "_msk", + "_blend" ], "PixelFormat": "BC4", "IsPowerOf2": true, diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Config/Reflectance.preset b/Gems/Atom/Asset/ImageProcessingAtom/Config/Reflectance.preset index ca773debbb..7a6af50728 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Config/Reflectance.preset +++ b/Gems/Atom/Asset/ImageProcessingAtom/Config/Reflectance.preset @@ -24,7 +24,8 @@ "_mt", "_metalness", "_metallic", - "_roughness" + "_roughness", + "_rough" ], "PixelFormat": "BC1", "IsPowerOf2": true, @@ -53,7 +54,8 @@ "_mt", "_metalness", "_metallic", - "_roughness" + "_roughness", + "_rough" ], "PixelFormat": "ETC2", "IsPowerOf2": true, @@ -81,7 +83,8 @@ "_mt", "_metalness", "_metallic", - "_roughness" + "_roughness", + "_rough" ], "PixelFormat": "ASTC_6x6", "IsPowerOf2": true, @@ -109,7 +112,8 @@ "_mt", "_metalness", "_metallic", - "_roughness" + "_roughness", + "_rough" ], "PixelFormat": "BC1", "IsPowerOf2": true, @@ -137,7 +141,8 @@ "_mt", "_metalness", "_metallic", - "_roughness" + "_roughness", + "_rough" ], "PixelFormat": "BC1", "IsPowerOf2": true, diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyValue.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyValue.h index cafd31d8a5..758afb1c66 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyValue.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Material/MaterialPropertyValue.h @@ -65,6 +65,7 @@ namespace AZ MaterialPropertyValue(const Vector4& value) : m_value(value) {} MaterialPropertyValue(const Color& value) : m_value(value) {} MaterialPropertyValue(const Data::Asset& value) : m_value(value) {} + MaterialPropertyValue(const Data::Instance& value) : m_value(value) {} MaterialPropertyValue(const AZStd::string& value) : m_value(value) {} //! Copy constructor diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material index c013eecae5..e84c6296be 100644 --- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material +++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/001_ManyFeatures.material @@ -7,7 +7,7 @@ "layer1_ambientOcclusion": { "enable": true, "factor": 1.6399999856948853, - "textureMap": "TestData/Textures/cc0/bark1disp2.jpg" + "textureMap": "TestData/Textures/cc0/bark1_disp.jpg" }, "layer1_baseColor": { "color": [ @@ -16,7 +16,7 @@ 0.12039368599653244, 1.0 ], - "textureMap": "TestData/Textures/cc0/bark1col.jpg" + "textureMap": "TestData/Textures/cc0/bark1_col.jpg" }, "layer1_emissive": { "color": [ @@ -30,16 +30,16 @@ "layer1_normal": { "factor": 0.4444443881511688, "flipY": true, - "textureMap": "TestData/Textures/cc0/bark1norm.jpg" + "textureMap": "TestData/Textures/cc0/bark1_norm.jpg" }, "layer1_parallax": { "enable": true, "factor": 0.02500000037252903, - "textureMap": "TestData/Textures/cc0/bark1disp2.jpg" + "textureMap": "TestData/Textures/cc0/bark1_disp.jpg" }, "layer1_roughness": { "lowerBound": 0.010100999847054482, - "textureMap": "TestData/Textures/cc0/bark1roughness.jpg" + "textureMap": "TestData/Textures/cc0/bark1_roughness.jpg" }, "layer1_specularF0": { "factor": 0.5099999904632568, @@ -55,7 +55,7 @@ }, "layer2_ambientOcclusion": { "factor": 1.2200000286102296, - "textureMap": "TestData/Textures/cc0/bark1disp2.jpg" + "textureMap": "TestData/Textures/cc0/bark1_disp.jpg" }, "layer2_baseColor": { "textureMap": "TestData/Textures/cc0/Lava004_1K_Color.jpg" diff --git a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material index 471b437bd2..126e1a7fcb 100644 --- a/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material +++ b/Gems/Atom/TestData/TestData/Materials/StandardMultilayerPbrTestCases/002_ParallaxPdo.material @@ -5,18 +5,18 @@ "propertyLayoutVersion": 3, "properties": { "layer1_baseColor": { - "textureMap": "TestData/Textures/cc0/bark1col.jpg" + "textureMap": "TestData/Textures/cc0/bark1_col.jpg" }, "layer1_normal": { - "textureMap": "TestData/Textures/cc0/bark1norm.jpg" + "textureMap": "TestData/Textures/cc0/bark1_norm.jpg" }, "layer1_parallax": { "enable": true, "factor": 0.03999999910593033, - "textureMap": "TestData/Textures/cc0/bark1disp2.jpg" + "textureMap": "TestData/Textures/cc0/bark1_disp.jpg" }, "layer1_roughness": { - "textureMap": "TestData/Textures/cc0/bark1roughness.jpg" + "textureMap": "TestData/Textures/cc0/bark1_roughness.jpg" }, "layer2_baseColor": { "textureMap": "TestData/Textures/cc0/Rock030_2K_Color.jpg" diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1_col.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_col.jpg new file mode 100644 index 0000000000..0a4c5f380c --- /dev/null +++ b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_col.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd44119610135ca5674de7144647df6580d7ac3e03576e9a8e87e741548e7364 +size 2105853 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1_disp.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_disp.jpg new file mode 100644 index 0000000000..57c74af488 --- /dev/null +++ b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_disp.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4dbb74aac2450d6457bb02d36bd3d74e671c2dc7e938e090331151ecc52d545b +size 845683 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1_norm.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_norm.jpg new file mode 100644 index 0000000000..41b1d6d30b --- /dev/null +++ b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_norm.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e69a3844c3a595245619a9dda4ed8981476a516ad3648a8b4dfb8151a68b0db5 +size 4439966 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1_roughness.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_roughness.jpg new file mode 100644 index 0000000000..2e7ccba4e0 --- /dev/null +++ b/Gems/Atom/TestData/TestData/Textures/cc0/bark1_roughness.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8caa5961599624a6414d7277c389dd85b175b9587989b815ffd90aff8f62b6c +size 1747230 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1col.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1col.jpg deleted file mode 100644 index 944a968d5b..0000000000 --- a/Gems/Atom/TestData/TestData/Textures/cc0/bark1col.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:24f5c234f11a1b29de9000b5a7ba74262f1bc5ebd2227ca1e85a12fa0e8b5237 -size 8273450 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1disp.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1disp.jpg deleted file mode 100644 index c8a2a44e9b..0000000000 --- a/Gems/Atom/TestData/TestData/Textures/cc0/bark1disp.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0112ac235da74c60105b0e1a2da49c1e4ab7b89a60960a60cec54ad65db0b4b6 -size 4585685 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1disp2.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1disp2.jpg deleted file mode 100644 index f93d68141b..0000000000 --- a/Gems/Atom/TestData/TestData/Textures/cc0/bark1disp2.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6a202449e5d787e76d959b6bee7a4b60b3821441ac918944c21358742ed1c546 -size 878112 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1norm.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1norm.jpg deleted file mode 100644 index f68ed8b696..0000000000 --- a/Gems/Atom/TestData/TestData/Textures/cc0/bark1norm.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b0100b3c356d76ae1cb4c42bd4cc9c58ff359155aab6b9e3c1b205fe25956738 -size 16848020 diff --git a/Gems/Atom/TestData/TestData/Textures/cc0/bark1roughness.jpg b/Gems/Atom/TestData/TestData/Textures/cc0/bark1roughness.jpg deleted file mode 100644 index f6e7acd7b6..0000000000 --- a/Gems/Atom/TestData/TestData/Textures/cc0/bark1roughness.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:11badf07e6a7d0501c915f669ff1b14c8744d427d47d06e2fdca46b8f86839c9 -size 4441528 diff --git a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp index e08a5a045c..bf46ece27b 100644 --- a/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp +++ b/Gems/Atom/Tools/AtomToolsFramework/Code/Source/Viewport/RenderViewportWidget.cpp @@ -164,6 +164,8 @@ namespace AtomToolsFramework bool RenderViewportWidget::OnInputChannelEventFiltered(const AzFramework::InputChannel& inputChannel) { + bool shouldConsumeEvent = true; + // Grab keyboard focus if we've been clicked on. // Qt normally handles this for us, but we're filtering native events before they get // synthesized into QMouseEvents. @@ -175,9 +177,18 @@ namespace AtomToolsFramework // Don't consume new input events if we don't currently have focus. // We do forward Ended events, as they may be relevant to our current state // (e.g. a key gets released after we lose focus, it shouldn't remain "stuck"). - if (!hasFocus() && inputChannel.GetState() != AzFramework::InputChannel::State::Ended) + if (!hasFocus()) { - return false; + if (inputChannel.GetState() == AzFramework::InputChannel::State::Ended) + { + // Forward the input ended event to our controllers, but don't prevent other viewports from receiving it. + shouldConsumeEvent = false; + } + else + { + // Not an event we should listen to, abort. + return false; + } } // If we receive a mouse button event from outside of our viewport, ignore it even if we have focus. @@ -196,7 +207,9 @@ namespace AtomToolsFramework } AzFramework::NativeWindowHandle windowId = reinterpret_cast(winId()); - return m_controllerList->HandleInputChannelEvent({GetId(), windowId, inputChannel}); + const bool eventHandled = m_controllerList->HandleInputChannelEvent({GetId(), windowId, inputChannel}); + // If our controllers handled the event and it's one we can safely consume (i.e. it's not an Ended event that other viewports might need), consume it. + return eventHandled && shouldConsumeEvent; } void RenderViewportWidget::OnTick([[maybe_unused]]float deltaTime, AZ::ScriptTimePoint time) diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FFont.h b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FFont.h index 96f5e09fc3..8e60cc2055 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FFont.h +++ b/Gems/AtomLyIntegration/AtomFont/Code/Include/AtomLyIntegration/AtomFont/FFont.h @@ -277,11 +277,11 @@ namespace AZ void ScaleCoord(const RHI::Viewport& viewport, float& x, float& y) const; - void InitDefaultWindowContext(); - void InitDefaultViewportContext(); - void OnBootstrapSceneReady(AZ::RPI::Scene* bootstrapScene) override; + RPI::WindowContextSharedPtr GetDefaultWindowContext() const; + RPI::ViewportContextPtr GetDefaultViewportContext() const; + private: static constexpr uint32_t NumBuffers = 2; static constexpr float WindowScaleWidth = 800.0f; @@ -294,9 +294,6 @@ namespace AZ size_t m_fontBufferSize = 0; unsigned char* m_fontBuffer = nullptr; - AZStd::shared_ptr m_defaultWindowContext; - AZStd::shared_ptr m_defaultViewportContext; - AZ::Data::Instance m_fontStreamingImage; AZ::RHI::Ptr m_fontImage; uint32_t m_fontImageVersion = 0; @@ -304,7 +301,13 @@ namespace AZ AtomFont* m_atomFont = nullptr; bool m_fontTexDirty = false; - bool m_fontInitialized = false; + enum class InitializationState : AZ::u8 + { + Uninitialized, + Initializing, + Initialized + }; + AZStd::atomic m_fontInitializationState = InitializationState::Uninitialized; FontEffects m_effects; @@ -345,26 +348,4 @@ namespace AZ } } -inline void AZ::FFont::InitDefaultWindowContext() -{ - if (!m_defaultWindowContext) - { - // font is created before window & viewport in the editor so need to do late init - // TODO need to deal with multiple windows, such as the editor - AZ::Render::Bootstrap::DefaultWindowBus::BroadcastResult(m_defaultWindowContext, &AZ::Render::Bootstrap::DefaultWindowInterface::GetDefaultWindowContext); - AZ_Assert(m_defaultWindowContext, "Unable to get the main window context"); - } -} - -inline void AZ::FFont::InitDefaultViewportContext() -{ - if (!m_defaultViewportContext) - { - // font is created before window & viewport in the editor so need to do late init - auto viewContextManager = AZ::Interface::Get(); - m_defaultViewportContext = viewContextManager->GetViewportContextByName(viewContextManager->GetDefaultViewportContextName()); - AZ_Assert(m_defaultViewportContext, "Unable to get the viewport context"); - } -} - #endif diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp index d32302a07b..20879876e7 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FFont.cpp @@ -84,19 +84,35 @@ AZ::FFont::FFont(AtomFont* atomFont, const char* fontName) AZ::Render::Bootstrap::NotificationBus::Handler::BusConnect(); } +AZ::RPI::ViewportContextPtr AZ::FFont::GetDefaultViewportContext() const +{ + auto viewContextManager = AZ::Interface::Get(); + return viewContextManager->GetDefaultViewportContext(); +} + +AZ::RPI::WindowContextSharedPtr AZ::FFont::GetDefaultWindowContext() const +{ + if (auto defaultViewportContext = GetDefaultViewportContext()) + { + return defaultViewportContext->GetWindowContext(); + } + return {}; +} bool AZ::FFont::InitFont() { - if (m_fontInitialized) + auto initializationState = InitializationState::Uninitialized; + // Do an atomic transition to Initializing if we're in the Uninitialized state. + // Otherwise, check the current state. + // If we're Initialized, there's no more work to be done, return true to indicate we're good to go. + // If we're Initializing (on another thread), return false to let the consumer know it's not safe for us to be used yet. + if (!m_fontInitializationState.compare_exchange_strong(initializationState, InitializationState::Initializing)) { - return true; + return initializationState == InitializationState::Initialized; } - InitDefaultWindowContext(); - InitDefaultViewportContext(); - // Create and initialize DynamicDrawContext for font draw - AZ::RPI::Ptr dynamicDraw = m_atomFont->GetOrCreateDynamicDrawForScene(m_defaultViewportContext->GetRenderScene().get()); + AZ::RPI::Ptr dynamicDraw = m_atomFont->GetOrCreateDynamicDrawForScene(GetDefaultViewportContext()->GetRenderScene().get()); // Save draw srg input indices for later use Data::Instance drawSrg = dynamicDraw->NewDrawSrg(); @@ -117,7 +133,7 @@ bool AZ::FFont::InitFont() m_vertexCount = 0; m_indexCount = 0; - m_fontInitialized = true; + m_fontInitializationState = InitializationState::Initialized; return true; } @@ -259,7 +275,7 @@ void AZ::FFont::DrawString(float x, float y, const char* str, const bool asciiMu return; } - DrawStringUInternal(m_defaultWindowContext->GetViewport(), m_defaultViewportContext.get(), x, y, 1.0f, str, asciiMultiLine, ctx); + DrawStringUInternal(GetDefaultWindowContext()->GetViewport(), GetDefaultViewportContext().get(), x, y, 1.0f, str, asciiMultiLine, ctx); } void AZ::FFont::DrawString(float x, float y, float z, const char* str, const bool asciiMultiLine, const TextDrawContext& ctx) @@ -269,7 +285,7 @@ void AZ::FFont::DrawString(float x, float y, float z, const char* str, const boo return; } - DrawStringUInternal(m_defaultWindowContext->GetViewport(), m_defaultViewportContext.get(), x, y, z, str, asciiMultiLine, ctx); + DrawStringUInternal(GetDefaultWindowContext()->GetViewport(), GetDefaultViewportContext().get(), x, y, z, str, asciiMultiLine, ctx); } void AZ::FFont::DrawStringUInternal( @@ -282,6 +298,12 @@ void AZ::FFont::DrawStringUInternal( const bool asciiMultiLine, const TextDrawContext& ctx) { + // Lazily ensure we're initialized before attempting to render. + if (!InitFont()) + { + return; + } + if (!str || !m_vertexBuffer // vertex buffer isn't created until BootstrapScene is ready, Editor tries to render text before that. || !m_fontTexture @@ -400,7 +422,7 @@ Vec2 AZ::FFont::GetTextSize(const char* str, const bool asciiMultiLine, const Te return Vec2(0.0f, 0.0f); } - return GetTextSizeUInternal(m_defaultWindowContext->GetViewport(), str, asciiMultiLine, ctx); + return GetTextSizeUInternal(GetDefaultWindowContext()->GetViewport(), str, asciiMultiLine, ctx); } Vec2 AZ::FFont::GetTextSizeUInternal( @@ -746,7 +768,7 @@ uint32_t AZ::FFont::WriteTextQuadsToBuffers(SVF_P2F_C4B_T2F_F4B* verts, uint16_t return true; }; - CreateQuadsForText(m_defaultWindowContext->GetViewport(), x, y, z, str, asciiMultiLine, ctx, AddQuad); + CreateQuadsForText(GetDefaultWindowContext()->GetViewport(), x, y, z, str, asciiMultiLine, ctx, AddQuad); return numQuadsWritten; } @@ -1438,7 +1460,7 @@ void AZ::FFont::AddCharsToFontTexture(const char* chars, int glyphSizeX, int gly Vec2 AZ::FFont::GetKerning(uint32_t leftGlyph, uint32_t rightGlyph, const TextDrawContext& ctx) const { - return GetKerningInternal(m_defaultWindowContext->GetViewport(), leftGlyph, rightGlyph, ctx); + return GetKerningInternal(GetDefaultWindowContext()->GetViewport(), leftGlyph, rightGlyph, ctx); } Vec2 AZ::FFont::GetKerningInternal(const RHI::Viewport& viewport, uint32_t leftGlyph, uint32_t rightGlyph, const TextDrawContext& ctx) const @@ -1454,7 +1476,7 @@ float AZ::FFont::GetAscender(const TextDrawContext& ctx) const float AZ::FFont::GetBaseline(const TextDrawContext& ctx) const { - return GetBaselineInternal(m_defaultWindowContext->GetViewport(), ctx); + return GetBaselineInternal(GetDefaultWindowContext()->GetViewport(), ctx); } float AZ::FFont::GetBaselineInternal(const RHI::Viewport& viewport, const TextDrawContext& ctx) const @@ -1496,7 +1518,7 @@ bool AZ::FFont::UpdateTexture() { using namespace AZ; - if (!m_fontInitialized || !m_fontImage) + if (m_fontInitializationState != InitializationState::Initialized || !m_fontImage) { return false; } @@ -1564,7 +1586,7 @@ void AZ::FFont::Prepare(const char* str, bool updateTexture, const AtomFont::Gly const bool rerenderGlyphs = m_sizeBehavior == SizeBehavior::Rerender; const AtomFont::GlyphSize usedGlyphSize = rerenderGlyphs ? glyphSize : AtomFont::defaultGlyphSize; bool texUpdateNeeded = m_fontTexture->PreCacheString(str, nullptr, m_sizeRatio, usedGlyphSize, m_fontHintParams) == 1 || m_fontTexDirty; - if (m_fontInitialized && updateTexture && texUpdateNeeded && m_fontImage) + if (m_fontInitializationState == InitializationState::Initialized && updateTexture && texUpdateNeeded && m_fontImage) { UpdateTexture(); m_fontTexDirty = false; diff --git a/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.cpp b/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.cpp index 2595fc09fd..7b76a1465c 100644 --- a/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.cpp +++ b/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.cpp @@ -148,6 +148,7 @@ namespace LmbrCentral ->Event("GetCurrentEntitiesFromSpawnedSlice", &SpawnerComponentRequestBus::Events::GetCurrentEntitiesFromSpawnedSlice) ->Event("GetAllCurrentlySpawnedEntities", &SpawnerComponentRequestBus::Events::GetAllCurrentlySpawnedEntities) ->Event("SetDynamicSlice", &SpawnerComponentRequestBus::Events::SetDynamicSliceByAssetId) + ->Event("IsReadyToSpawn", &SpawnerComponentRequestBus::Events::IsReadyToSpawn) ; behaviorContext->EBus("SpawnerComponentNotificationBus") @@ -250,17 +251,15 @@ namespace LmbrCentral //========================================================================= void SpawnerComponent::SetDynamicSliceByAssetId(AZ::Data::AssetId& assetId) { - auto sliceAsset = AZ::Data::AssetManager::Instance().GetAsset(assetId, AZ::AzTypeInfo::Uuid(), m_sliceAsset.GetAutoLoadBehavior()); + if (m_sliceAsset.GetId() == assetId) + { + return; + } - if (sliceAsset.IsReady()) - { - m_sliceAsset = sliceAsset; - } - else - { - AZ::Data::AssetBus::Handler::BusDisconnect(); - AZ::Data::AssetBus::Handler::BusConnect(assetId); - } + m_sliceAsset = AZ::Data::AssetManager::Instance().GetAsset( + assetId, AZ::AzTypeInfo::Uuid(), m_sliceAsset.GetAutoLoadBehavior()); + AZ::Data::AssetBus::Handler::BusDisconnect(); + AZ::Data::AssetBus::Handler::BusConnect(assetId); } //========================================================================= @@ -444,6 +443,12 @@ namespace LmbrCentral return entities; } + //========================================================================= + bool SpawnerComponent::IsReadyToSpawn() + { + return m_sliceAsset.IsReady(); + } + //========================================================================= void SpawnerComponent::OnSlicePreInstantiate(const AZ::Data::AssetId& /*sliceAssetId*/, [[maybe_unused]] const AZ::SliceComponent::SliceInstanceAddress& sliceAddress) { diff --git a/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.h b/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.h index 3dee332df3..75f5db8df2 100644 --- a/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.h +++ b/Gems/LmbrCentral/Code/Source/Scripting/SpawnerComponent.h @@ -70,7 +70,8 @@ namespace LmbrCentral AZStd::vector GetCurrentlySpawnedSlices() override; bool HasAnyCurrentlySpawnedSlices() override; AZStd::vector GetCurrentEntitiesFromSpawnedSlice(const AzFramework::SliceInstantiationTicket& ticket) override; - AZStd::vector GetAllCurrentlySpawnedEntities(); + AZStd::vector GetAllCurrentlySpawnedEntities() override; + bool IsReadyToSpawn() override; ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/Gems/LmbrCentral/Code/include/LmbrCentral/Scripting/SpawnerComponentBus.h b/Gems/LmbrCentral/Code/include/LmbrCentral/Scripting/SpawnerComponentBus.h index 6122a747f3..92ca003300 100644 --- a/Gems/LmbrCentral/Code/include/LmbrCentral/Scripting/SpawnerComponentBus.h +++ b/Gems/LmbrCentral/Code/include/LmbrCentral/Scripting/SpawnerComponentBus.h @@ -91,6 +91,9 @@ namespace LmbrCentral //! Note that spawning is not instant, if a slice hasn't finished spawning then none of its entities are returned. //! If an entity has been destroyed since it was spawned, its ID is not returned. virtual AZStd::vector GetAllCurrentlySpawnedEntities() = 0; + + //! Returns whether or not the spawner is in a state that's ready to spawn. + virtual bool IsReadyToSpawn() = 0; }; using SpawnerComponentRequestBus = AZ::EBus; diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.cpp b/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.cpp index 6fa930ba34..19390de956 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.cpp @@ -79,15 +79,19 @@ namespace // Create the nodes in a horizontal list at the top of the canvas. - AZ::Vector2 pos(20.0f, -100.0f); + AZ::Vector2 pos(20.0f, 20.0f); for (const auto& index : ui->commandList->selectionModel()->selectedIndexes()) { - if (index.column() != CommandListDataModel::ColumnIndex::Command) + if (index.column() != CommandListDataModel::ColumnIndex::CommandIndex) { continue; } AZ::Uuid type = dataModel->data(index, CommandListDataModel::CustomRole::Types).value(); + if (type.IsNull()) + { + continue; + } [[maybe_unused]] const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(type); AZ_Assert(classData, "Failed to find ClassData for ID: %s", type.ToString().data()); @@ -115,6 +119,8 @@ namespace ScriptCanvasEditor ///////////////////////////////////////////////////////////////////////////////////////////// CommandListDataModel::CommandListDataModel([[maybe_unused]] QWidget* parent /*= nullptr*/) { + ScriptCanvasCommandLineRequestBus::Handler::BusConnect(); + AZ::SerializeContext* serializeContext = nullptr; AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext); @@ -138,12 +144,62 @@ namespace ScriptCanvasEditor if (add) { - m_nodeTypes.push_back(classData->m_typeId); + Entry entry; + entry.m_type = classData->m_typeId; + m_entries.emplace_back(entry); } } return true; } - ); + ); + + ScriptCanvasCommandLineRequestBus::Broadcast(&ScriptCanvasCommandLineRequests::AddCommand, "add_node", "Adds the specified node to the graph", + [serializeContext](const AZStd::vector& nodes) + { + AZ::Uuid nodeTypeToAdd = AZ::Uuid::CreateNull(); + if (nodes.size() > 0) + { + const AZStd::string& nodeName = *(nodes.begin()); + + serializeContext->EnumerateDerived( + [&nodeName, &nodeTypeToAdd](const AZ::SerializeContext::ClassData* classData, [[maybe_unused]] const AZ::Uuid& classUuid) -> bool + { + if (classData && classData->m_editData) + { + if (nodeName.compare(classData->m_name) == 0) + { + nodeTypeToAdd = classData->m_typeId; + } + } + return true; + } + ); + + if (!nodeTypeToAdd.IsNull()) + { + ScriptCanvas::ScriptCanvasId scriptCanvasId; + ScriptCanvasEditor::GeneralRequestBus::BroadcastResult(scriptCanvasId, &ScriptCanvasEditor::GeneralRequests::GetActiveScriptCanvasId); + + AZ::EntityId graphCanvasGraphId; + ScriptCanvasEditor::GeneralRequestBus::BroadcastResult(graphCanvasGraphId, &ScriptCanvasEditor::GeneralRequests::GetActiveGraphCanvasGraphId); + + if (scriptCanvasId.IsValid() && graphCanvasGraphId.IsValid()) + { + ScriptCanvasEditor::Nodes::StyleConfiguration styleConfiguration; + + AZ::Vector2 pos(100.0f, 20.0f); + NodeIdPair nodePair = ScriptCanvasEditor::Nodes::CreateNode(nodeTypeToAdd, scriptCanvasId, styleConfiguration); + GraphCanvas::SceneRequestBus::Event(graphCanvasGraphId, &GraphCanvas::SceneRequests::AddNode, nodePair.m_graphCanvasId, pos, false); + } + } + } + } + ); + } + + CommandListDataModel::~CommandListDataModel() + { + ScriptCanvasCommandLineRequestBus::Handler::BusDisconnect(); } QModelIndex CommandListDataModel::index(int row, int column, const QModelIndex& parent /*= QModelIndex()*/) const @@ -162,7 +218,7 @@ namespace ScriptCanvasEditor int CommandListDataModel::rowCount([[maybe_unused]] const QModelIndex& parent /*= QModelIndex()*/) const { - return static_cast(m_nodeTypes.size()); + return static_cast(m_entries.size()); } int CommandListDataModel::columnCount([[maybe_unused]] const QModelIndex& parent /*= QModelIndex()*/) const @@ -190,19 +246,40 @@ namespace ScriptCanvasEditor } } - AZ::Uuid nodeType = m_nodeTypes[index.row()]; - const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(nodeType); - if (index.column() == ColumnIndex::Command) + AZ::Uuid nodeType = m_entries[index.row()].m_type; + if (nodeType.IsNull()) { - return QVariant(QString(classData->m_name)); + if (index.column() == ColumnIndex::CommandIndex) + { + return QVariant(QString(m_entries[index.row()].m_command.c_str())); + } + if (index.column() == ColumnIndex::DescriptionIndex) + { + AZStd::string command = m_entries[index.row()].m_command; + const auto& entry = m_commands.find(command); + if (entry != m_commands.end()) + { + return QVariant(QString(entry->second->GetDescription().c_str())); + } + } } - if (index.column() == ColumnIndex::Description) + else { - return QVariant(QString(classData->m_editData ? classData->m_editData->m_description : tr("No description provided."))); - } - if (index.column() == ColumnIndex::Trail) - { - return QVariant(QString("")); + if (const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(nodeType)) + { + if (index.column() == ColumnIndex::CommandIndex) + { + return QVariant(QString(classData->m_name)); + } + if (index.column() == ColumnIndex::DescriptionIndex) + { + return QVariant(QString(classData->m_editData ? classData->m_editData->m_description : tr("No description provided."))); + } + if (index.column() == ColumnIndex::TrailIndex) + { + return QVariant(QString("")); + } + } } } @@ -210,25 +287,42 @@ namespace ScriptCanvasEditor { case CustomRole::Types: { - AZ::Uuid nodeType = m_nodeTypes[index.row()]; + AZ::Uuid nodeType = m_entries[index.row()].m_type; return QVariant::fromValue(nodeType); } break; case CustomRole::Node: { - AZ::Uuid nodeType = m_nodeTypes[index.row()]; - const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(nodeType); - if (index.column() == ColumnIndex::Command) + AZ::Uuid nodeType = m_entries[index.row()].m_type; + if (nodeType.IsNull()) { - return QVariant(QString(classData->m_name)); + return QVariant(QString(m_entries[index.row()].m_command.c_str())); } - if (index.column() == ColumnIndex::Description) + else { - return QVariant(QString(classData->m_editData ? classData->m_editData->m_description : tr("No description provided."))); + if (const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(nodeType)) + { + if (index.column() == ColumnIndex::CommandIndex) + { + return QVariant(QString(classData->m_name)); + } + if (index.column() == ColumnIndex::DescriptionIndex) + { + return QVariant(QString(classData->m_editData ? classData->m_editData->m_description : tr("No description provided."))); + } + if (index.column() == ColumnIndex::TrailIndex) + { + return QVariant(QString("")); + } + } } - if (index.column() == ColumnIndex::Trail) + } + break; + case CustomRole::Commands: + { + if (index.column() == ColumnIndex::CommandIndex) { - return QVariant(QString("")); + return QVariant(QString(m_entries[index.row()].m_command.c_str())); } } break; @@ -250,21 +344,31 @@ namespace ScriptCanvasEditor AZ::SerializeContext* serializeContext = nullptr; AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext); - for (const auto& entry : m_nodeTypes) + for (const auto& entry : m_entries) { - const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(entry); - if (classData) + if (!entry.m_type.IsNull()) { - QString name = QString(classData->m_name); - if (name.startsWith(input.c_str(), Qt::CaseSensitivity::CaseInsensitive)) + if (const AZ::SerializeContext::ClassData* classData = serializeContext->FindClassData(entry.m_type)) { - return true; + QString name = QString(classData->m_name); + if (name.startsWith(input.c_str(), Qt::CaseSensitivity::CaseInsensitive)) + { + return true; + } } } + else + { + QString commandName = entry.m_command.c_str(); + return (commandName.startsWith(input.c_str(), Qt::CaseSensitivity::CaseInsensitive)); + } } + return false; } + ScriptCanvasEditor::Widget::CommandRegistry CommandListDataModel::m_commands; + // CommandLineEdit ///////////////////////////////////////////////////////////////////////////////////////////// @@ -335,8 +439,25 @@ namespace ScriptCanvasEditor case Qt::Key_Return: { // Invoke the command - // TODO: trigger invoke - // CommandRequestBus::Broadcast(&CommandRequest::Invoke, text().toStdString().c_str()); + AZStd::string commandText = text().toStdString().c_str(); + AZStd::vector tokens; + AZ::StringFunc::Tokenize(commandText, tokens, " "); + if (tokens.size() == 1) + { + ScriptCanvasCommandLineRequestBus::Broadcast(&ScriptCanvasCommandLineRequests::Invoke, tokens.begin()->c_str()); + } + else if (tokens.size() > 1) + { + AZStd::string command = *(tokens.begin()); + AZStd::vector args; + for (auto it = tokens.begin() + 1; it != tokens.end(); ++it) + { + args.push_back(*it); + } + ScriptCanvasCommandLineRequestBus::Broadcast(&ScriptCanvasCommandLineRequests::InvokeWithArguments, command.c_str(), args); + } + + ResetState(); qobject_cast(parent())->hide(); } @@ -376,20 +497,29 @@ namespace ScriptCanvasEditor // CommandListDataProxyModel ///////////////////////////////////////////////////////////////////////////////////////////// - CommandListDataProxyModel::CommandListDataProxyModel(QObject* parent /*= nullptr*/) + CommandListDataProxyModel::CommandListDataProxyModel(CommandListDataModel* commandListData, QObject* parent /*= nullptr*/) : QSortFilterProxyModel(parent) { - QStringList commands; + setSourceModel(commandListData); + + QStringList commandList; - CommandListDataModel* commandListData = new CommandListDataModel(); for (int i = 0; i < commandListData->rowCount(); ++i) { - QModelIndex index = commandListData->index(i, CommandListDataModel::ColumnIndex::Command); + QModelIndex index = commandListData->index(i, CommandListDataModel::ColumnIndex::CommandIndex); QString command = commandListData->data(index, CommandListDataModel::CustomRole::Node).toString(); - commands.push_back(command); + commandList.push_back(command); } - m_completer = new QCompleter(commands); + ScriptCanvasCommandLineRequests::CommandNameList commands; + ScriptCanvasCommandLineRequestBus::BroadcastResult(commands, &ScriptCanvasCommandLineRequests::GetCommands); + for (auto& command : commands) + { + QString commandName = command.first.c_str(); + commandList.push_back(commandName); + } + + m_completer = new QCompleter(commandList); m_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion); m_completer->setCaseSensitivity(Qt::CaseInsensitive); } @@ -421,7 +551,7 @@ namespace ScriptCanvasEditor } } - QModelIndex index = dataModel->index(sourceRow, CommandListDataModel::ColumnIndex::Command); + QModelIndex index = dataModel->index(sourceRow, CommandListDataModel::ColumnIndex::CommandIndex); QString sourceStr = dataModel->data(index).toString(); if (sourceRow > 0 && sourceStr.startsWith(m_input.c_str(), Qt::CaseSensitivity::CaseInsensitive)) @@ -450,8 +580,7 @@ namespace ScriptCanvasEditor ui->setupUi(this); CommandListDataModel* commandListDataModel = new CommandListDataModel(); - CommandListDataProxyModel* commandListDataProxyModel = new CommandListDataProxyModel(); - commandListDataProxyModel->setSourceModel(commandListDataModel); + CommandListDataProxyModel* commandListDataProxyModel = new CommandListDataProxyModel(commandListDataModel); ui->commandList->setModel(commandListDataProxyModel); @@ -460,8 +589,8 @@ namespace ScriptCanvasEditor connect(ui->commandText, &CommandLineEdit::onKeyReleased, this, &CommandLine::onEditKeyReleaseEvent); connect(ui->commandList, &CommandLineList::onKeyReleased, this, &CommandLine::onListKeyReleaseEvent); - ui->commandList->setColumnWidth(CommandListDataModel::ColumnIndex::Command, 250); - ui->commandList->setColumnWidth(CommandListDataModel::ColumnIndex::Description, 1000); + ui->commandList->setColumnWidth(CommandListDataModel::ColumnIndex::CommandIndex, 250); + ui->commandList->setColumnWidth(CommandListDataModel::ColumnIndex::DescriptionIndex, 1000); } void CommandLine::onTextChanged(const QString& text) diff --git a/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.h b/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.h index ab9b115bde..28e3ce4671 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.h +++ b/Gems/ScriptCanvas/Code/Editor/View/Widgets/CommandLine.h @@ -25,6 +25,7 @@ #include #include #include +#include #endif namespace Ui @@ -36,10 +37,49 @@ namespace ScriptCanvasEditor { namespace Widget { + class Command + { + public: + using Functor = AZStd::function)>; + + Command(const AZStd::string& name, const AZStd::string& description, Functor functor) + : m_name(name) + , m_description(description) + , m_functor(functor) + {} + + void operator()(const AZStd::vector& args) + { + m_functor(args); + } + + const AZStd::string& GetName() const { return m_name; } + const AZStd::string& GetDescription() const { return m_description; } + + private: + AZStd::string m_name; + AZStd::string m_description; + Functor m_functor; + }; + + using CommandRegistry = AZStd::unordered_map>; + + struct ScriptCanvasCommandLineRequests : public AZ::EBusTraits + { + virtual void AddCommand(const AZStd::string commandName, const AZStd::string description, Command::Functor) = 0; + virtual void Invoke(const char* commandName) = 0; + virtual void InvokeWithArguments(const char* commandName, const AZStd::vector&) = 0; + + using CommandNameList = AZStd::list>; + virtual CommandNameList GetCommands() = 0; + }; + using ScriptCanvasCommandLineRequestBus = AZ::EBus; + // TODO #lsempe: this deserves its own file // CommandListDataModel ///////////////////////////////////////////////////////////////////////////////////////////// class CommandListDataModel : public QAbstractTableModel + , ScriptCanvasCommandLineRequestBus::Handler { Q_OBJECT @@ -49,9 +89,9 @@ namespace ScriptCanvasEditor enum ColumnIndex { - Command, - Description, - Trail, + CommandIndex, + DescriptionIndex, + TrailIndex, Count }; @@ -65,6 +105,8 @@ namespace ScriptCanvasEditor }; CommandListDataModel(QWidget* parent = nullptr); + ~CommandListDataModel() override; + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; QModelIndex parent(const QModelIndex &child) const override; int rowCount(const QModelIndex &parent = QModelIndex()) const override; @@ -75,10 +117,62 @@ namespace ScriptCanvasEditor bool HasMatches(const AZStd::string& input); + struct Entry + { + AZ::Uuid m_type; + AZStd::string m_command; + + Entry() + { + m_type = AZ::Uuid::CreateNull(); + } + }; + protected: - AZStd::vector m_nodeTypes; + AZStd::vector m_entries; + static CommandRegistry m_commands; + + void AddCommand(const AZStd::string commandName, const AZStd::string description, Command::Functor f) override + { + if (m_commands.find(commandName) == m_commands.end()) + { + m_commands[commandName] = AZStd::make_unique(commandName, description, f); + Entry entry; + entry.m_command = commandName; + entry.m_type = AZ::Uuid::CreateNull(); + m_entries.emplace_back(entry); + } + } + + void Invoke(const char* commandName) override + { + auto command = m_commands.find(commandName); + if (command != m_commands.end()) + { + command->second->operator()({}); + } + } + + void InvokeWithArguments(const char* commandName, const AZStd::vector& args) override + { + auto command = m_commands.find(commandName); + if (command != m_commands.end()) + { + command->second->operator()(args); + } + } + + ScriptCanvasCommandLineRequests::CommandNameList GetCommands() override + { + ScriptCanvasCommandLineRequests::CommandNameList commands; + for (auto& command : m_commands) + { + commands.push_back(AZStd::make_pair(command.second->GetName(), command.second->GetDescription())); + } + return commands; + } }; class CommandListDataProxyModel : public QSortFilterProxyModel @@ -88,7 +182,7 @@ namespace ScriptCanvasEditor public: AZ_CLASS_ALLOCATOR(CommandListDataProxyModel, AZ::SystemAllocator, 0); - CommandListDataProxyModel(QObject* parent = nullptr); + CommandListDataProxyModel(CommandListDataModel* commandListData, QObject* parent = nullptr); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; @@ -168,4 +262,4 @@ namespace ScriptCanvasEditor AZStd::unique_ptr ui; }; } -} \ No newline at end of file +} diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp index 3f226e62e0..ee4d6d9371 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/MainWindow.cpp @@ -595,7 +595,6 @@ namespace ScriptCanvasEditor m_commandLine = new Widget::CommandLine(this); m_commandLine->setBaseSize(QSize(size().width(), m_commandLine->size().height())); m_commandLine->setObjectName("CommandLine"); - m_commandLine->hide(); m_layout->addWidget(m_commandLine); m_layout->addWidget(m_emptyCanvas); diff --git a/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui b/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui index 40ba00bb31..3b3043a4a0 100644 --- a/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui +++ b/Gems/ScriptCanvas/Code/Editor/View/Windows/mainwindow.ui @@ -244,7 +244,7 @@ false - false + true diff --git a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja index b7394ef212..185cf82c86 100644 --- a/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja +++ b/Gems/ScriptCanvas/Code/Include/ScriptCanvas/AutoGen/ScriptCanvasGrammar_Header.jinja @@ -66,7 +66,7 @@ namespace {{attribute_Namespace}} {% set deprecationUuid = Class.attrib['DeprecationUUID'] %} -// The following will be injected directly into the source header file for which AzCodeGenerator is being run. +// The following will be injected directly into the source header file for which AZ AutoGen is being run. // You must #include the generated header into the source header #define SCRIPTCANVAS_NODE_{{ className }} \ public: \ diff --git a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake index 9057b5ba1b..e42e8e40ea 100644 --- a/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake +++ b/cmake/3rdParty/Platform/Linux/BuiltInPackages_linux.cmake @@ -15,7 +15,7 @@ ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev3-multiplatform TARG ly_associate_package(PACKAGE_NAME ilmbase-2.3.0-rev4-multiplatform TARGETS ilmbase PACKAGE_HASH 97547fdf1fbc4d81b8ccf382261f8c25514ed3b3c4f8fd493f0a4fa873bba348) ly_associate_package(PACKAGE_NAME hdf5-1.0.11-rev2-multiplatform TARGETS hdf5 PACKAGE_HASH 11d5e04df8a93f8c52a5684a4cacbf0d9003056360983ce34f8d7b601082c6bd) ly_associate_package(PACKAGE_NAME alembic-1.7.11-rev3-multiplatform TARGETS alembic PACKAGE_HASH ba7a7d4943dd752f5a662374f6c48b93493df1d8e2c5f6a8d101f3b50700dd25) -ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev6-multiplatform TARGETS assimplib PACKAGE_HASH 47f1a6d05d101def036c030484c4a6e19d745aacd57037174715c7afe2b19b4c) +ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev7-multiplatform TARGETS assimplib PACKAGE_HASH def855c89d8210db3040f1cb6ec837141ab9b8e74c158eae7c03d50160fcf30b) ly_associate_package(PACKAGE_NAME squish-ccr-20150601-rev3-multiplatform TARGETS squish-ccr PACKAGE_HASH c878c6c0c705e78403c397d03f5aa7bc87e5978298710e14d09c9daf951a83b3) ly_associate_package(PACKAGE_NAME ASTCEncoder-2017_11_14-rev2-multiplatform TARGETS ASTCEncoder PACKAGE_HASH c240ffc12083ee39a5ce9dc241de44d116e513e1e3e4cc1d05305e7aa3bdc326) ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform TARGETS md5 PACKAGE_HASH 29e52ad22c78051551f78a40c2709594f0378762ae03b417adca3f4b700affdf) diff --git a/cmake/3rdParty/Platform/Linux/Clang_linux.cmake b/cmake/3rdParty/Platform/Linux/Clang_linux.cmake deleted file mode 100644 index 1cf269d1a2..0000000000 --- a/cmake/3rdParty/Platform/Linux/Clang_linux.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# -# 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. -# - -set(CLANG_PLATFORM_LIB_PATH ${BASE_PATH}/linux_x64/release/lib) - -set(CLANG_INCLUDE_DIRECTORIES - llvm/include - linux_x64/release/include -) - -set(CLANG_LIBS - ${CLANG_PLATFORM_LIB_PATH}/libclangFrontend.a - ${CLANG_PLATFORM_LIB_PATH}/libclangSerialization.a - ${CLANG_PLATFORM_LIB_PATH}/libclangDriver.a - ${CLANG_PLATFORM_LIB_PATH}/libclangTooling.a - ${CLANG_PLATFORM_LIB_PATH}/libclangParse.a - ${CLANG_PLATFORM_LIB_PATH}/libclangSema.a - ${CLANG_PLATFORM_LIB_PATH}/libclangAnalysis.a - ${CLANG_PLATFORM_LIB_PATH}/libclangRewriteFrontend.a - ${CLANG_PLATFORM_LIB_PATH}/libclangRewrite.a - ${CLANG_PLATFORM_LIB_PATH}/libclangEdit.a - ${CLANG_PLATFORM_LIB_PATH}/libclangAST.a - ${CLANG_PLATFORM_LIB_PATH}/libclangLex.a - ${CLANG_PLATFORM_LIB_PATH}/libclangBasic.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMCore.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMBinaryFormat.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMDebugInfoDWARF.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMMC.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMOption.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMBitReader.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMMCParser.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMProfileData.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMTarget.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMSupport.a -) diff --git a/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake b/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake index 2b1ba4d0e5..83d862ee78 100644 --- a/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake +++ b/cmake/3rdParty/Platform/Linux/cmake_linux_files.cmake @@ -13,7 +13,6 @@ set(FILES AWSGameLiftServerSDK_linux.cmake BuiltInPackages_linux.cmake civetweb_linux.cmake - Clang_linux.cmake dyad_linux.cmake FbxSdk_linux.cmake OpenSSL_linux.cmake diff --git a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake index ef66259e22..d6d017d1d1 100644 --- a/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake +++ b/cmake/3rdParty/Platform/Mac/BuiltInPackages_mac.cmake @@ -15,7 +15,7 @@ ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev3-multiplatform ly_associate_package(PACKAGE_NAME ilmbase-2.3.0-rev4-multiplatform TARGETS ilmbase PACKAGE_HASH 97547fdf1fbc4d81b8ccf382261f8c25514ed3b3c4f8fd493f0a4fa873bba348) ly_associate_package(PACKAGE_NAME hdf5-1.0.11-rev2-multiplatform TARGETS hdf5 PACKAGE_HASH 11d5e04df8a93f8c52a5684a4cacbf0d9003056360983ce34f8d7b601082c6bd) ly_associate_package(PACKAGE_NAME alembic-1.7.11-rev3-multiplatform TARGETS alembic PACKAGE_HASH ba7a7d4943dd752f5a662374f6c48b93493df1d8e2c5f6a8d101f3b50700dd25) -ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev6-multiplatform TARGETS assimplib PACKAGE_HASH 47f1a6d05d101def036c030484c4a6e19d745aacd57037174715c7afe2b19b4c) +ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev7-multiplatform TARGETS assimplib PACKAGE_HASH def855c89d8210db3040f1cb6ec837141ab9b8e74c158eae7c03d50160fcf30b) ly_associate_package(PACKAGE_NAME squish-ccr-20150601-rev3-multiplatform TARGETS squish-ccr PACKAGE_HASH c878c6c0c705e78403c397d03f5aa7bc87e5978298710e14d09c9daf951a83b3) ly_associate_package(PACKAGE_NAME ASTCEncoder-2017_11_14-rev2-multiplatform TARGETS ASTCEncoder PACKAGE_HASH c240ffc12083ee39a5ce9dc241de44d116e513e1e3e4cc1d05305e7aa3bdc326) ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform TARGETS md5 PACKAGE_HASH 29e52ad22c78051551f78a40c2709594f0378762ae03b417adca3f4b700affdf) diff --git a/cmake/3rdParty/Platform/Mac/Clang_mac.cmake b/cmake/3rdParty/Platform/Mac/Clang_mac.cmake deleted file mode 100644 index 3d7fc64465..0000000000 --- a/cmake/3rdParty/Platform/Mac/Clang_mac.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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. -# - -set(CLANG_PLATFORM_LIB_PATH ${BASE_PATH}/xcode/$,debug,release>/lib) - -set(CLANG_INCLUDE_DIRECTORIES - llvm/include - xcode/$,debug,release>/include -) - -set(CLANG_LIBS - ${CLANG_PLATFORM_LIB_PATH}/libclangFrontend.a - ${CLANG_PLATFORM_LIB_PATH}/libclangSerialization.a - ${CLANG_PLATFORM_LIB_PATH}/libclangDriver.a - ${CLANG_PLATFORM_LIB_PATH}/libclangTooling.a - ${CLANG_PLATFORM_LIB_PATH}/libclangParse.a - ${CLANG_PLATFORM_LIB_PATH}/libclangSema.a - ${CLANG_PLATFORM_LIB_PATH}/libclangAnalysis.a - ${CLANG_PLATFORM_LIB_PATH}/libclangRewriteFrontend.a - ${CLANG_PLATFORM_LIB_PATH}/libclangRewrite.a - ${CLANG_PLATFORM_LIB_PATH}/libclangEdit.a - ${CLANG_PLATFORM_LIB_PATH}/libclangAST.a - ${CLANG_PLATFORM_LIB_PATH}/libclangASTMatchers.a - ${CLANG_PLATFORM_LIB_PATH}/libclangLex.a - ${CLANG_PLATFORM_LIB_PATH}/libclangBasic.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMCore.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMBinaryFormat.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMDebugInfoDWARF.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMMC.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMOption.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMBitReader.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMMCParser.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMProfileData.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMTarget.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMSupport.a - - ${CLANG_PLATFORM_LIB_PATH}/libLLVMDemangle.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMSupport.a - ${CLANG_PLATFORM_LIB_PATH}/libLLVMCore.a - -) diff --git a/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake b/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake index 0e3cc53262..9d0166913a 100644 --- a/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake +++ b/cmake/3rdParty/Platform/Mac/cmake_mac_files.cmake @@ -12,7 +12,6 @@ set(FILES BuiltInPackages_mac.cmake civetweb_mac.cmake - Clang_mac.cmake DirectXShaderCompiler_mac.cmake FbxSdk_mac.cmake OpenGLInterface_mac.cmake diff --git a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake index 58050652c0..09dd543e5c 100644 --- a/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake +++ b/cmake/3rdParty/Platform/Windows/BuiltInPackages_windows.cmake @@ -15,7 +15,7 @@ ly_associate_package(PACKAGE_NAME Lua-5.3.5-rev3-multiplatform ly_associate_package(PACKAGE_NAME ilmbase-2.3.0-rev4-multiplatform TARGETS ilmbase PACKAGE_HASH 97547fdf1fbc4d81b8ccf382261f8c25514ed3b3c4f8fd493f0a4fa873bba348) ly_associate_package(PACKAGE_NAME hdf5-1.0.11-rev2-multiplatform TARGETS hdf5 PACKAGE_HASH 11d5e04df8a93f8c52a5684a4cacbf0d9003056360983ce34f8d7b601082c6bd) ly_associate_package(PACKAGE_NAME alembic-1.7.11-rev3-multiplatform TARGETS alembic PACKAGE_HASH ba7a7d4943dd752f5a662374f6c48b93493df1d8e2c5f6a8d101f3b50700dd25) -ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev6-multiplatform TARGETS assimplib PACKAGE_HASH 47f1a6d05d101def036c030484c4a6e19d745aacd57037174715c7afe2b19b4c) +ly_associate_package(PACKAGE_NAME assimp-5.0.1-rev7-multiplatform TARGETS assimplib PACKAGE_HASH def855c89d8210db3040f1cb6ec837141ab9b8e74c158eae7c03d50160fcf30b) ly_associate_package(PACKAGE_NAME squish-ccr-20150601-rev3-multiplatform TARGETS squish-ccr PACKAGE_HASH c878c6c0c705e78403c397d03f5aa7bc87e5978298710e14d09c9daf951a83b3) ly_associate_package(PACKAGE_NAME ASTCEncoder-2017_11_14-rev2-multiplatform TARGETS ASTCEncoder PACKAGE_HASH c240ffc12083ee39a5ce9dc241de44d116e513e1e3e4cc1d05305e7aa3bdc326) ly_associate_package(PACKAGE_NAME md5-2.0-multiplatform TARGETS md5 PACKAGE_HASH 29e52ad22c78051551f78a40c2709594f0378762ae03b417adca3f4b700affdf) diff --git a/cmake/3rdParty/Platform/Windows/Clang_windows.cmake b/cmake/3rdParty/Platform/Windows/Clang_windows.cmake deleted file mode 100644 index 69a6b77119..0000000000 --- a/cmake/3rdParty/Platform/Windows/Clang_windows.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# -# 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. -# - -set(CLANG_PLATFORM_LIB_PATH ${BASE_PATH}/vs2015/$,debug,release>/lib) - -set(CLANG_INCLUDE_DIRECTORIES - llvm/include - vs2015/$,debug,release>/include -) - -set(CLANG_LIBS - ${CLANG_PLATFORM_LIB_PATH}/clangFrontend.lib - ${CLANG_PLATFORM_LIB_PATH}/clangSerialization.lib - ${CLANG_PLATFORM_LIB_PATH}/clangDriver.lib - ${CLANG_PLATFORM_LIB_PATH}/clangTooling.lib - ${CLANG_PLATFORM_LIB_PATH}/clangParse.lib - ${CLANG_PLATFORM_LIB_PATH}/clangSema.lib - ${CLANG_PLATFORM_LIB_PATH}/clangAnalysis.lib - ${CLANG_PLATFORM_LIB_PATH}/clangRewriteFrontend.lib - ${CLANG_PLATFORM_LIB_PATH}/clangRewrite.lib - ${CLANG_PLATFORM_LIB_PATH}/clangEdit.lib - ${CLANG_PLATFORM_LIB_PATH}/clangAST.lib - ${CLANG_PLATFORM_LIB_PATH}/clangLex.lib - ${CLANG_PLATFORM_LIB_PATH}/clangBasic.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMBinaryFormat.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMDebugInfoDWARF.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMMC.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMOption.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMBitReader.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMMCParser.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMProfileData.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMTarget.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMCore.lib - ${CLANG_PLATFORM_LIB_PATH}/LLVMSupport.lib - Version.lib -) diff --git a/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake b/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake index 2c7890fcc4..fe4aa6bc82 100644 --- a/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake +++ b/cmake/3rdParty/Platform/Windows/cmake_windows_files.cmake @@ -12,7 +12,6 @@ set(FILES AWSGameLiftServerSDK_windows.cmake BuiltInPackages_windows.cmake - Clang_windows.cmake Crashpad_windows.cmake DirectXShaderCompiler_windows.cmake dyad_windows.cmake diff --git a/scripts/build/Platform/Android/build_config.json b/scripts/build/Platform/Android/build_config.json index 0fa4d9ade3..097ff59e4e 100644 --- a/scripts/build/Platform/Android/build_config.json +++ b/scripts/build/Platform/Android/build_config.json @@ -40,6 +40,16 @@ "CMAKE_BUILD_ARGS":"-j!NUMBER_OF_PROCESSORS!" } }, + "android_packaging_all": { + "TAGS": [ + "packaging" + ], + "COMMAND": "python_windows.cmd", + "PARAMETERS": { + "SCRIPT_PATH": "scripts/build/package/package.py", + "SCRIPT_PARAMETERS": "--platform Android --type all" + } + }, "profile": { "TAGS":[ "weekly-build-metrics", diff --git a/scripts/build/package/Platform/Android/package_env.json b/scripts/build/package/Platform/Android/package_env.json new file mode 100644 index 0000000000..017937413a --- /dev/null +++ b/scripts/build/package/Platform/Android/package_env.json @@ -0,0 +1,25 @@ +{ + "local_env": { + "S3_PREFIX": "${BRANCH_NAME}/Android" + }, + "types":{ + "all":{ + "PACKAGE_TARGETS":[ + { + "FILE_LIST": "all.json", + "FILE_LIST_TYPE": "All", + "PACKAGE_NAME": "${PACKAGE_NAME_PATTERN}-android-all-${BUILD_NUMBER}.zip" + } + ], + "BOOTSTRAP_CFG_GAME_FOLDER":"AutomatedTesting", + "SKIP_BUILD": 0, + "BUILD_TARGETS":[ + { + "BUILD_CONFIG_FILENAME": "build_config.json", + "PLATFORM": "Android", + "TYPE": "profile" + } + ] + } + } +}