diff --git a/AutomatedTesting/TestAssets/ReportOneMissingDependency.txt b/AutomatedTesting/TestAssets/ReportOneMissingDependency.txt new file mode 100644 index 0000000000..24a8493ee5 --- /dev/null +++ b/AutomatedTesting/TestAssets/ReportOneMissingDependency.txt @@ -0,0 +1,5 @@ +This is the UUID for libs / particles / milestone2particles . xml. +6BDE282B49C957F7B0714B26579BCA9A +This isn an invalid UUID +33bdee92F3225688ABEE534F6058593F +This is another invalid UUID B076CDDC-14DK-50F4-A5E9-7518ABB3E851 \ No newline at end of file diff --git a/Code/CryEngine/CrySystem/CrySystem_precompiled.cpp b/Code/CryEngine/CrySystem/CrySystem_precompiled.cpp deleted file mode 100644 index eaa80bbdc1..0000000000 --- a/Code/CryEngine/CrySystem/CrySystem_precompiled.cpp +++ /dev/null @@ -1,14 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. -// If you make changes in ICryPak.h, make changes here, to dirty the PCH. -#include "CrySystem_precompiled.h" diff --git a/Code/CryEngine/CrySystem/crysystem_files.cmake b/Code/CryEngine/CrySystem/crysystem_files.cmake index 84250de95b..f0398ffb88 100644 --- a/Code/CryEngine/CrySystem/crysystem_files.cmake +++ b/Code/CryEngine/CrySystem/crysystem_files.cmake @@ -75,6 +75,5 @@ set(FILES ViewSystem/View.h ViewSystem/ViewSystem.cpp ViewSystem/ViewSystem.h - CrySystem_precompiled.cpp WindowsErrorReporting.cpp ) diff --git a/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionEvents.cpp b/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionEvents.cpp index 4c9124f594..9f9e5c51ad 100644 --- a/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionEvents.cpp +++ b/Code/Framework/AzFramework/AzFramework/Physics/Collision/CollisionEvents.cpp @@ -37,9 +37,10 @@ namespace AzPhysics if (auto* behaviorContext = azdynamic_cast(context)) { behaviorContext->Class() - ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) - ->Method("GetTriggerEntityId", &TriggerEvent::GetTriggerEntityId) - ->Method("GetOtherEntityId", &TriggerEvent::GetOtherEntityId) + ->Attribute(AZ::Script::Attributes::Module, "physics") + ->Attribute(AZ::Script::Attributes::Category, "Physics") + ->Method("Get Trigger EntityId", &TriggerEvent::GetTriggerEntityId) + ->Method("Get Other EntityId", &TriggerEvent::GetOtherEntityId) ; } } @@ -104,10 +105,11 @@ namespace AzPhysics if (auto* behaviorContext = azdynamic_cast(context)) { behaviorContext->Class() - ->Attribute(AZ::Script::Attributes::ExcludeFrom, AZ::Script::Attributes::ExcludeFlags::All) - ->Property("Contacts", BehaviorValueProperty(&CollisionEvent::m_contacts)) - ->Method("GetBody1EntityId", &CollisionEvent::GetBody1EntityId) - ->Method("GetBody2EntityId", &CollisionEvent::GetBody2EntityId) + ->Attribute(AZ::Script::Attributes::Module, "physics") + ->Attribute(AZ::Script::Attributes::Category, "Physics") + ->Property("Contacts", BehaviorValueGetter(&CollisionEvent::m_contacts), nullptr) + ->Method("Get Body 1 EntityId", &CollisionEvent::GetBody1EntityId) + ->Method("Get Body 2 EntityId", &CollisionEvent::GetBody2EntityId) ; } } diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/camera.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/camera.svg new file mode 100644 index 0000000000..7fa565d5b8 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/camera.svg @@ -0,0 +1,9 @@ + + + Camera + + + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/debug.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/debug.svg new file mode 100644 index 0000000000..938e4e3342 --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/debug.svg @@ -0,0 +1,7 @@ + + + debug + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/resolution.svg b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/resolution.svg new file mode 100644 index 0000000000..2434d6707d --- /dev/null +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/Menu/resolution.svg @@ -0,0 +1,7 @@ + + + resolution + + + + \ No newline at end of file diff --git a/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc b/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc index 7b0c6530ab..2487917f67 100644 --- a/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc +++ b/Code/Framework/AzQtComponents/AzQtComponents/Images/resources.qrc @@ -15,4 +15,9 @@ Notifications/download.svg Notifications/link.svg + + Menu/resolution.svg + Menu/debug.svg + Menu/camera.svg + diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/API/ViewPaneOptions.h b/Code/Framework/AzToolsFramework/AzToolsFramework/API/ViewPaneOptions.h index fb86968ebb..4891d2ef85 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/API/ViewPaneOptions.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/API/ViewPaneOptions.h @@ -42,6 +42,9 @@ namespace AzToolsFramework bool detachedWindow = false; ///< set to true if the view pane should use a detached, non-dockable widget. This is to workaround a problem with QOpenGLWidget on macOS. Currently this has no effect on other platforms. bool isDisabledInSimMode = false; ///< set to true if the view pane should not be openable from level editor menu when editor is in simulation mode. + + bool showOnToolsToolbar = false; ///< set to true if the view pane should create a button on the tools toolbar to open/close the pane + QString toolbarIcon; ///< path to the icon to use for the toolbar button - only used if showOnToolsToolbar is set to true }; } // namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFramework_precompiled.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFramework_precompiled.cpp deleted file mode 100644 index f9de86bce5..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/AzToolsFramework_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "AzToolsFramework_precompiled.h" diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h index d8eb81dd40..d8bc63cfc6 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Entity/PrefabEditorEntityOwnershipService.h @@ -197,7 +197,7 @@ namespace AzToolsFramework AZ::IO::PathView filePath, Prefab::InstanceOptionalReference instanceToParentUnder) override; Prefab::InstanceOptionalReference GetRootPrefabInstance() override; - + const AZStd::vector>& GetPlayInEditorAssetData() override; ////////////////////////////////////////////////////////////////////////// diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplateInterface.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplateInterface.h index c2ddbcf24f..c9b4b5acc3 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplateInterface.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplateInterface.h @@ -47,8 +47,13 @@ namespace AzToolsFramework virtual void AppendEntityAliasToPatchPaths(PrefabDom& providedPatch, const AZ::EntityId& entityId) = 0; - //! Updates the template links (updating instances) for the given templateId using the providedPatch - virtual bool PatchTemplate(PrefabDomValue& providedPatch, TemplateId templateId) = 0; + //! Updates the template links (updating instances) for the given template and triggers propagation on its instances. + //! @param providedPatch The patch to apply to the template. + //! @param templateId The id of the template to update. + //! @param instanceToExclude An optional reference to an instance of the template being updated that should not be refreshes as part of propagation. + //! Defaults to nullopt, which means that all instances will be refreshed. + //! @return True if the template was patched correctly, false if the operation failed. + virtual bool PatchTemplate(PrefabDomValue& providedPatch, TemplateId templateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) = 0; virtual void ApplyPatchesToInstance(const AZ::EntityId& entityId, PrefabDom& patches, const Instance& instanceToAddPatches) = 0; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp index 6d3ddedd51..9fb6293b74 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.cpp @@ -172,7 +172,7 @@ namespace AzToolsFramework } } - bool InstanceToTemplatePropagator::PatchTemplate(PrefabDomValue& providedPatch, TemplateId templateId) + bool InstanceToTemplatePropagator::PatchTemplate(PrefabDomValue& providedPatch, TemplateId templateId, InstanceOptionalReference instanceToExclude) { PrefabDom& templateDomReference = m_prefabSystemComponentInterface->FindTemplateDom(templateId); @@ -184,7 +184,7 @@ namespace AzToolsFramework if (result.GetOutcome() == AZ::JsonSerializationResult::Outcomes::Success) { m_prefabSystemComponentInterface->SetTemplateDirtyFlag(templateId, true); - m_prefabSystemComponentInterface->PropagateTemplateChanges(templateId); + m_prefabSystemComponentInterface->PropagateTemplateChanges(templateId, instanceToExclude); return true; } else diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.h index 9a6aad8ac1..358494091d 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceToTemplatePropagator.h @@ -37,7 +37,7 @@ namespace AzToolsFramework InstanceOptionalReference GetTopMostInstanceInHierarchy(AZ::EntityId entityId); - bool PatchTemplate(PrefabDomValue& providedPatch, TemplateId templateId) override; + bool PatchTemplate(PrefabDomValue& providedPatch, TemplateId templateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) override; void ApplyPatchesToInstance(const AZ::EntityId& entityId, PrefabDom& patches, const Instance& instanceToAddPatches) override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp index 6194adf784..b7a81a7f0c 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.cpp @@ -56,7 +56,7 @@ namespace AzToolsFramework AZ::Interface::Unregister(this); } - void InstanceUpdateExecutor::AddTemplateInstancesToQueue(TemplateId instanceTemplateId) + void InstanceUpdateExecutor::AddTemplateInstancesToQueue(TemplateId instanceTemplateId, InstanceOptionalReference instanceToExclude) { auto findInstancesResult = m_templateInstanceMapperInterface->FindInstancesOwnedByTemplate(instanceTemplateId); @@ -70,9 +70,18 @@ namespace AzToolsFramework return; } + Instance* instanceToExcludePtr = nullptr; + if (instanceToExclude.has_value()) + { + instanceToExcludePtr = &(instanceToExclude->get()); + } + for (auto instance : findInstancesResult->get()) { - m_instancesUpdateQueue.emplace_back(instance); + if (instance != instanceToExcludePtr) + { + m_instancesUpdateQueue.emplace_back(instance); + } } } @@ -103,7 +112,7 @@ namespace AzToolsFramework EntityIdList selectedEntityIds; ToolsApplicationRequestBus::BroadcastResult(selectedEntityIds, &ToolsApplicationRequests::GetSelectedEntities); - ToolsApplicationRequestBus::Broadcast(&ToolsApplicationRequests::SetSelectedEntities, EntityIdList()); + PrefabDom instanceDomFromRootDocument; // Process all instances in the queue, capped to the batch size. // Even though we potentially initialized the batch size to the queue, it's possible for the queue size to shrink @@ -148,13 +157,62 @@ namespace AzToolsFramework continue; } - Template& currentTemplate = currentTemplateReference->get(); Instance::EntityList newEntities; - if (PrefabDomUtils::LoadInstanceFromPrefabDom(*instanceToUpdate, newEntities, currentTemplate.GetPrefabDom())) + + // Climb up to the root of the instance hierarchy from this instance + InstanceOptionalConstReference rootInstance = *instanceToUpdate; + AZStd::vector pathOfInstances; + + while (rootInstance->get().GetParentInstance() != AZStd::nullopt) { - // If a link was created for a nested instance before the changes were propagated, - // then we associate it correctly here - instanceToUpdate->GetNestedInstances([&](AZStd::unique_ptr& nestedInstance) { + pathOfInstances.emplace_back(rootInstance); + rootInstance = rootInstance->get().GetParentInstance(); + } + + AZStd::string aliasPathResult = ""; + for (auto instanceIter = pathOfInstances.rbegin(); instanceIter != pathOfInstances.rend(); ++instanceIter) + { + aliasPathResult.append("/Instances/"); + aliasPathResult.append((*instanceIter)->get().GetInstanceAlias()); + } + + PrefabDomPath rootPrefabDomPath(aliasPathResult.c_str()); + + PrefabDom& rootPrefabTemplateDom = + m_prefabSystemComponentInterface->FindTemplateDom(rootInstance->get().GetTemplateId()); + + auto instanceDomFromRootValue = rootPrefabDomPath.Get(rootPrefabTemplateDom); + if (!instanceDomFromRootValue) + { + AZ_Assert( + false, + "InstanceUpdateExecutor::UpdateTemplateInstancesInQueue - " + "Could not load Instance DOM from the top level ancestor's DOM."); + + isUpdateSuccessful = false; + continue; + } + + PrefabDomValueReference instanceDomFromRoot = *instanceDomFromRootValue; + if (!instanceDomFromRoot.has_value()) + { + AZ_Assert( + false, + "InstanceUpdateExecutor::UpdateTemplateInstancesInQueue - " + "Could not load Instance DOM from the top level ancestor's DOM."); + + isUpdateSuccessful = false; + continue; + } + + // If a link was created for a nested instance before the changes were propagated, + // then we associate it correctly here + instanceDomFromRootDocument.CopyFrom(instanceDomFromRoot->get(), instanceDomFromRootDocument.GetAllocator()); + if (PrefabDomUtils::LoadInstanceFromPrefabDom(*instanceToUpdate, newEntities, instanceDomFromRootDocument)) + { + Template& currentTemplate = currentTemplateReference->get(); + instanceToUpdate->GetNestedInstances([&](AZStd::unique_ptr& nestedInstance) + { if (nestedInstance->GetLinkId() != InvalidLinkId) { return; @@ -179,22 +237,11 @@ namespace AzToolsFramework AzToolsFramework::EditorEntityContextRequestBus::Broadcast( &AzToolsFramework::EditorEntityContextRequests::HandleEntitiesAdded, newEntities); } - else - { - AZ_Error( - "Prefab", false, - "InstanceUpdateExecutor::UpdateTemplateInstancesInQueue - " - "Could not load Instance from Prefab DOM of Template with Id '%llu' on file path '%s'.", - currentTemplateId, currentTemplate.GetFilePath().c_str()); - - isUpdateSuccessful = false; - } } - 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. + // Since entities get recreated during propagation, we need to check whether the entities + // corresponding to the list of selected entity ids are present or not. AZ::Entity* entity = GetEntityById(*entityIdIterator); if (entity == nullptr) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.h index fa13c34b98..a3fdd019c2 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutor.h @@ -35,7 +35,7 @@ namespace AzToolsFramework explicit InstanceUpdateExecutor(int instanceCountToUpdateInBatch = 0); - void AddTemplateInstancesToQueue(TemplateId instanceTemplateId) override; + void AddTemplateInstancesToQueue(TemplateId instanceTemplateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) override; bool UpdateTemplateInstancesInQueue() override; virtual void RemoveTemplateInstanceFromQueue(const Instance* instance) override; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutorInterface.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutorInterface.h index d794c4929d..2454a995cf 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutorInterface.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/Instance/InstanceUpdateExecutorInterface.h @@ -27,7 +27,7 @@ namespace AzToolsFramework virtual ~InstanceUpdateExecutorInterface() = default; // Add all Instances of Template with given Id into a queue for updating them later. - virtual void AddTemplateInstancesToQueue(TemplateId instanceTemplateId) = 0; + virtual void AddTemplateInstancesToQueue(TemplateId instanceTemplateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) = 0; // Update Instances in the waiting queue. virtual bool UpdateTemplateInstancesInQueue() = 0; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp index 4656dcf48f..fcdbc5ce07 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.cpp @@ -242,11 +242,13 @@ namespace AzToolsFramework m_instanceToTemplateInterface->GenerateDomForEntity(containerAfterReset, *containerEntity); // Update the state of the entity - PrefabUndoEntityUpdate* state = aznew PrefabUndoEntityUpdate(AZStd::to_string(static_cast(containerEntityId))); - state->SetParent(undoBatch.GetUndoBatch()); - state->Capture(containerBeforeReset, containerAfterReset, containerEntityId); + auto templateId = instanceToCreate->get().GetTemplateId(); - state->Redo(); + PrefabDom transformPatch; + m_instanceToTemplateInterface->GeneratePatch(transformPatch, containerBeforeReset, containerAfterReset); + m_instanceToTemplateInterface->AppendEntityAliasToPatchPaths(transformPatch, containerEntityId); + + m_instanceToTemplateInterface->PatchTemplate(transformPatch, templateId); } // This clears any entities marked as dirty due to reparenting of entities during the process of creating a prefab. @@ -661,12 +663,12 @@ namespace AzToolsFramework else { Internal_HandleContainerOverride( - parentUndoBatch, entityId, patch, owningInstance->get().GetLinkId()); + parentUndoBatch, entityId, patch, owningInstance->get().GetLinkId(), owningInstance->get().GetParentInstance()); } } else { - Internal_HandleEntityChange(parentUndoBatch, entityId, beforeState, afterState); + Internal_HandleEntityChange(parentUndoBatch, entityId, beforeState, afterState, owningInstance); if (isNewParentOwnedByDifferentInstance) { @@ -679,25 +681,27 @@ namespace AzToolsFramework } void PrefabPublicHandler::Internal_HandleContainerOverride( - UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, const PrefabDom& patch, const LinkId linkId) + UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, const PrefabDom& patch, + const LinkId linkId, InstanceOptionalReference parentInstance) { // Save these changes as patches to the link PrefabUndoLinkUpdate* linkUpdate = aznew PrefabUndoLinkUpdate(AZStd::to_string(static_cast(entityId))); linkUpdate->SetParent(undoBatch); linkUpdate->Capture(patch, linkId); - linkUpdate->Redo(); + linkUpdate->Redo(parentInstance); } void PrefabPublicHandler::Internal_HandleEntityChange( - UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, PrefabDom& beforeState, PrefabDom& afterState) + UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, PrefabDom& beforeState, + PrefabDom& afterState, InstanceOptionalReference instance) { // Update the state of the entity PrefabUndoEntityUpdate* state = aznew PrefabUndoEntityUpdate(AZStd::to_string(static_cast(entityId))); state->SetParent(undoBatch); state->Capture(beforeState, afterState, entityId); - state->Redo(); + state->Redo(instance); } void PrefabPublicHandler::Internal_HandleInstanceChange( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h index 167791d1c1..f3d778d8de 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabPublicHandler.h @@ -162,9 +162,11 @@ namespace AzToolsFramework InstanceOptionalConstReference instance, const AZStd::unordered_set& templateSourcePaths); static void Internal_HandleContainerOverride( - UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, const PrefabDom& patch, const LinkId linkId); + UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, const PrefabDom& patch, + const LinkId linkId, InstanceOptionalReference parentInstance = AZStd::nullopt); static void Internal_HandleEntityChange( - UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, PrefabDom& beforeState, PrefabDom& afterState); + UndoSystem::URSequencePoint* undoBatch, AZ::EntityId entityId, PrefabDom& beforeState, + PrefabDom& afterState, InstanceOptionalReference instance = AZStd::nullopt); void Internal_HandleInstanceChange(UndoSystem::URSequencePoint* undoBatch, AZ::Entity* entity, AZ::EntityId beforeParentId, AZ::EntityId afterParentId); void UpdateLinkPatchesWithNewEntityAliases( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp index 5f5564b4e1..ab77d53283 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.cpp @@ -141,8 +141,10 @@ namespace AzToolsFramework return newInstance; } - void PrefabSystemComponent::PropagateTemplateChanges(TemplateId templateId) + void PrefabSystemComponent::PropagateTemplateChanges(TemplateId templateId, InstanceOptionalReference instanceToExclude) { + UpdatePrefabInstances(templateId, instanceToExclude); + auto templateIdToLinkIdsIterator = m_templateToLinkIdsMap.find(templateId); if (templateIdToLinkIdsIterator != m_templateToLinkIdsMap.end()) { @@ -153,10 +155,6 @@ namespace AzToolsFramework templateIdToLinkIdsIterator->second.end())); UpdateLinkedInstances(linkIdsToUpdateQueue); } - else - { - UpdatePrefabInstances(templateId); - } } void PrefabSystemComponent::UpdatePrefabTemplate(TemplateId templateId, const PrefabDom& updatedDom) @@ -174,9 +172,9 @@ namespace AzToolsFramework } } - void PrefabSystemComponent::UpdatePrefabInstances(const TemplateId& templateId) + void PrefabSystemComponent::UpdatePrefabInstances(const TemplateId& templateId, InstanceOptionalReference instanceToExclude) { - m_instanceUpdateExecutor.AddTemplateInstancesToQueue(templateId); + m_instanceUpdateExecutor.AddTemplateInstancesToQueue(templateId, instanceToExclude); } void PrefabSystemComponent::UpdateLinkedInstances(AZStd::queue& linkIdsQueue) @@ -250,8 +248,6 @@ namespace AzToolsFramework if (targetTemplateIdToLinkIdMap[targetTemplateId].first.empty() && targetTemplateIdToLinkIdMap[targetTemplateId].second) { - UpdatePrefabInstances(targetTemplateId); - auto templateToLinkIter = m_templateToLinkIdsMap.find(targetTemplateId); if (templateToLinkIter != m_templateToLinkIdsMap.end()) { diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.h index 0a9a450f64..a5170b8eef 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponent.h @@ -215,14 +215,14 @@ namespace AzToolsFramework */ void UpdatePrefabTemplate(TemplateId templateId, const PrefabDom& updatedDom) override; - void PropagateTemplateChanges(TemplateId templateId) override; + void PropagateTemplateChanges(TemplateId templateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) override; /** * Updates all Instances owned by a Template. * * @param templateId The id of the Template owning Instances to update. */ - void UpdatePrefabInstances(const TemplateId& templateId); + void UpdatePrefabInstances(const TemplateId& templateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt); private: AZ_DISABLE_COPY_MOVE(PrefabSystemComponent); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponentInterface.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponentInterface.h index f47941254a..8daf4e731b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponentInterface.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabSystemComponentInterface.h @@ -56,7 +56,7 @@ namespace AzToolsFramework virtual PrefabDom& FindTemplateDom(TemplateId templateId) = 0; virtual void UpdatePrefabTemplate(TemplateId templateId, const PrefabDom& updatedDom) = 0; - virtual void PropagateTemplateChanges(TemplateId templateId) = 0; + virtual void PropagateTemplateChanges(TemplateId templateId, InstanceOptionalReference instanceToExclude = AZStd::nullopt) = 0; virtual AZStd::unique_ptr InstantiatePrefab(AZ::IO::PathView filePath) = 0; virtual AZStd::unique_ptr InstantiatePrefab(const TemplateId& templateId) = 0; diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp index aadcdcdea0..d0b3426495 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.cpp @@ -70,10 +70,10 @@ namespace AzToolsFramework const AZ::EntityId& entityId) { //get the entity alias for future undo/redo - InstanceOptionalReference instanceOptionalReference = m_instanceEntityMapperInterface->FindOwningInstance(entityId); - AZ_Error("Prefab", instanceOptionalReference, + auto instanceReference = m_instanceEntityMapperInterface->FindOwningInstance(entityId); + AZ_Error("Prefab", instanceReference, "Failed to find an owning instance for the entity with id %llu.", static_cast(entityId)); - Instance& instance = instanceOptionalReference->get(); + Instance& instance = instanceReference->get(); m_templateId = instance.GetTemplateId(); m_entityAlias = (instance.GetEntityAlias(entityId)).value(); @@ -106,6 +106,17 @@ namespace AzToolsFramework m_templateId); } + void PrefabUndoEntityUpdate::Redo(InstanceOptionalReference instanceToExclude) + { + [[maybe_unused]] bool isPatchApplicationSuccessful = + m_instanceToTemplateInterface->PatchTemplate(m_redoPatch, m_templateId, instanceToExclude); + + AZ_Error( + "Prefab", isPatchApplicationSuccessful, + "Applying the patch on the entity with alias '%s' in template with id '%llu' was unsuccessful", m_entityAlias.c_str(), + m_templateId); + } + //PrefabInstanceLinkUndo PrefabUndoInstanceLink::PrefabUndoInstanceLink(const AZStd::string& undoOperationName) : PrefabUndoBase(undoOperationName) @@ -290,7 +301,12 @@ namespace AzToolsFramework UpdateLink(m_linkDomNext); } - void PrefabUndoLinkUpdate::UpdateLink(PrefabDom& linkDom) + void PrefabUndoLinkUpdate::Redo(InstanceOptionalReference instanceToExclude) + { + UpdateLink(m_linkDomNext, instanceToExclude); + } + + void PrefabUndoLinkUpdate::UpdateLink(PrefabDom& linkDom, InstanceOptionalReference instanceToExclude) { LinkReference link = m_prefabSystemComponentInterface->FindLink(m_linkId); @@ -304,7 +320,7 @@ namespace AzToolsFramework //propagate the link changes link->get().UpdateTarget(); - m_prefabSystemComponentInterface->PropagateTemplateChanges(link->get().GetTargetTemplateId()); + m_prefabSystemComponentInterface->PropagateTemplateChanges(link->get().GetTargetTemplateId(), instanceToExclude); //mark as dirty m_prefabSystemComponentInterface->SetTemplateDirtyFlag(link->get().GetTargetTemplateId(), true); diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h index 33d9e5ad33..7ae677571a 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabUndo.h @@ -71,11 +71,12 @@ namespace AzToolsFramework void Capture( PrefabDom& initialState, - PrefabDom& endState, - const AZ::EntityId& entity); + PrefabDom& endState, const AZ::EntityId& entity); void Undo() override; void Redo() override; + //! Overload to allow to apply the change, but prevent instanceToExclude from being refreshed. + void Redo(InstanceOptionalReference instanceToExclude); private: InstanceEntityMapperInterface* m_instanceEntityMapperInterface = nullptr; @@ -139,9 +140,11 @@ namespace AzToolsFramework void Undo() override; void Redo() override; + //! Overload to allow to apply the change, but prevent instanceToExclude from being refreshed. + void Redo(InstanceOptionalReference instanceToExclude); private: - void UpdateLink(PrefabDom& linkDom); + void UpdateLink(PrefabDom& linkDom, InstanceOptionalReference instanceToExclude = AZStd::nullopt); LinkId m_linkId; PrefabDom m_linkDomNext; //data for delete/update diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp index 8ed488b010..308f0f074f 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/Viewport/EditorContextMenu.cpp @@ -62,7 +62,8 @@ namespace AzToolsFramework if (!contextMenu.m_menu->isEmpty()) { - contextMenu.m_menu->exec(QCursor::pos()); + // Use popup instead of exec; this avoids blocking input event processing while the menu dialog is active + contextMenu.m_menu->popup(QCursor::pos()); } } } diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp index fee0267766..eadb870563 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ViewportSelection/EditorTransformComponentSelection.cpp @@ -2240,42 +2240,31 @@ namespace AzToolsFramework RegenerateManipulators(); }); - bool isPrefabSystemEnabled = false; - AzFramework::ApplicationRequests::Bus::BroadcastResult( - isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled); + // duplicate selection + AddAction( + m_actions, { QKeySequence(Qt::CTRL + Qt::Key_D) }, + /*ID_EDIT_CLONE =*/33525, s_duplicateTitle, s_duplicateDesc, + []() + { + AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); - bool prefabWipFeaturesEnabled = false; - AzFramework::ApplicationRequests::Bus::BroadcastResult( - prefabWipFeaturesEnabled, &AzFramework::ApplicationRequests::ArePrefabWipFeaturesEnabled); - - if (!isPrefabSystemEnabled || (isPrefabSystemEnabled && prefabWipFeaturesEnabled)) - { - // duplicate selection - AddAction( - m_actions, { QKeySequence(Qt::CTRL + Qt::Key_D) }, - /*ID_EDIT_CLONE =*/33525, s_duplicateTitle, s_duplicateDesc, - []() + // Clear Widget selection - Prevents issues caused by cloning entities while a property in the Reflected Property Editor + // is being edited. + if (QApplication::focusWidget()) { - AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzToolsFramework); + QApplication::focusWidget()->clearFocus(); + } - // Clear Widget selection - Prevents issues caused by cloning entities while a property in the Reflected Property Editor - // is being edited. - if (QApplication::focusWidget()) - { - QApplication::focusWidget()->clearFocus(); - } + ScopedUndoBatch undoBatch(s_duplicateUndoRedoDesc); + auto selectionCommand = AZStd::make_unique(EntityIdList(), s_duplicateUndoRedoDesc); + selectionCommand->SetParent(undoBatch.GetUndoBatch()); + selectionCommand.release(); - ScopedUndoBatch undoBatch(s_duplicateUndoRedoDesc); - auto selectionCommand = AZStd::make_unique(EntityIdList(), s_duplicateUndoRedoDesc); - selectionCommand->SetParent(undoBatch.GetUndoBatch()); - selectionCommand.release(); + bool handled = false; + EditorRequestBus::Broadcast(&EditorRequests::CloneSelection, handled); - bool handled = false; - EditorRequestBus::Broadcast(&EditorRequests::CloneSelection, handled); - - // selection update handled in AfterEntitySelectionChanged - }); - } + // selection update handled in AfterEntitySelectionChanged + }); // delete selection AddAction( diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake index 8d0180f6ce..e5ac1f9693 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake @@ -11,7 +11,6 @@ set(FILES AzToolsFramework_precompiled.h - AzToolsFramework_precompiled.cpp AssetEditor/AssetEditorBus.h AssetEditor/AssetEditorToolbar.ui AssetEditor/AssetEditorStatusBar.ui diff --git a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp index 0cf39a3572..458625fa3f 100644 --- a/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp +++ b/Code/Framework/AzToolsFramework/Tests/Prefab/PrefabEntityAliasTests.cpp @@ -242,6 +242,7 @@ namespace UnitTest // Patch the nested prefab to reference an entity in its parent ASSERT_TRUE(m_instanceToTemplateInterface->PatchEntityInTemplate(patch, newEntity->GetId())); + m_instanceUpdateExecutorInterface->AddTemplateInstancesToQueue(rootInstance->GetTemplateId()); m_instanceUpdateExecutorInterface->UpdateTemplateInstancesInQueue(); // Using the aliases we saved grab the updated entities so we can verify the entity reference is still preserved diff --git a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp index 8f6e927a84..39c7ae43fd 100644 --- a/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp +++ b/Code/Sandbox/Editor/Core/LevelEditorMenuHandler.cpp @@ -473,18 +473,8 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe // editMenu->addAction(ID_EDIT_PASTE); // editMenu.AddSeparator(); - bool isPrefabSystemEnabled = false; - AzFramework::ApplicationRequests::Bus::BroadcastResult(isPrefabSystemEnabled, &AzFramework::ApplicationRequests::IsPrefabSystemEnabled); - - bool prefabWipFeaturesEnabled = false; - AzFramework::ApplicationRequests::Bus::BroadcastResult( - prefabWipFeaturesEnabled, &AzFramework::ApplicationRequests::ArePrefabWipFeaturesEnabled); - - if (!isPrefabSystemEnabled || (isPrefabSystemEnabled && prefabWipFeaturesEnabled)) - { - // Duplicate - editMenu.AddAction(ID_EDIT_CLONE); - } + // Duplicate + editMenu.AddAction(ID_EDIT_CLONE); // Delete editMenu.AddAction(ID_EDIT_DELETE); @@ -912,6 +902,12 @@ QAction* LevelEditorMenuHandler::CreateViewPaneAction(const QtViewPane* view) action = new QAction(menuText, this); action->setObjectName(view->m_name); action->setCheckable(true); + + if (view->m_options.showOnToolsToolbar) + { + action->setIcon(QIcon(view->m_options.toolbarIcon)); + } + m_actionManager->AddAction(view->m_id, action); if (!view->m_options.shortcut.isEmpty()) @@ -941,6 +937,11 @@ QAction* LevelEditorMenuHandler::CreateViewPaneMenuItem( menu->addAction(action); + if (view->m_options.showOnToolsToolbar) + { + m_mainWindow->GetToolbarManager()->AddButtonToEditToolbar(action); + } + return action; } diff --git a/Code/Sandbox/Editor/InfoBar.cpp b/Code/Sandbox/Editor/InfoBar.cpp deleted file mode 100644 index 14ef2e7f05..0000000000 --- a/Code/Sandbox/Editor/InfoBar.cpp +++ /dev/null @@ -1,394 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "EditorDefs.h" - -#include "InfoBar.h" - -// Editor -#include "MainWindow.h" -#include "DisplaySettings.h" -#include "GameEngine.h" -#include "Include/ITransformManipulator.h" -#include "ActionManager.h" -#include "Settings.h" -#include "Include/IObjectManager.h" -#include "MathConversion.h" - -AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING -#include -AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING - -#include - -#include - -void BeautifyEulerAngles(Vec3& v) -{ - if (v.x + v.y + v.z >= 360.0f) - { - v.x = 180.0f - v.x; - v.y = 180.0f - v.y; - v.z = 180.0f - v.z; - } -} - -///////////////////////////////////////////////////////////////////////////// -// CInfoBar dialog -CInfoBar::CInfoBar(QWidget* parent) - : QWidget(parent) - , ui(new Ui::CInfoBar) -{ - ui->setupUi(this); - - m_bSelectionChanged = false; - m_bDragMode = false; - m_prevMoveSpeed = 0; - m_currValue = Vec3(-111, +222, -333); //this wasn't initialized. I don't know what a good value is - m_oldMainVolume = 1.0f; - - GetIEditor()->RegisterNotifyListener(this); - - //audio request setup - m_oMuteAudioRequest.pData = &m_oMuteAudioRequestData; - m_oUnmuteAudioRequest.pData = &m_oUnmuteAudioRequestData; - - OnInitDialog(); - - auto comboBoxTextChanged = static_cast(&QComboBox::currentTextChanged); - connect(ui->m_moveSpeed, comboBoxTextChanged, this, &CInfoBar::OnUpdateMoveSpeedText); - connect(ui->m_moveSpeed->lineEdit(), &QLineEdit::returnPressed, this, &CInfoBar::OnSpeedComboBoxEnter); - - // Hide some buttons from the expander menu - AzQtComponents::Style::addClass(ui->m_physDoStepBtn, "expanderMenu_hide"); - AzQtComponents::Style::addClass(ui->m_physSingleStepBtn, "expanderMenu_hide"); - - connect(ui->m_physicsBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedPhysics); - connect(ui->m_physSingleStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSingleStepPhys); - connect(ui->m_physDoStepBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedDoStepPhys); - connect(ui->m_syncPlayerBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedSyncplayer); - connect(ui->m_gotoPos, &QToolButton::clicked, this, &CInfoBar::OnBnClickedGotoPosition); - connect(ui->m_muteBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedMuteAudio); - connect(ui->m_vrBtn, &QToolButton::clicked, this, &CInfoBar::OnBnClickedEnableVR); - - connect(this, &CInfoBar::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered); - - connect(ui->m_physicsBtn, &QAbstractButton::toggled, ui->m_physicsBtn, [this](bool checked) { - ui->m_physicsBtn->setToolTip(checked ? tr("Stop Simulation (Ctrl+P)") : tr("Simulate (Ctrl+P)")); - }); - connect(ui->m_physSingleStepBtn, &QAbstractButton::toggled, ui->m_physSingleStepBtn, [this](bool checked) { - ui->m_physSingleStepBtn->setToolTip(checked ? tr("Disable Physics/AI Single-step Mode ('<' in Game Mode)") : tr("Enable Physics/AI Single-step Mode ('<' in Game Mode)")); - }); - connect(ui->m_syncPlayerBtn, &QAbstractButton::toggled, ui->m_syncPlayerBtn, [this](bool checked) { - ui->m_syncPlayerBtn->setToolTip(checked ? tr("Synchronize Player with Camera") : tr("Move Player and Camera Separately")); - }); - connect(ui->m_muteBtn, &QAbstractButton::toggled, ui->m_muteBtn, [this](bool checked) { - ui->m_muteBtn->setToolTip(checked ? tr("Un-mute Audio") : tr("Mute Audio")); - }); - connect(ui->m_vrBtn, &QAbstractButton::toggled, ui->m_vrBtn, [this](bool checked) { - ui->m_vrBtn->setToolTip(checked ? tr("Disable VR Preview") : tr("Enable VR Preview")); - }); - - ui->m_moveSpeed->setValidator(new QDoubleValidator(m_minSpeed, m_maxSpeed, m_numDecimals, ui->m_moveSpeed)); - - // Save off the move speed here since setting up the combo box can cause it to update values in the background. - float cameraMoveSpeed = gSettings.cameraMoveSpeed; - - // Populate the presets in the ComboBox - for (float presetValue : m_speedPresetValues) - { - ui->m_moveSpeed->addItem(QString().setNum(presetValue, 'f', m_numDecimals), presetValue); - } - - SetSpeedComboBox(cameraMoveSpeed); - - ui->m_moveSpeed->setInsertPolicy(QComboBox::NoInsert); - - using namespace AzToolsFramework::ComponentModeFramework; - EditorComponentModeNotificationBus::Handler::BusConnect(AzToolsFramework::GetEntityContextId()); -} - -////////////////////////////////////////////////////////////////////////// -CInfoBar::~CInfoBar() -{ - using namespace AzToolsFramework::ComponentModeFramework; - EditorComponentModeNotificationBus::Handler::BusDisconnect(); - - GetIEditor()->UnregisterNotifyListener(this); - - AZ::VR::VREventBus::Handler::BusDisconnect(); -} - -////////////////////////////////////////////////////////////////////////// -void CInfoBar::OnEditorNotifyEvent(EEditorNotifyEvent event) -{ - if (event == eNotify_OnIdleUpdate) - { - IdleUpdate(); - } - else if (event == eNotify_OnBeginGameMode || event == eNotify_OnEndGameMode) - { - // Audio: determine muted state of audio - //m_bMuted = gEnv->pAudioSystem->GetMainVolume() == 0.f; - ui->m_muteBtn->setChecked(gSettings.bMuteAudio); - } - else if (event == eNotify_OnBeginLoad || event == eNotify_OnCloseScene) - { - // make sure AI/Physics is disabled on level load (CE-4229) - if (GetIEditor()->GetGameEngine()->GetSimulationMode()) - { - OnBnClickedPhysics(); - } - - ui->m_physicsBtn->setEnabled(false); - ui->m_physSingleStepBtn->setEnabled(false); - ui->m_physDoStepBtn->setEnabled(false); - } - else if (event == eNotify_OnEndLoad || event == eNotify_OnEndNewScene) - { - ui->m_physicsBtn->setEnabled(true); - ui->m_physSingleStepBtn->setEnabled(true); - ui->m_physDoStepBtn->setEnabled(true); - } - else if (event == eNotify_OnSelectionChange) - { - m_bSelectionChanged = true; - } -} - -void CInfoBar::IdleUpdate() -{ - if (!m_idleUpdateEnabled) - { - return; - } - - bool updateUI = false; - // Update Width/Height of selection rectangle. - AABB box; - GetIEditor()->GetSelectedRegion(box); - float width = box.max.x - box.min.x; - float height = box.max.y - box.min.y; - if (m_width != width || m_height != height) - { - m_width = width; - m_height = height; - updateUI = true; - } - - Vec3 marker = GetIEditor()->GetMarkerPosition(); - - int selectedEntitiesCount = 0; - AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult( - selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount); - if (selectedEntitiesCount != m_numSelected) - { - m_numSelected = selectedEntitiesCount; - updateUI = true; - } - - QString str; - if (updateUI) - { - if (m_numSelected == 0) - { - str = tr("None Selected"); - } - else if (m_numSelected == 1) - { - str = tr("1 Object Selected"); - } - else - { - str = tr("%1 Objects Selected").arg(m_numSelected); - } - - ui->m_statusText->setText(str); - m_sLastText = str; - } - - if (gSettings.cameraMoveSpeed != m_prevMoveSpeed && - !ui->m_moveSpeed->lineEdit()->hasFocus()) - { - m_prevMoveSpeed = gSettings.cameraMoveSpeed; - SetSpeedComboBox(gSettings.cameraMoveSpeed); - } - - { - bool bPhysics = GetIEditor()->GetGameEngine()->GetSimulationMode(); - if ((ui->m_physicsBtn->isChecked() && !bPhysics) || - (!ui->m_physicsBtn->isChecked() && bPhysics)) - { - ui->m_physicsBtn->setChecked(bPhysics); - } - - // Unsupported for Phyics:: atm - bool bSingleStep = false; - if (ui->m_physSingleStepBtn->isChecked() != bSingleStep) - { - ui->m_physSingleStepBtn->setChecked(bSingleStep); - } - - bool bSyncPlayer = GetIEditor()->GetGameEngine()->IsSyncPlayerPosition(); - if ((!ui->m_syncPlayerBtn->isChecked() && !bSyncPlayer) || - (ui->m_syncPlayerBtn->isChecked() && bSyncPlayer)) - { - ui->m_syncPlayerBtn->setChecked(!bSyncPlayer); - } - } - - // if our selection changed, or if our display values are out of date - if (m_bSelectionChanged) - { - m_bSelectionChanged = false; - } -} - -inline double Round(double fVal, double fStep) -{ - if (fStep > 0.f) - { - fVal = int_round(fVal / fStep) * fStep; - } - return fVal; -} - -void CInfoBar::OnUpdateMoveSpeedText(const QString& text) -{ - gSettings.cameraMoveSpeed = aznumeric_cast(Round(text.toDouble(), m_speedStep)); -} - -void CInfoBar::OnSpeedComboBoxEnter() -{ - ui->m_moveSpeed->clearFocus(); -} - -void CInfoBar::OnInitDialog() -{ - QFontMetrics metrics({}); - int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier; - - ui->m_moveSpeed->setFixedWidth(width); - - ui->m_physicsBtn->setEnabled(false); - ui->m_physSingleStepBtn->setEnabled(false); - ui->m_physDoStepBtn->setEnabled(false); - - ui->m_muteBtn->setChecked(gSettings.bMuteAudio); - Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest); - - //This is here just in case this class hasn't been created before - //a VR headset was initialized - ui->m_vrBtn->setEnabled(false); - if (AZ::VR::HMDDeviceRequestBus::GetTotalNumOfEventHandlers() != 0) - { - ui->m_vrBtn->setEnabled(true); - } - - AZ::VR::VREventBus::Handler::BusConnect(); -} - -void CInfoBar::OnHMDInitialized() -{ - ui->m_vrBtn->setEnabled(true); -} - -void CInfoBar::OnHMDShutdown() -{ - ui->m_vrBtn->setEnabled(false); -} - -void CInfoBar::OnBnClickedTerrainCollision() -{ - emit ActionTriggered(ID_TERRAIN_COLLISION); -} - -void CInfoBar::OnBnClickedPhysics() -{ - if (!ui->m_physicsBtn->isEnabled()) - { - return; - } - - bool bPhysics = GetIEditor()->GetGameEngine()->GetSimulationMode(); - ui->m_physicsBtn->setChecked(bPhysics); - emit ActionTriggered(ID_SWITCH_PHYSICS); - - if (bPhysics && ui->m_physSingleStepBtn->isChecked()) - { - OnBnClickedSingleStepPhys(); - } -} - -void CInfoBar::OnBnClickedSingleStepPhys() -{ -} - -void CInfoBar::OnBnClickedDoStepPhys() -{ -} - -////////////////////////////////////////////////////////////////////////// -void CInfoBar::OnBnClickedSyncplayer() -{ - emit ActionTriggered(ID_GAME_SYNCPLAYER); -} - -////////////////////////////////////////////////////////////////////////// -void CInfoBar::OnBnClickedGotoPosition() -{ - emit ActionTriggered(ID_DISPLAY_GOTOPOSITION); -} - -////////////////////////////////////////////////////////////////////////// -void CInfoBar::OnBnClickedMuteAudio() -{ - gSettings.bMuteAudio = !gSettings.bMuteAudio; - - Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest); - - ui->m_muteBtn->setChecked(gSettings.bMuteAudio); -} - -void CInfoBar::OnBnClickedEnableVR() -{ - gSettings.bEnableGameModeVR = !gSettings.bEnableGameModeVR; - ui->m_vrBtn->setChecked(gSettings.bEnableGameModeVR); -} - -void CInfoBar::EnteredComponentMode(const AZStd::vector& /*componentModeTypes*/) -{ - ui->m_physicsBtn->setDisabled(true); -} - -void CInfoBar::LeftComponentMode(const AZStd::vector& /*componentModeTypes*/) -{ - ui->m_physicsBtn->setEnabled(true); -} - -void CInfoBar::SetSpeedComboBox(double value) -{ - value = AZStd::clamp(Round(value, m_speedStep), m_minSpeed, m_maxSpeed); - - int index = ui->m_moveSpeed->findData(value); - if (index != -1) - { - ui->m_moveSpeed->setCurrentIndex(index); - } - else - { - ui->m_moveSpeed->lineEdit()->setText(QString().setNum(value, 'f', m_numDecimals)); - } -} - -#include diff --git a/Code/Sandbox/Editor/InfoBar.h b/Code/Sandbox/Editor/InfoBar.h deleted file mode 100644 index 6e547d46c6..0000000000 --- a/Code/Sandbox/Editor/InfoBar.h +++ /dev/null @@ -1,121 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#ifndef CRYINCLUDE_EDITOR_INFOBAR_H -#define CRYINCLUDE_EDITOR_INFOBAR_H - -#pragma once -// InfoBar.h : header file -// - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#endif - -///////////////////////////////////////////////////////////////////////////// -// CInfoBar dialog - -namespace Ui { - class CInfoBar; -} - -class CInfoBar - : public QWidget - , public IEditorNotifyListener - , public AZ::VR::VREventBus::Handler - , private AzToolsFramework::ComponentModeFramework::EditorComponentModeNotificationBus::Handler -{ - Q_OBJECT - - // Construction -public: - CInfoBar(QWidget* parent = nullptr); - ~CInfoBar(); - - // Toggle the mute audio button - void ToggleAudio() { OnBnClickedMuteAudio(); } - void SetSpeedComboBox(double value); - -Q_SIGNALS: - void ActionTriggered(int command); - - // Implementation -protected: - void IdleUpdate(); - virtual void OnEditorNotifyEvent(EEditorNotifyEvent event); - - virtual void OnOK() {}; - virtual void OnCancel() {}; - - void OnBnClickedSyncplayer(); - void OnBnClickedGotoPosition(); - - void OnSpeedComboBoxEnter(); - void OnUpdateMoveSpeedText(const QString&); - void OnBnClickedTerrainCollision(); - void OnBnClickedPhysics(); - void OnBnClickedSingleStepPhys(); - void OnBnClickedDoStepPhys(); - void OnBnClickedMuteAudio(); - void OnBnClickedEnableVR(); - void OnInitDialog(); - - ////////////////////////////////////////////////////////////////////////// - /// VR Event Bus Implementation - ////////////////////////////////////////////////////////////////////////// - void OnHMDInitialized() override; - void OnHMDShutdown() override; - ////////////////////////////////////////////////////////////////////////// - - // EditorComponentModeNotificationBus - void EnteredComponentMode(const AZStd::vector& componentModeTypes) override; - void LeftComponentMode(const AZStd::vector& componentModeTypes) override; - - float m_width, m_height; - //int m_heightMapX,m_heightMapY; - double m_fieldWidthMultiplier = 1.8; - - int m_numSelected; - float m_prevMoveSpeed; - - // Speed combobox/lineEdit settings - double m_minSpeed = 0.1; - double m_maxSpeed = 100.0; - double m_speedStep = 0.1; - int m_numDecimals = 1; - - // Speed presets - float m_speedPresetValues[3] = { 0.1f, 1.0f, 10.0f }; - - bool m_bSelectionChanged; - - bool m_bDragMode; - QString m_sLastText; - - Vec3 m_lastValue; - Vec3 m_currValue; - float m_oldMainVolume; - - Audio::SAudioRequest m_oMuteAudioRequest; - Audio::SAudioManagerRequestData m_oMuteAudioRequestData; - Audio::SAudioRequest m_oUnmuteAudioRequest; - Audio::SAudioManagerRequestData m_oUnmuteAudioRequestData; - - QScopedPointer ui; - - bool m_idleUpdateEnabled = true; -}; - -#endif // CRYINCLUDE_EDITOR_INFOBAR_H diff --git a/Code/Sandbox/Editor/InfoBar.ui b/Code/Sandbox/Editor/InfoBar.ui deleted file mode 100644 index 84207629df..0000000000 --- a/Code/Sandbox/Editor/InfoBar.ui +++ /dev/null @@ -1,333 +0,0 @@ - - - CInfoBar - - - - 0 - 0 - 1600 - 27 - - - - - 0 - 0 - - - - true - - - b - - - - 0 - - - QLayout::SetFixedSize - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - No Objects Selected - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Go to Position - - - Go to Position - - - - :/InfoBar/GotoLocation-default.svg:/InfoBar/GotoLocation-default.svg - - - - 22 - 18 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 1 - 18 - - - - - - - - Speed - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Camera Movement Speed - - - true - - - - - - - - 0 - 0 - - - - Synchronize Player with Camera - - - Synchronize Player with Camera - - - - :/InfoBar/NoPlayerSync-default.svg - :/InfoBar/NoPlayerSync-selected.svg - :/InfoBar/NoPlayerSync-default.svg - - - - 18 - 18 - - - - true - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 1 - 18 - - - - - - - - Simulate (Ctrl+P) - - - Simulate (Ctrl+P) - - - - :/InfoBar/PhysicsCol-default.svg:/InfoBar/PhysicsCol-default.svg - - - - 18 - 18 - - - - true - - - - - - - - 0 - 0 - - - - Enable Physics/AI Single-step Mode ('<' in Game Mode) - - - Enable Physics/AI Single-step Mode ('<' in Game Mode) - - - - :/InfoBar/Pause-default.svg:/InfoBar/Pause-default.svg - - - - 18 - 18 - - - - true - - - false - - - - - - - - 0 - 0 - - - - Perform a Single Physics/AI Simulation Step ('>' in Game Mode) - - - Perform a Single Physics/AI Simulation Step ('>' in Game Mode) - - - - :/InfoBar/PausePlay-default.svg:/InfoBar/PausePlay-default.svg - - - - 18 - 18 - - - - false - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 1 - 18 - - - - - - - - - 0 - 0 - - - - Mute Audio - - - Mute Audio - - - - :/InfoBar/Mute-default.svg:/InfoBar/Mute-default.svg - - - - 18 - 18 - - - - true - - - - - - - - 0 - 0 - - - - Enable VR Preview - - - Enable VR Preview - - - - :/InfoBar/VR-default.svg:/InfoBar/VR-default.svg - - - - 18 - 18 - - - - true - - - - - - - - - - diff --git a/Code/Sandbox/Editor/LayoutWnd.cpp b/Code/Sandbox/Editor/LayoutWnd.cpp index 54389f30c1..1de4d9584a 100644 --- a/Code/Sandbox/Editor/LayoutWnd.cpp +++ b/Code/Sandbox/Editor/LayoutWnd.cpp @@ -94,134 +94,12 @@ void CLayoutSplitter::CreateLayoutView(int row, int col, int id) viewPane->SetId(id); } -////////////////////////////////////////////////////////////////////////// -// InfoBarExpanderWatcher -////////////////////////////////////////////////////////////////////////// - -class InfoBarExpanderWatcher - : public QObject -{ -public: - InfoBarExpanderWatcher(QObject* parent = nullptr) - : QObject(parent) - { - } - - bool eventFilter(QObject* obj, QEvent* event) override - { - switch (event->type()) - { - case QEvent::MouseButtonPress: - case QEvent::MouseButtonRelease: - case QEvent::MouseButtonDblClick: - { - if (qobject_cast(obj)) - { - auto mouseEvent = static_cast(event); - auto expansion = qobject_cast(obj); - - expansion->setPopupMode(QToolButton::InstantPopup); - auto menu = new QMenu(expansion); - - auto toolbar = qobject_cast(expansion->parentWidget()); - - auto toolWidgets = toolbar->findChildren(); - - if (toolWidgets.count() > 0) - { - for (auto toolWidget : toolWidgets) - { - if (AzQtComponents::Style::hasClass(toolWidget, "expanderMenu_hide")) - { - continue; - } - - if (auto toolButton = qobject_cast(toolWidget)) - { - if (!toolButton->isVisible()) - { - // Skip some empty buttons - if (toolButton->text().isEmpty()) - { - continue; - } - - QString plainText = QTextDocumentFragment::fromHtml(toolButton->text()).toPlainText(); - QAction* action = new QAction(plainText, menu); - - if (!toolButton->isEnabled()) - { - action->setEnabled(false); - } - - connect(action, &QAction::triggered, toolButton, &QToolButton::clicked); - - if (toolButton->isCheckable()) - { - action->setCheckable(true); - } - - action->setChecked(toolButton->isChecked()); - - menu->addAction(action); - } - } - else if (auto toolCombo = qobject_cast(toolWidget)) - { - // Add custom menu for Speed - if (toolCombo->objectName() == "m_moveSpeed") - { - double currentValue = toolCombo->lineEdit()->text().toDouble(); - - QMenu* newMenu = menu->addMenu(QString("Speed: %1").arg(currentValue)); - - double presets[] = { 0.1, 1.0, 10.0 }; - for (double preset : presets) - { - QAction* presetAction = new QAction(newMenu); - presetAction->setText(QString::number(preset)); - - connect(presetAction, &QAction::triggered, this, [preset, this]() { - if (m_infoBar) - { - m_infoBar->SetSpeedComboBox(preset); - } - }); - - newMenu->addAction(presetAction); - } - } - } - } - } - - menu->exec(mouseEvent->globalPos()); - return true; - } - - break; - } - } - - return QObject::eventFilter(obj, event); - } - - void SetInfoBar(CInfoBar* infoBar) - { - m_infoBar = infoBar; - } - -private: - CInfoBar* m_infoBar = nullptr; -}; - ////////////////////////////////////////////////////////////////////////// // CLayoutWnd ////////////////////////////////////////////////////////////////////////// CLayoutWnd::CLayoutWnd(QSettings* settings, QWidget* parent) : AzQtComponents::ToolBarArea(parent) , m_settings(settings) - , m_expanderWatcher(new InfoBarExpanderWatcher(this)) { m_bMaximized = false; m_maximizedView = 0; @@ -230,23 +108,8 @@ CLayoutWnd::CLayoutWnd(QSettings* settings, QWidget* parent) m_maximizedViewId = 0; m_infoBarSize = QSize(0, 0); - m_infoBar = new CInfoBar(this); connect(qApp, &QApplication::focusChanged, this, &CLayoutWnd::OnFocusChanged); - m_expanderWatcher->SetInfoBar(m_infoBar); - - m_infoToolBar = CreateToolBarFromWidget(m_infoBar, - Qt::BottomToolBarArea, - QStringLiteral("Info Panel")); - m_infoToolBar->setMovable(false); - m_infoToolBar->setObjectName("InfoBar"); - AzQtComponents::Style::addClass(m_infoToolBar, "DefaultSpacing"); - - if (QToolButton* expansion = AzQtComponents::ToolBar::getToolBarExpansionButton(m_infoToolBar)) - { - expansion->installEventFilter(m_expanderWatcher); - } - setContextMenuPolicy(Qt::NoContextMenu); } @@ -415,7 +278,6 @@ 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) diff --git a/Code/Sandbox/Editor/LayoutWnd.h b/Code/Sandbox/Editor/LayoutWnd.h index 87240cbf76..2af56f907c 100644 --- a/Code/Sandbox/Editor/LayoutWnd.h +++ b/Code/Sandbox/Editor/LayoutWnd.h @@ -20,7 +20,6 @@ #if !defined(Q_MOC_RUN) #include "Viewport.h" -#include "InfoBar.h" #include #include @@ -77,8 +76,6 @@ private: friend class CLayoutWnd; }; -class InfoBarExpanderWatcher; - /** Main layout window. */ class CLayoutWnd @@ -116,8 +113,6 @@ public: //! Switch 2D viewports. void Cycle2DViewport(); - CInfoBar& GetInfoBar() { return *m_infoBar; } - public slots: void ResetLayout(); @@ -162,11 +157,8 @@ private: // Id of maximized view pane. int m_maximizedViewId; - CInfoBar* m_infoBar; - QToolBar* m_infoToolBar; QSize m_infoBarSize; QSettings* m_settings; - InfoBarExpanderWatcher* m_expanderWatcher; }; ///////////////////////////////////////////////////////////////////////////// diff --git a/Code/Sandbox/Editor/MainWindow.cpp b/Code/Sandbox/Editor/MainWindow.cpp index 9e983c3593..3753c29064 100644 --- a/Code/Sandbox/Editor/MainWindow.cpp +++ b/Code/Sandbox/Editor/MainWindow.cpp @@ -297,68 +297,6 @@ namespace } } -class SnapToWidget - : public QWidget -{ -public: - typedef AZStd::function SetValueCallback; - typedef AZStd::function GetValueCallback; - - SnapToWidget(QAction* defaultAction, SetValueCallback setValueCallback, GetValueCallback getValueCallback) - : m_setValueCallback(setValueCallback) - , m_getValueCallback(getValueCallback) - { - QHBoxLayout* layout = new QHBoxLayout(); - setLayout(layout); - - m_toolButton = new QToolButton(); - m_toolButton->setAutoRaise(true); - m_toolButton->setCheckable(false); - m_toolButton->setDefaultAction(defaultAction); - - m_spinBox = new AzQtComponents::DoubleSpinBox(); - - layout->addWidget(m_toolButton); - layout->addWidget(m_spinBox); - - m_spinBox->setEnabled(defaultAction->isChecked()); - m_spinBox->setMinimum(1e-2f); - - { - QSignalBlocker signalBlocker(m_spinBox); - m_spinBox->setValue(m_getValueCallback()); - } - - QObject::connect(m_spinBox, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, &SnapToWidget::OnValueChanged); - QObject::connect(defaultAction, &QAction::changed, this, &SnapToWidget::OnActionChanged); - } - - void SetIcon(QIcon icon) - { - m_toolButton->setIcon(icon); - } - -protected: - - void OnValueChanged(double value) - { - m_setValueCallback(value); - } - - void OnActionChanged() - { - m_spinBox->setEnabled(m_toolButton->isChecked()); - } - -private: - - QToolButton* m_toolButton = nullptr; - AzQtComponents::DoubleSpinBox* m_spinBox = nullptr; - - SetValueCallback m_setValueCallback; - GetValueCallback m_getValueCallback; -}; - ///////////////////////////////////////////////////////////////////////////// // MainWindow ///////////////////////////////////////////////////////////////////////////// @@ -532,9 +470,11 @@ void MainWindow::Initialize() InitToolActionHandlers(); + // Initialize toolbars before we setup the menu so that any tools can be added to the toolbar as needed + InitToolBars(); + m_levelEditorMenuHandler->Initialize(); - InitToolBars(); InitStatusBar(); AzToolsFramework::SourceControlNotificationBus::Handler::BusConnect(); @@ -1274,36 +1214,6 @@ void UndoRedoToolButton::Update(int count) setEnabled(count > 0); } -QWidget* MainWindow::CreateSnapToGridWidget() -{ - SnapToWidget::SetValueCallback setCallback = [](double snapStep) - { - SandboxEditor::SetGridSnappingSize(snapStep); - }; - - SnapToWidget::GetValueCallback getCallback = []() - { - return SandboxEditor::GridSnappingSize(); - }; - - return new SnapToWidget(m_actionManager->GetAction(ID_SNAP_TO_GRID), setCallback, getCallback); -} - -QWidget* MainWindow::CreateSnapToAngleWidget() -{ - SnapToWidget::SetValueCallback setCallback = [](double snapAngle) - { - SandboxEditor::SetAngleSnappingSize(snapAngle); - }; - - SnapToWidget::GetValueCallback getCallback = []() - { - return SandboxEditor::AngleSnappingSize(); - }; - - return new SnapToWidget(m_actionManager->GetAction(ID_SNAPANGLE), setCallback, getCallback); -} - bool MainWindow::IsPreview() const { return GetIEditor()->IsInPreviewMode(); @@ -2016,12 +1926,6 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId) case ID_TOOLBAR_WIDGET_REDO: w = CreateUndoRedoButton(ID_REDO); break; - case ID_TOOLBAR_WIDGET_SNAP_GRID: - w = CreateSnapToGridWidget(); - break; - case ID_TOOLBAR_WIDGET_SNAP_ANGLE: - w = CreateSnapToAngleWidget(); - break; case ID_TOOLBAR_WIDGET_SPACER_RIGHT: w = CreateSpacerRightWidget(); break; diff --git a/Code/Sandbox/Editor/MainWindow.h b/Code/Sandbox/Editor/MainWindow.h index ab60b0e0d4..43600b039e 100644 --- a/Code/Sandbox/Editor/MainWindow.h +++ b/Code/Sandbox/Editor/MainWindow.h @@ -202,8 +202,6 @@ private: // AzToolsFramework::SourceControlNotificationBus::Handler: void ConnectivityStateChanged(const AzToolsFramework::SourceControlState state) override; - QWidget* CreateSnapToGridWidget(); - QWidget* CreateSnapToAngleWidget(); QWidget* CreateSpacerRightWidget(); QToolButton* CreateUndoRedoButton(int command); diff --git a/Code/Sandbox/Editor/Style/Editor.qss b/Code/Sandbox/Editor/Style/Editor.qss index fa7d67dd43..2e96c73f35 100644 --- a/Code/Sandbox/Editor/Style/Editor.qss +++ b/Code/Sandbox/Editor/Style/Editor.qss @@ -144,20 +144,6 @@ EditorWindow QToolBar border-bottom: 2px solid #111111; } -/* InfoBar (Toolbar below the main viewport) */ - -QToolBar#InfoBar -{ - qproperty-iconSize: 22px 18px; -} - -QToolBar#InfoBar AzQtComponents--VectorElement[Coordinate="X"] QLabel, -QToolBar#InfoBar AzQtComponents--VectorElement[Coordinate="Y"] QLabel, -QToolBar#InfoBar AzQtComponents--VectorElement[Coordinate="Z"] QLabel -{ - background-color: #333333; -} - DockWidgetTitleBar #DockWidgetContextMenu { qproperty-icon: url(:/Cards/img/UI20/Cards/menu_ico.svg); diff --git a/Code/Sandbox/Editor/ToolbarManager.cpp b/Code/Sandbox/Editor/ToolbarManager.cpp index 391eabae33..137057a4fa 100644 --- a/Code/Sandbox/Editor/ToolbarManager.cpp +++ b/Code/Sandbox/Editor/ToolbarManager.cpp @@ -582,19 +582,6 @@ AmazonToolbar ToolbarManager::GetEditModeToolbar() const { AmazonToolbar t = AmazonToolbar("EditMode", QObject::tr("Edit Mode Toolbar")); t.SetMainToolbar(true); - t.AddAction(ID_TOOLBAR_WIDGET_UNDO, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_TOOLBAR_WIDGET_REDO, ORIGINAL_TOOLBAR_VERSION); - - t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION); - - t.AddAction(ID_EDITMODE_MOVE, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_EDITMODE_ROTATE, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_EDITMODE_SCALE, ORIGINAL_TOOLBAR_VERSION); - - t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_TOOLBAR_WIDGET_SNAP_GRID, ORIGINAL_TOOLBAR_VERSION); - t.AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, ORIGINAL_TOOLBAR_VERSION); - return t; } @@ -636,6 +623,20 @@ AmazonToolbar ToolbarManager::GetMiscToolbar() const return t; } +void ToolbarManager::AddButtonToEditToolbar(QAction* action) +{ + QString toolbarName = "EditMode"; + const AmazonToolbar* toolbar = FindToolbar(toolbarName); + + if (toolbar) + { + if (toolbar->Toolbar()) + { + toolbar->Toolbar()->addAction(action); + } + } +} + const AmazonToolbar* ToolbarManager::FindDefaultToolbar(const QString& toolbarName) const { for (const AmazonToolbar& toolbar : m_standardToolbars) diff --git a/Code/Sandbox/Editor/ToolbarManager.h b/Code/Sandbox/Editor/ToolbarManager.h index 70228636f5..1867316d01 100644 --- a/Code/Sandbox/Editor/ToolbarManager.h +++ b/Code/Sandbox/Editor/ToolbarManager.h @@ -169,6 +169,8 @@ public: AmazonToolbar GetMiscToolbar() const; AmazonToolbar GetPlayConsoleToolbar() const; + void AddButtonToEditToolbar(QAction* action); + private: Q_DISABLE_COPY(ToolbarManager); void SaveToolbars(); diff --git a/Code/Sandbox/Editor/ViewportTitleDlg.cpp b/Code/Sandbox/Editor/ViewportTitleDlg.cpp index 5ccb83cd5b..f85aa1f06d 100644 --- a/Code/Sandbox/Editor/ViewportTitleDlg.cpp +++ b/Code/Sandbox/Editor/ViewportTitleDlg.cpp @@ -21,6 +21,8 @@ // Qt #include +#include + // CryCommon #include @@ -35,16 +37,20 @@ #include "Objects/SelectionGroup.h" #include "UsedResources.h" #include "Include/IObjectManager.h" +#include "ActionManager.h" +#include "MainWindow.h" +#include "GameEngine.h" +#include "MathConversion.h" +#include "EditorViewportSettings.h" -#include - +#include +#include AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING #include "ui_ViewportTitleDlg.h" AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING #endif //!defined(Q_MOC_RUN) - // CViewportTitleDlg dialog inline namespace Helpers @@ -103,7 +109,9 @@ CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent) layout->addWidget(container); container->setObjectName("ViewportTitleDlgContainer"); - m_pViewPane = NULL; + m_prevMoveSpeed = 0; + + m_pViewPane = nullptr; GetIEditor()->RegisterNotifyListener(this); GetISystem()->GetISystemEventDispatcher()->RegisterListener(this); @@ -111,21 +119,176 @@ CViewportTitleDlg::CViewportTitleDlg(QWidget* pParent) LoadCustomPresets("AspectRatioPresets", "AspectRatioPreset", m_customAspectRatioPresets); LoadCustomPresets("ResPresets", "ResPreset", m_customResPresets); - OnInitDialog(); + // audio request setup + m_oMuteAudioRequest.pData = &m_oMuteAudioRequestData; + m_oUnmuteAudioRequest.pData = &m_oUnmuteAudioRequestData; - connect(m_ui->m_fovLabel, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpFOVMenu); - connect(m_ui->m_fovStaticCtrl, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpFOVMenu); - connect(m_ui->m_ratioStaticCtrl, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpAspectMenu); - connect(m_ui->m_ratioLabel, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpAspectMenu); - connect(m_ui->m_sizeStaticCtrl, &QWidget::customContextMenuRequested, this, &CViewportTitleDlg::PopUpResolutionMenu); + SetupCameraDropdownMenu(); + SetupResolutionDropdownMenu(); + SetupViewportInformationMenu(); + SetupOverflowMenu(); + + Audio::AudioSystemRequestBus::Broadcast(&Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest); + + connect(this, &CViewportTitleDlg::ActionTriggered, MainWindow::instance()->GetActionManager(), &ActionManager::ActionTriggered); + + AZ::VR::VREventBus::Handler::BusConnect(); + + OnInitDialog(); } CViewportTitleDlg::~CViewportTitleDlg() { + AZ::VR::VREventBus::Handler::BusDisconnect(); GetISystem()->GetISystemEventDispatcher()->RemoveListener(this); GetIEditor()->UnregisterNotifyListener(this); } +void CViewportTitleDlg::SetupCameraDropdownMenu() +{ + // Setup the camera dropdown menu + QMenu* cameraMenu = new QMenu(this); + cameraMenu->addMenu(GetFovMenu()); + m_ui->m_cameraMenu->setMenu(cameraMenu); + m_ui->m_cameraMenu->setPopupMode(QToolButton::InstantPopup); + QAction* gotoPositionAction = new QAction("Go to position", cameraMenu); + connect(gotoPositionAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedGotoPosition); + cameraMenu->addAction(gotoPositionAction); + m_syncPlayerToCameraAction = new QAction("Sync camera to player", cameraMenu); + m_syncPlayerToCameraAction->setCheckable(true); + connect(m_syncPlayerToCameraAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedSyncplayer); + cameraMenu->addAction(m_syncPlayerToCameraAction); + + cameraMenu->addSeparator(); + + auto cameraSpeedActionWidget = new QWidgetAction(cameraMenu); + auto cameraSpeedContainer = new QWidget(cameraMenu); + auto cameraSpeedLabel = new QLabel(tr("Camera Speed"), cameraMenu); + m_cameraSpeed = new QComboBox(cameraMenu); + m_cameraSpeed->setEditable(true); + m_cameraSpeed->setValidator(new QDoubleValidator(m_minSpeed, m_maxSpeed, m_numDecimals, m_cameraSpeed)); + + QHBoxLayout* cameraSpeedLayout = new QHBoxLayout; + cameraSpeedLayout->addWidget(cameraSpeedLabel); + cameraSpeedLayout->addWidget(m_cameraSpeed); + cameraSpeedContainer->setLayout(cameraSpeedLayout); + cameraSpeedActionWidget->setDefaultWidget(cameraSpeedContainer); + + // Save off the move speed here since setting up the combo box can cause it to update values in the background. + float cameraMoveSpeed = gSettings.cameraMoveSpeed; + + // Populate the presets in the ComboBox + for (float presetValue : m_speedPresetValues) + { + m_cameraSpeed->addItem(QString().setNum(presetValue, 'f', m_numDecimals), presetValue); + } + + auto comboBoxTextChanged = static_cast(&QComboBox::currentTextChanged); + + SetSpeedComboBox(cameraMoveSpeed); + m_cameraSpeed->setInsertPolicy(QComboBox::NoInsert); + connect(m_cameraSpeed, comboBoxTextChanged, this, &CViewportTitleDlg::OnUpdateMoveSpeedText); + connect(m_cameraSpeed->lineEdit(), &QLineEdit::returnPressed, this, &CViewportTitleDlg::OnSpeedComboBoxEnter); + + cameraMenu->addAction(cameraSpeedActionWidget); +} + +void CViewportTitleDlg::SetupResolutionDropdownMenu() +{ + // Setup the resolution dropdown menu + QMenu* resolutionMenu = new QMenu(this); + resolutionMenu->addMenu(GetAspectMenu()); + resolutionMenu->addMenu(GetResolutionMenu()); + m_ui->m_resolutionMenu->setMenu(resolutionMenu); + m_ui->m_resolutionMenu->setPopupMode(QToolButton::InstantPopup); +} + +void CViewportTitleDlg::SetupViewportInformationMenu() +{ + // Setup the debug information button + m_ui->m_debugInformationMenu->setMenu(GetViewportInformationMenu()); + connect(m_ui->m_debugInformationMenu, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleDisplayInfo); + m_ui->m_debugInformationMenu->setPopupMode(QToolButton::MenuButtonPopup); + +} + +void CViewportTitleDlg::SetupOverflowMenu() +{ + // Setup the overflow menu + QMenu* overFlowMenu = new QMenu(this); + m_debugHelpersAction = new QAction("Debug Helpers", overFlowMenu); + m_debugHelpersAction->setCheckable(true); + m_debugHelpersAction->setChecked(Helpers::IsHelpersShown()); + connect(m_debugHelpersAction, &QAction::triggered, this, &CViewportTitleDlg::OnToggleHelpers); + overFlowMenu->addAction(m_debugHelpersAction); + + m_audioMuteAction = new QAction("Mute Audio", overFlowMenu); + connect(m_audioMuteAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedMuteAudio); + overFlowMenu->addAction(m_audioMuteAction); + + m_enableVRAction = new QAction("Enable VR Preview", overFlowMenu); + connect(m_enableVRAction, &QAction::triggered, this, &CViewportTitleDlg::OnBnClickedEnableVR); + overFlowMenu->addAction(m_enableVRAction); + + overFlowMenu->addSeparator(); + + m_enableGridSnappingAction = new QAction("Enable Grid Snapping", overFlowMenu); + connect(m_enableGridSnappingAction, &QAction::triggered, this, &CViewportTitleDlg::OnGridSnappingToggled); + m_enableGridSnappingAction->setCheckable(true); + overFlowMenu->addAction(m_enableGridSnappingAction); + + m_gridSizeActionWidget = new QWidgetAction(overFlowMenu); + auto gridSizeContainer = new QWidget(overFlowMenu); + auto gridSizeLabel = new QLabel(tr("Grid Size"), overFlowMenu); + + m_gridSpinBox = new AzQtComponents::DoubleSpinBox(); + m_gridSpinBox->setValue(SandboxEditor::GridSnappingSize()); + m_gridSpinBox->setMinimum(1e-2f); + + QObject::connect( + m_gridSpinBox, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, &CViewportTitleDlg::OnGridSpinBoxChanged); + + QHBoxLayout* gridSizeLayout = new QHBoxLayout; + gridSizeLayout->addWidget(gridSizeLabel); + gridSizeLayout->addWidget(m_gridSpinBox); + gridSizeContainer->setLayout(gridSizeLayout); + m_gridSizeActionWidget->setDefaultWidget(gridSizeContainer); + overFlowMenu->addAction(m_gridSizeActionWidget); + + overFlowMenu->addSeparator(); + + m_enableAngleSnappingAction = new QAction("Enable Grid Snapping", overFlowMenu); + connect(m_enableAngleSnappingAction, &QAction::triggered, this, &CViewportTitleDlg::OnAngleSnappingToggled); + m_enableAngleSnappingAction->setCheckable(true); + overFlowMenu->addAction(m_enableAngleSnappingAction); + + m_angleSizeActionWidget = new QWidgetAction(overFlowMenu); + auto angleSizeContainer = new QWidget(overFlowMenu); + auto angleSizeLabel = new QLabel(tr("Angle Snapping"), overFlowMenu); + + m_angleSpinBox = new AzQtComponents::DoubleSpinBox(); + m_angleSpinBox->setValue(SandboxEditor::AngleSnappingSize()); + m_angleSpinBox->setMinimum(1e-2f); + + QObject::connect( + m_angleSpinBox, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), this, + &CViewportTitleDlg::OnAngleSpinBoxChanged); + + QHBoxLayout* angleSizeLayout = new QHBoxLayout; + angleSizeLayout->addWidget(angleSizeLabel); + angleSizeLayout->addWidget(m_angleSpinBox); + angleSizeContainer->setLayout(angleSizeLayout); + m_angleSizeActionWidget->setDefaultWidget(angleSizeContainer); + overFlowMenu->addAction(m_angleSizeActionWidget); + + m_ui->m_overflowBtn->setMenu(overFlowMenu); + m_ui->m_overflowBtn->setPopupMode(QToolButton::InstantPopup); + connect(overFlowMenu, &QMenu::aboutToShow, this, &CViewportTitleDlg::UpdateOverFlowMenuState); + + UpdateMuteActionText(); +} + + ////////////////////////////////////////////////////////////////////////// void CViewportTitleDlg::SetViewPane(CLayoutViewPane* pViewPane) { @@ -140,21 +303,27 @@ void CViewportTitleDlg::SetViewPane(CLayoutViewPane* pViewPane) void CViewportTitleDlg::OnInitDialog() { m_ui->m_titleBtn->setText(m_title); - m_ui->m_sizeStaticCtrl->setText(QString()); - - m_ui->m_toggleHelpersBtn->setChecked(GetIEditor()->GetDisplaySettings()->IsDisplayHelpers()); - // Add a child parented to us that listens for r_displayInfo changes. auto displayInfoHelper = new CViewportTitleDlgDisplayInfoHelper(this); connect(displayInfoHelper, &CViewportTitleDlgDisplayInfoHelper::ViewportInfoStatusUpdated, this, &CViewportTitleDlg::UpdateDisplayInfo); UpdateDisplayInfo(); - connect(m_ui->m_toggleHelpersBtn, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleHelpers); - connect(m_ui->m_toggleDisplayInfoBtn, &QToolButton::clicked, this, &CViewportTitleDlg::OnToggleDisplayInfo); + // This is here just in case this class hasn't been created before + // a VR headset was initialized + m_enableVRAction->setEnabled(false); + if (AZ::VR::HMDDeviceRequestBus::GetTotalNumOfEventHandlers() != 0) + { + m_enableVRAction->setEnabled(true); + } + + AZ::VR::VREventBus::Handler::BusConnect(); + + QFontMetrics metrics({}); + int width = metrics.boundingRect("-9999.99").width() * m_fieldWidthMultiplier; + + m_cameraSpeed->setFixedWidth(width); - m_ui->m_toggleHelpersBtn->setProperty("class", "big"); - m_ui->m_toggleDisplayInfoBtn->setProperty("class", "big"); } ////////////////////////////////////////////////////////////////////////// @@ -177,6 +346,80 @@ void CViewportTitleDlg::OnMaximize() void CViewportTitleDlg::OnToggleHelpers() { Helpers::ToggleHelpers(); + m_debugHelpersAction->setChecked(Helpers::IsHelpersShown()); +} + +void CViewportTitleDlg::SetNoViewportInfo() +{ + AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast( + &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState, AZ::AtomBridge::ViewportInfoDisplayState::NoInfo); +} + +void CViewportTitleDlg::SetNormalViewportInfo() +{ + AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast( + &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState, AZ::AtomBridge::ViewportInfoDisplayState::NormalInfo); +} + +void CViewportTitleDlg::SetFullViewportInfo() +{ + AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast( + &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState, AZ::AtomBridge::ViewportInfoDisplayState::FullInfo); +} + +void CViewportTitleDlg::SetCompactViewportInfo() +{ + AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast( + &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState, AZ::AtomBridge::ViewportInfoDisplayState::CompactInfo); +} + + +////////////////////////////////////////////////////////////////////////// +void CViewportTitleDlg::UpdateDisplayInfo() +{ + if (m_viewportInformationMenu == nullptr) + { + // Nothing to update, just return; + return; + } + + AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo; + AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult( + state, + &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState + ); + + m_noInformationAction->setChecked(false); + m_normalInformationAction->setChecked(false); + m_fullInformationAction->setChecked(false); + m_compactInformationAction->setChecked(false); + + switch (state) + { + case AZ::AtomBridge::ViewportInfoDisplayState::NormalInfo: + { + m_normalInformationAction->setChecked(true); + break; + } + case AZ::AtomBridge::ViewportInfoDisplayState::FullInfo: + { + m_fullInformationAction->setChecked(true); + break; + } + case AZ::AtomBridge::ViewportInfoDisplayState::CompactInfo: + { + m_compactInformationAction->setChecked(true); + break; + } + case AZ::AtomBridge::ViewportInfoDisplayState::NoInfo: + default: + { + m_noInformationAction->setChecked(true); + break; + } + } + + m_ui->m_debugInformationMenu->setChecked(state != AZ::AtomBridge::ViewportInfoDisplayState::NoInfo); } ////////////////////////////////////////////////////////////////////////// @@ -184,27 +427,12 @@ void CViewportTitleDlg::OnToggleDisplayInfo() { AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo; AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult( - state, - &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState - ); + state, &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState); state = aznumeric_cast( - (aznumeric_cast(state)+1) % aznumeric_cast(AZ::AtomBridge::ViewportInfoDisplayState::Invalid)); + (aznumeric_cast(state) + 1) % aznumeric_cast(AZ::AtomBridge::ViewportInfoDisplayState::Invalid)); // SetDisplayState will fire OnViewportInfoDisplayStateChanged and notify us, no need to call UpdateDisplayInfo. AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Broadcast( - &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState, - state - ); -} - -////////////////////////////////////////////////////////////////////////// -void CViewportTitleDlg::UpdateDisplayInfo() -{ - AZ::AtomBridge::ViewportInfoDisplayState state = AZ::AtomBridge::ViewportInfoDisplayState::NoInfo; - AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::BroadcastResult( - state, - &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::GetDisplayState - ); - m_ui->m_toggleDisplayInfoBtn->setChecked(state != AZ::AtomBridge::ViewportInfoDisplayState::NoInfo); + &AZ::AtomBridge::AtomViewportInfoDisplayRequestBus::Events::SetDisplayState, state); } ////////////////////////////////////////////////////////////////////////// @@ -277,7 +505,7 @@ void CViewportTitleDlg::CreateFOVMenu() { if (!m_fovMenu) { - m_fovMenu = new QMenu(this); + m_fovMenu = new QMenu("FOV", this); } m_fovMenu->clear(); @@ -292,17 +520,6 @@ void CViewportTitleDlg::CreateFOVMenu() connect(action, &QAction::triggered, this, &CViewportTitleDlg::OnMenuFOVCustom); } -void CViewportTitleDlg::PopUpFOVMenu() -{ - if (m_pViewPane == NULL) - { - return; - } - - CreateFOVMenu(); - m_fovMenu->exec(QCursor::pos()); -} - QMenu* const CViewportTitleDlg::GetFovMenu() { CreateFOVMenu(); @@ -379,9 +596,9 @@ void CViewportTitleDlg::OnMenuAspectRatioCustom() ////////////////////////////////////////////////////////////////////////// void CViewportTitleDlg::CreateAspectMenu() { - if (!m_aspectMenu) + if (m_aspectMenu == nullptr) { - m_aspectMenu = new QMenu(this); + m_aspectMenu = new QMenu("Aspect Ratio"); } m_aspectMenu->clear(); @@ -396,23 +613,48 @@ void CViewportTitleDlg::CreateAspectMenu() connect(customAction, &QAction::triggered, this, &CViewportTitleDlg::OnMenuAspectRatioCustom); } -void CViewportTitleDlg::PopUpAspectMenu() -{ - if (!m_pViewPane) - { - return; - } - - CreateAspectMenu(); - m_aspectMenu->exec(QCursor::pos()); -} - QMenu* const CViewportTitleDlg::GetAspectMenu() { CreateAspectMenu(); return m_aspectMenu; } +QMenu* const CViewportTitleDlg::GetViewportInformationMenu() +{ + CreateViewportInformationMenu(); + return m_viewportInformationMenu; +} + +void CViewportTitleDlg::CreateViewportInformationMenu() +{ + if (m_viewportInformationMenu == nullptr) + { + m_viewportInformationMenu = new QMenu("Viewport Information"); + + m_noInformationAction = new QAction(tr("None"), m_viewportInformationMenu); + m_noInformationAction->setCheckable(true); + connect(m_noInformationAction, &QAction::triggered, this, &CViewportTitleDlg::SetNoViewportInfo); + m_viewportInformationMenu->addAction(m_noInformationAction); + + m_normalInformationAction = new QAction(tr("Normal"), m_viewportInformationMenu); + m_normalInformationAction->setCheckable(true); + connect(m_normalInformationAction, &QAction::triggered, this, &CViewportTitleDlg::SetNormalViewportInfo); + m_viewportInformationMenu->addAction(m_normalInformationAction); + + m_fullInformationAction = new QAction(tr("Full"), m_viewportInformationMenu); + m_fullInformationAction->setCheckable(true); + connect(m_fullInformationAction, &QAction::triggered, this, &CViewportTitleDlg::SetFullViewportInfo); + m_viewportInformationMenu->addAction(m_fullInformationAction); + + m_compactInformationAction = new QAction(tr("Compact"), m_viewportInformationMenu); + m_compactInformationAction->setCheckable(true); + connect(m_compactInformationAction, &QAction::triggered, this, &CViewportTitleDlg::SetCompactViewportInfo); + m_viewportInformationMenu->addAction(m_compactInformationAction); + + UpdateDisplayInfo(); + } +} + void CViewportTitleDlg::AddResolutionMenus(QMenu* menu, std::function callback, const QStringList& customPresets) { static const CRenderViewport::SResolution resolutions[] = { @@ -479,7 +721,7 @@ void CViewportTitleDlg::CreateResolutionMenu() { if (!m_resolutionMenu) { - m_resolutionMenu = new QMenu(this); + m_resolutionMenu = new QMenu("Resolution"); } m_resolutionMenu->clear(); @@ -494,17 +736,6 @@ void CViewportTitleDlg::CreateResolutionMenu() connect(action, &QAction::triggered, this, &CViewportTitleDlg::OnMenuResolutionCustom); } -void CViewportTitleDlg::PopUpResolutionMenu() -{ - if (!m_pViewPane) - { - return; - } - - CreateResolutionMenu(); - m_resolutionMenu->exec(QCursor::pos()); -} - QMenu* const CViewportTitleDlg::GetResolutionMenu() { CreateResolutionMenu(); @@ -514,14 +745,14 @@ QMenu* const CViewportTitleDlg::GetResolutionMenu() ////////////////////////////////////////////////////////////////////////// void CViewportTitleDlg::OnViewportSizeChanged(int width, int height) { - m_ui->m_sizeStaticCtrl->setText(QString::fromLatin1("%1 x %2").arg(width).arg(height)); + m_resolutionMenu->setTitle(QString::fromLatin1("Resolution: %1 x %2").arg(width).arg(height)); if (width != 0 && height != 0) { // Calculate greatest common divider of width & height int whGCD = gcd(width, height); - m_ui->m_ratioStaticCtrl->setText(QString::fromLatin1("%1:%2").arg(width / whGCD).arg(height / whGCD)); + m_aspectMenu->setTitle(QString::fromLatin1("Ratio: %1:%2").arg(width / whGCD).arg(height / whGCD)); } } @@ -529,9 +760,9 @@ void CViewportTitleDlg::OnViewportSizeChanged(int width, int height) void CViewportTitleDlg::OnViewportFOVChanged(float fov) { const float degFOV = RAD2DEG(fov); - if (m_ui && m_ui->m_fovStaticCtrl) + if (m_fovMenu) { - m_ui->m_fovStaticCtrl->setText(QString::fromLatin1("%1%2").arg(qRound(degFOV)).arg(QString(QByteArray::fromPercentEncoding("%C2%B0")))); + m_fovMenu->setTitle(QString::fromLatin1("FOV: %1%2").arg(qRound(degFOV)).arg(QString(QByteArray::fromPercentEncoding("%C2%B0")))); } } @@ -541,7 +772,11 @@ void CViewportTitleDlg::OnEditorNotifyEvent(EEditorNotifyEvent event) switch (event) { case eNotify_OnDisplayRenderUpdate: - m_ui->m_toggleHelpersBtn->setChecked(GetIEditor()->GetDisplaySettings()->IsDisplayHelpers()); + m_debugHelpersAction->setChecked(Helpers::IsHelpersShown()); + break; + case eNotify_OnBeginGameMode: + case eNotify_OnEndGameMode: + UpdateMuteActionText(); break; } } @@ -615,6 +850,132 @@ bool CViewportTitleDlg::eventFilter(QObject* object, QEvent* event) return QWidget::eventFilter(object, event) || consumeEvent; } +void CViewportTitleDlg::OnBnClickedSyncplayer() +{ + emit ActionTriggered(ID_GAME_SYNCPLAYER); + + bool bSyncPlayer = GetIEditor()->GetGameEngine()->IsSyncPlayerPosition(); + m_syncPlayerToCameraAction->setChecked(!bSyncPlayer); +} + +void CViewportTitleDlg::OnBnClickedGotoPosition() +{ + emit ActionTriggered(ID_DISPLAY_GOTOPOSITION); +} + +void CViewportTitleDlg::OnBnClickedMuteAudio() +{ + gSettings.bMuteAudio = !gSettings.bMuteAudio; + + Audio::AudioSystemRequestBus::Broadcast( + &Audio::AudioSystemRequestBus::Events::PushRequest, gSettings.bMuteAudio ? m_oMuteAudioRequest : m_oUnmuteAudioRequest); + + UpdateMuteActionText(); +} + +void CViewportTitleDlg::UpdateMuteActionText() +{ + m_audioMuteAction->setText(gSettings.bMuteAudio ? tr("Un-mute Audio") : tr("Mute Audio")); +} + +void CViewportTitleDlg::OnHMDInitialized() +{ + m_enableVRAction->setEnabled(true); +} + +void CViewportTitleDlg::OnHMDShutdown() +{ + m_enableVRAction->setEnabled(false); +} + +void CViewportTitleDlg::OnBnClickedEnableVR() +{ + gSettings.bEnableGameModeVR = !gSettings.bEnableGameModeVR; + + m_enableVRAction->setText(gSettings.bEnableGameModeVR ? tr("Disable VR Preview") : tr("Enable VR Preview")); +} + +inline double Round(double fVal, double fStep) +{ + if (fStep > 0.f) + { + fVal = int_round(fVal / fStep) * fStep; + } + return fVal; +} + +void CViewportTitleDlg::SetSpeedComboBox(double value) +{ + value = AZStd::clamp(Round(value, m_speedStep), m_minSpeed, m_maxSpeed); + + int index = m_cameraSpeed->findData(value); + if (index != -1) + { + m_cameraSpeed->setCurrentIndex(index); + } + else + { + m_cameraSpeed->lineEdit()->setText(QString().setNum(value, 'f', m_numDecimals)); + } +} + +void CViewportTitleDlg::OnSpeedComboBoxEnter() +{ + m_cameraSpeed->clearFocus(); +} + +void CViewportTitleDlg::OnUpdateMoveSpeedText(const QString& text) +{ + gSettings.cameraMoveSpeed = aznumeric_cast(Round(text.toDouble(), m_speedStep)); +} + +void CViewportTitleDlg::CheckForCameraSpeedUpdate() +{ + if (gSettings.cameraMoveSpeed != m_prevMoveSpeed && !m_cameraSpeed->lineEdit()->hasFocus()) + { + m_prevMoveSpeed = gSettings.cameraMoveSpeed; + SetSpeedComboBox(gSettings.cameraMoveSpeed); + } +} + +void CViewportTitleDlg::OnGridSnappingToggled() +{ + m_gridSizeActionWidget->setEnabled(m_enableGridSnappingAction->isChecked()); + MainWindow::instance()->GetActionManager()->GetAction(ID_SNAP_TO_GRID)->trigger(); +} + +void CViewportTitleDlg::OnAngleSnappingToggled() +{ + m_angleSizeActionWidget->setEnabled(m_enableAngleSnappingAction->isChecked()); + MainWindow::instance()->GetActionManager()->GetAction(ID_SNAPANGLE)->trigger(); +} + +void CViewportTitleDlg::OnGridSpinBoxChanged(double value) +{ + SandboxEditor::SetGridSnappingSize(value); +} + +void CViewportTitleDlg::OnAngleSpinBoxChanged(double value) +{ + SandboxEditor::SetAngleSnappingSize(value); +} + +void CViewportTitleDlg::UpdateOverFlowMenuState() +{ + bool gridSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(ID_SNAP_TO_GRID)->isChecked(); + { + QSignalBlocker signalBlocker(m_enableGridSnappingAction); + m_enableGridSnappingAction->setChecked(gridSnappingActive); + } + m_gridSizeActionWidget->setEnabled(gridSnappingActive); + + bool angleSnappingActive = MainWindow::instance()->GetActionManager()->GetAction(ID_SNAPANGLE)->isChecked(); + { + QSignalBlocker signalBlocker(m_enableAngleSnappingAction); + m_enableAngleSnappingAction->setChecked(angleSnappingActive); + } + m_angleSizeActionWidget->setEnabled(angleSnappingActive); +} namespace { diff --git a/Code/Sandbox/Editor/ViewportTitleDlg.h b/Code/Sandbox/Editor/ViewportTitleDlg.h index ce2f116d97..dd0816082a 100644 --- a/Code/Sandbox/Editor/ViewportTitleDlg.h +++ b/Code/Sandbox/Editor/ViewportTitleDlg.h @@ -19,8 +19,16 @@ #include "RenderViewport.h" #include +#include + #include #include +#include +#include + +#include + +#include #endif // CViewportTitleDlg dialog @@ -42,6 +50,7 @@ class CViewportTitleDlg : public QWidget , public IEditorNotifyListener , public ISystemEventListener + , public AZ::VR::VREventBus::Handler { Q_OBJECT public: @@ -63,10 +72,15 @@ public: bool eventFilter(QObject* object, QEvent* event) override; + void SetSpeedComboBox(double value); + QMenu* const GetFovMenu(); QMenu* const GetAspectMenu(); QMenu* const GetResolutionMenu(); +Q_SIGNALS: + void ActionTriggered(int command); + protected: virtual void OnInitDialog(); @@ -75,9 +89,20 @@ protected: void OnMaximize(); void OnToggleHelpers(); - void OnToggleDisplayInfo(); void UpdateDisplayInfo(); + ////////////////////////////////////////////////////////////////////////// + /// VR Event Bus Implementation + ////////////////////////////////////////////////////////////////////////// + void OnHMDInitialized() override; + void OnHMDShutdown() override; + ////////////////////////////////////////////////////////////////////////// + + void SetupCameraDropdownMenu(); + void SetupResolutionDropdownMenu(); + void SetupViewportInformationMenu(); + void SetupOverflowMenu(); + QString m_title; CLayoutViewPane* m_pViewPane; @@ -87,22 +112,84 @@ protected: QStringList m_customFOVPresets; QStringList m_customAspectRatioPresets; + float m_prevMoveSpeed; + + // Speed combobox/lineEdit settings + double m_minSpeed = 0.1; + double m_maxSpeed = 100.0; + double m_speedStep = 0.1; + int m_numDecimals = 1; + + // Speed presets + float m_speedPresetValues[3] = { 0.1f, 1.0f, 10.0f }; + + double m_fieldWidthMultiplier = 1.8; + + void OnMenuFOVCustom(); void CreateFOVMenu(); - void PopUpFOVMenu(); void OnMenuAspectRatioCustom(); void CreateAspectMenu(); - void PopUpAspectMenu(); void OnMenuResolutionCustom(); void CreateResolutionMenu(); - void PopUpResolutionMenu(); + + void CreateViewportInformationMenu(); + QMenu* const GetViewportInformationMenu(); + void SetNoViewportInfo(); + void SetNormalViewportInfo(); + void SetFullViewportInfo(); + void SetCompactViewportInfo(); + + void OnBnClickedSyncplayer(); + void OnBnClickedGotoPosition(); + void OnBnClickedMuteAudio(); + void OnBnClickedEnableVR(); + + void UpdateMuteActionText(); + + void OnToggleDisplayInfo(); + + void OnSpeedComboBoxEnter(); + void OnUpdateMoveSpeedText(const QString&); + + void CheckForCameraSpeedUpdate(); + + void OnGridSnappingToggled(); + void OnAngleSnappingToggled(); + + void OnGridSpinBoxChanged(double value); + void OnAngleSpinBoxChanged(double value); + + void UpdateOverFlowMenuState(); QMenu* m_fovMenu = nullptr; QMenu* m_aspectMenu = nullptr; QMenu* m_resolutionMenu = nullptr; + QMenu* m_viewportInformationMenu = nullptr; + QAction* m_noInformationAction = nullptr; + QAction* m_normalInformationAction = nullptr; + QAction* m_fullInformationAction = nullptr; + QAction* m_compactInformationAction = nullptr; + QAction* m_debugHelpersAction = nullptr; + QAction* m_syncPlayerToCameraAction = nullptr; + QAction* m_audioMuteAction = nullptr; + QAction* m_enableVRAction = nullptr; + QAction* m_enableGridSnappingAction = nullptr; + QAction* m_enableAngleSnappingAction = nullptr; + QComboBox* m_cameraSpeed = nullptr; + AzQtComponents::DoubleSpinBox* m_gridSpinBox = nullptr; + AzQtComponents::DoubleSpinBox* m_angleSpinBox = nullptr; + QWidgetAction* m_gridSizeActionWidget = nullptr; + QWidgetAction* m_angleSizeActionWidget = nullptr; + + Audio::SAudioRequest m_oMuteAudioRequest; + Audio::SAudioManagerRequestData m_oMuteAudioRequestData; + Audio::SAudioRequest m_oUnmuteAudioRequest; + Audio::SAudioManagerRequestData m_oUnmuteAudioRequestData; + QScopedPointer m_ui; }; diff --git a/Code/Sandbox/Editor/ViewportTitleDlg.ui b/Code/Sandbox/Editor/ViewportTitleDlg.ui index e7b5cce1ec..2d547bfa99 100644 --- a/Code/Sandbox/Editor/ViewportTitleDlg.ui +++ b/Code/Sandbox/Editor/ViewportTitleDlg.ui @@ -61,121 +61,43 @@ - - - Qt::CustomContextMenu - - - FOV: - - + + + + :/Menu/camera.svg:/Menu/camera.svg + + + + + + + + + :/Menu/debug.svg:/Menu/debug.svg + + + + true + + + + + + + + :/Menu/resolution.svg:/Menu/resolution.svg + + + - - - - 0 - 0 - - - - Qt::CustomContextMenu - - - 120° - - - - - - - Qt::CustomContextMenu - - - Ratio: - - - - - - - - 0 - 0 - - - - - 40 - 0 - - - - Qt::CustomContextMenu - - - 000:000 - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - Qt::CustomContextMenu - - - 0000 x 0000 - - - - - - - - - - Toggle display info - - - Toggle display info - - - - :/stylesheet/img/UI20/Info.svg:/stylesheet/img/UI20/Info.svg - - - true - - - - - - - Toggle display helpers - - - Toggle display helpers - - - - :/stylesheet/img/UI20/Helpers.svg:/stylesheet/img/UI20/Helpers.svg - - - true - - + + + + :/stylesheet/img/UI20/menu-centered.svg:/stylesheet/img/UI20/menu-centered.svg + + + @@ -187,6 +109,8 @@ 1 - - + + + + diff --git a/Code/Sandbox/Editor/editor_lib_files.cmake b/Code/Sandbox/Editor/editor_lib_files.cmake index ebd7f89cfb..dc9d794021 100644 --- a/Code/Sandbox/Editor/editor_lib_files.cmake +++ b/Code/Sandbox/Editor/editor_lib_files.cmake @@ -424,10 +424,6 @@ set(FILES GotoPositionDlg.cpp GotoPositionDlg.h GotoPositionDlg.ui - InfoBar.cpp - InfoBar.qrc - InfoBar.h - InfoBar.ui LayoutConfigDialog.cpp LayoutConfigDialog.h LayoutConfigDialog.ui diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin_precompiled.cpp b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin_precompiled.cpp deleted file mode 100644 index ce0194251b..0000000000 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/ComponentEntityEditorPlugin_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "ComponentEntityEditorPlugin_precompiled.h" diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp index 8161d07547..694714cc6e 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/SandboxIntegration.cpp @@ -670,18 +670,11 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con AzToolsFramework::EditorContextMenuBus::Broadcast(&AzToolsFramework::EditorContextMenuEvents::PopulateEditorGlobalContextMenu, menu); } - bool prefabWipFeaturesEnabled = false; - AzFramework::ApplicationRequests::Bus::BroadcastResult( - prefabWipFeaturesEnabled, &AzFramework::ApplicationRequests::ArePrefabWipFeaturesEnabled); - - if (!prefabSystemEnabled || (prefabSystemEnabled && prefabWipFeaturesEnabled)) + action = menu->addAction(QObject::tr("Duplicate")); + QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_Duplicate(); }); + if (selected.size() == 0) { - action = menu->addAction(QObject::tr("Duplicate")); - QObject::connect(action, &QAction::triggered, action, [this] { ContextMenu_Duplicate(); }); - if (selected.size() == 0) - { - action->setDisabled(true); - } + action->setDisabled(true); } if (!prefabSystemEnabled) diff --git a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/componententityeditorplugin_files.cmake b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/componententityeditorplugin_files.cmake index 6672bc8b47..2b5877b1e6 100644 --- a/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/componententityeditorplugin_files.cmake +++ b/Code/Sandbox/Plugins/ComponentEntityEditorPlugin/componententityeditorplugin_files.cmake @@ -15,7 +15,6 @@ set(FILES ComponentEntityEditorPlugin.cpp SandboxIntegration.h SandboxIntegration.cpp - ComponentEntityEditorPlugin_precompiled.cpp ComponentEntityEditorPlugin_precompiled.h UI/ComponentEntityEditorOutlinerWindow.qrc UI/QComponentEntityEditorMainWindow.h diff --git a/Code/Sandbox/Plugins/EditorAssetImporter/EditorAssetImporter_precompiled.cpp b/Code/Sandbox/Plugins/EditorAssetImporter/EditorAssetImporter_precompiled.cpp deleted file mode 100644 index a77146223e..0000000000 --- a/Code/Sandbox/Plugins/EditorAssetImporter/EditorAssetImporter_precompiled.cpp +++ /dev/null @@ -1,15 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "EditorAssetImporter_precompiled.h" - diff --git a/Code/Sandbox/Plugins/EditorAssetImporter/editorassetimporter_files.cmake b/Code/Sandbox/Plugins/EditorAssetImporter/editorassetimporter_files.cmake index 68f7a450a1..c017aa6320 100644 --- a/Code/Sandbox/Plugins/EditorAssetImporter/editorassetimporter_files.cmake +++ b/Code/Sandbox/Plugins/EditorAssetImporter/editorassetimporter_files.cmake @@ -23,7 +23,6 @@ set(FILES SceneSerializationHandler.h SceneSerializationHandler.cpp Main.cpp - EditorAssetImporter_precompiled.cpp EditorAssetImporter_precompiled.h AssetImporter.qrc AssetImporterWindow.ui diff --git a/Code/Sandbox/Plugins/FFMPEGPlugin/FFMPEGPlugin_precompiled.cpp b/Code/Sandbox/Plugins/FFMPEGPlugin/FFMPEGPlugin_precompiled.cpp deleted file mode 100644 index b7f4fd23cc..0000000000 --- a/Code/Sandbox/Plugins/FFMPEGPlugin/FFMPEGPlugin_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ -#include "FFMPEGPlugin_precompiled.h" - diff --git a/Code/Sandbox/Plugins/FFMPEGPlugin/ffmpegplugin_files.cmake b/Code/Sandbox/Plugins/FFMPEGPlugin/ffmpegplugin_files.cmake index 9ae55cc45a..1c36b4c5bc 100644 --- a/Code/Sandbox/Plugins/FFMPEGPlugin/ffmpegplugin_files.cmake +++ b/Code/Sandbox/Plugins/FFMPEGPlugin/ffmpegplugin_files.cmake @@ -12,7 +12,6 @@ set(FILES FFMPEGPlugin.rc main.cpp - FFMPEGPlugin_precompiled.cpp FFMPEGPlugin_precompiled.h FFMPEGPlugin.cpp FFMPEGPlugin.h diff --git a/Code/Sandbox/Plugins/PerforcePlugin/PerforcePlugin_precompiled.cpp b/Code/Sandbox/Plugins/PerforcePlugin/PerforcePlugin_precompiled.cpp deleted file mode 100644 index cc1ded61a4..0000000000 --- a/Code/Sandbox/Plugins/PerforcePlugin/PerforcePlugin_precompiled.cpp +++ /dev/null @@ -1,15 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "PerforcePlugin_precompiled.h" - diff --git a/Code/Sandbox/Plugins/PerforcePlugin/perforceplugin_files.cmake b/Code/Sandbox/Plugins/PerforcePlugin/perforceplugin_files.cmake index 6e3a497aca..11e81d3358 100644 --- a/Code/Sandbox/Plugins/PerforcePlugin/perforceplugin_files.cmake +++ b/Code/Sandbox/Plugins/PerforcePlugin/perforceplugin_files.cmake @@ -20,6 +20,5 @@ set(FILES PerforceSourceControl.cpp PerforceSourceControl.h resource.h - PerforcePlugin_precompiled.cpp PerforcePlugin_precompiled.h ) diff --git a/Code/Sandbox/Plugins/ProjectSettingsTool/ProjectSettingsTool_precompiled.cpp b/Code/Sandbox/Plugins/ProjectSettingsTool/ProjectSettingsTool_precompiled.cpp deleted file mode 100644 index 82549e649a..0000000000 --- a/Code/Sandbox/Plugins/ProjectSettingsTool/ProjectSettingsTool_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "ProjectSettingsTool_precompiled.h" diff --git a/Code/Sandbox/Plugins/ProjectSettingsTool/projectsettingstool_files.cmake b/Code/Sandbox/Plugins/ProjectSettingsTool/projectsettingstool_files.cmake index 235109e629..72287be08a 100644 --- a/Code/Sandbox/Plugins/ProjectSettingsTool/projectsettingstool_files.cmake +++ b/Code/Sandbox/Plugins/ProjectSettingsTool/projectsettingstool_files.cmake @@ -11,7 +11,6 @@ set(FILES main.cpp - ProjectSettingsTool_precompiled.cpp ProjectSettingsTool_precompiled.h DefaultImageValidator.cpp DefaultImageValidator.h diff --git a/Code/Tools/ProjectManager/Resources/ProjectManager.qss b/Code/Tools/ProjectManager/Resources/ProjectManager.qss index c18d61fc24..80470591a8 100644 --- a/Code/Tools/ProjectManager/Resources/ProjectManager.qss +++ b/Code/Tools/ProjectManager/Resources/ProjectManager.qss @@ -291,6 +291,30 @@ QTabBar::tab:pressed height:50px; } +#projectSettingsTab::tab-bar > QPushButton { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #888888, stop: 1.0 #555555); + qproperty-flat: true; + margin-right:30px; + margin-bottom:12px; + margin-top:0px; + min-width:170px; + max-width:170px; + min-height:26px; + max-height:26px; + border-radius: 3px; + text-align:center; + font-size:13px; +} +#projectSettingsTab::tab-bar > QPushButton:hover { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #999999, stop: 1.0 #666666); +} +#projectSettingsTab::tab-bar > QPushButton:pressed { + background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, + stop: 0 #555555, stop: 1.0 #777777); +} + #projectSettingsTopFrame { background-color:#1E252F; } diff --git a/Code/Tools/ProjectManager/Source/ProjectInfo.cpp b/Code/Tools/ProjectManager/Source/ProjectInfo.cpp index da0b4ebd61..99649cbfdf 100644 --- a/Code/Tools/ProjectManager/Source/ProjectInfo.cpp +++ b/Code/Tools/ProjectManager/Source/ProjectInfo.cpp @@ -15,10 +15,13 @@ namespace O3DE::ProjectManager { ProjectInfo::ProjectInfo(const QString& path, const QString& projectName, const QString& displayName, - const QString& imagePath, const QString& backgroundImagePath, bool needsBuild) + const QString& origin, const QString& summary, const QString& imagePath, const QString& backgroundImagePath, + bool needsBuild) : m_path(path) , m_projectName(projectName) , m_displayName(displayName) + , m_origin(origin) + , m_summary(summary) , m_imagePath(imagePath) , m_backgroundImagePath(backgroundImagePath) , m_needsBuild(needsBuild) diff --git a/Code/Tools/ProjectManager/Source/ProjectInfo.h b/Code/Tools/ProjectManager/Source/ProjectInfo.h index 857e6ea4d5..184916a514 100644 --- a/Code/Tools/ProjectManager/Source/ProjectInfo.h +++ b/Code/Tools/ProjectManager/Source/ProjectInfo.h @@ -15,6 +15,7 @@ #if !defined(Q_MOC_RUN) #include #include +#include #endif namespace O3DE::ProjectManager @@ -23,8 +24,17 @@ namespace O3DE::ProjectManager { public: ProjectInfo() = default; - ProjectInfo(const QString& path, const QString& projectName, const QString& displayName, - const QString& imagePath, const QString& backgroundImagePath, bool needsBuild); + + ProjectInfo( + const QString& path, + const QString& projectName, + const QString& displayName, + const QString& origin, + const QString& summary, + const QString& imagePath, + const QString& backgroundImagePath, + bool needsBuild); + bool operator==(const ProjectInfo& rhs); bool operator!=(const ProjectInfo& rhs); @@ -36,12 +46,16 @@ namespace O3DE::ProjectManager // From project.json QString m_projectName; QString m_displayName; + QString m_origin; + QString m_summary; + QStringList m_userTags; // Used on projects home screen QString m_imagePath; QString m_backgroundImagePath; // Used in project creation + bool m_needsBuild = false; //! Does this project need to be built }; } // namespace O3DE::ProjectManager diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.cpp b/Code/Tools/ProjectManager/Source/PythonBindings.cpp index d7d0414c1f..5e7c78d2ec 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.cpp +++ b/Code/Tools/ProjectManager/Source/PythonBindings.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #pragma pop_macro("slots") #include @@ -289,6 +290,7 @@ namespace O3DE::ProjectManager m_engineTemplate = pybind11::module::import("o3de.engine_template"); m_enableGemProject = pybind11::module::import("o3de.enable_gem"); m_disableGemProject = pybind11::module::import("o3de.disable_gem"); + m_editProjectProperties = pybind11::module::import("o3de.project_properties"); // make sure the engine is registered RegisterThisEngine(); @@ -678,6 +680,15 @@ namespace O3DE::ProjectManager { projectInfo.m_projectName = Py_To_String(projectData["project_name"]); projectInfo.m_displayName = Py_To_String_Optional(projectData, "display_name", projectInfo.m_projectName); + projectInfo.m_origin = Py_To_String_Optional(projectData, "origin", projectInfo.m_origin); + projectInfo.m_summary = Py_To_String_Optional(projectData, "summary", projectInfo.m_summary); + if (projectData.contains("user_tags")) + { + for (auto tag : projectData["user_tags"]) + { + projectInfo.m_userTags.append(Py_To_String(tag)); + } + } } catch ([[maybe_unused]] const std::exception& e) { @@ -748,9 +759,27 @@ namespace O3DE::ProjectManager }); } - bool PythonBindings::UpdateProject([[maybe_unused]] const ProjectInfo& projectInfo) + AZ::Outcome PythonBindings::UpdateProject(const ProjectInfo& projectInfo) { - return false; + return ExecuteWithLockErrorHandling([&] + { + std::list newTags; + for (const auto& i : projectInfo.m_userTags) + { + newTags.push_back(i.toStdString()); + } + + m_editProjectProperties.attr("edit_project_props")( + pybind11::str(projectInfo.m_path.toStdString()), // proj_path + pybind11::none(), // proj_name not used + pybind11::str(projectInfo.m_origin.toStdString()), // new_origin + pybind11::str(projectInfo.m_displayName.toStdString()), // new_display + pybind11::str(projectInfo.m_summary.toStdString()), // new_summary + pybind11::str(projectInfo.m_imagePath.toStdString()), // new_icon + pybind11::none(), // add_tags not used + pybind11::none(), // remove_tags not used + pybind11::list(pybind11::cast(newTags))); // replace_tags + }); } ProjectTemplateInfo PythonBindings::ProjectTemplateInfoFromPath(pybind11::handle path) diff --git a/Code/Tools/ProjectManager/Source/PythonBindings.h b/Code/Tools/ProjectManager/Source/PythonBindings.h index 278aa2d5d7..707595b6fd 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindings.h +++ b/Code/Tools/ProjectManager/Source/PythonBindings.h @@ -50,7 +50,7 @@ namespace O3DE::ProjectManager AZ::Outcome> GetProjects() override; bool AddProject(const QString& path) override; bool RemoveProject(const QString& path) override; - bool UpdateProject(const ProjectInfo& projectInfo) override; + AZ::Outcome UpdateProject(const ProjectInfo& projectInfo) override; AZ::Outcome AddGemToProject(const QString& gemPath, const QString& projectPath) override; AZ::Outcome RemoveGemFromProject(const QString& gemPath, const QString& projectPath) override; @@ -78,5 +78,6 @@ namespace O3DE::ProjectManager pybind11::handle m_manifest; pybind11::handle m_enableGemProject; pybind11::handle m_disableGemProject; + pybind11::handle m_editProjectProperties; }; } diff --git a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h index 09d9187dbd..fd94a4e964 100644 --- a/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h +++ b/Code/Tools/ProjectManager/Source/PythonBindingsInterface.h @@ -122,7 +122,7 @@ namespace O3DE::ProjectManager * @param projectInfo the info to use to update the project * @return true on success, false on failure */ - virtual bool UpdateProject(const ProjectInfo& projectInfo) = 0; + virtual AZ::Outcome UpdateProject(const ProjectInfo& projectInfo) = 0; /** * Add a gem to a project diff --git a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp index 6fcb1b1c71..be1f0e5529 100644 --- a/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp +++ b/Code/Tools/ProjectManager/Source/UpdateProjectCtrl.cpp @@ -58,7 +58,7 @@ namespace O3DE::ProjectManager tabWidget->tabBar()->setObjectName("projectSettingsTabBar"); tabWidget->addTab(m_updateSettingsScreen, tr("General")); - QPushButton* gemsButton = new QPushButton(tr("Add More Gems"), this); + QPushButton* gemsButton = new QPushButton(tr("Configure Gems"), this); topBarHLayout->addWidget(gemsButton); tabWidget->setCornerWidget(gemsButton); @@ -136,10 +136,10 @@ namespace O3DE::ProjectManager // Update project if settings changed if (m_projectInfo != newProjectSettings) { - bool result = PythonBindingsInterface::Get()->UpdateProject(newProjectSettings); - if (!result) + auto result = PythonBindingsInterface::Get()->UpdateProject(newProjectSettings); + if (!result.IsSuccess()) { - QMessageBox::critical(this, tr("Project update failed"), tr("Failed to update project.")); + QMessageBox::critical(this, tr("Project update failed"), tr(result.GetError().c_str())); return; } } @@ -189,7 +189,7 @@ namespace O3DE::ProjectManager { if (m_stack->currentIndex() == ScreenOrder::Gems) { - m_header->setSubTitle(QString(tr("Add More Gems to \"%1\"")).arg(m_projectInfo.m_projectName)); + m_header->setSubTitle(QString(tr("Configure Gems for \"%1\"")).arg(m_projectInfo.m_projectName)); m_nextButton->setText(tr("Confirm")); } else diff --git a/Code/Tools/Standalone/StandaloneTools_precompiled.cpp b/Code/Tools/Standalone/StandaloneTools_precompiled.cpp deleted file mode 100644 index 073859f9b8..0000000000 --- a/Code/Tools/Standalone/StandaloneTools_precompiled.cpp +++ /dev/null @@ -1,14 +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. -* -*/ - -#include "StandaloneTools_precompiled.h" - diff --git a/Code/Tools/Standalone/standalone_tools_files.cmake b/Code/Tools/Standalone/standalone_tools_files.cmake index 57e3e45d66..65933bd8c6 100644 --- a/Code/Tools/Standalone/standalone_tools_files.cmake +++ b/Code/Tools/Standalone/standalone_tools_files.cmake @@ -10,7 +10,6 @@ # set(FILES - StandaloneTools_precompiled.cpp StandaloneTools_precompiled.h targetver.h Source/StandaloneToolsApplication.cpp diff --git a/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer_precompiled.cpp b/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer_precompiled.cpp deleted file mode 100644 index 75643c0cf7..0000000000 --- a/Gems/AssetMemoryAnalyzer/Code/Source/AssetMemoryAnalyzer_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "AssetMemoryAnalyzer_precompiled.h" diff --git a/Gems/AssetMemoryAnalyzer/Code/assetmemoryanalyzer_files.cmake b/Gems/AssetMemoryAnalyzer/Code/assetmemoryanalyzer_files.cmake index 88994a2b47..8119a6e870 100644 --- a/Gems/AssetMemoryAnalyzer/Code/assetmemoryanalyzer_files.cmake +++ b/Gems/AssetMemoryAnalyzer/Code/assetmemoryanalyzer_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/AssetMemoryAnalyzer_precompiled.cpp Source/AssetMemoryAnalyzer_precompiled.h Include/AssetMemoryAnalyzer/AssetMemoryAnalyzerBus.h Source/AssetMemoryAnalyzer.cpp diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessing_precompiled.cpp b/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessing_precompiled.cpp deleted file mode 100644 index 35211fa378..0000000000 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/Source/ImageProcessing_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "ImageProcessing_precompiled.h" diff --git a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake index 69c678877d..c7ecee12bb 100644 --- a/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake +++ b/Gems/Atom/Asset/ImageProcessingAtom/Code/imageprocessing_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/ImageProcessing_precompiled.cpp Source/ImageProcessing_precompiled.h Source/Compressors/CryTextureSquisher/CryTextureSquisher.cpp Source/Compressors/CryTextureSquisher/CryTextureSquisher.h diff --git a/Gems/Atom/RHI/DX12/Code/Source/RHI/Atom_RHI_DX12_precompiled.cpp b/Gems/Atom/RHI/DX12/Code/Source/RHI/Atom_RHI_DX12_precompiled.cpp deleted file mode 100644 index cb87449665..0000000000 --- a/Gems/Atom/RHI/DX12/Code/Source/RHI/Atom_RHI_DX12_precompiled.cpp +++ /dev/null @@ -1,12 +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. - * - */ -#include diff --git a/Gems/Atom/RHI/DX12/Code/atom_rhi_dx12_private_common_files.cmake b/Gems/Atom/RHI/DX12/Code/atom_rhi_dx12_private_common_files.cmake index 3325964d17..13917b3f0d 100644 --- a/Gems/Atom/RHI/DX12/Code/atom_rhi_dx12_private_common_files.cmake +++ b/Gems/Atom/RHI/DX12/Code/atom_rhi_dx12_private_common_files.cmake @@ -11,7 +11,6 @@ set(FILES Source/RHI/Atom_RHI_DX12_precompiled.h - Source/RHI/Atom_RHI_DX12_precompiled.cpp Source/RHI/Buffer.cpp Source/RHI/Buffer.h Source/RHI/BufferPool.cpp diff --git a/Gems/Atom/RHI/Metal/Code/Source/Atom_RHI_Metal_precompiled.cpp b/Gems/Atom/RHI/Metal/Code/Source/Atom_RHI_Metal_precompiled.cpp deleted file mode 100644 index 42d5a87697..0000000000 --- a/Gems/Atom/RHI/Metal/Code/Source/Atom_RHI_Metal_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Atom_RHI_Metal_precompiled.h" diff --git a/Gems/Atom/RHI/Metal/Code/atom_rhi_metal_common_files.cmake b/Gems/Atom/RHI/Metal/Code/atom_rhi_metal_common_files.cmake index 3eb2579038..d678075f14 100644 --- a/Gems/Atom/RHI/Metal/Code/atom_rhi_metal_common_files.cmake +++ b/Gems/Atom/RHI/Metal/Code/atom_rhi_metal_common_files.cmake @@ -10,6 +10,5 @@ # set(FILES - Source/Atom_RHI_Metal_precompiled.cpp Source/Atom_RHI_Metal_precompiled.h ) diff --git a/Gems/Atom/RHI/Null/Code/Source/Atom_RHI_Null_precompiled.cpp b/Gems/Atom/RHI/Null/Code/Source/Atom_RHI_Null_precompiled.cpp deleted file mode 100644 index 56bdaca01b..0000000000 --- a/Gems/Atom/RHI/Null/Code/Source/Atom_RHI_Null_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Atom_RHI_Null_precompiled.h" diff --git a/Gems/Atom/RHI/Null/Code/atom_rhi_null_common_files.cmake b/Gems/Atom/RHI/Null/Code/atom_rhi_null_common_files.cmake index f0f7fd03de..aeb34c55a6 100644 --- a/Gems/Atom/RHI/Null/Code/atom_rhi_null_common_files.cmake +++ b/Gems/Atom/RHI/Null/Code/atom_rhi_null_common_files.cmake @@ -10,6 +10,5 @@ # set(FILES - Source/Atom_RHI_Null_precompiled.cpp Source/Atom_RHI_Null_precompiled.h ) diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/Atom_RHI_Vulkan_precompiled.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/Atom_RHI_Vulkan_precompiled.cpp deleted file mode 100644 index 65e8f51730..0000000000 --- a/Gems/Atom/RHI/Vulkan/Code/Source/Atom_RHI_Vulkan_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Atom_RHI_Vulkan_precompiled.h" diff --git a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp index 76662ebc6e..04f2465e78 100644 --- a/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp +++ b/Gems/Atom/RHI/Vulkan/Code/Source/RHI/Device.cpp @@ -720,7 +720,7 @@ namespace AZ StringList deviceExtensions = physicalDevice.GetDeviceExtensionNames(); StringList::iterator itRayTracingExtension = AZStd::find(deviceExtensions.begin(), deviceExtensions.end(), VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME); m_features.m_rayTracing = (itRayTracingExtension != deviceExtensions.end()); - m_features.m_unboundedArrays = true; + m_features.m_unboundedArrays = physicalDevice.GetPhysicalDeviceDescriptorIndexingFeatures().shaderStorageTexelBufferArrayNonUniformIndexing; const auto& deviceLimits = physicalDevice.GetDeviceLimits(); m_limits.m_maxImageDimension1D = deviceLimits.maxImageDimension1D; diff --git a/Gems/Atom/RHI/Vulkan/Code/atom_rhi_vulkan_common_files.cmake b/Gems/Atom/RHI/Vulkan/Code/atom_rhi_vulkan_common_files.cmake index 83a962fb2b..717f2ff994 100644 --- a/Gems/Atom/RHI/Vulkan/Code/atom_rhi_vulkan_common_files.cmake +++ b/Gems/Atom/RHI/Vulkan/Code/atom_rhi_vulkan_common_files.cmake @@ -10,6 +10,5 @@ # set(FILES - Source/Atom_RHI_Vulkan_precompiled.cpp Source/Atom_RHI_Vulkan_precompiled.h ) diff --git a/Gems/Atom/RPI/Code/CMakeLists.txt b/Gems/Atom/RPI/Code/CMakeLists.txt index 2898967add..8a2684347e 100644 --- a/Gems/Atom/RPI/Code/CMakeLists.txt +++ b/Gems/Atom/RPI/Code/CMakeLists.txt @@ -150,6 +150,7 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS) PRIVATE AZ::AtomCore AZ::AzTest + AZ::AzTestShared AZ::AzFramework AZ::AzToolsFramework Legacy::CryCommon diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/AuxGeom/AuxGeomDraw.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/AuxGeom/AuxGeomDraw.h index 0e7f11e46e..525bbc1521 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/AuxGeom/AuxGeomDraw.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/AuxGeom/AuxGeomDraw.h @@ -81,7 +81,7 @@ namespace AZ //! Common arguments for free polygon (point, line, Triangle) draws. struct AuxGeomDynamicDrawArguments { - const AZ::Vector3* m_verts = nullptr; //!< An array of points, 1 for each vertice. + const AZ::Vector3* m_verts = nullptr; //!< An array of points, 1 for each vertex. uint32_t m_vertCount = 0; //!< The number of vertices. const AZ::Color* m_colors; //!< An array of colors, must have either vertCount entries or 1 entry. uint32_t m_colorCount = 0; //!< The number of colors, must equal 1 or vertCount. diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Model/Model.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Model/Model.h index 35af200759..514e3e37a5 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Model/Model.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Public/Model/Model.h @@ -61,12 +61,13 @@ namespace AZ //! Important: only to be used in the Editor, it may kick off a job to calculate spatial information. //! [GFX TODO][ATOM-4343 Bake mesh spatial during AP processing] //! - //! @param rayStart position where the ray starts - //! @param dir direction where the ray ends (does not have to be unit length) - //! @param distanceFactor if an intersection is detected, this will be set such that distanceFactor * dir.length == distance to intersection - //! @param normal if an intersection is detected, this will be set to the normal at the point of intersection - //! @return true if the ray intersects the mesh - bool LocalRayIntersection(const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distanceFactor, AZ::Vector3& normal) const; + //! @param rayStart The starting point of the ray. + //! @param rayDir The direction and length of the ray (magnitude is encoded in the direction). + //! @param[out] distanceNormalized If an intersection is found, will be set to the normalized distance of the intersection + //! (in the range 0.0-1.0) - to calculate the actual distance, multiply distanceNormalized by the magnitude of rayDir. + //! @param[out] normal If an intersection is found, will be set to the normal at the point of collision. + //! @return True if the ray intersects the mesh. + bool LocalRayIntersection(const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const; //! Checks a ray for intersection against this model, where the ray is in a different coordinate space. //! Important: only to be used in the Editor, it may kick off a job to calculate spatial information. @@ -74,13 +75,19 @@ namespace AZ //! //! @param modelTransform a transform that puts the model into the ray's coordinate space //! @param nonUniformScale Non-uniform scale applied in the model's local frame. - //! @param rayStart position where the ray starts - //! @param dir direction where the ray ends (does not have to be unit length) - //! @param distanceFactor if an intersection is detected, this will be set such that distanceFactor * dir.length == distance to intersection - //! @param normal if an intersection is detected, this will be set to the normal at the point of intersection - //! @return true if the ray intersects the mesh - bool RayIntersection(const AZ::Transform& modelTransform, const AZ::Vector3& nonUniformScale, const AZ::Vector3& rayStart, - const AZ::Vector3& dir, float& distanceFactor, AZ::Vector3& normal) const; + //! @param rayStart The starting point of the ray. + //! @param rayDir The direction and length of the ray (magnitude is encoded in the direction). + //! @param[out] distanceNormalized If an intersection is found, will be set to the normalized distance of the intersection + //! (in the range 0.0-1.0) - to calculate the actual distance, multiply distanceNormalized by the magnitude of rayDir. + //! @param[out] normal If an intersection is found, will be set to the normal at the point of collision. + //! @return True if the ray intersects the mesh. + bool RayIntersection( + const AZ::Transform& modelTransform, + const AZ::Vector3& nonUniformScale, + const AZ::Vector3& rayStart, + const AZ::Vector3& rayDir, + float& distanceNormalized, + AZ::Vector3& normal) const; //! Get available UV names from the model and its lods. const AZStd::unordered_set& GetUvNames() const; diff --git a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelAsset.h b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelAsset.h index 8a773dc29e..f3da349195 100644 --- a/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelAsset.h +++ b/Gems/Atom/RPI/Code/Include/Atom/RPI.Reflect/Model/ModelAsset.h @@ -63,12 +63,14 @@ namespace AZ //! Important: only to be used in the Editor, it may kick off a job to calculate spatial information. //! [GFX TODO][ATOM-4343 Bake mesh spatial information during AP processing] //! - //! @param rayStart position where the ray starts - //! @param dir direction where the ray ends (does not have to be unit length) - //! @param distance if an intersection is detected, this will be set such that distanceFactor * dir.length == distance to intersection - //! @param normal if an intersection is detected, this will be set to the normal at the point of collision - //! @return true if the ray intersects the mesh - virtual bool LocalRayIntersectionAgainstModel(const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const; + //! @param rayStart The starting point of the ray. + //! @param rayDir The direction and length of the ray (magnitude is encoded in the direction). + //! @param[out] distanceNormalized If an intersection is found, will be set to the normalized distance of the intersection + //! (in the range 0.0-1.0) - to calculate the actual distance, multiply distanceNormalized by the magnitude of rayDir. + //! @param[out] normal If an intersection is found, will be set to the normal at the point of collision. + //! @return True if the ray intersects the mesh. + virtual bool LocalRayIntersectionAgainstModel( + const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const; private: void SetReady(); @@ -79,9 +81,15 @@ namespace AZ // mutable method void BuildKdTree() const; - bool BruteForceRayIntersect(const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const; + bool BruteForceRayIntersect( + const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const; - bool LocalRayIntersectionAgainstMesh(const ModelLodAsset::Mesh& mesh, const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const; + bool LocalRayIntersectionAgainstMesh( + const ModelLodAsset::Mesh& mesh, + const AZ::Vector3& rayStart, + const AZ::Vector3& rayDir, + float& distanceNormalized, + AZ::Vector3& normal) const; // Various model information used in raycasting AZ::Name m_positionName{ "POSITION" }; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp index 86477bf785..17ff2c64c8 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Public/Model/Model.cpp @@ -137,12 +137,12 @@ namespace AZ return m_modelAsset; } - bool Model::LocalRayIntersection(const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const + bool Model::LocalRayIntersection(const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const { AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); float start; float end; - const int result = Intersect::IntersectRayAABB2(rayStart, dir.GetReciprocal(), m_aabb, start, end); + const int result = Intersect::IntersectRayAABB2(rayStart, rayDir.GetReciprocal(), m_aabb, start, end); if (Intersect::ISECT_RAY_AABB_NONE != result) { if (ModelAsset* modelAssetPtr = m_modelAsset.Get()) @@ -151,7 +151,7 @@ namespace AZ AZ::Debug::Timer timer; timer.Stamp(); #endif - const bool hit = modelAssetPtr->LocalRayIntersectionAgainstModel(rayStart, dir, distance, normal); + const bool hit = modelAssetPtr->LocalRayIntersectionAgainstModel(rayStart, rayDir, distanceNormalized, normal); #if defined(AZ_RPI_PROFILE_RAYCASTING_AGAINST_MODELS) if (hit) { @@ -166,8 +166,12 @@ namespace AZ } bool Model::RayIntersection( - const AZ::Transform& modelTransform, const AZ::Vector3& nonUniformScale, const AZ::Vector3& rayStart, const AZ::Vector3& dir, - float& distanceFactor, AZ::Vector3& normal) const + const AZ::Transform& modelTransform, + const AZ::Vector3& nonUniformScale, + const AZ::Vector3& rayStart, + const AZ::Vector3& rayDir, + float& distanceNormalized, + AZ::Vector3& normal) const { AZ_PROFILE_FUNCTION(Debug::ProfileCategory::AzRender); const AZ::Vector3 clampedScale = nonUniformScale.GetMax(AZ::Vector3(AZ::MinTransformScale)); @@ -175,12 +179,13 @@ namespace AZ const AZ::Transform inverseTM = modelTransform.GetInverse(); const AZ::Vector3 raySrcLocal = inverseTM.TransformPoint(rayStart) / clampedScale; - // Instead of just rotating 'dir' we need it to be scaled too, so that 'distanceFactor' will be in the target units rather than object local units. - const AZ::Vector3 rayDest = rayStart + dir; + // Instead of just rotating 'rayDir' we need it to be scaled too, so that 'distanceNormalized' will be in the target units rather + // than object local units. + const AZ::Vector3 rayDest = rayStart + rayDir; const AZ::Vector3 rayDestLocal = inverseTM.TransformPoint(rayDest) / clampedScale; const AZ::Vector3 rayDirLocal = rayDestLocal - raySrcLocal; - bool result = LocalRayIntersection(raySrcLocal, rayDirLocal, distanceFactor, normal); + const bool result = LocalRayIntersection(raySrcLocal, rayDirLocal, distanceNormalized, normal); normal = (normal * clampedScale).GetNormalized(); return result; } diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp index 988d07e66d..52fda0f56b 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelAsset.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -75,7 +76,8 @@ namespace AZ m_status = Data::AssetData::AssetStatus::Ready; } - bool ModelAsset::LocalRayIntersectionAgainstModel(const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const + bool ModelAsset::LocalRayIntersectionAgainstModel( + const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const { AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::AzRender); @@ -85,7 +87,7 @@ namespace AZ m_modelTriangleCount = CalculateTriangleCount(); } - // check the total vertex count for this model and skip kdtree if the model is simple enough + // check the total vertex count for this model and skip kd-tree if the model is simple enough if (*m_modelTriangleCount > s_minimumModelTriangleCountToOptimize) { if (!m_kdTree) @@ -97,11 +99,11 @@ namespace AZ } else { - return m_kdTree->RayIntersection(rayStart, dir, distance, normal); + return m_kdTree->RayIntersection(rayStart, rayDir, distanceNormalized, normal); } } - return BruteForceRayIntersect(rayStart, dir, distance, normal); + return BruteForceRayIntersect(rayStart, rayDir, distanceNormalized, normal); } void ModelAsset::BuildKdTree() const @@ -136,7 +138,8 @@ namespace AZ } } - bool ModelAsset::BruteForceRayIntersect(const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const + bool ModelAsset::BruteForceRayIntersect( + const AZ::Vector3& rayStart, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const { // brute force - check every triangle if (GetLodAssets().empty() == false) @@ -144,27 +147,27 @@ namespace AZ // intersect against the highest level of detail if (ModelLodAsset* loadAssetPtr = GetLodAssets()[0].Get()) { - float shortestDistance = std::numeric_limits::max(); bool anyHit = false; - AZ::Vector3 intersectionNormal; - + float shortestDistanceNormalized = AZStd::numeric_limits::max(); for (const ModelLodAsset::Mesh& mesh : loadAssetPtr->GetMeshes()) { - if (LocalRayIntersectionAgainstMesh(mesh, rayStart, dir, distance, intersectionNormal)) + float currentDistanceNormalized; + if (LocalRayIntersectionAgainstMesh(mesh, rayStart, rayDir, currentDistanceNormalized, intersectionNormal)) { anyHit = true; - if (distance < shortestDistance) + + if (currentDistanceNormalized < shortestDistanceNormalized) { normal = intersectionNormal; - shortestDistance = distance; + shortestDistanceNormalized = currentDistanceNormalized; } } } if (anyHit) { - distance = shortestDistance; + distanceNormalized = shortestDistanceNormalized; } return anyHit; @@ -174,7 +177,12 @@ namespace AZ return false; } - bool ModelAsset::LocalRayIntersectionAgainstMesh(const ModelLodAsset::Mesh& mesh, const AZ::Vector3& rayStart, const AZ::Vector3& dir, float& distance, AZ::Vector3& normal) const + bool ModelAsset::LocalRayIntersectionAgainstMesh( + const ModelLodAsset::Mesh& mesh, + const AZ::Vector3& rayStart, + const AZ::Vector3& rayDir, + float& distanceNormalized, + AZ::Vector3& normal) const { const BufferAssetView& indexBufferView = mesh.GetIndexBufferAssetView(); const AZStd::array_view& streamBufferList = mesh.GetStreamBufferInfoList(); @@ -217,14 +225,13 @@ namespace AZ AZStd::array_view indexRawBuffer = indexAssetViewPtr->GetBuffer(); RHI::BufferViewDescriptor indexRawDesc = indexAssetViewPtr->GetBufferViewDescriptor(); - float closestNormalizedDistance = 1.f; bool anyHit = false; - const AZ::Vector3 rayEnd = rayStart + dir * distance; + const AZ::Vector3 rayEnd = rayStart + rayDir; AZ::Vector3 a, b, c; AZ::Vector3 intersectionNormal; - float normalizedDistance = 1.f; + float shortestDistanceNormalized = AZStd::numeric_limits::max(); const AZ::u32* indexPtr = reinterpret_cast(indexRawBuffer.data()); for (uint32_t indexIter = 0; indexIter <= indexRawDesc.m_elementCount - 3; indexIter += 3, indexPtr += 3) { @@ -247,20 +254,22 @@ namespace AZ p = reinterpret_cast(&positionRawBuffer[index2 * positionElementSize]); c.Set(const_cast(p)); - if (AZ::Intersect::IntersectSegmentTriangleCCW(rayStart, rayEnd, a, b, c, intersectionNormal, normalizedDistance)) + float currentDistanceNormalized; + if (AZ::Intersect::IntersectSegmentTriangleCCW(rayStart, rayEnd, a, b, c, intersectionNormal, currentDistanceNormalized)) { - if (normalizedDistance < closestNormalizedDistance) + anyHit = true; + + if (currentDistanceNormalized < shortestDistanceNormalized) { normal = intersectionNormal; - closestNormalizedDistance = normalizedDistance; + shortestDistanceNormalized = currentDistanceNormalized; } - anyHit = true; } } if (anyHit) { - distance = closestNormalizedDistance * distance; + distanceNormalized = shortestDistanceNormalized; } return anyHit; diff --git a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp index bee489c2fd..2ee6d93df3 100644 --- a/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp +++ b/Gems/Atom/RPI/Code/Source/RPI.Reflect/Model/ModelKdTree.cpp @@ -208,10 +208,10 @@ namespace AZ bool ModelKdTree::RayIntersection( const AZ::Vector3& raySrc, const AZ::Vector3& rayDir, float& distanceNormalized, AZ::Vector3& normal) const { - float closestDistanceNormalized = AZStd::numeric_limits::max(); - if (RayIntersectionRecursively(m_pRootNode.get(), raySrc, rayDir, closestDistanceNormalized, normal)) + float shortestDistanceNormalized = AZStd::numeric_limits::max(); + if (RayIntersectionRecursively(m_pRootNode.get(), raySrc, rayDir, shortestDistanceNormalized, normal)) { - distanceNormalized = closestDistanceNormalized; + distanceNormalized = shortestDistanceNormalized; return true; } diff --git a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp index 3ce17bee8b..f039240ee0 100644 --- a/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp +++ b/Gems/Atom/RPI/Code/Tests/Model/ModelTests.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -568,7 +569,7 @@ namespace UnitTest ValidateModelAsset(serializedModelAsset.Get(), expectedModel); } - // Tests that if we try to set the name on a Model + // Tests that if we try to set the name on a Model // before calling Begin that it will fail. TEST_F(ModelTests, SetNameNoBegin) { @@ -581,7 +582,7 @@ namespace UnitTest creator.SetName("TestName"); } - // Tests that if we try to add a ModelLod to a Model + // Tests that if we try to add a ModelLod to a Model // before calling Begin that it will fail. TEST_F(ModelTests, AddLodNoBegin) { @@ -598,7 +599,7 @@ namespace UnitTest creator.AddLodAsset(AZStd::move(lod)); } - // Tests that if we create a ModelAsset without adding + // Tests that if we create a ModelAsset without adding // any ModelLodAssets that the creator will properly fail to produce an asset. TEST_F(ModelTests, CreateModelNoLods) { @@ -618,8 +619,8 @@ namespace UnitTest ASSERT_EQ(asset.Get(), nullptr); } - // Tests that if we call SetLodIndexBuffer without calling - // Begin first on the ModelLodAssetCreator that it + // Tests that if we call SetLodIndexBuffer without calling + // Begin first on the ModelLodAssetCreator that it // fails as expected. TEST_F(ModelTests, SetLodIndexBufferNoBegin) { @@ -633,8 +634,8 @@ namespace UnitTest creator.SetLodIndexBuffer(validIndexBuffer); } - // Tests that if we call AddLodStreamBuffer without calling - // Begin first on the ModelLodAssetCreator that it + // Tests that if we call AddLodStreamBuffer without calling + // Begin first on the ModelLodAssetCreator that it // fails as expected. TEST_F(ModelTests, AddLodStreamBufferNoBegin) { @@ -648,8 +649,8 @@ namespace UnitTest creator.AddLodStreamBuffer(validStreamBuffer); } - // Tests that if we call BeginMesh without calling - // Begin first on the ModelLodAssetCreator that it + // Tests that if we call BeginMesh without calling + // Begin first on the ModelLodAssetCreator that it // fails as expected. TEST_F(ModelTests, BeginMeshNoBegin) { @@ -662,13 +663,13 @@ namespace UnitTest } // Tests that if we try to set an AABB on a mesh - // without calling Begin or BeginMesh that it fails + // without calling Begin or BeginMesh that it fails // as expected. Also tests the case that Begin *is* // called but BeginMesh is not. TEST_F(ModelTests, SetAabbNoBeginNoBeginMesh) { using namespace AZ; - + RPI::ModelLodAssetCreator creator; AZ::Aabb aabb = AZ::Aabb::CreateCenterRadius(AZ::Vector3::CreateZero(), 1.0f); @@ -691,13 +692,13 @@ namespace UnitTest } // Tests that if we try to set the material id on a mesh - // without calling Begin or BeginMesh that it fails + // without calling Begin or BeginMesh that it fails // as expected. Also tests the case that Begin *is* // called but BeginMesh is not. TEST_F(ModelTests, SetMaterialIdNoBeginNoBeginMesh) { using namespace AZ; - + RPI::ModelLodAssetCreator creator; { @@ -715,7 +716,7 @@ namespace UnitTest } // Tests that if we try to set the index buffer on a mesh - // without calling Begin or BeginMesh that it fails + // without calling Begin or BeginMesh that it fails // as expected. Also tests the case that Begin *is* // called but BeginMesh is not. TEST_F(ModelTests, SetIndexBufferNoBeginNoBeginMesh) @@ -751,7 +752,7 @@ namespace UnitTest } // Tests that if we try to add a stream buffer on a mesh - // without calling Begin or BeginMesh that it fails + // without calling Begin or BeginMesh that it fails // as expected. Also tests the case that Begin *is* // called but BeginMesh is not. TEST_F(ModelTests, AddStreamBufferNoBeginNoBeginMesh) @@ -785,7 +786,7 @@ namespace UnitTest } } - // Tests that if we try to end the creation of a + // Tests that if we try to end the creation of a // ModelLodAsset that has no meshes that it fails // as expected. TEST_F(ModelTests, CreateLodNoMeshes) @@ -804,7 +805,7 @@ namespace UnitTest ASSERT_EQ(asset.Get(), nullptr); } - // Tests that validation still fails when expected + // Tests that validation still fails when expected // even after producing a valid mesh due to a missing // BeginMesh call TEST_F(ModelTests, SecondMeshFailureNoBeginMesh) @@ -862,8 +863,8 @@ namespace UnitTest ASSERT_EQ(asset->GetMeshes().size(), 1); } - // Tests that validation still fails when expected - // even after producing a valid mesh due to SetMeshX + // Tests that validation still fails when expected + // even after producing a valid mesh due to SetMeshX // calls coming after End TEST_F(ModelTests, SecondMeshAfterEnd) { @@ -907,7 +908,7 @@ namespace UnitTest AZ::Aabb aabb = AZ::Aabb::CreateCenterRadius(Vector3::CreateZero(), 1.0f); ErrorMessageFinder messageFinder("Begin() was not called", 6); - + creator.BeginMesh(); creator.SetMeshAabb(AZStd::move(aabb)); creator.SetMeshMaterialAsset(m_materialAsset); @@ -955,6 +956,20 @@ namespace UnitTest EXPECT_EQ(uvStreamTangentBitmask.GetFullTangentBitmask(), 0x70000F51); } + // + // +----+ + // / /| + // +----+ | + // | | + + // | |/ + // +----+ + // + static constexpr AZStd::array CubePositions = { -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, + -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f }; + static constexpr AZStd::array CubeIndices = { + uint32_t{ 0 }, 2, 1, 1, 2, 3, 4, 5, 6, 5, 7, 6, 0, 4, 2, 4, 6, 2, 1, 3, 5, 5, 3, 7, 0, 1, 4, 4, 1, 5, 2, 6, 3, 6, 7, 3, + }; + // This class creates a Model with one LOD, whose mesh contains 2 planes. Plane 1 is in the XY plane at Z=-0.5, and // plane 2 is in the XY plane at Z=0.5. The two planes each have 9 quads which have been triangulated. It only has // a position and index buffer. @@ -972,52 +987,75 @@ namespace UnitTest // *---*---*---* // \ / \ / \ / \ // *---*---*---* + static constexpr AZStd::array TwoSeparatedPlanesPositions{ + -1.0f, -0.333f, -0.5f, -0.333f, -1.0f, -0.5f, -0.333f, -0.333f, -0.5f, 0.333f, -0.333f, -0.5f, 1.0f, -1.0f, -0.5f, + 1.0f, -0.333f, -0.5f, 0.333f, -1.0f, -0.5f, 0.333f, 1.0f, -0.5f, 1.0f, 0.333f, -0.5f, 1.0f, 1.0f, -0.5f, + 0.333f, 0.333f, -0.5f, -0.333f, 1.0f, -0.5f, -0.333f, 0.333f, -0.5f, -1.0f, 1.0f, -0.5f, -1.0f, 0.333f, -0.5f, + -1.0f, -0.333f, 0.5f, -0.333f, -1.0f, 0.5f, -0.333f, -0.333f, 0.5f, 0.333f, -0.333f, 0.5f, 1.0f, -1.0f, 0.5f, + 1.0f, -0.333f, 0.5f, -0.333f, -0.333f, 0.5f, 0.333f, -1.0f, 0.5f, 0.333f, -0.333f, 0.5f, 0.333f, 1.0f, 0.5f, + 1.0f, 0.333f, 0.5f, 1.0f, 1.0f, 0.5f, 0.333f, 0.333f, 0.5f, 1.0f, -0.333f, 0.5f, -0.333f, 1.0f, 0.5f, + -0.333f, 0.333f, 0.5f, 0.333f, -0.333f, 0.5f, 0.333f, 0.333f, 0.5f, -1.0f, 1.0f, 0.5f, -0.333f, 0.333f, 0.5f, + -1.0f, 0.333f, 0.5f, -1.0f, -1.0f, -0.5f, -1.0f, -1.0f, 0.5f, 0.333f, -0.333f, 0.5f, 0.333f, -1.0f, 0.5f, + 1.0f, -1.0f, 0.5f, 0.333f, -1.0f, 0.5f, 0.333f, 0.333f, 0.5f, 0.333f, -0.333f, 0.5f, 1.0f, -0.333f, 0.5f, + -0.333f, 0.333f, 0.5f, -0.333f, -0.333f, 0.5f, 0.333f, -0.333f, 0.5f, + }; + // clang-format off + static constexpr AZStd::array TwoSeparatedPlanesIndices{ + uint32_t{ 0 }, 1, 2, 3, 4, 5, 2, 6, 3, 7, 8, 9, 10, 5, 8, 11, 10, 7, 12, 3, 10, 13, 12, 11, 14, 2, 12, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 25, 29, 27, 24, 30, 31, 32, 33, 34, 29, 35, 17, 34, + 0, 36, 1, 3, 6, 4, 2, 1, 6, 7, 10, 8, 10, 3, 5, 11, 12, 10, 12, 2, 3, 13, 14, 12, 14, 0, 2, + 15, 37, 16, 38, 39, 40, 17, 16, 41, 24, 27, 25, 42, 43, 44, 29, 34, 27, 45, 46, 47, 33, 35, 34, 35, 15, 17, + }; + // clang-format on + + // Ensure that the index buffer references all the positions in the position buffer + static constexpr inline auto minmaxElement = AZStd::minmax_element(begin(TwoSeparatedPlanesIndices), end(TwoSeparatedPlanesIndices)); + static_assert(*minmaxElement.second == (TwoSeparatedPlanesPositions.size() / 3) - 1); + template class TD; - class TwoSeparatedPlanesMesh + class TestMesh { public: - TwoSeparatedPlanesMesh() + TestMesh(const float* positions, size_t positionCount, const uint32_t* indices, size_t indicesCount) { - using namespace AZ; - - RPI::ModelLodAssetCreator lodCreator; - lodCreator.Begin(Data::AssetId(AZ::Uuid::CreateRandom())); + AZ::RPI::ModelLodAssetCreator lodCreator; + lodCreator.Begin(AZ::Data::AssetId(AZ::Uuid::CreateRandom())); lodCreator.BeginMesh(); - lodCreator.SetMeshAabb(Aabb::CreateFromMinMax({-1.0f, -1.0f, -0.5f}, {1.0f, 1.0f, 0.5f})); + lodCreator.SetMeshAabb(AZ::Aabb::CreateFromMinMax({-1.0f, -1.0f, -0.5f}, {1.0f, 1.0f, 0.5f})); lodCreator.SetMeshMaterialAsset( AZ::Data::Asset(AZ::Data::AssetId(AZ::Uuid::CreateRandom(), 0), AZ::AzTypeInfo::Uuid(), "") ); { - AZ::Data::Asset indexBuffer = BuildTestBuffer(s_indexes.size(), sizeof(uint32_t)); - AZStd::copy(s_indexes.begin(), s_indexes.end(), reinterpret_cast(const_cast(indexBuffer->GetBuffer().data()))); + AZ::Data::Asset indexBuffer = BuildTestBuffer(indicesCount, sizeof(uint32_t)); + AZStd::copy(indices, indices + indicesCount, reinterpret_cast(const_cast(indexBuffer->GetBuffer().data()))); lodCreator.SetMeshIndexBuffer({ indexBuffer, - RHI::BufferViewDescriptor::CreateStructured(0, s_indexes.size(), sizeof(uint32_t)) + AZ::RHI::BufferViewDescriptor::CreateStructured(0, indicesCount, sizeof(uint32_t)) }); } { - AZ::Data::Asset positionBuffer = BuildTestBuffer(s_positions.size() / 3, sizeof(float) * 3); - AZStd::copy(s_positions.begin(), s_positions.end(), reinterpret_cast(const_cast(positionBuffer->GetBuffer().data()))); + AZ::Data::Asset positionBuffer = BuildTestBuffer(positionCount / 3, sizeof(float) * 3); + AZStd::copy(positions, positions + positionCount, reinterpret_cast(const_cast(positionBuffer->GetBuffer().data()))); lodCreator.AddMeshStreamBuffer( AZ::RHI::ShaderSemantic(AZ::Name("POSITION")), AZ::Name(), { positionBuffer, - RHI::BufferViewDescriptor::CreateStructured(0, s_positions.size() / 3, sizeof(float) * 3) + AZ::RHI::BufferViewDescriptor::CreateStructured(0, positionCount / 3, sizeof(float) * 3) } ); } lodCreator.EndMesh(); - Data::Asset lodAsset; + AZ::Data::Asset lodAsset; lodCreator.End(lodAsset); - RPI::ModelAssetCreator modelCreator; - modelCreator.Begin(Data::AssetId(AZ::Uuid::CreateRandom())); + AZ::RPI::ModelAssetCreator modelCreator; + modelCreator.Begin(AZ::Data::AssetId(AZ::Uuid::CreateRandom())); modelCreator.SetName("TestModel"); modelCreator.AddLodAsset(AZStd::move(lodAsset)); modelCreator.End(m_modelAsset); @@ -1030,40 +1068,20 @@ namespace UnitTest private: AZ::Data::Asset m_modelAsset; - - static constexpr AZStd::array s_positions{ - -1.0f, -0.333f, -0.5f, -0.333f, -1.0f, -0.5f, -0.333f, -0.333f, -0.5f, 0.333f, -0.333f, -0.5f, 1.0f, -1.0f, -0.5f, - 1.0f, -0.333f, -0.5f, 0.333f, -1.0f, -0.5f, 0.333f, 1.0f, -0.5f, 1.0f, 0.333f, -0.5f, 1.0f, 1.0f, -0.5f, - 0.333f, 0.333f, -0.5f, -0.333f, 1.0f, -0.5f, -0.333f, 0.333f, -0.5f, -1.0f, 1.0f, -0.5f, -1.0f, 0.333f, -0.5f, - -1.0f, -0.333f, 0.5f, -0.333f, -1.0f, 0.5f, -0.333f, -0.333f, 0.5f, 0.333f, -0.333f, 0.5f, 1.0f, -1.0f, 0.5f, - 1.0f, -0.333f, 0.5f, -0.333f, -0.333f, 0.5f, 0.333f, -1.0f, 0.5f, 0.333f, -0.333f, 0.5f, 0.333f, 1.0f, 0.5f, - 1.0f, 0.333f, 0.5f, 1.0f, 1.0f, 0.5f, 0.333f, 0.333f, 0.5f, 1.0f, -0.333f, 0.5f, -0.333f, 1.0f, 0.5f, - -0.333f, 0.333f, 0.5f, 0.333f, -0.333f, 0.5f, 0.333f, 0.333f, 0.5f, -1.0f, 1.0f, 0.5f, -0.333f, 0.333f, 0.5f, - -1.0f, 0.333f, 0.5f, -1.0f, -1.0f, -0.5f, -1.0f, -1.0f, 0.5f, 0.333f, -0.333f, 0.5f, 0.333f, -1.0f, 0.5f, - 1.0f, -1.0f, 0.5f, 0.333f, -1.0f, 0.5f, 0.333f, 0.333f, 0.5f, 0.333f, -0.333f, 0.5f, 1.0f, -0.333f, 0.5f, - -0.333f, 0.333f, 0.5f, -0.333f, -0.333f, 0.5f, 0.333f, -0.333f, 0.5f, - }; - static constexpr AZStd::array s_indexes{ - uint32_t{0}, 1, 2, 3, 4, 5, 2, 6, 3, 7, 8, 9, 10, 5, 8, 11, 10, 7, 12, 3, 10, 13, 12, 11, 14, 2, 12, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 25, 29, 27, 24, 30, 31, 32, 33, 34, 29, 35, 17, 34, - 0, 36, 1, 3, 6, 4, 2, 1, 6, 7, 10, 8, 10, 3, 5, 11, 12, 10, 12, 2, 3, 13, 14, 12, 14, 0, 2, - 15, 37, 16, 38, 39, 40, 17, 16, 41, 24, 27, 25, 42, 43, 44, 29, 34, 27, 45, 46, 47, 33, 35, 34, 35, 15, 17, - }; - - // Ensure that the index buffer references all the positions in the position buffer - static constexpr inline auto minmaxElement = AZStd::minmax_element(begin(s_indexes), end(s_indexes)); - static_assert(*minmaxElement.second == (s_positions.size() / 3) - 1); }; - struct KdTreeIntersectParams + struct IntersectParams { float xpos; float ypos; float zpos; + float xdir; + float ydir; + float zdir; float expectedDistance; bool expectedShouldIntersect; - friend std::ostream& operator<<(std::ostream& os, const KdTreeIntersectParams& param) + friend std::ostream& operator<<(std::ostream& os, const IntersectParams& param) { return os << "xpos:" << param.xpos @@ -1076,13 +1094,15 @@ namespace UnitTest class KdTreeIntersectsParameterizedFixture : public ModelTests - , public ::testing::WithParamInterface + , public ::testing::WithParamInterface { }; TEST_P(KdTreeIntersectsParameterizedFixture, KdTreeIntersects) { - TwoSeparatedPlanesMesh mesh; + TestMesh mesh( + TwoSeparatedPlanesPositions.data(), TwoSeparatedPlanesPositions.size(), TwoSeparatedPlanesIndices.data(), + TwoSeparatedPlanesIndices.size()); AZ::RPI::ModelKdTree kdTree; ASSERT_TRUE(kdTree.Build(mesh.GetModel().Get())); @@ -1092,38 +1112,40 @@ namespace UnitTest EXPECT_THAT( kdTree.RayIntersection( - AZ::Vector3(GetParam().xpos, GetParam().ypos, GetParam().zpos), AZ::Vector3::CreateAxisZ(-1.0f), distance, normal), + AZ::Vector3(GetParam().xpos, GetParam().ypos, GetParam().zpos), + AZ::Vector3(GetParam().xdir, GetParam().ydir, GetParam().zdir), distance, normal), testing::Eq(GetParam().expectedShouldIntersect)); EXPECT_THAT(distance, testing::FloatEq(GetParam().expectedDistance)); } - static constexpr inline AZStd::array intersectTestData{ - KdTreeIntersectParams{ -0.1f, 0.0f, 1.0f, 0.5f, true }, - KdTreeIntersectParams{ 0.0f, 0.0f, 1.0f, 0.5f, true }, - KdTreeIntersectParams{ 0.1f, 0.0f, 1.0f, 0.5f, true }, + static constexpr AZStd::array KdTreeIntersectTestData{ + IntersectParams{ -0.1f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.1f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, // Test the center of each triangle - KdTreeIntersectParams{-0.111f, -0.111f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.111f, -0.778f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.111f, 0.555f, 1.0f, 0.5f, true}, // Should intersect triangle with indices {29, 34, 27} and {11, 12, 10} - KdTreeIntersectParams{-0.555f, -0.555f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.555f, 0.111f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.555f, 0.778f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.778f, -0.111f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.778f, -0.778f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{-0.778f, 0.555f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.111f, -0.555f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.111f, 0.111f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.111f, 0.778f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.555f, -0.111f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.555f, -0.778f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.555f, 0.555f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.778f, -0.555f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.778f, 0.111f, 1.0f, 0.5f, true}, - KdTreeIntersectParams{0.778f, 0.778f, 1.0f, 0.5f, true}, + IntersectParams{ -0.111f, -0.111f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.111f, -0.778f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.111f, 0.555f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, + true }, // Should intersect triangle with indices {29, 34, 27} and {11, 12, 10} + IntersectParams{ -0.555f, -0.555f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.555f, 0.111f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.555f, 0.778f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.778f, -0.111f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.778f, -0.778f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ -0.778f, 0.555f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.111f, -0.555f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.111f, 0.111f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.111f, 0.778f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.555f, -0.111f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.555f, -0.778f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.555f, 0.555f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.778f, -0.555f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.778f, 0.111f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 0.778f, 0.778f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, true }, }; - INSTANTIATE_TEST_CASE_P(KdTreeIntersectsPlane, KdTreeIntersectsParameterizedFixture, ::testing::ValuesIn(intersectTestData)); + INSTANTIATE_TEST_CASE_P(KdTreeIntersectsPlane, KdTreeIntersectsParameterizedFixture, ::testing::ValuesIn(KdTreeIntersectTestData)); class KdTreeIntersectsFixture : public ModelTests @@ -1133,7 +1155,10 @@ namespace UnitTest { ModelTests::SetUp(); - m_mesh = AZStd::make_unique(); + m_mesh = AZStd::make_unique( + TwoSeparatedPlanesPositions.data(), TwoSeparatedPlanesPositions.size(), TwoSeparatedPlanesIndices.data(), + TwoSeparatedPlanesIndices.size()); + m_kdTree = AZStd::make_unique(); ASSERT_TRUE(m_kdTree->Build(m_mesh->GetModel().Get())); } @@ -1146,7 +1171,7 @@ namespace UnitTest ModelTests::TearDown(); } - AZStd::unique_ptr m_mesh; + AZStd::unique_ptr m_mesh; AZStd::unique_ptr m_kdTree; }; @@ -1154,7 +1179,7 @@ namespace UnitTest { float t = AZStd::numeric_limits::max(); AZ::Vector3 normal; - + constexpr float rayLength = 100.0f; EXPECT_THAT( m_kdTree->RayIntersection( @@ -1181,4 +1206,85 @@ namespace UnitTest EXPECT_THAT( m_kdTree->RayIntersection(AZ::Vector3::CreateAxisZ(5.0f), -AZ::Vector3::CreateAxisZ(), t, normal), testing::Eq(false)); } + + class BruteForceIntersectsParameterizedFixture + : public ModelTests + , public ::testing::WithParamInterface + { + }; + + TEST_P(BruteForceIntersectsParameterizedFixture, BruteForceIntersectsCube) + { + TestMesh mesh(CubePositions.data(), CubePositions.size(), CubeIndices.data(), CubeIndices.size()); + + float distance = AZStd::numeric_limits::max(); + AZ::Vector3 normal; + + EXPECT_THAT( + mesh.GetModel()->LocalRayIntersectionAgainstModel( + AZ::Vector3(GetParam().xpos, GetParam().ypos, GetParam().zpos), + AZ::Vector3(GetParam().xdir, GetParam().ydir, GetParam().zdir), distance, normal), + testing::Eq(GetParam().expectedShouldIntersect)); + EXPECT_THAT(distance, testing::FloatEq(GetParam().expectedDistance)); + } + + static constexpr AZStd::array BruteForceIntersectTestData{ + IntersectParams{ 5.0f, 0.0f, 5.0f, 0.0f, 0.0f, -1.0f, AZStd::numeric_limits::max(), false }, + IntersectParams{ 0.0f, 0.0f, 1.5f, 0.0f, 0.0f, -1.0f, 0.5f, true }, + IntersectParams{ 5.0f, 0.0f, 0.0f, -10.0f, 0.0f, 0.0f, 0.4f, true }, + IntersectParams{ -5.0f, 0.0f, 0.0f, 20.0f, 0.0f, 0.0f, 0.2f, true }, + IntersectParams{ 0.0f, -10.0f, 0.0f, 0.0f, 20.0f, 0.0f, 0.45f, true }, + IntersectParams{ 0.0f, 20.0f, 0.0f, 0.0f, -40.0f, 0.0f, 0.475f, true }, + IntersectParams{ 0.0f, 20.0f, 0.0f, 0.0f, -19.0f, 0.0f, 1.0f, true }, + }; + + INSTANTIATE_TEST_CASE_P( + BruteForceIntersects, BruteForceIntersectsParameterizedFixture, ::testing::ValuesIn(BruteForceIntersectTestData)); + + class BruteForceModelIntersectsFixture + : public ModelTests + { + public: + void SetUp() override + { + ModelTests::SetUp(); + m_mesh = AZStd::make_unique(CubePositions.data(), CubePositions.size(), CubeIndices.data(), CubeIndices.size()); + } + + void TearDown() override + { + m_mesh.reset(); + ModelTests::TearDown(); + } + + AZStd::unique_ptr m_mesh; + }; + + TEST_F(BruteForceModelIntersectsFixture, BruteForceIntersectionDetectedWithCube) + { + float t = 0.0f; + AZ::Vector3 normal; + + // firing down the negative z axis, positioned 5 units from cube (cube is 2x2x2 so intersection + // happens at 1 in z) + EXPECT_THAT( + m_mesh->GetModel()->LocalRayIntersectionAgainstModel( + AZ::Vector3::CreateAxisZ(5.0f), -AZ::Vector3::CreateAxisZ(10.0f), t, normal), + testing::Eq(true)); + EXPECT_THAT(t, testing::FloatEq(0.4f)); + } + + TEST_F(BruteForceModelIntersectsFixture, BruteForceIntersectionDetectedAndNormalSetAtEndOfRay) + { + float t = 0.0f; + AZ::Vector3 normal = AZ::Vector3::CreateOne(); // invalid starting normal + + // ensure the intersection happens right at the end of the ray + EXPECT_THAT( + m_mesh->GetModel()->LocalRayIntersectionAgainstModel( + AZ::Vector3::CreateAxisY(10.0f), -AZ::Vector3::CreateAxisY(9.0f), t, normal), + testing::Eq(true)); + EXPECT_THAT(t, testing::FloatEq(1.0f)); + EXPECT_THAT(normal, IsClose(AZ::Vector3::CreateAxisY())); + } } // namespace UnitTest diff --git a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditor.qss b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditor.qss index e518d80740..506c5a2952 100644 --- a/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditor.qss +++ b/Gems/Atom/Tools/MaterialEditor/Code/Source/Window/MaterialEditor.qss @@ -11,8 +11,8 @@ */ /* Style for visualizing property values overridden from their prefab values */ -AzToolsFramework--PropertyRowWidget[IsOverridden=true] QLabel +AzToolsFramework--PropertyRowWidget[IsOverridden="true"] QLabel { font-weight: bold; - color: #F5A623; + color: #1E70EB; } diff --git a/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Materials/baseboards.material b/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Materials/baseboards.material index f75490c2ad..dee6ded191 100644 --- a/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Materials/baseboards.material +++ b/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Materials/baseboards.material @@ -37,9 +37,6 @@ "factor": 0.4343433976173401, "textureMap": "Materials/Bricks038_8K/Bricks038_8K_Roughness.png", "useTexture": false - }, - "subsurfaceScattering": { - "useThicknessMap": false } } } diff --git a/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/Lighthead_lightfacingemissive.material b/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/Lighthead_lightfacingemissive.material index 21cb12a82c..ddc298a08b 100644 --- a/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/Lighthead_lightfacingemissive.material +++ b/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/Lighthead_lightfacingemissive.material @@ -18,15 +18,6 @@ }, "opacity": { "factor": 1.0 - }, - "subsurfaceScattering": { - "enableSubsurfaceScattering": true, - "quality": 1.0, - "scatterDistance": 2.626262664794922, - "subsurfaceScatterFactor": 1.0, - "thickness": 0.1414141058921814, - "transmissionMode": "ThinObject", - "transmissionScale": 1.8181817531585694 } } } diff --git a/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/PlayfulTeapot_playfulteapot.material b/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/PlayfulTeapot_playfulteapot.material index b46dd709b1..27540c587e 100644 --- a/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/PlayfulTeapot_playfulteapot.material +++ b/Gems/AtomContent/LookDevelopmentStudioPixar/Assets/Objects/PlayfulTeapot_playfulteapot.material @@ -31,18 +31,6 @@ }, "roughness": { "factor": 0.0 - }, - "subsurfaceScattering": { - "enableSubsurfaceScattering": true, - "quality": 1.0, - "scatterColor": [ - 0.045288778841495517, - 0.24347294867038728, - 0.2060578316450119, - 1.0 - ], - "scatterDistance": 4.040403842926025, - "subsurfaceScatterFactor": 0.5 } } } diff --git a/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Copper/copper.material b/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Copper/copper.material index 4489e12c4d..80b7ea29f3 100644 --- a/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Copper/copper.material +++ b/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Copper/copper.material @@ -20,11 +20,6 @@ }, "roughness": { "factor": 0.20202019810676576 - }, - "subsurfaceScattering": { - "quality": 0.329292893409729, - "scatterDistance": 6.666666507720947, - "subsurfaceScatterFactor": 0.9595959782600403 } } } diff --git a/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plaster/plaster.material b/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plaster/plaster.material index 3121fdac24..cdf76f612d 100644 --- a/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plaster/plaster.material +++ b/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plaster/plaster.material @@ -28,17 +28,6 @@ }, "specularF0": { "factor": 1.0 - }, - "subsurfaceScattering": { - "quality": 0.9838383793830872, - "scatterColor": [ - 0.143602654337883, - 0.012634470127522946, - 0.0005798428319394589, - 1.0 - ], - "scatterDistance": 18.383838653564454, - "subsurfaceScatterFactor": 0.1414141058921814 } } } diff --git a/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plastic_01/plastic_01.material b/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plastic_01/plastic_01.material index e953d04238..227017e1ab 100644 --- a/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plastic_01/plastic_01.material +++ b/Gems/AtomContent/ReferenceMaterials/Assets/Materials/Plastic_01/plastic_01.material @@ -25,17 +25,6 @@ }, "specularF0": { "factor": 1.0 - }, - "subsurfaceScattering": { - "quality": 0.9838383793830872, - "scatterColor": [ - 0.143602654337883, - 0.012634470127522946, - 0.0005798428319394589, - 1.0 - ], - "scatterDistance": 18.383838653564454, - "subsurfaceScatterFactor": 0.1414141058921814 } } } diff --git a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_ceiling.material b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_ceiling.material index 95d08d398b..88730c9556 100644 --- a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_ceiling.material +++ b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_ceiling.material @@ -4,20 +4,15 @@ "parentMaterial": "", "propertyLayoutVersion": 3, "properties": { - "occlusion": { - "diffuseTextureMap": "Textures/ceiling_1k_ao.png" - }, "baseColor": { - "textureBlendMode": "Lerp", + "color": [ + 0.800000011920929, + 0.800000011920929, + 0.800000011920929, + 1.0 + ], "textureMap": "Textures/ceiling_1k_basecolor.png" }, - "clearCoat": { - "enable": true, - "factor": 0.5, - "influenceMap": "Textures/ceiling_1k_ao.png", - "normalMap": "Textures/ceiling_1k_normal.png", - "roughness": 0.30000001192092898 - }, "emissive": { "color": [ 0.0, @@ -26,33 +21,8 @@ 1.0 ] }, - "general": { - "applySpecularAA": true - }, - "irradiance": { - "color": [ - 1.0, - 0.7591058015823364, - 0.43776607513427737, - 1.0 - ] - }, - "normal": { - "textureMap": "Textures/ceiling_1k_normal.png" - }, "opacity": { "factor": 1.0 - }, - "parallax": { - "algorithm": "ContactRefinement", - "factor": 0.019999999552965165, - "pdo": true, - "quality": "Medium", - "textureMap": "Textures/ceiling_1k_height.png", - "useTexture": false - }, - "roughness": { - "textureMap": "Textures/ceiling_1k_roughness.png" } } -} +} \ No newline at end of file diff --git a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_chain.material b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_chain.material index 223bd0a24f..1ed442a9e0 100644 --- a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_chain.material +++ b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_chain.material @@ -13,31 +13,16 @@ ], "textureMap": "Textures/chain_basecolor.png" }, - "general": { - "applySpecularAA": true - }, - "irradiance": { + "emissive": { "color": [ - 0.4891279339790344, - 0.7931944727897644, - 1.0, + 0.0, + 0.0, + 0.0, 1.0 ] }, - "metallic": { - "textureMap": "Textures/chain_alpha.png" - }, - "normal": { - "textureMap": "Textures/chain_normal.jpg" - }, "opacity": { - "alphaSource": "Split", - "factor": 0.30000001192092898, - "mode": "Cutout", - "textureMap": "Textures/chain_alpha.png" - }, - "roughness": { - "factor": 0.4000000059604645 + "factor": 1.0 } } -} +} \ No newline at end of file diff --git a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_leaf.material b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_leaf.material index ac326ae935..c95d0a662b 100644 --- a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_leaf.material +++ b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_leaf.material @@ -47,25 +47,6 @@ }, "roughness": { "textureMap": "Textures/thorn_roughness.png" - }, - "subsurfaceScattering": { - "enableSubsurfaceScattering": true, - "quality": 1.0, - "scatterColor": [ - 0.28143739700317385, - 1.0, - 0.13000686466693879, - 1.0 - ], - "scatterDistance": 1.0, - "thickness": 0.10000000149011612, - "transmissionMode": "ThinObject", - "transmissionTint": [ - 0.07225146889686585, - 0.16981765627861024, - 0.04444953054189682, - 1.0 - ] } } } diff --git a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_lion.material b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_lion.material index b1f78aa33f..08eb920607 100644 --- a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_lion.material +++ b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_lion.material @@ -4,9 +4,6 @@ "parentMaterial": "", "propertyLayoutVersion": 3, "properties": { - "occlusion": { - "diffuseTextureMap": "Textures/lion_1k_ao.png" - }, "baseColor": { "color": [ 0.800000011920929, @@ -16,38 +13,16 @@ ], "textureMap": "Textures/lion_1k_basecolor.png" }, - "general": { - "applySpecularAA": true - }, - "irradiance": { + "emissive": { "color": [ - 1.0, - 0.7364919781684876, - 0.3672388792037964, + 0.0, + 0.0, + 0.0, 1.0 ] }, - "metallic": { - "textureMap": "Textures/lion_1k_metallic.png" - }, - "normal": { - "textureMap": "Textures/lion_1k_normal.jpg" - }, "opacity": { "factor": 1.0 - }, - "parallax": { - "algorithm": "ContactRefinement", - "factor": 0.009999999776482582, - "pdo": true, - "quality": "Ultra", - "textureMap": "Textures/lion_1k_height.png" - }, - "roughness": { - "textureMap": "Textures/lion_1k_roughness.png" - }, - "specularF0": { - "enableMultiScatterCompensation": true } } -} +} \ No newline at end of file diff --git a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_vaseplant.material b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_vaseplant.material index 37d9e2c01c..290ddc81a6 100644 --- a/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_vaseplant.material +++ b/Gems/AtomContent/Sponza/Assets/objects/sponza_mat_vaseplant.material @@ -28,24 +28,6 @@ "doubleSided": true, "factor": 0.28999999165534975, "mode": "Cutout" - }, - "subsurfaceScattering": { - "enableSubsurfaceScattering": true, - "quality": 1.0, - "scatterColor": [ - 0.07421988248825073, - 0.10223544389009476, - 0.0, - 1.0 - ], - "subsurfaceScatterFactor": 0.0, - "transmissionMode": "ThinObject", - "transmissionTint": [ - 0.33716335892677309, - 0.4620737135410309, - 0.0, - 1.0 - ] } } } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont_precompiled.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont_precompiled.cpp deleted file mode 100644 index 63f8a2bddb..0000000000 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont_precompiled.cpp +++ /dev/null @@ -1,14 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include diff --git a/Gems/AtomLyIntegration/AtomFont/Code/atomfont_files.cmake b/Gems/AtomLyIntegration/AtomFont/Code/atomfont_files.cmake index d2b76a2d79..533fe9e527 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/atomfont_files.cmake +++ b/Gems/AtomLyIntegration/AtomFont/Code/atomfont_files.cmake @@ -33,5 +33,4 @@ set(FILES Include/AtomLyIntegration/AtomFont/AtomNullFont.h Include/AtomLyIntegration/AtomFont/resource.h Include/AtomLyIntegration/AtomFont/AtomFont_precompiled.h - Source/AtomFont_precompiled.cpp ) diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp index 9079f639ba..532c8720b5 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,8 @@ #include #include +#include +#include #include #include @@ -57,6 +60,8 @@ namespace AZ Activate(); AzFramework::BoundsRequestBus::Handler::BusConnect(m_entityId); } + + m_auxGeomFeatureProcessor = RPI::Scene::GetFeatureProcessorForEntity(m_entityId); } AtomActorInstance::~AtomActorInstance() @@ -88,7 +93,119 @@ namespace AZ AZ::Interface::Get()->RefreshEntityLocalBoundsUnion(m_entityId); } - AZ::Aabb AtomActorInstance:: GetWorldBounds() + void AtomActorInstance::DebugDraw(const DebugOptions& debugOptions) + { + if (m_auxGeomFeatureProcessor) + { + if (RPI::AuxGeomDrawPtr auxGeom = m_auxGeomFeatureProcessor->GetDrawQueue()) + { + if (debugOptions.m_drawAABB) + { + const MCore::AABB emfxAabb = m_actorInstance->GetAABB(); + const AZ::Aabb azAabb = AZ::Aabb::CreateFromMinMax(emfxAabb.GetMin(), emfxAabb.GetMax()); + auxGeom->DrawAabb(azAabb, AZ::Color(0.0f, 1.0f, 1.0f, 1.0f), RPI::AuxGeomDraw::DrawStyle::Line); + } + + if (debugOptions.m_drawSkeleton) + { + RenderSkeleton(auxGeom.get()); + } + + if (debugOptions.m_emfxDebugDraw) + { + RenderEMFXDebugDraw(auxGeom.get()); + } + } + } + } + + void AtomActorInstance::RenderSkeleton(RPI::AuxGeomDraw* auxGeom) + { + AZ_Assert(m_actorInstance, "Valid actor instance required."); + const EMotionFX::TransformData* transformData = m_actorInstance->GetTransformData(); + const EMotionFX::Skeleton* skeleton = m_actorInstance->GetActor()->GetSkeleton(); + const EMotionFX::Pose* pose = transformData->GetCurrentPose(); + + const AZ::u32 transformCount = transformData->GetNumTransforms(); + const AZ::u32 lodLevel = m_actorInstance->GetLODLevel(); + const AZ::u32 numJoints = skeleton->GetNumNodes(); + + m_auxVertices.clear(); + m_auxVertices.reserve(numJoints * 2); + + for (AZ::u32 jointIndex = 0; jointIndex < numJoints; ++jointIndex) + { + const EMotionFX::Node* joint = skeleton->GetNode(jointIndex); + if (!joint->GetSkeletalLODStatus(lodLevel)) + { + continue; + } + + const AZ::u32 parentIndex = joint->GetParentIndex(); + if (parentIndex == InvalidIndex32) + { + continue; + } + + const AZ::Vector3 parentPos = pose->GetWorldSpaceTransform(parentIndex).mPosition; + m_auxVertices.emplace_back(parentPos); + + const AZ::Vector3 bonePos = pose->GetWorldSpaceTransform(jointIndex).mPosition; + m_auxVertices.emplace_back(bonePos); + } + + const AZ::Color skeletonColor(0.604f, 0.804f, 0.196f, 1.0f); + RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; + lineArgs.m_verts = m_auxVertices.data(); + lineArgs.m_vertCount = m_auxVertices.size(); + lineArgs.m_colors = &skeletonColor; + lineArgs.m_colorCount = 1; + lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; + auxGeom->DrawLines(lineArgs); + } + + void AtomActorInstance::RenderEMFXDebugDraw(RPI::AuxGeomDraw* auxGeom) + { + EMotionFX::DebugDraw& debugDraw = EMotionFX::GetDebugDraw(); + debugDraw.Lock(); + EMotionFX::DebugDraw::ActorInstanceData* actorInstanceData = debugDraw.GetActorInstanceData(m_actorInstance); + actorInstanceData->Lock(); + const AZStd::vector& lines = actorInstanceData->GetLines(); + if (lines.empty()) + { + actorInstanceData->Unlock(); + debugDraw.Unlock(); + return; + } + + m_auxVertices.clear(); + m_auxVertices.reserve(lines.size() * 2); + m_auxColors.clear(); + m_auxColors.reserve(m_auxVertices.size()); + + for (const EMotionFX::DebugDraw::Line& line : actorInstanceData->GetLines()) + { + m_auxVertices.emplace_back(line.m_start); + m_auxColors.emplace_back(line.m_startColor); + m_auxVertices.emplace_back(line.m_end); + m_auxColors.emplace_back(line.m_endColor); + } + + AZ_Assert(m_auxVertices.size() == m_auxColors.size(), + "Number of vertices and number of colors need to match."); + actorInstanceData->Unlock(); + debugDraw.Unlock(); + + RPI::AuxGeomDraw::AuxGeomDynamicDrawArguments lineArgs; + lineArgs.m_verts = m_auxVertices.data(); + lineArgs.m_vertCount = m_auxVertices.size(); + lineArgs.m_colors = m_auxColors.data(); + lineArgs.m_colorCount = m_auxColors.size(); + lineArgs.m_depthTest = RPI::AuxGeomDraw::DepthTest::Off; + auxGeom->DrawLines(lineArgs); + } + + AZ::Aabb AtomActorInstance::GetWorldBounds() { return m_worldAABB; } diff --git a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.h b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.h index e05280e896..98e47e7128 100644 --- a/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.h +++ b/Gems/AtomLyIntegration/EMotionFXAtom/Code/Source/AtomActorInstance.h @@ -42,6 +42,8 @@ namespace EMotionFX } namespace AZ::RPI { + class AuxGeomDraw; + class AuxGeomFeatureProcessorInterface; class Model; class Buffer; class StreamingImage; @@ -89,7 +91,7 @@ namespace AZ // RenderActorInstance overrides ... void OnTick(float timeDelta) override; void UpdateBounds() override; - void DebugDraw(const DebugOptions& debugOptions) override { AZ_UNUSED(debugOptions) }; + void DebugDraw(const DebugOptions& debugOptions) override; void SetMaterials(const EMotionFX::Integration::ActorAsset::MaterialList& materialPerLOD) override { AZ_UNUSED(materialPerLOD); }; void SetSkinningMethod(EMotionFX::Integration::SkinningMethod emfxSkinningMethod); SkinningMethod GetAtomSkinningMethod() const; @@ -177,6 +179,13 @@ namespace AZ void InitWrinkleMasks(); void UpdateWrinkleMasks(); + // Helper and debug geometry rendering + void RenderSkeleton(RPI::AuxGeomDraw* auxGeom); + void RenderEMFXDebugDraw(RPI::AuxGeomDraw* auxGeom); + RPI::AuxGeomFeatureProcessorInterface* m_auxGeomFeatureProcessor = nullptr; + AZStd::vector m_auxVertices; + AZStd::vector m_auxColors; + AZStd::intrusive_ptr m_skinnedMeshInputBuffers = nullptr; AZStd::intrusive_ptr m_skinnedMeshInstance; AZ::Data::Instance m_boneTransforms = nullptr; diff --git a/Gems/Camera/Code/Source/Camera_precompiled.cpp b/Gems/Camera/Code/Source/Camera_precompiled.cpp deleted file mode 100644 index a305cdc9df..0000000000 --- a/Gems/Camera/Code/Source/Camera_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Camera_precompiled.h" diff --git a/Gems/Camera/Code/camera_files.cmake b/Gems/Camera/Code/camera_files.cmake index f8bf93d66d..43f29435c5 100644 --- a/Gems/Camera/Code/camera_files.cmake +++ b/Gems/Camera/Code/camera_files.cmake @@ -16,6 +16,5 @@ set(FILES camera_files.cmake Source/CameraComponentController.cpp Source/CameraComponentController.h Source/CameraViewRegistrationBus.h - Source/Camera_precompiled.cpp Source/Camera_precompiled.h ) diff --git a/Gems/CameraFramework/Code/Source/CameraFramework_precompiled.cpp b/Gems/CameraFramework/Code/Source/CameraFramework_precompiled.cpp deleted file mode 100644 index e5c5926821..0000000000 --- a/Gems/CameraFramework/Code/Source/CameraFramework_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "CameraFramework_precompiled.h" diff --git a/Gems/CameraFramework/Code/cameraframework_files.cmake b/Gems/CameraFramework/Code/cameraframework_files.cmake index f6571f1689..c62e7d6455 100644 --- a/Gems/CameraFramework/Code/cameraframework_files.cmake +++ b/Gems/CameraFramework/Code/cameraframework_files.cmake @@ -16,6 +16,5 @@ set(FILES Include/CameraFramework/ICameraTransformBehavior.h Source/CameraRigComponent.h Source/CameraRigComponent.cpp - Source/CameraFramework_precompiled.cpp Source/CameraFramework_precompiled.h ) diff --git a/Gems/DebugDraw/Code/Source/DebugDraw_precompiled.cpp b/Gems/DebugDraw/Code/Source/DebugDraw_precompiled.cpp deleted file mode 100644 index d5601bd1c0..0000000000 --- a/Gems/DebugDraw/Code/Source/DebugDraw_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "DebugDraw_precompiled.h" diff --git a/Gems/DebugDraw/Code/debugdraw_editor_files.cmake b/Gems/DebugDraw/Code/debugdraw_editor_files.cmake index a5adb2faac..da5e2c0870 100644 --- a/Gems/DebugDraw/Code/debugdraw_editor_files.cmake +++ b/Gems/DebugDraw/Code/debugdraw_editor_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/DebugDraw_precompiled.cpp Source/DebugDraw_precompiled.h Include/DebugDraw/DebugDrawBus.h Source/DebugDrawModule.cpp diff --git a/Gems/DebugDraw/Code/debugdraw_files.cmake b/Gems/DebugDraw/Code/debugdraw_files.cmake index 4e0b115f1b..bc53fd1d26 100644 --- a/Gems/DebugDraw/Code/debugdraw_files.cmake +++ b/Gems/DebugDraw/Code/debugdraw_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/DebugDraw_precompiled.cpp Source/DebugDraw_precompiled.h Include/DebugDraw/DebugDrawBus.h Source/DebugDrawLineComponent.cpp diff --git a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h index 731641f6aa..78ffa4ecda 100644 --- a/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h +++ b/Gems/EMotionFX/Code/EMotionFX/Rendering/OpenGL2/Source/GLExtensions.h @@ -12,6 +12,7 @@ #pragma once +#include #include QT_FORWARD_DECLARE_CLASS(QOpenGLContext); diff --git a/Gems/EMotionFX/Code/Source/EMotionFX_precompiled.cpp b/Gems/EMotionFX/Code/Source/EMotionFX_precompiled.cpp deleted file mode 100644 index c827107a59..0000000000 --- a/Gems/EMotionFX/Code/Source/EMotionFX_precompiled.cpp +++ /dev/null @@ -1,14 +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. -* -*/ - - -#include "EMotionFX_precompiled.h" diff --git a/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp b/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp index 7d5b7ade00..5c085e96f7 100644 --- a/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp +++ b/Gems/EMotionFX/Code/Source/Integration/Editor/Components/EditorActorComponent.cpp @@ -435,19 +435,17 @@ namespace EMotionFX void EditorActorComponent::LaunchAnimationEditor(const AZ::Data::AssetId& assetId, const AZ::Data::AssetType&) { + // call to open must be done before LoadCharacter + const char* panelName = EMStudio::MainWindow::GetEMotionFXPaneName(); + EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, OpenViewPane, panelName); + if (assetId.IsValid()) { AZ::Data::AssetId animgraphAssetId; - animgraphAssetId.SetInvalid(); EditorAnimGraphComponentRequestBus::EventResult(animgraphAssetId, GetEntityId(), &EditorAnimGraphComponentRequestBus::Events::GetAnimGraphAssetId); AZ::Data::AssetId motionSetAssetId; - motionSetAssetId.SetInvalid(); EditorAnimGraphComponentRequestBus::EventResult(motionSetAssetId, GetEntityId(), &EditorAnimGraphComponentRequestBus::Events::GetMotionSetAssetId); - // call to open must be done before LoadCharacter - const char* panelName = EMStudio::MainWindow::GetEMotionFXPaneName(); - EBUS_EVENT(AzToolsFramework::EditorRequests::Bus, OpenViewPane, panelName); - EMStudio::MainWindow* mainWindow = EMStudio::GetMainWindow(); if (mainWindow) { @@ -555,6 +553,7 @@ namespace EMotionFX RenderActorInstance::DebugOptions debugOptions; debugOptions.m_drawAABB = m_renderBounds; debugOptions.m_drawSkeleton = m_renderSkeleton; + debugOptions.m_emfxDebugDraw = true; m_renderActorInstance->DebugDraw(debugOptions); } } diff --git a/Gems/EMotionFX/Code/emotionfx_editor_files.cmake b/Gems/EMotionFX/Code/emotionfx_editor_files.cmake index d8216822d4..8d88013e39 100644 --- a/Gems/EMotionFX/Code/emotionfx_editor_files.cmake +++ b/Gems/EMotionFX/Code/emotionfx_editor_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/EMotionFX_precompiled.cpp Source/EMotionFX_precompiled.h ../Assets/Editor/Layouts/Layouts.qrc ../Assets/Editor/Images/Icons/Resources.qrc diff --git a/Gems/EMotionFX/Code/emotionfx_files.cmake b/Gems/EMotionFX/Code/emotionfx_files.cmake index 6650bb05be..88440f2d1d 100644 --- a/Gems/EMotionFX/Code/emotionfx_files.cmake +++ b/Gems/EMotionFX/Code/emotionfx_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/EMotionFX_precompiled.cpp Source/EMotionFX_precompiled.h Include/Integration/AnimationBus.h Include/Integration/MotionExtractionBus.h diff --git a/Gems/FastNoise/Code/Source/FastNoise_precompiled.cpp b/Gems/FastNoise/Code/Source/FastNoise_precompiled.cpp deleted file mode 100644 index 015459eeae..0000000000 --- a/Gems/FastNoise/Code/Source/FastNoise_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "FastNoise_precompiled.h" diff --git a/Gems/FastNoise/Code/fastnoise_files.cmake b/Gems/FastNoise/Code/fastnoise_files.cmake index 1846b689f7..56b7997848 100644 --- a/Gems/FastNoise/Code/fastnoise_files.cmake +++ b/Gems/FastNoise/Code/fastnoise_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/FastNoise_precompiled.cpp Source/FastNoise_precompiled.h Include/FastNoise/Ebuses/FastNoiseBus.h Include/FastNoise/Ebuses/FastNoiseGradientRequestBus.h diff --git a/Gems/Gestures/Code/Source/Gestures_precompiled.cpp b/Gems/Gestures/Code/Source/Gestures_precompiled.cpp deleted file mode 100644 index f0f3900ac9..0000000000 --- a/Gems/Gestures/Code/Source/Gestures_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Gestures_precompiled.h" diff --git a/Gems/Gestures/Code/gestures_files.cmake b/Gems/Gestures/Code/gestures_files.cmake index c4b6dec967..c94189a295 100644 --- a/Gems/Gestures/Code/gestures_files.cmake +++ b/Gems/Gestures/Code/gestures_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Gestures_precompiled.cpp Source/Gestures_precompiled.h Include/Gestures/GestureRecognizerClickOrTap.h Include/Gestures/GestureRecognizerClickOrTap.inl diff --git a/Gems/GradientSignal/Code/Source/GradientSignal_precompiled.cpp b/Gems/GradientSignal/Code/Source/GradientSignal_precompiled.cpp deleted file mode 100644 index cc70b11143..0000000000 --- a/Gems/GradientSignal/Code/Source/GradientSignal_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "GradientSignal_precompiled.h" diff --git a/Gems/GradientSignal/Code/gradientsignal_files.cmake b/Gems/GradientSignal/Code/gradientsignal_files.cmake index 1b5b16b5e0..88c6c604fe 100644 --- a/Gems/GradientSignal/Code/gradientsignal_files.cmake +++ b/Gems/GradientSignal/Code/gradientsignal_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/GradientSignal_precompiled.cpp Source/GradientSignal_precompiled.h Include/GradientSignal/GradientSampler.h Include/GradientSignal/SmoothStep.h diff --git a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp index ca5e962685..2917642d66 100644 --- a/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp +++ b/Gems/GraphCanvas/Code/StaticLib/GraphCanvas/Widgets/NodePalette/Model/NodePaletteSortFilterProxyModel.cpp @@ -147,16 +147,17 @@ namespace GraphCanvas return true; } - QString test = model->data(index).toString(); + QString test = model->data(index).toString(); + bool showRow = false; - int regexIndex = test.lastIndexOf(m_filterRegex); + int regexIndex = m_filterRegex.indexIn(test); if (regexIndex >= 0) { showRow = true; - - AZStd::pair highlight(regexIndex, m_filter.size()); + + AZStd::pair highlight(regexIndex, m_filterRegex.matchedLength()); currentItem->SetHighlight(highlight); } else @@ -283,8 +284,20 @@ namespace GraphCanvas void NodePaletteSortFilterProxyModel::SetFilter(const QString& filter) { - m_filter = QRegExp::escape(filter); - m_filterRegex = QRegExp(m_filter, Qt::CaseInsensitive); + // Remove whitespace and escape() so every regexp special character is escaped with a backslash + // Then ignore all whitespace by adding \s* (regex optional whitespace match) in between every other character. + // We use \s* instead of simply removing all whitespace from the filter and node-names in order to preserve the node-name and accurately highlight the matching portion. + // Example: "OnGraphStart" or "On Graph Start" + m_filter = QRegExp::escape(filter.simplified().replace(" ", "")); + + QString regExIgnoreWhitespace(m_filter[0]); + for (int i = 1; i < m_filter.size(); ++i) + { + regExIgnoreWhitespace.append("\\s*"); + regExIgnoreWhitespace.append(m_filter[i]); + } + + m_filterRegex = QRegExp(regExIgnoreWhitespace, Qt::CaseInsensitive); } void NodePaletteSortFilterProxyModel::ClearFilter() diff --git a/Gems/GraphCanvas/Code/graphcanvas_files.cmake b/Gems/GraphCanvas/Code/graphcanvas_files.cmake index 98db1c7709..13d8fa8832 100644 --- a/Gems/GraphCanvas/Code/graphcanvas_files.cmake +++ b/Gems/GraphCanvas/Code/graphcanvas_files.cmake @@ -10,7 +10,6 @@ # set(FILES - precompiled.cpp precompiled.h Include/GraphCanvas/Widgets/RootGraphicsItem.h Include/GraphCanvas/tools.h diff --git a/Gems/GraphCanvas/Code/precompiled.cpp b/Gems/GraphCanvas/Code/precompiled.cpp deleted file mode 100644 index 51bab26696..0000000000 --- a/Gems/GraphCanvas/Code/precompiled.cpp +++ /dev/null @@ -1,14 +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. -* -*/ - -#include "precompiled.h" - diff --git a/Gems/HttpRequestor/Code/Source/HttpRequestor_precompiled.cpp b/Gems/HttpRequestor/Code/Source/HttpRequestor_precompiled.cpp deleted file mode 100644 index 87aa3da28e..0000000000 --- a/Gems/HttpRequestor/Code/Source/HttpRequestor_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "HttpRequestor_precompiled.h" diff --git a/Gems/HttpRequestor/Code/httprequestor_files.cmake b/Gems/HttpRequestor/Code/httprequestor_files.cmake index c699e829c5..2e83237d35 100644 --- a/Gems/HttpRequestor/Code/httprequestor_files.cmake +++ b/Gems/HttpRequestor/Code/httprequestor_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/HttpRequestor_precompiled.cpp Source/HttpRequestor_precompiled.h Source/HttpRequestManager.cpp Source/HttpRequestManager.h diff --git a/Gems/HttpRequestor/Code/lmbraws_unsupported_files.cmake b/Gems/HttpRequestor/Code/lmbraws_unsupported_files.cmake index bc5bbc81ca..dee0851f34 100644 --- a/Gems/HttpRequestor/Code/lmbraws_unsupported_files.cmake +++ b/Gems/HttpRequestor/Code/lmbraws_unsupported_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/HttpRequestor_precompiled.cpp Source/HttpRequestor_precompiled.h Source/ComponentStub.cpp ) diff --git a/Gems/ImGui/Code/Source/ImGui_precompiled.cpp b/Gems/ImGui/Code/Source/ImGui_precompiled.cpp deleted file mode 100644 index aa38ffff9c..0000000000 --- a/Gems/ImGui/Code/Source/ImGui_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "ImGui_precompiled.h" diff --git a/Gems/ImGui/Code/imgui_common_files.cmake b/Gems/ImGui/Code/imgui_common_files.cmake index 8ece0845d6..851cd0ccf5 100644 --- a/Gems/ImGui/Code/imgui_common_files.cmake +++ b/Gems/ImGui/Code/imgui_common_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/ImGui_precompiled.cpp Source/ImGui_precompiled.h Include/ImGuiBus.h Include/ImGuiContextScope.h diff --git a/Gems/ImGui/Code/imgui_lyutils_static_files.cmake b/Gems/ImGui/Code/imgui_lyutils_static_files.cmake index 64e5ea4072..9ed0113424 100644 --- a/Gems/ImGui/Code/imgui_lyutils_static_files.cmake +++ b/Gems/ImGui/Code/imgui_lyutils_static_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/ImGui_precompiled.cpp Source/ImGui_precompiled.h Include/LYImGuiUtils/HistogramContainer.h Include/LYImGuiUtils/ImGuiDrawHelpers.h diff --git a/Gems/InAppPurchases/Code/Source/InAppPurchases_precompiled.cpp b/Gems/InAppPurchases/Code/Source/InAppPurchases_precompiled.cpp deleted file mode 100644 index b865614634..0000000000 --- a/Gems/InAppPurchases/Code/Source/InAppPurchases_precompiled.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or -* a third party where indicated. -* -* 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. -* -*/ - -#include "InAppPurchases_precompiled.h" diff --git a/Gems/InAppPurchases/Code/inapppurchases_files.cmake b/Gems/InAppPurchases/Code/inapppurchases_files.cmake index 7b75343af9..01a867313b 100644 --- a/Gems/InAppPurchases/Code/inapppurchases_files.cmake +++ b/Gems/InAppPurchases/Code/inapppurchases_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/InAppPurchases_precompiled.cpp Source/InAppPurchases_precompiled.h Include/InAppPurchases/InAppPurchasesBus.h Include/InAppPurchases/InAppPurchasesInterface.h diff --git a/Gems/LmbrCentral/Code/Source/LmbrCentral_precompiled.cpp b/Gems/LmbrCentral/Code/Source/LmbrCentral_precompiled.cpp deleted file mode 100644 index 5752d6a093..0000000000 --- a/Gems/LmbrCentral/Code/Source/LmbrCentral_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "LmbrCentral_precompiled.h" diff --git a/Gems/LmbrCentral/Code/lmbrcentral_files.cmake b/Gems/LmbrCentral/Code/lmbrcentral_files.cmake index 9b4d01af23..d18da75507 100644 --- a/Gems/LmbrCentral/Code/lmbrcentral_files.cmake +++ b/Gems/LmbrCentral/Code/lmbrcentral_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/LmbrCentral_precompiled.cpp Source/LmbrCentral_precompiled.h include/LmbrCentral/Ai/NavigationComponentBus.h include/LmbrCentral/Ai/NavigationAreaBus.h diff --git a/Gems/LyShine/Code/Editor/UiCanvasEditor_precompiled.cpp b/Gems/LyShine/Code/Editor/UiCanvasEditor_precompiled.cpp deleted file mode 100644 index e894c3a0f7..0000000000 --- a/Gems/LyShine/Code/Editor/UiCanvasEditor_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "UiCanvasEditor_precompiled.h" diff --git a/Gems/LyShine/Code/Source/Animation/LyShine_precompiled.cpp b/Gems/LyShine/Code/Source/Animation/LyShine_precompiled.cpp deleted file mode 100644 index 02d8df72c1..0000000000 --- a/Gems/LyShine/Code/Source/Animation/LyShine_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "LyShine_precompiled.h" diff --git a/Gems/LyShine/Code/Source/LyShine_precompiled.cpp b/Gems/LyShine/Code/Source/LyShine_precompiled.cpp deleted file mode 100644 index 02d8df72c1..0000000000 --- a/Gems/LyShine/Code/Source/LyShine_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "LyShine_precompiled.h" diff --git a/Gems/LyShine/Code/lyshine_static_files.cmake b/Gems/LyShine/Code/lyshine_static_files.cmake index 8491a66030..2435a01623 100644 --- a/Gems/LyShine/Code/lyshine_static_files.cmake +++ b/Gems/LyShine/Code/lyshine_static_files.cmake @@ -16,7 +16,6 @@ set(FILES Source/LyShine.h Source/LyShineDebug.cpp Source/LyShineDebug.h - Source/LyShine_precompiled.cpp Source/LyShine_precompiled.h Source/StringUtfUtils.h Source/UiImageComponent.cpp diff --git a/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake b/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake index 82fc50584c..a434ec2343 100644 --- a/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake +++ b/Gems/LyShine/Code/lyshine_uicanvaseditor_files.cmake @@ -12,7 +12,6 @@ set(FILES Editor/LyShineEditorSystemComponent.cpp Editor/LyShineEditorSystemComponent.h - Editor/UiCanvasEditor_precompiled.cpp Editor/UiCanvasEditor_precompiled.h Editor/UiCanvasEditor.qrc Editor/Animation/UiAnimViewDialog.cpp diff --git a/Gems/LyShineExamples/Code/Source/LyShineExamples_precompiled.cpp b/Gems/LyShineExamples/Code/Source/LyShineExamples_precompiled.cpp deleted file mode 100644 index 33c6ac3831..0000000000 --- a/Gems/LyShineExamples/Code/Source/LyShineExamples_precompiled.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or -* a third party where indicated. -* -* 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. -* -*/ - -#include "LyShineExamples_precompiled.h" diff --git a/Gems/LyShineExamples/Code/lyshineexamples_files.cmake b/Gems/LyShineExamples/Code/lyshineexamples_files.cmake index 08fccda4ea..c82899c374 100644 --- a/Gems/LyShineExamples/Code/lyshineexamples_files.cmake +++ b/Gems/LyShineExamples/Code/lyshineexamples_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/LyShineExamples_precompiled.cpp Source/LyShineExamples_precompiled.h Include/LyShineExamples/LyShineExamplesBus.h Include/LyShineExamples/LyShineExamplesCppExampleBus.h diff --git a/Gems/Maestro/Code/Source/Cinematics/Maestro_precompiled.cpp b/Gems/Maestro/Code/Source/Cinematics/Maestro_precompiled.cpp deleted file mode 100644 index 40dec66d87..0000000000 --- a/Gems/Maestro/Code/Source/Cinematics/Maestro_precompiled.cpp +++ /dev/null @@ -1,14 +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. -* -*/ -// Original file Copyright Crytek GMBH or its affiliates, used under license. - -#include "Maestro_precompiled.h" diff --git a/Gems/Maestro/Code/Source/Maestro_precompiled.cpp b/Gems/Maestro/Code/Source/Maestro_precompiled.cpp deleted file mode 100644 index d0c3f18d11..0000000000 --- a/Gems/Maestro/Code/Source/Maestro_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Maestro_precompiled.h" diff --git a/Gems/Maestro/Code/maestro_static_files.cmake b/Gems/Maestro/Code/maestro_static_files.cmake index c0fb90ddca..3fd5671898 100644 --- a/Gems/Maestro/Code/maestro_static_files.cmake +++ b/Gems/Maestro/Code/maestro_static_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Maestro_precompiled.cpp Source/Maestro_precompiled.h Source/Cinematics/ShadowsSetupNode.h Source/Cinematics/ShadowsSetupNode.cpp diff --git a/Gems/MessagePopup/Code/Source/MessagePopup_precompiled.cpp b/Gems/MessagePopup/Code/Source/MessagePopup_precompiled.cpp deleted file mode 100644 index 45495b87d0..0000000000 --- a/Gems/MessagePopup/Code/Source/MessagePopup_precompiled.cpp +++ /dev/null @@ -1,12 +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. -*/ - -#include "MessagePopup_precompiled.h" diff --git a/Gems/MessagePopup/Code/messagepopup_files.cmake b/Gems/MessagePopup/Code/messagepopup_files.cmake index 3c8b98378a..73a5f3f6b6 100644 --- a/Gems/MessagePopup/Code/messagepopup_files.cmake +++ b/Gems/MessagePopup/Code/messagepopup_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/MessagePopup_precompiled.cpp Source/MessagePopup_precompiled.h Include/MessagePopup/MessagePopupBus.h Source/MessagePopupSystemComponent.cpp diff --git a/Gems/Metastream/Code/Source/Metastream_precompiled.cpp b/Gems/Metastream/Code/Source/Metastream_precompiled.cpp deleted file mode 100644 index 7b4896ad9f..0000000000 --- a/Gems/Metastream/Code/Source/Metastream_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Metastream_precompiled.h" diff --git a/Gems/Metastream/Code/metastream_files.cmake b/Gems/Metastream/Code/metastream_files.cmake index c5fd0ee95b..575aa09340 100644 --- a/Gems/Metastream/Code/metastream_files.cmake +++ b/Gems/Metastream/Code/metastream_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Metastream_precompiled.cpp Source/Metastream_precompiled.h Include/Metastream/MetastreamBus.h Source/DataCache.h diff --git a/Gems/Microphone/Code/Source/Microphone_precompiled.cpp b/Gems/Microphone/Code/Source/Microphone_precompiled.cpp deleted file mode 100644 index a584ed909d..0000000000 --- a/Gems/Microphone/Code/Source/Microphone_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "Microphone_precompiled.h" diff --git a/Gems/Microphone/Code/microphone_files.cmake b/Gems/Microphone/Code/microphone_files.cmake index 1058deb13c..d32a723cfb 100644 --- a/Gems/Microphone/Code/microphone_files.cmake +++ b/Gems/Microphone/Code/microphone_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Microphone_precompiled.cpp Source/Microphone_precompiled.h Source/MicrophoneSystemComponent.cpp Source/MicrophoneSystemComponent.h diff --git a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja index 259f469020..21bf6ab69b 100644 --- a/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja +++ b/Gems/Multiplayer/Code/Source/AutoGen/AutoComponent_Source.jinja @@ -368,26 +368,26 @@ void {{ ClassName }}::Signal{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.jo ->Method("{{ UpperFirst(Property.attrib['Name']) }}", [](const {{ ClassName }}* self, {{ ', '.join(paramDefines) }}) { self->m_controller->{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.join(paramNames) }}); }) - ->Method("{{ UpperFirst(Property.attrib['Name']) }}ByEntity", [](AZ::EntityId id, {{ ', '.join(paramDefines) }}) { + ->Method("{{ UpperFirst(Property.attrib['Name']) }}ByEntityId", [](AZ::EntityId id, {{ ', '.join(paramDefines) }}) { AZ::Entity* entity = AZ::Interface::Get()->FindEntity(id); if (!entity) { - AZ_Warning("Network Property", false, "{{ ClassName }} Get{{ UpperFirst(Property.attrib['Name']) }} failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str()) + AZ_Warning("Network Property", false, "{{ ClassName }} {{ UpperFirst(Property.attrib['Name']) }}ByEntityId failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str()) return; } {{ ClassName }}* networkComponent = entity->FindComponent<{{ ClassName }}>(); if (!networkComponent) { - AZ_Warning("Network Property", false, "{{ ClassName }} Get{{ UpperFirst(Property.attrib['Name']) }} failed. Entity '%s' (id: %s) is missing {{ ClassName }}, be sure to add {{ ClassName }} to this entity.", entity->GetName().c_str(), id.ToString().c_str()) + AZ_Warning("Network Property", false, "{{ ClassName }} {{ UpperFirst(Property.attrib['Name']) }}ByEntityId failed. Entity '%s' (id: %s) is missing {{ ClassName }}, be sure to add {{ ClassName }} to this entity.", entity->GetName().c_str(), id.ToString().c_str()) return; } {{ ClassName }}Controller* controller = static_cast<{{ ClassName }}Controller*>(networkComponent->GetController()); if (!controller) { - AZ_Warning("Network Property", false, "{{ ClassName }} Get{{ UpperFirst(Property.attrib['Name']) }} method failed. Entity '%s' (id: %s) {{ ClassName }} is missing the network controller. This RemoteProcedure can only be invoked from {{InvokeFrom}} network entities, because this entity doesn't have a controller, it must not be a {{InvokeFrom}} entity. Please check your network context before attempting to call {{ UpperFirst(Property.attrib['Name']) }}.", entity->GetName().c_str(), id.ToString().c_str()) + AZ_Warning("Network Property", false, "{{ ClassName }} {{ UpperFirst(Property.attrib['Name']) }}ByEntityId method failed. Entity '%s' (id: %s) {{ ClassName }} is missing the network controller. This RemoteProcedure can only be invoked from {{InvokeFrom}} network entities, because this entity doesn't have a controller, it must not be a {{InvokeFrom}} entity. Please check your network context before attempting to call {{ UpperFirst(Property.attrib['Name']) }}.", entity->GetName().c_str(), id.ToString().c_str()) return; } @@ -429,6 +429,32 @@ void {{ ClassName }}::Signal{{ UpperFirst(Property.attrib['Name']) }}({{ ', '.jo ->Method("Get{{ UpperFirst(Property.attrib['Name']) }}Event", [](const {{ ClassName }}* self) -> AZ::Event<{{ ', '.join(paramTypes) }}>& { return self->m_controller->Get{{ UpperFirst(Property.attrib['Name']) }}Event(); + }) + ->Attribute(AZ::Script::Attributes::AzEventDescription, {{ LowerFirst(Property.attrib['Name']) }}EventDesc) + ->Method("Get{{ UpperFirst(Property.attrib['Name']) }}EventByEntityId", [](AZ::EntityId id) -> AZ::Event<{{ ', '.join(paramTypes) }}>* + { + AZ::Entity* entity = AZ::Interface::Get()->FindEntity(id); + if (!entity) + { + AZ_Warning("Network Property", false, "{{ ClassName }} Get{{ UpperFirst(Property.attrib['Name']) }}EventByEntityId failed. The entity with id %s doesn't exist, please provide a valid entity id.", id.ToString().c_str()) + return nullptr; + } + + {{ ClassName }}* networkComponent = entity->FindComponent<{{ ClassName }}>(); + if (!networkComponent) + { + AZ_Warning("Network Property", false, "{{ ClassName }} Get{{ UpperFirst(Property.attrib['Name']) }}EventByEntityId failed. Entity '%s' (id: %s) is missing {{ ClassName }}, be sure to add {{ ClassName }} to this entity.", entity->GetName().c_str(), id.ToString().c_str()) + return nullptr; + } + + {{ ClassName }}Controller* controller = static_cast<{{ ClassName }}Controller*>(networkComponent->GetController()); + if (!controller) + { + AZ_Warning("Network Property", false, "{{ ClassName }} Get{{ UpperFirst(Property.attrib['Name']) }}EventByEntity method failed. Entity '%s' (id: %s) {{ ClassName }} is missing the network controller. This RemoteProcedure can only be received by {{InvokeTo}} network entities, because this entity doesn't have a controller, it must not be a {{InvokeTo}} entity. Please check your network context before attempting to Get{{ UpperFirst(Property.attrib['Name']) }}Event.", entity->GetName().c_str(), id.ToString().c_str()) + return nullptr; + } + + return &controller->Get{{ UpperFirst(Property.attrib['Name']) }}Event(); }) ->Attribute(AZ::Script::Attributes::AzEventDescription, AZStd::move({{ LowerFirst(Property.attrib['Name']) }}EventDesc)) {% endif %} diff --git a/Gems/Multiplayer/Code/Source/Multiplayer_precompiled.cpp b/Gems/Multiplayer/Code/Source/Multiplayer_precompiled.cpp deleted file mode 100644 index fa8fd7b67c..0000000000 --- a/Gems/Multiplayer/Code/Source/Multiplayer_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "Multiplayer_precompiled.h" diff --git a/Gems/Multiplayer/Code/multiplayer_debug_files.cmake b/Gems/Multiplayer/Code/multiplayer_debug_files.cmake index 8d0b121735..4b175c7691 100644 --- a/Gems/Multiplayer/Code/multiplayer_debug_files.cmake +++ b/Gems/Multiplayer/Code/multiplayer_debug_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Multiplayer_precompiled.cpp Source/Multiplayer_precompiled.h Source/Debug/MultiplayerDebugModule.cpp Source/Debug/MultiplayerDebugModule.h diff --git a/Gems/Multiplayer/Code/multiplayer_files.cmake b/Gems/Multiplayer/Code/multiplayer_files.cmake index 73de45ba9d..9f5ca8c805 100644 --- a/Gems/Multiplayer/Code/multiplayer_files.cmake +++ b/Gems/Multiplayer/Code/multiplayer_files.cmake @@ -41,7 +41,6 @@ set(FILES Include/Multiplayer/NetworkTime/RewindableObject.inl Include/Multiplayer/Physics/PhysicsUtils.h Include/Multiplayer/ReplicationWindows/IReplicationWindow.h - Source/Multiplayer_precompiled.cpp Source/Multiplayer_precompiled.h Source/MultiplayerSystemComponent.cpp Source/MultiplayerSystemComponent.h diff --git a/Gems/Multiplayer/Code/multiplayer_tools_files.cmake b/Gems/Multiplayer/Code/multiplayer_tools_files.cmake index 3fef954ba6..bc0b3feeeb 100644 --- a/Gems/Multiplayer/Code/multiplayer_tools_files.cmake +++ b/Gems/Multiplayer/Code/multiplayer_tools_files.cmake @@ -11,7 +11,6 @@ set(FILES Include/Multiplayer/IMultiplayerTools.h - Source/Multiplayer_precompiled.cpp Source/Multiplayer_precompiled.h Source/Pipeline/NetworkPrefabProcessor.cpp Source/Pipeline/NetworkPrefabProcessor.h diff --git a/Gems/PhysX/Code/NumericalMethods/Source/NumericalMethods_precompiled.cpp b/Gems/PhysX/Code/NumericalMethods/Source/NumericalMethods_precompiled.cpp deleted file mode 100644 index 4b6948a654..0000000000 --- a/Gems/PhysX/Code/NumericalMethods/Source/NumericalMethods_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include diff --git a/Gems/PhysX/Code/NumericalMethods/numericalmethods_files.cmake b/Gems/PhysX/Code/NumericalMethods/numericalmethods_files.cmake index 1e7abecd31..eb96204150 100644 --- a/Gems/PhysX/Code/NumericalMethods/numericalmethods_files.cmake +++ b/Gems/PhysX/Code/NumericalMethods/numericalmethods_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/NumericalMethods_precompiled.cpp Source/NumericalMethods_precompiled.h Include/NumericalMethods/Optimization.h Include/NumericalMethods/Eigenanalysis.h diff --git a/Gems/PhysX/Code/Source/PhysXUnsupported_precompiled.cpp b/Gems/PhysX/Code/Source/PhysXUnsupported_precompiled.cpp deleted file mode 100644 index 04bb39a00f..0000000000 --- a/Gems/PhysX/Code/Source/PhysXUnsupported_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include diff --git a/Gems/PhysX/Code/Source/PhysX_precompiled.cpp b/Gems/PhysX/Code/Source/PhysX_precompiled.cpp deleted file mode 100644 index 1300e5b541..0000000000 --- a/Gems/PhysX/Code/Source/PhysX_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include diff --git a/Gems/PhysX/Code/physx_files.cmake b/Gems/PhysX/Code/physx_files.cmake index 6350c06e0d..24aa42d62a 100644 --- a/Gems/PhysX/Code/physx_files.cmake +++ b/Gems/PhysX/Code/physx_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/PhysX_precompiled.cpp Source/PhysX_precompiled.h Source/SystemComponent.cpp Source/SystemComponent.h diff --git a/Gems/PhysXDebug/Code/Source/PhysXDebugUnsupported_precompiled.cpp b/Gems/PhysXDebug/Code/Source/PhysXDebugUnsupported_precompiled.cpp deleted file mode 100644 index 4199046abd..0000000000 --- a/Gems/PhysXDebug/Code/Source/PhysXDebugUnsupported_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include diff --git a/Gems/PhysXDebug/Code/Source/PhysXDebug_precompiled.cpp b/Gems/PhysXDebug/Code/Source/PhysXDebug_precompiled.cpp deleted file mode 100644 index 2fb13c5f8a..0000000000 --- a/Gems/PhysXDebug/Code/Source/PhysXDebug_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "PhysXDebug_precompiled.h" diff --git a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp index 34315eb11e..c693599a59 100644 --- a/Gems/PhysXDebug/Code/Source/SystemComponent.cpp +++ b/Gems/PhysXDebug/Code/Source/SystemComponent.cpp @@ -42,7 +42,7 @@ namespace PhysXDebug const float SystemComponent::m_maxCullingBoxSize = 150.0f; namespace Internal { - const AZ::Crc32 VewportId = 0; // was AzFramework::g_defaultSceneEntityDebugDisplayId but it didn't render to the viewport. + const AZ::Crc32 VewportId = AzFramework::g_defaultSceneEntityDebugDisplayId; } bool UseEditorPhysicsScene() @@ -565,9 +565,9 @@ namespace PhysXDebug static void physx_CullingBoxSize([[maybe_unused]] const AZ::ConsoleCommandContainer& arguments) { const int argumentCount = arguments.size(); - if (argumentCount == 2) + if (argumentCount == 1) { - float newCullingBoxSize = (float)strtol(AZ::CVarFixedString(arguments[1]).c_str(), nullptr, 10); + float newCullingBoxSize = (float)strtol(AZ::CVarFixedString(arguments[0]).c_str(), nullptr, 10); PhysXDebug::PhysXDebugRequestBus::Broadcast(&PhysXDebug::PhysXDebugRequestBus::Events::SetCullingBoxSize, newCullingBoxSize); } else @@ -584,9 +584,9 @@ namespace PhysXDebug const int argumentCount = arguments.size(); - if (argumentCount == 2) + if (argumentCount == 1) { - const auto userPreference = static_cast(strtol(AZ::CVarFixedString(arguments[1]).c_str(), nullptr, 10)); + const auto userPreference = static_cast(strtol(AZ::CVarFixedString(arguments[0]).c_str(), nullptr, 10)); switch (userPreference) { diff --git a/Gems/PhysXDebug/Code/physxdebug_editor_files.cmake b/Gems/PhysXDebug/Code/physxdebug_editor_files.cmake index 2645795a77..460da598a0 100644 --- a/Gems/PhysXDebug/Code/physxdebug_editor_files.cmake +++ b/Gems/PhysXDebug/Code/physxdebug_editor_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/PhysXDebug_precompiled.cpp Source/PhysXDebug_precompiled.h Source/EditorSystemComponent.cpp Source/EditorSystemComponent.h diff --git a/Gems/PhysXDebug/Code/physxdebug_files.cmake b/Gems/PhysXDebug/Code/physxdebug_files.cmake index 7eea56626b..2d04c8e5de 100644 --- a/Gems/PhysXDebug/Code/physxdebug_files.cmake +++ b/Gems/PhysXDebug/Code/physxdebug_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/PhysXDebug_precompiled.cpp Source/PhysXDebug_precompiled.h Include/PhysXDebug/PhysXDebugBus.h Source/Module.cpp diff --git a/Gems/PhysXDebug/Code/physxdebug_unsupported_files.cmake b/Gems/PhysXDebug/Code/physxdebug_unsupported_files.cmake index e5d7ae7e46..76649b2a91 100644 --- a/Gems/PhysXDebug/Code/physxdebug_unsupported_files.cmake +++ b/Gems/PhysXDebug/Code/physxdebug_unsupported_files.cmake @@ -11,6 +11,5 @@ set(FILES Source/ModuleUnsupported.cpp - Source/PhysXDebugUnsupported_precompiled.cpp Source/PhysXDebugUnsupported_precompiled.h ) diff --git a/Gems/ScriptCanvas/Code/Editor/precompiled.cpp b/Gems/ScriptCanvas/Code/Editor/precompiled.cpp deleted file mode 100644 index 6fdd7bdc45..0000000000 --- a/Gems/ScriptCanvas/Code/Editor/precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "precompiled.h" diff --git a/Gems/ScriptCanvas/Code/Source/precompiled.cpp b/Gems/ScriptCanvas/Code/Source/precompiled.cpp deleted file mode 100644 index 6fdd7bdc45..0000000000 --- a/Gems/ScriptCanvas/Code/Source/precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "precompiled.h" diff --git a/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_files.cmake b/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_files.cmake index 2f1555af3d..54fd98b4ce 100644 --- a/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_files.cmake +++ b/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Editor/precompiled.cpp Editor/precompiled.h Editor/ScriptCanvasEditorGem.cpp Editor/Settings.h diff --git a/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_shared_files.cmake b/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_shared_files.cmake index 17b62d1d3d..42b6bfed72 100644 --- a/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_shared_files.cmake +++ b/Gems/ScriptCanvas/Code/scriptcanvasgem_editor_shared_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Editor/precompiled.cpp Editor/precompiled.h Editor/ScriptCanvasEditorGem.cpp Include/ScriptCanvas/ScriptCanvasGem.h diff --git a/Gems/ScriptCanvas/Code/scriptcanvasgem_game_files.cmake b/Gems/ScriptCanvas/Code/scriptcanvasgem_game_files.cmake index ead7f6d660..dfe0c6f5e3 100644 --- a/Gems/ScriptCanvas/Code/scriptcanvasgem_game_files.cmake +++ b/Gems/ScriptCanvas/Code/scriptcanvasgem_game_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/precompiled.cpp Source/precompiled.h Source/ScriptCanvasGem.cpp ) diff --git a/Gems/ScriptCanvas/Code/scriptcanvasgem_tests_files.cmake b/Gems/ScriptCanvas/Code/scriptcanvasgem_tests_files.cmake index 9a877a2b42..7791c9ca48 100644 --- a/Gems/ScriptCanvas/Code/scriptcanvasgem_tests_files.cmake +++ b/Gems/ScriptCanvas/Code/scriptcanvasgem_tests_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/precompiled.cpp Source/precompiled.h Tests/ScriptCanvasTest.cpp ) diff --git a/Gems/ScriptCanvasDeveloper/Code/Source/precompiled.cpp b/Gems/ScriptCanvasDeveloper/Code/Source/precompiled.cpp deleted file mode 100644 index 6fdd7bdc45..0000000000 --- a/Gems/ScriptCanvasDeveloper/Code/Source/precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "precompiled.h" diff --git a/Gems/ScriptCanvasDeveloper/Code/scriptcanvasdeveloper_gem_common_files.cmake b/Gems/ScriptCanvasDeveloper/Code/scriptcanvasdeveloper_gem_common_files.cmake index fd63448066..34de0f5910 100644 --- a/Gems/ScriptCanvasDeveloper/Code/scriptcanvasdeveloper_gem_common_files.cmake +++ b/Gems/ScriptCanvasDeveloper/Code/scriptcanvasdeveloper_gem_common_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/precompiled.cpp Source/precompiled.h Include/ScriptCanvasDeveloper/ScriptCanvasDeveloperGem.h Include/ScriptCanvasDeveloper/ScriptCanvasDeveloperComponent.h diff --git a/Gems/ScriptCanvasPhysics/Code/Source/ScriptCanvasPhysics_precompiled.cpp b/Gems/ScriptCanvasPhysics/Code/Source/ScriptCanvasPhysics_precompiled.cpp deleted file mode 100644 index 683b5507b8..0000000000 --- a/Gems/ScriptCanvasPhysics/Code/Source/ScriptCanvasPhysics_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "ScriptCanvasPhysics_precompiled.h" diff --git a/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_files.cmake b/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_files.cmake index b2fdfacf67..8815d67909 100644 --- a/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_files.cmake +++ b/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/ScriptCanvasPhysics_precompiled.cpp Source/ScriptCanvasPhysics_precompiled.h Source/PhysicsNodeLibrary.cpp Source/PhysicsNodeLibrary.h diff --git a/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_shared_files.cmake b/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_shared_files.cmake index 769a3db241..b7c97e99ec 100644 --- a/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_shared_files.cmake +++ b/Gems/ScriptCanvasPhysics/Code/scriptcanvas_physics_shared_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/ScriptCanvasPhysics_precompiled.cpp Source/ScriptCanvasPhysics_precompiled.h Source/ScriptCanvasPhysicsModule.cpp ) diff --git a/Gems/ScriptEvents/Code/Source/precompiled.cpp b/Gems/ScriptEvents/Code/Source/precompiled.cpp deleted file mode 100644 index 6fdd7bdc45..0000000000 --- a/Gems/ScriptEvents/Code/Source/precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "precompiled.h" diff --git a/Gems/ScriptEvents/Code/scriptevents_editor_files.cmake b/Gems/ScriptEvents/Code/scriptevents_editor_files.cmake index 8fc57de0dd..c3a491d5bf 100644 --- a/Gems/ScriptEvents/Code/scriptevents_editor_files.cmake +++ b/Gems/ScriptEvents/Code/scriptevents_editor_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/precompiled.cpp Source/precompiled.h Source/Editor/ScriptEventsEditorGem.cpp Source/Editor/ScriptEventsSystemEditorComponent.cpp diff --git a/Gems/ScriptEvents/Code/scriptevents_files.cmake b/Gems/ScriptEvents/Code/scriptevents_files.cmake index a79f81ab28..348ac8b1b5 100644 --- a/Gems/ScriptEvents/Code/scriptevents_files.cmake +++ b/Gems/ScriptEvents/Code/scriptevents_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/precompiled.cpp Source/precompiled.h Source/ScriptEventsGem.cpp ) diff --git a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweener_precompiled.cpp b/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweener_precompiled.cpp deleted file mode 100644 index 85423f94c1..0000000000 --- a/Gems/ScriptedEntityTweener/Code/Source/ScriptedEntityTweener_precompiled.cpp +++ /dev/null @@ -1,13 +0,0 @@ -/* -* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates, or -* a third party where indicated. -* -* 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. -* -*/ - -#include "ScriptedEntityTweener_precompiled.h" diff --git a/Gems/ScriptedEntityTweener/Code/scriptedentitytweener_files.cmake b/Gems/ScriptedEntityTweener/Code/scriptedentitytweener_files.cmake index b889832c16..e3d8d57e2b 100644 --- a/Gems/ScriptedEntityTweener/Code/scriptedentitytweener_files.cmake +++ b/Gems/ScriptedEntityTweener/Code/scriptedentitytweener_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/ScriptedEntityTweener_precompiled.cpp Source/ScriptedEntityTweener_precompiled.h Include/ScriptedEntityTweener/ScriptedEntityTweenerBus.h Include/ScriptedEntityTweener/ScriptedEntityTweenerEnums.h diff --git a/Gems/SliceFavorites/Code/Source/SliceFavorites_precompiled.cpp b/Gems/SliceFavorites/Code/Source/SliceFavorites_precompiled.cpp deleted file mode 100644 index 99dba85db4..0000000000 --- a/Gems/SliceFavorites/Code/Source/SliceFavorites_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "SliceFavorites_precompiled.h" diff --git a/Gems/SliceFavorites/Code/slicefavorites_files.cmake b/Gems/SliceFavorites/Code/slicefavorites_files.cmake index c0b878cbb8..06fcdc87e3 100644 --- a/Gems/SliceFavorites/Code/slicefavorites_files.cmake +++ b/Gems/SliceFavorites/Code/slicefavorites_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/SliceFavorites_precompiled.cpp Source/SliceFavorites_precompiled.h Include/SliceFavorites/SliceFavoritesBus.h Source/SliceFavoritesSystemComponent.cpp diff --git a/Gems/StartingPointCamera/Code/Source/StartingPointCamera_precompiled.cpp b/Gems/StartingPointCamera/Code/Source/StartingPointCamera_precompiled.cpp deleted file mode 100644 index 79702ea5f2..0000000000 --- a/Gems/StartingPointCamera/Code/Source/StartingPointCamera_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "StartingPointCamera_precompiled.h" diff --git a/Gems/StartingPointCamera/Code/startingpointcamera_files.cmake b/Gems/StartingPointCamera/Code/startingpointcamera_files.cmake index e0f5331e41..9f4c100f77 100644 --- a/Gems/StartingPointCamera/Code/startingpointcamera_files.cmake +++ b/Gems/StartingPointCamera/Code/startingpointcamera_files.cmake @@ -33,6 +33,5 @@ set(FILES Source/CameraTransformBehaviors/OffsetCameraPosition.cpp Source/CameraTransformBehaviors/Rotate.h Source/CameraTransformBehaviors/Rotate.cpp - Source/StartingPointCamera_precompiled.cpp Source/StartingPointCamera_precompiled.h ) diff --git a/Gems/StartingPointInput/Code/Source/StartingPointInput_precompiled.cpp b/Gems/StartingPointInput/Code/Source/StartingPointInput_precompiled.cpp deleted file mode 100644 index e4c7581b08..0000000000 --- a/Gems/StartingPointInput/Code/Source/StartingPointInput_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "StartingPointInput_precompiled.h" diff --git a/Gems/StartingPointInput/Code/startingpointinput_editor_files.cmake b/Gems/StartingPointInput/Code/startingpointinput_editor_files.cmake index b1e619c55d..fd69b6180c 100644 --- a/Gems/StartingPointInput/Code/startingpointinput_editor_files.cmake +++ b/Gems/StartingPointInput/Code/startingpointinput_editor_files.cmake @@ -24,6 +24,4 @@ set(FILES Source/InputNode.cpp Source/StartingPointInputGem.cpp Source/StartingPointInput_precompiled.h - Source/StartingPointInput_precompiled.cpp - ) diff --git a/Gems/StartingPointInput/Code/startingpointinput_files.cmake b/Gems/StartingPointInput/Code/startingpointinput_files.cmake index 2208dff6b5..c330233722 100644 --- a/Gems/StartingPointInput/Code/startingpointinput_files.cmake +++ b/Gems/StartingPointInput/Code/startingpointinput_files.cmake @@ -27,5 +27,4 @@ set(FILES Source/InputHandlerNodeable.ScriptCanvasNodeable.xml Source/InputNode.ScriptCanvasGrammar.xml Source/StartingPointInput_precompiled.h - Source/StartingPointInput_precompiled.cpp ) diff --git a/Gems/StartingPointMovement/Code/CMakeLists.txt b/Gems/StartingPointMovement/Code/CMakeLists.txt index 417dfe01ee..b9178dc839 100644 --- a/Gems/StartingPointMovement/Code/CMakeLists.txt +++ b/Gems/StartingPointMovement/Code/CMakeLists.txt @@ -9,21 +9,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # -ly_add_target( - NAME StartingPointMovement.Static STATIC - NAMESPACE Gem - FILES_CMAKE - startingpointmovement_files.cmake - INCLUDE_DIRECTORIES - PRIVATE - Source - PUBLIC - Include - BUILD_DEPENDENCIES - PRIVATE - AZ::AzCore -) - ly_add_target( NAME StartingPointMovement ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE} NAMESPACE Gem @@ -36,7 +21,6 @@ ly_add_target( Include BUILD_DEPENDENCIES PRIVATE - Gem::StartingPointMovement.Static AZ::AzCore AZ::AzFramework ) diff --git a/Gems/StartingPointMovement/Code/Source/StartingPointMovement_precompiled.cpp b/Gems/StartingPointMovement/Code/Source/StartingPointMovement_precompiled.cpp deleted file mode 100644 index 7027e2ede1..0000000000 --- a/Gems/StartingPointMovement/Code/Source/StartingPointMovement_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "StartingPointMovement_precompiled.h" diff --git a/Gems/StartingPointMovement/Code/startingpointmovement_files.cmake b/Gems/StartingPointMovement/Code/startingpointmovement_files.cmake deleted file mode 100644 index 21ce5801ac..0000000000 --- a/Gems/StartingPointMovement/Code/startingpointmovement_files.cmake +++ /dev/null @@ -1,17 +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(FILES - Include/StartingPointMovement/StartingPointMovementConstants.h - Include/StartingPointMovement/StartingPointMovementUtilities.h - Source/StartingPointMovement_precompiled.cpp - Source/StartingPointMovement_precompiled.h -) diff --git a/Gems/StartingPointMovement/Code/startingpointmovement_shared_files.cmake b/Gems/StartingPointMovement/Code/startingpointmovement_shared_files.cmake index f6bc7b14ea..3fec69b2fe 100644 --- a/Gems/StartingPointMovement/Code/startingpointmovement_shared_files.cmake +++ b/Gems/StartingPointMovement/Code/startingpointmovement_shared_files.cmake @@ -11,4 +11,7 @@ set(FILES Source/StartingPointMovementGem.cpp + Include/StartingPointMovement/StartingPointMovementConstants.h + Include/StartingPointMovement/StartingPointMovementUtilities.h + Source/StartingPointMovement_precompiled.h ) diff --git a/Gems/SurfaceData/Code/Source/SurfaceData_precompiled.cpp b/Gems/SurfaceData/Code/Source/SurfaceData_precompiled.cpp deleted file mode 100644 index ce5861193f..0000000000 --- a/Gems/SurfaceData/Code/Source/SurfaceData_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "SurfaceData_precompiled.h" diff --git a/Gems/SurfaceData/Code/surfacedata_files.cmake b/Gems/SurfaceData/Code/surfacedata_files.cmake index f906a12afc..20abf8d3ab 100644 --- a/Gems/SurfaceData/Code/surfacedata_files.cmake +++ b/Gems/SurfaceData/Code/surfacedata_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/SurfaceData_precompiled.cpp Source/SurfaceData_precompiled.h Include/SurfaceData/SurfaceDataConstants.h Include/SurfaceData/SurfaceDataTypes.h diff --git a/Gems/TextureAtlas/Code/Source/TextureAtlas_precompiled.cpp b/Gems/TextureAtlas/Code/Source/TextureAtlas_precompiled.cpp deleted file mode 100644 index 53e132032b..0000000000 --- a/Gems/TextureAtlas/Code/Source/TextureAtlas_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "TextureAtlas_precompiled.h" diff --git a/Gems/TextureAtlas/Code/textureatlas_files.cmake b/Gems/TextureAtlas/Code/textureatlas_files.cmake index c45c1d49a8..f96daa05d0 100644 --- a/Gems/TextureAtlas/Code/textureatlas_files.cmake +++ b/Gems/TextureAtlas/Code/textureatlas_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/TextureAtlas_precompiled.cpp Source/TextureAtlas_precompiled.h Include/TextureAtlas/TextureAtlasBus.h Include/TextureAtlas/TextureAtlasNotificationBus.h diff --git a/Gems/TickBusOrderViewer/Code/Source/TickBusOrderViewer_precompiled.cpp b/Gems/TickBusOrderViewer/Code/Source/TickBusOrderViewer_precompiled.cpp deleted file mode 100644 index aa7933d130..0000000000 --- a/Gems/TickBusOrderViewer/Code/Source/TickBusOrderViewer_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "TickBusOrderViewer_precompiled.h" diff --git a/Gems/TickBusOrderViewer/Code/tickbusorderviewer_files.cmake b/Gems/TickBusOrderViewer/Code/tickbusorderviewer_files.cmake index ceae29ebe3..a4f0b2228b 100644 --- a/Gems/TickBusOrderViewer/Code/tickbusorderviewer_files.cmake +++ b/Gems/TickBusOrderViewer/Code/tickbusorderviewer_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/TickBusOrderViewer_precompiled.cpp Source/TickBusOrderViewer_precompiled.h Include/TickBusOrderViewer/TickBusOrderViewerBus.h Source/TickBusOrderViewerSystemComponent.cpp diff --git a/Gems/Twitch/Code/Source/Twitch_precompiled.cpp b/Gems/Twitch/Code/Source/Twitch_precompiled.cpp deleted file mode 100644 index 40f10ede34..0000000000 --- a/Gems/Twitch/Code/Source/Twitch_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "Twitch_precompiled.h" diff --git a/Gems/Twitch/Code/lmbraws_unsupported_files.cmake b/Gems/Twitch/Code/lmbraws_unsupported_files.cmake index 1fb36a4871..5c98bf6b97 100644 --- a/Gems/Twitch/Code/lmbraws_unsupported_files.cmake +++ b/Gems/Twitch/Code/lmbraws_unsupported_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Twitch_precompiled.cpp Source/Twitch_precompiled.h Source/ComponentStub.cpp ) diff --git a/Gems/Twitch/Code/twitch_files.cmake b/Gems/Twitch/Code/twitch_files.cmake index cba8e44961..f06ef55371 100644 --- a/Gems/Twitch/Code/twitch_files.cmake +++ b/Gems/Twitch/Code/twitch_files.cmake @@ -14,7 +14,6 @@ set(FILES Include/Twitch/TwitchTypes.h Include/Twitch/BaseTypes.h Include/Twitch/RESTTypes.h - Source/Twitch_precompiled.cpp Source/Twitch_precompiled.h Source/TwitchSystemComponent.cpp Source/TwitchSystemComponent.h diff --git a/Gems/Vegetation/Code/Source/Vegetation_precompiled.cpp b/Gems/Vegetation/Code/Source/Vegetation_precompiled.cpp deleted file mode 100644 index c8ed8a1b9d..0000000000 --- a/Gems/Vegetation/Code/Source/Vegetation_precompiled.cpp +++ /dev/null @@ -1,12 +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. -* -*/ -#include "Vegetation_precompiled.h" diff --git a/Gems/Vegetation/Code/vegetation_files.cmake b/Gems/Vegetation/Code/vegetation_files.cmake index ff741902e2..abfd568862 100644 --- a/Gems/Vegetation/Code/vegetation_files.cmake +++ b/Gems/Vegetation/Code/vegetation_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/Vegetation_precompiled.cpp Source/Vegetation_precompiled.h Include/Vegetation/DescriptorListAsset.h Include/Vegetation/Descriptor.h diff --git a/Gems/VirtualGamepad/Code/Source/VirtualGamepad_precompiled.cpp b/Gems/VirtualGamepad/Code/Source/VirtualGamepad_precompiled.cpp deleted file mode 100644 index 8049f28d48..0000000000 --- a/Gems/VirtualGamepad/Code/Source/VirtualGamepad_precompiled.cpp +++ /dev/null @@ -1,13 +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. -* -*/ - -#include "VirtualGamepad_precompiled.h" diff --git a/Gems/VirtualGamepad/Code/virtualgamepad_files.cmake b/Gems/VirtualGamepad/Code/virtualgamepad_files.cmake index 8d026b7dbb..874d6252a2 100644 --- a/Gems/VirtualGamepad/Code/virtualgamepad_files.cmake +++ b/Gems/VirtualGamepad/Code/virtualgamepad_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/VirtualGamepad_precompiled.cpp Source/VirtualGamepad_precompiled.h Include/VirtualGamepad/VirtualGamepadBus.h Source/InputDeviceVirtualGamepad.cpp diff --git a/Gems/WhiteBox/Code/Source/WhiteBoxUnsupported_precompiled.cpp b/Gems/WhiteBox/Code/Source/WhiteBoxUnsupported_precompiled.cpp deleted file mode 100644 index 611ac1f0a1..0000000000 --- a/Gems/WhiteBox/Code/Source/WhiteBoxUnsupported_precompiled.cpp +++ /dev/null @@ -1,13 +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. - * - */ - -#include diff --git a/Gems/WhiteBox/Code/Source/WhiteBox_precompiled.cpp b/Gems/WhiteBox/Code/Source/WhiteBox_precompiled.cpp deleted file mode 100644 index 892230742f..0000000000 --- a/Gems/WhiteBox/Code/Source/WhiteBox_precompiled.cpp +++ /dev/null @@ -1,13 +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. - * - */ - -#include "WhiteBox_precompiled.h" diff --git a/Gems/WhiteBox/Code/whitebox_supported_files.cmake b/Gems/WhiteBox/Code/whitebox_supported_files.cmake index 41aa4433cc..372f8cee45 100644 --- a/Gems/WhiteBox/Code/whitebox_supported_files.cmake +++ b/Gems/WhiteBox/Code/whitebox_supported_files.cmake @@ -10,7 +10,6 @@ # set(FILES - Source/WhiteBox_precompiled.cpp Source/WhiteBox_precompiled.h Include/WhiteBox/WhiteBoxBus.h Source/WhiteBoxAllocator.cpp diff --git a/Gems/WhiteBox/Code/whitebox_unsupported_files.cmake b/Gems/WhiteBox/Code/whitebox_unsupported_files.cmake index a44907e1be..3dca84c067 100644 --- a/Gems/WhiteBox/Code/whitebox_unsupported_files.cmake +++ b/Gems/WhiteBox/Code/whitebox_unsupported_files.cmake @@ -11,6 +11,5 @@ set(FILES Source/WhiteBoxModuleUnsupported.cpp - Source/WhiteBoxUnsupported_precompiled.cpp Source/WhiteBoxUnsupported_precompiled.h ) diff --git a/Tools/LyTestTools/ly_test_tools/o3de/asset_processor.py b/Tools/LyTestTools/ly_test_tools/o3de/asset_processor.py index 8e2b93c20a..a9c9a2fa5b 100644 --- a/Tools/LyTestTools/ly_test_tools/o3de/asset_processor.py +++ b/Tools/LyTestTools/ly_test_tools/o3de/asset_processor.py @@ -597,9 +597,10 @@ class AssetProcessor(object): run_result = subprocess.run(command, close_fds=True, timeout=timeout, capture_output=capture_output) output_list = None if capture_output: - output_list = run_result.stdout.splitlines() if decode: - output_list = [line.decode('utf-8') for line in output_list] + output_list = run_result.stdout.decode('utf-8').splitlines() + else: + output_list = run_result.stdout.splitlines() if run_result.returncode != 0: errorMessage = f"{command} returned error code: {run_result.returncode}" diff --git a/cmake/Packaging.cmake b/cmake/Packaging.cmake index 3e23511fa1..6c077ac617 100644 --- a/cmake/Packaging.cmake +++ b/cmake/Packaging.cmake @@ -16,6 +16,9 @@ endif() # public facing options will be used for conversion into cpack specific ones below. set(LY_INSTALLER_DOWNLOAD_URL "" CACHE STRING "URL embedded into the installer to download additional artifacts") set(LY_INSTALLER_LICENSE_URL "" CACHE STRING "Optionally embed a link to the license instead of raw text") +set(LY_INSTALLER_UPLOAD_URL "" CACHE STRING + "URL used to automatically upload the artifacts. Can also be set via LY_INSTALLER_UPLOAD_URL environment variable. Currently only accepts S3 URLs e.g. s3:///") +set(LY_INSTALLER_AWS_PROFILE "" CACHE STRING "AWS CLI profile for uploading artifacts. Can also be set via LY_INSTALLER_AWS_PROFILE environment variable.") set(CPACK_DESIRED_CMAKE_VERSION 3.20.2) @@ -103,6 +106,45 @@ install(FILES ${_cmake_package_dest} DESTINATION ./Tools/Redistributables/CMake ) +# checks for and removes trailing slash +function(strip_trailing_slash in_url out_url) + string(LENGTH ${in_url} _url_length) + MATH(EXPR _url_length "${_url_length}-1") + + string(SUBSTRING ${in_url} 0 ${_url_length} _clean_url) + if("${in_url}" STREQUAL "${_clean_url}/") + set(${out_url} ${_clean_url} PARENT_SCOPE) + else() + set(${out_url} ${in_url} PARENT_SCOPE) + endif() +endfunction() + +set(_versioned_target_url_tag ${LY_VERSION_STRING}/${PAL_HOST_PLATFORM_NAME}) + +if(NOT LY_INSTALLER_UPLOAD_URL AND DEFINED ENV{LY_INSTALLER_UPLOAD_URL}) + set(LY_INSTALLER_UPLOAD_URL $ENV{LY_INSTALLER_UPLOAD_URL}) +endif() + +if(LY_INSTALLER_UPLOAD_URL) + ly_is_s3_url(${LY_INSTALLER_UPLOAD_URL} _is_s3_bucket) + if(NOT _is_s3_bucket) + message(FATAL_ERROR "Only S3 installer uploading is supported at this time") + endif() + + if (LY_INSTALLER_AWS_PROFILE) + set(CPACK_AWS_PROFILE ${LY_INSTALLER_AWS_PROFILE}) + elseif (DEFINED ENV{LY_INSTALLER_AWS_PROFILE}) + set(CPACK_AWS_PROFILE $ENV{LY_INSTALLER_AWS_PROFILE}) + else() + message(FATAL_ERROR + "An AWS profile is required for installer S3 uploading. Please provide " + "one via LY_INSTALLER_AWS_PROFILE CLI argument or environment variable") + endif() + + strip_trailing_slash(${LY_INSTALLER_UPLOAD_URL} LY_INSTALLER_UPLOAD_URL) + set(CPACK_UPLOAD_URL ${LY_INSTALLER_UPLOAD_URL}/${_versioned_target_url_tag}) +endif() + # IMPORTANT: required to be included AFTER setting all property overrides include(CPack REQUIRED) @@ -146,9 +188,11 @@ ly_configure_cpack_component( ) if(LY_INSTALLER_DOWNLOAD_URL) - # this will set the following variables: CPACK_DOWNLOAD_SITE, CPACK_DOWNLOAD_ALL, and CPACK_UPLOAD_DIRECTORY + strip_trailing_slash(${LY_INSTALLER_DOWNLOAD_URL} LY_INSTALLER_DOWNLOAD_URL) + + # this will set the following variables: CPACK_DOWNLOAD_SITE, CPACK_DOWNLOAD_ALL, and CPACK_UPLOAD_DIRECTORY (local) cpack_configure_downloads( - ${LY_INSTALLER_DOWNLOAD_URL} + ${LY_INSTALLER_DOWNLOAD_URL}/${_versioned_target_url_tag} UPLOAD_DIRECTORY ${CMAKE_BINARY_DIR}/_CPack_Uploads # to match the _CPack_Packages directory ALL ) diff --git a/cmake/Platform/Windows/PackagingPostBuild.cmake b/cmake/Platform/Windows/PackagingPostBuild.cmake index d379358bf4..89b3efb44b 100644 --- a/cmake/Platform/Windows/PackagingPostBuild.cmake +++ b/cmake/Platform/Windows/PackagingPostBuild.cmake @@ -59,12 +59,21 @@ set(_light_command message(STATUS "Creating Bootstrap Installer...") execute_process( COMMAND ${_candle_command} - COMMAND_ERROR_IS_FATAL ANY + RESULT_VARIABLE _candle_result + ERROR_VARIABLE _candle_errors ) +if(NOT ${_candle_result} EQUAL 0) + message(FATAL_ERROR "An error occurred invoking candle.exe. ${_candle_errors}") +endif() + execute_process( COMMAND ${_light_command} - COMMAND_ERROR_IS_FATAL ANY + RESULT_VARIABLE _light_result + ERROR_VARIABLE _light_errors ) +if(NOT ${_light_result} EQUAL 0) + message(FATAL_ERROR "An error occurred invoking light.exe. ${_light_errors}") +endif() file(COPY ${_bootstrap_output_file} DESTINATION ${CPACK_PACKAGE_DIRECTORY} @@ -87,3 +96,42 @@ file(COPY ${_artifacts} DESTINATION ${CPACK_UPLOAD_DIRECTORY} ) message(STATUS "Artifacts copied to ${CPACK_UPLOAD_DIRECTORY}") + +if(NOT CPACK_UPLOAD_URL) + return() +endif() + +file(REAL_PATH "${CPACK_SOURCE_DIR}/.." _root_path) + +file(TO_NATIVE_PATH "${_root_path}/python/python.cmd" _python_cmd) +file(TO_NATIVE_PATH "${_root_path}/scripts/build/tools/upload_to_s3.py" _upload_script) +file(TO_NATIVE_PATH "${_cpack_wix_out_dir}" _cpack_wix_out_dir) + +# strip the scheme and extract the bucket/key prefix from the URL +string(REPLACE "s3://" "" _stripped_url ${CPACK_UPLOAD_URL}) +string(REPLACE "/" ";" _tokens ${_stripped_url}) + +list(POP_FRONT _tokens _bucket) +string(JOIN "/" _prefix ${_tokens}) + +set(_file_regex ".*(cab|exe|msi)$") + +set(_upload_command + ${_python_cmd} -s + -u ${_upload_script} + --base_dir ${_cpack_wix_out_dir} + --file_regex="${_file_regex}" + --bucket ${_bucket} + --key_prefix ${_prefix} + --profile ${CPACK_AWS_PROFILE} +) + +execute_process( + COMMAND ${_upload_command} + RESULT_VARIABLE _upload_result + ERROR_VARIABLE _upload_errors +) + +if (NOT ${_upload_result} EQUAL 0) + message(FATAL_ERROR "An error occurred uploading artifacts. ${_upload_errors}") +endif() diff --git a/scripts/build/Jenkins/Jenkinsfile b/scripts/build/Jenkins/Jenkinsfile index 1bce2988bf..693cf31727 100644 --- a/scripts/build/Jenkins/Jenkinsfile +++ b/scripts/build/Jenkins/Jenkinsfile @@ -366,6 +366,9 @@ def ExportTestResults(Map options, String platform, String type, String workspac dir("${o3deroot}/${params.OUTPUT_DIRECTORY}") { junit testResults: "Testing/**/*.xml" palRmDir("Testing") + // Recreate test runner xml directories that need to be pre generated + palMkdir("Testing/Pytest") + palMkdir("Testing/Gtest") } } } diff --git a/scripts/build/tools/upload_to_s3.py b/scripts/build/tools/upload_to_s3.py index d6d6d8ddb5..5dfe5eb66e 100755 --- a/scripts/build/tools/upload_to_s3.py +++ b/scripts/build/tools/upload_to_s3.py @@ -65,6 +65,11 @@ def get_client(service_name, profile_name): def get_files_to_upload(base_dir, regex): # Get all file names in base directory files = [x for x in os.listdir(base_dir) if os.path.isfile(os.path.join(base_dir, x))] + # strip the surround quotes, if they exist + try: + regex = json.loads(regex) + except: + pass # Get all file names matching the regular expression, those file will be uploaded to S3 files_to_upload = [x for x in files if re.match(regex, x)] return files_to_upload diff --git a/scripts/o3de/o3de/project_properties.py b/scripts/o3de/o3de/project_properties.py index 69bd1b9406..52f1346b51 100644 --- a/scripts/o3de/o3de/project_properties.py +++ b/scripts/o3de/o3de/project_properties.py @@ -30,7 +30,7 @@ def get_project_props(name: str = None, path: pathlib.Path = None) -> dict: return proj_json def edit_project_props(proj_path, proj_name, new_origin, new_display, - new_summary, new_icon, new_tag, remove_tag) -> int: + new_summary, new_icon, new_tags, delete_tags, replace_tags) -> int: proj_json = get_project_props(proj_name, proj_path) if not proj_json: @@ -44,16 +44,22 @@ def edit_project_props(proj_path, proj_name, new_origin, new_display, proj_json['summary'] = new_summary if new_icon: proj_json['icon_path'] = new_icon - if new_tag: - proj_json.setdefault('user_tags', []).append(new_tag) - if remove_tag: + if new_tags: + tag_list = [new_tags] if isinstance(new_tags, str) else new_tags + proj_json.setdefault('user_tags', []).extend(tag_list) + if delete_tags: + removal_list = [delete_tags] if isinstance(delete_tags, str) else delete_tags if 'user_tags' in proj_json: - if remove_tag in proj_json['user_tags']: - proj_json['user_tags'].remove(remove_tag) - else: - logger.warn(f'{remove_tag} not found in user_tags for removal.') + for tag in removal_list: + if tag in proj_json['user_tags']: + proj_json['user_tags'].remove(tag) + else: + logger.warn(f'{tag} not found in user_tags for removal.') else: - logger.warn(f'user_tags property not found for removal of tag {remove_tag}.') + logger.warn(f'user_tags property not found for removal of {remove_tags}.') + if replace_tags: + tag_list = [replace_tags] if isinstance(replace_tags, str) else replace_tags + proj_json['user_tags'] = tag_list manifest.save_o3de_manifest(proj_json, pathlib.Path(proj_path) / 'project.json') return 0 @@ -65,8 +71,9 @@ def _edit_project_props(args: argparse) -> int: args.project_display, args.project_summary, args.project_icon, - args.project_tag, - args.remove_tag) + args.add_tags, + args.delete_tags, + args.replace_tags) def add_parser_args(parser): group = parser.add_mutually_exclusive_group(required=True) @@ -83,10 +90,13 @@ def add_parser_args(parser): help='Sets the summary description of the project.') group.add_argument('-pi', '--project-icon', type=str, required=False, help='Sets the path to the projects icon resource.') - group.add_argument('-pt', '--project-tag', type=str, required=False, - help='Adds a tag to user_tags property. These tags are intended for documentation and filtering.') - group.add_argument('-rt', '--remove-tag', type=str, required=False, - help='Removes a tag from the user_tags property.') + group = parser.add_mutually_exclusive_group(required=False) + group.add_argument('-at', '--add-tags', type=str, nargs='*', required=False, + help='Adds tag(s) to user_tags property. Space delimited list (ex. -at A B C)') + group.add_argument('-dt', '--delete-tags', type=str, nargs ='*', required=False, + help='Removes tag(s) from the user_tags property. Space delimited list (ex. -dt A B C') + group.add_argument('-rt', '--replace-tags', type=str, nargs ='*', required=False, + help='Replace entirety of user_tags property with space delimited list of values') parser.set_defaults(func=_edit_project_props) def add_args(subparsers) -> None: