/* * 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 #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](const AZStd::vector& newParameters) { EBUS_EVENT(AzToolsFramework::PropertyEditorGUIMessages::Bus, RequestWrite, picker); }); return picker; } void AnimGraphParameterMaskHandler::ConsumeAttribute(AnimGraphParameterPicker* GUI, AZ::u32 attrib, AzToolsFramework::PropertyAttributeReader* attrValue, 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(size_t index, AnimGraphParameterPicker* GUI, property_t& instance, 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(size_t index, AnimGraphParameterPicker* GUI, const property_t& instance, AzToolsFramework::InstanceDataNode* node) { QSignalBlocker signalBlocker(GUI); GUI->InitializeParameterNames(instance); return true; } } // namespace EMotionFX