Animation Editor: Motion event colors aren't in sync with the event presets (#7582)

The motion events in the timeview had the wrong colors assigned as they weren't correctly mapped to the given event presets.

Signed-off-by: Benjamin Jillich <jillich@amazon.com>
monroegm-disable-blank-issue-2
Benjamin Jillich 4 years ago committed by GitHub
parent 932f0a4d84
commit 1413977aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -302,27 +302,30 @@ namespace EMStudio
}
}
// Check if motion event with this configuration exists and return color.
AZ::u32 MotionEventPresetManager::GetEventColor(const EMotionFX::EventDataSet& eventDatas) const
{
for (const MotionEventPreset* preset : m_eventPresets)
{
EMotionFX::EventDataSet commonDatas;
const EMotionFX::EventDataSet& presetDatas = preset->GetEventDatas();
const bool allMatch = AZStd::all_of(presetDatas.cbegin(), presetDatas.cend(), [eventDatas](const EMotionFX::EventDataPtr& presetData)
const size_t numEventDatas = eventDatas.size();
if (numEventDatas == presetDatas.size())
{
const auto thisPresetDataHasMatch = AZStd::find_if(eventDatas.cbegin(), eventDatas.cend(), [presetData](const EMotionFX::EventDataPtr& eventData)
for (size_t i = 0; i < numEventDatas; ++i)
{
return ((presetData && eventData && *presetData == *eventData) || (!presetData && !eventData));
});
return thisPresetDataHasMatch != eventDatas.cend();
});
if (allMatch)
const EMotionFX::EventDataPtr& eventData = eventDatas[i];
const EMotionFX::EventDataPtr& presetData = presetDatas[i];
if (eventData && presetData &&
eventData->RTTI_GetType() == presetData->RTTI_GetType() &&
*eventData == *presetData)
{
return preset->GetEventColor();
}
}
}
}
// Use the same color for all events that are not from a preset.
return s_unknownEventColor;

Loading…
Cancel
Save