You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.2 KiB
C++
80 lines
3.2 KiB
C++
/*
|
|
* 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 <EMotionFX/Source/EventHandler.h>
|
|
#include <Editor/PropertyWidgets/AnimGraphParameterMaskHandler.h>
|
|
#include <EMotionFX/Tools/EMotionStudio/Plugins/StandardPlugins/Source/AnimGraph/ParameterSelectionWindow.h>
|
|
#include <QHBoxLayout>
|
|
#include <QMessageBox>
|
|
#include <QTimer>
|
|
|
|
|
|
namespace EMotionFX
|
|
{
|
|
AZ_CLASS_ALLOCATOR_IMPL(AnimGraphParameterMaskHandler, EditorAllocator, 0)
|
|
|
|
AnimGraphParameterMaskHandler::AnimGraphParameterMaskHandler()
|
|
: QObject()
|
|
, AzToolsFramework::PropertyHandler<AZStd::vector<AZStd::string>, 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<AZStd::string>& 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<AnimGraphNode*>(attrValue->GetInstancePointer());
|
|
m_object = azdynamic_cast<ObjectAffectedByParameterChanges*>(node);
|
|
GUI->SetObjectAffectedByParameterChanges(m_object);
|
|
}
|
|
|
|
if (attrib == AZ::Edit::Attributes::ReadOnly)
|
|
{
|
|
bool value;
|
|
if (attrValue->Read<bool>(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
|