/* * 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 #include #include #include namespace AZ { namespace SceneAPI { namespace SceneUI { AZ_CLASS_ALLOCATOR_IMPL(TranformRowHandler, SystemAllocator, 0) TranformRowHandler* TranformRowHandler::s_instance = nullptr; QWidget* TranformRowHandler::CreateGUI(QWidget* parent) { return aznew TransformRowWidget(parent); } u32 TranformRowHandler::GetHandlerName() const { return AZ_CRC("TranformRow", 0x795295be); } bool TranformRowHandler::AutoDelete() const { return false; } bool TranformRowHandler::IsDefaultHandler() const { return true; } void TranformRowHandler::ConsumeAttribute(TransformRowWidget* widget, u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, const char* debugName) { if (attrib == AZ::Edit::Attributes::ReadOnly) { bool value; if (attrValue->Read(value)) { widget->SetEnableEdit(!value); } } else { AzToolsFramework::Vector3PropertyHandler handler; handler.ConsumeAttribute(widget->GetTranslationWidget(), attrib, attrValue, debugName); handler.ConsumeAttribute(widget->GetRotationWidget(), attrib, attrValue, debugName); handler.ConsumeAttribute(widget->GetScaleWidget(), attrib, attrValue, debugName); } } void TranformRowHandler::WriteGUIValuesIntoProperty(size_t /*index*/, TransformRowWidget* GUI, property_t& instance, AzToolsFramework::InstanceDataNode* /*node*/) { GUI->GetTransform(instance); } bool TranformRowHandler::ReadValuesIntoGUI(size_t /*index*/, TransformRowWidget* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* /*node*/) { GUI->SetTransform(instance); return false; } void TranformRowHandler::Register() { using namespace AzToolsFramework; if (!s_instance) { s_instance = aznew TranformRowHandler(); PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::Bus::Events::RegisterPropertyType, s_instance); } } void TranformRowHandler::Unregister() { using namespace AzToolsFramework; if (s_instance) { PropertyTypeRegistrationMessages::Bus::Broadcast(&PropertyTypeRegistrationMessages::Bus::Events::UnregisterPropertyType, s_instance); delete s_instance; s_instance = nullptr; } } void TranformRowHandler::ConsumeFilterTypeAttribute(TransformRowWidget* /*widget*/, AzToolsFramework::PropertyAttributeReader* /*attrValue*/) { } } // namespace SceneUI } // namespace SceneAPI } // namespace AZ #include