Change the blueprint action database to refresh type promotion instead of doing it from the module change callback.

This ensures the type promotion is refreshed right before it is needed and avoids redundant refreshes when multiple modules load at once.
#rb ben.hoffman

[CL 27177959 by ben zeigler in ue5-main branch]
This commit is contained in:
ben zeigler
2023-08-17 13:25:12 -04:00
parent 4078eb3dd5
commit e3b7df8297
5 changed files with 17 additions and 31 deletions
@@ -1365,6 +1365,10 @@ void FBlueprintActionDatabase::Tick(float DeltaTime)
{
RefreshAll();
}
else if (!BlueprintActionDatabaseImpl::PendingModules.IsEmpty())
{
PreRefresh(false);
}
// Check for any modules that may have been loaded since the last tick. Even if we call RefreshAll() above, we still want to run
// through this list in order to keep track of loaded modules containing native script types that are registered into the database.
@@ -1500,6 +1504,9 @@ void FBlueprintActionDatabase::RefreshAll()
TGuardValue<bool> ScopedInitialization(BlueprintActionDatabaseImpl::bIsInitializing, true);
BlueprintActionDatabaseImpl::bRefreshAllRequested = false;
// Refresh other systems before the database is recreated
PreRefresh(true);
// Remove callbacks from blueprints
for (TObjectIterator<UBlueprint> BlueprintIt; BlueprintIt; ++BlueprintIt)
{
@@ -2002,6 +2009,12 @@ void FBlueprintActionDatabase::OnBlueprintChanged(UBlueprint* InBlueprint)
}
}
void FBlueprintActionDatabase::PreRefresh(bool bRefreshAll)
{
// Refresh other systems as necessary, doing it here avoids redundant work
FTypePromotion::RefreshPromotionTables();
}
bool FBlueprintActionDatabase::IsClassAllowed(UClass const* InClass, EPermissionsContext InContext)
{
if (InClass == nullptr)