on demand reflect az events when they are the return value of ebuses (#6625)

Signed-off-by: carlitosan <82187351+carlitosan@users.noreply.github.com>
This commit is contained in:
carlitosan
2022-01-04 14:21:06 -08:00
committed by GitHub
parent 50b22a23cf
commit c83bf11a3d
@@ -1159,7 +1159,7 @@ namespace ScriptCanvasEditor
, AZStd::string_view eventName
, const ScriptCanvas::EBusBusId& busId
, const ScriptCanvas::EBusEventId& eventId
, const AZ::BehaviorEBusEventSender&
, const AZ::BehaviorEBusEventSender& sender
, ScriptCanvas::PropertyStatus propertyStatus
, bool isOverload)
{
@@ -1193,6 +1193,17 @@ namespace ScriptCanvasEditor
senderInformation->m_displayName = details.m_name.empty() ? eventName : details.m_name.c_str();
senderInformation->m_toolTip = details.m_tooltip.empty() ? "" : details.m_tooltip;
auto safeRegister = [](AZ::BehaviorMethod* method)
{
if (method && AZ::MethodReturnsAzEventByReferenceOrPointer(*method))
{
const AZ::BehaviorParameter* resultParameter = method->GetResult();
ScriptCanvas::ReflectEventTypeOnDemand(resultParameter->m_typeId, resultParameter->m_name, resultParameter->m_azRtti);
}
};
safeRegister(sender.m_event);
safeRegister(sender.m_broadcast);
m_registeredNodes.emplace(AZStd::make_pair(nodeIdentifier, senderInformation));
}
}