123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- /*
- * Copyright (c) Contributors to the Open 3D Engine Project.
- * For complete copyright and license terms please see the LICENSE at the root of this distribution.
- *
- * SPDX-License-Identifier: Apache-2.0 OR MIT
- *
- */
- #include <AzCore/EBus/EBus.h>
- #include <AzToolsFramework/Debug/TraceContext.h>
- #include <AzToolsFramework/UI/PropertyEditor/PropertyVectorCtrl.hxx>
- #include <AzToolsFramework/UI/PropertyEditor/PropertyDoubleSpinCtrl.hxx>
- #include <SceneAPI/SceneUI/RowWidgets/TransformRowHandler.h>
- namespace AZ
- {
- namespace SceneAPI
- {
- namespace SceneUI
- {
- AZ_CLASS_ALLOCATOR_IMPL(TranformRowHandler, SystemAllocator);
- TranformRowHandler* TranformRowHandler::s_instance = nullptr;
- QWidget* TranformRowHandler::CreateGUI(QWidget* parent)
- {
- return aznew TransformRowWidget(parent);
- }
- u32 TranformRowHandler::GetHandlerName() const
- {
- return AZ_CRC_CE("TranformRow");
- }
- 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<bool>(value))
- {
- widget->SetEnableEdit(!value);
- }
- }
- else
- {
- AzToolsFramework::Vector3PropertyHandler vector3Handler;
- vector3Handler.ConsumeAttribute(widget->GetTranslationWidget(), attrib, attrValue, debugName);
- vector3Handler.ConsumeAttribute(widget->GetRotationWidget(), attrib, attrValue, debugName);
- AzToolsFramework::doublePropertySpinboxHandler spinboxHandler;
- spinboxHandler.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 <RowWidgets/moc_TransformRowHandler.cpp>
|