Merge pull request #7730 from aws-lumberyard-dev/scripting/script_events

Fixed Script Event registration going to the incorrect Behavior Context
monroegm-disable-blank-issue-2
Luis Sempé 4 years ago committed by GitHub
commit 44187d50ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1337,6 +1337,7 @@ namespace AZ
// EBusInterface settings
static const EBusAddressPolicy AddressPolicy = EBusAddressPolicy::ById;
typedef BehaviorContext* BusIdType;
using MutexType = AZStd::recursive_mutex;
//////////////////////////////////////////////////////////////////////////
/// Called when a new global method is reflected in behavior context or removed from it

@ -39,7 +39,7 @@ namespace AZ
// [GFX TODO][ATOM-13648] Add local system allocator to material system
// ScriptContext creates a new allocator if null (default) is passed in.
// Temporarily using system allocator for preventing hitting the max allocator number.
m_scriptContext = AZStd::make_unique<AZ::ScriptContext>(ScriptContextIds::DefaultScriptContextId, &AZ::AllocatorInstance<AZ::SystemAllocator>::Get());
m_scriptContext = AZStd::make_unique<AZ::ScriptContext>(AZ_CRC_CE("MaterialFunctor"), &AZ::AllocatorInstance<AZ::SystemAllocator>::Get());
m_sriptBehaviorContext = AZStd::make_unique<AZ::BehaviorContext>();
ReflectScriptContext(m_sriptBehaviorContext.get());

@ -115,7 +115,7 @@ namespace ScriptEvents
m_maxVersion = definition.GetVersion();
}
AZ::BehaviorContextBus::Broadcast(&AZ::BehaviorContextBus::Events::OnAddEBus, m_busName.c_str(), bus);
AZ::BehaviorContextBus::Event(behaviorContext, &AZ::BehaviorContextBus::Events::OnAddEBus, m_busName.c_str(), bus);
m_scriptEventBindings[m_assetId] = AZStd::make_unique<ScriptEventBinding>(behaviorContext, m_busName.c_str(), definition.GetAddressType());
ScriptEventNotificationBus::Event(m_assetId, &ScriptEventNotifications::OnRegistered, definition);

Loading…
Cancel
Save