/* * 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 #include #include #include #include #include namespace EMotionFX { AZ_CLASS_ALLOCATOR_IMPL(AnimGraphParameterMaskHandler, EditorAllocator, 0) AnimGraphParameterMaskHandler::AnimGraphParameterMaskHandler() : QObject() , AzToolsFramework::PropertyHandler, AnimGraphParameterPicker>() , m_object(nullptr) { } AZ::u32 AnimGraphParameterMaskHandler::GetHandlerName() const { return AZ_CRC("AnimGraphParameterMask", 0x67dd0993); } QWidget* AnimGraphParameterMaskHandler::CreateGUI(QWidget* parent) { AnimGraphParameterPicker* picker = aznew AnimGraphParameterPicker(parent, false, true); connect(picker, &AnimGraphParameterPicker::ParametersChanged, this, [picker]([[maybe_unused]] const AZStd::vector& newParameters) { EBUS_EVENT(AzToolsFramework::PropertyEditorGUIMessages::Bus, RequestWrite, picker); }); return picker; } void AnimGraphParameterMaskHandler::ConsumeAttribute(AnimGraphParameterPicker* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, [[maybe_unused]] const char* debugName) { if (attrValue) { AnimGraphNode* node = static_cast(attrValue->GetInstancePointer()); m_object = azdynamic_cast(node); GUI->SetObjectAffectedByParameterChanges(m_object); } if (attrib == AZ::Edit::Attributes::ReadOnly) { bool value; if (attrValue->Read(value)) { GUI->setEnabled(!value); } } } void AnimGraphParameterMaskHandler::WriteGUIValuesIntoProperty([[maybe_unused]] size_t index, [[maybe_unused]] AnimGraphParameterPicker* GUI, property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) { // Don't update the parameter names yet, we still need the information for constructing the command group. instance = m_object->GetParameters(); } bool AnimGraphParameterMaskHandler::ReadValuesIntoGUI([[maybe_unused]] size_t index, AnimGraphParameterPicker* GUI, const property_t& instance, [[maybe_unused]] AzToolsFramework::InstanceDataNode* node) { QSignalBlocker signalBlocker(GUI); GUI->InitializeParameterNames(instance); return true; } } // namespace EMotionFX