diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp index 74dfbb266d..aff0684dfb 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformComponent.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp deleted file mode 100644 index 94d0113bcf..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.cpp +++ /dev/null @@ -1,82 +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" -#include -#include -#include - -namespace AzToolsFramework -{ - void RegisterTransformScaleHandler() - { - PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::RegisterPropertyType, aznew Components::TransformScalePropertyHandler()); - } - - namespace Components - { - AZ::u32 TransformScalePropertyHandler::GetHandlerName(void) const - { - return TransformScaleHandler; - } - - QWidget* TransformScalePropertyHandler::CreateGUI(QWidget* parent) - { - AzQtComponents::DoubleSpinBox* newCtrl = new AzQtComponents::DoubleSpinBox(parent); - connect(newCtrl, QOverload::of(&AzQtComponents::DoubleSpinBox::valueChanged), newCtrl, [newCtrl]() - { - AzToolsFramework::PropertyEditorGUIMessages::Bus::Broadcast(&AzToolsFramework::PropertyEditorGUIMessages::RequestWrite, newCtrl); - }); - - newCtrl->setMinimum(AZ::MinTransformScale); - newCtrl->setMaximum(AZ::MaxTransformScale); - - return newCtrl; - } - - void TransformScalePropertyHandler::ConsumeAttribute(AzQtComponents::DoubleSpinBox* GUI, AZ::u32 attrib, - AzToolsFramework::PropertyAttributeReader* attrValue, [[maybe_unused]] const char* debugName) - { - if (attrib == AZ::Edit::Attributes::Suffix) - { - AZStd::string label; - if (attrValue->Read(label)) - { - GUI->setSuffix(label.c_str()); - } - } - } - - void TransformScalePropertyHandler::WriteGUIValuesIntoProperty([[maybe_unused]] size_t index, AzQtComponents::DoubleSpinBox* GUI, - AZ::Vector3& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) - { - const float value = aznumeric_cast(GUI->value()); - const float currentMaxElement = instance.GetMaxElement(); - if (currentMaxElement != 0.0f) - { - instance *= value / currentMaxElement; - } - else - { - instance = AZ::Vector3(value); - } - } - - bool TransformScalePropertyHandler::ReadValuesIntoGUI([[maybe_unused]] size_t index, AzQtComponents::DoubleSpinBox* GUI, - const AZ::Vector3& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) - { - QSignalBlocker signalBlocker(GUI); - GUI->setValue(instance.GetMaxElement()); - return true; - } - } // namespace Components -} // namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.h b/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.h deleted file mode 100644 index f13aa37904..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/ToolsComponents/TransformScalePropertyHandler.h +++ /dev/null @@ -1,56 +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. -* -*/ - -#pragma once - -#if !defined(Q_MOC_RUN) -#include -#include -#include -#endif - -namespace AzToolsFramework -{ - namespace Components - { - static const AZ::Crc32 TransformScaleHandler = AZ_CRC_CE("TransformScale"); - - //! Handler to allow the scale field inside the Transform Component to be represented as a single value in - //! the editor, but stored internally as a Vector3. - //! The purpose for this is to prevent any new entities being created with non-uniform scale on the Transform - //! Component, but preserve the data required for migrating any existing entities to use the Non-Uniform Scale - //! Component, until all migration work is completed. - //! The value shown in the editor will be the maximum value from the scale vector, and changing the value in - //! the editor will update the vector so that its maximum value matches the newly edited value, but its - //! components retain their existing proportion. - //! For example, if the current vector scale is (2, 3, 4), the value in the editor will appear as 4. If the value - //! in the editor is updated to 2, then the vector scale will update to (1, 1.5, 2), keeping the same proportion - //! between the x, y and z components. - class TransformScalePropertyHandler - : public QObject - , public AzToolsFramework::PropertyHandler - { - Q_OBJECT //AUTOMOC - public: - AZ_CLASS_ALLOCATOR(TransformScalePropertyHandler, AZ::SystemAllocator, 0); - - AZ::u32 GetHandlerName(void) const override; - QWidget* CreateGUI(QWidget* parent) override; - void ConsumeAttribute(AzQtComponents::DoubleSpinBox* GUI, AZ::u32 attrib, - AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) override; - void WriteGUIValuesIntoProperty(size_t index, AzQtComponents::DoubleSpinBox* GUI, - AZ::Vector3& instance, AzToolsFramework::InstanceDataNode* node) override; - bool ReadValuesIntoGUI(size_t index, AzQtComponents::DoubleSpinBox* GUI, - const AZ::Vector3& instance, AzToolsFramework::InstanceDataNode* node) override; - }; - } // namespace Components -} // namespace AzToolsFramework diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp index bd61e6ceed..181885cc70 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyManagerComponent.cpp @@ -16,7 +16,6 @@ #include #include #include -#include namespace AzToolsFramework { @@ -38,7 +37,6 @@ namespace AzToolsFramework void RegisterButtonPropertyHandlers(); void RegisterMultiLineEditHandler(); void RegisterCrcHandler(); - void RegisterTransformScaleHandler(); void ReflectPropertyEditor(AZ::ReflectContext* context); namespace Components diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake index aaf5c86d33..8d0180f6ce 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake @@ -293,8 +293,6 @@ set(FILES ToolsComponents/TransformComponent.h ToolsComponents/TransformComponent.cpp ToolsComponents/TransformComponentBus.h - ToolsComponents/TransformScalePropertyHandler.cpp - ToolsComponents/TransformScalePropertyHandler.h ToolsComponents/ScriptEditorComponent.cpp ToolsComponents/ScriptEditorComponent.h ToolsComponents/ToolsAssetCatalogComponent.cpp