Speculative Fix ensure CommonUI postload

#jira UE-153367
#rb Patrick.Boutot
#preflight 62841ae0185a31bd39edc2e1

[CL 20302071 by daren cheng in ue5-main branch]
This commit is contained in:
daren cheng
2022-05-20 16:18:32 -04:00
parent 5e4fdf3eaf
commit c5fb55c802
4 changed files with 14 additions and 5 deletions
@@ -40,7 +40,9 @@ void UCommonBorder::PostLoad()
UCommonBorder* CDO = Cast<UCommonBorder>(GetClass()->GetDefaultObject());
if (Background == CDO->Background)
{
Style = ICommonUIModule::GetEditorSettings().GetTemplateBorderStyle();
UCommonUIEditorSettings& Settings = ICommonUIModule::GetEditorSettings();
Settings.ConditionalPostLoad();
Style = Settings.GetTemplateBorderStyle();
}
}
@@ -335,7 +335,9 @@ void UCommonButtonBase::PostLoad()
// We will remove this once existing content is fixed up. Since previously the native CDO was actually the default style, this code will attempt to set the style on assets that were once using this default
if (!Style && !bStyleNoLongerNeedsConversion && !IsRunningDedicatedServer())
{
Style = ICommonUIModule::GetEditorSettings().GetTemplateButtonStyle();
UCommonUIEditorSettings& Settings = ICommonUIModule::GetEditorSettings();
Settings.ConditionalPostLoad();
Style = Settings.GetTemplateButtonStyle();
}
bStyleNoLongerNeedsConversion = true;
@@ -351,7 +351,9 @@ void UCommonLoadGuard::PostLoad()
//TODO: I want this removed, it's needed for backwards compatibility
if (!TextStyle && !bStyleNoLongerNeedsConversion && !IsRunningDedicatedServer())
{
TextStyle = ICommonUIModule::GetEditorSettings().GetTemplateTextStyle();
UCommonUIEditorSettings& Settings = ICommonUIModule::GetEditorSettings();
Settings.ConditionalPostLoad();
TextStyle = Settings.GetTemplateTextStyle();
}
bStyleNoLongerNeedsConversion = true;
@@ -295,10 +295,13 @@ void UCommonTextBlock::PostLoad()
// We will remove this once existing content is fixed up. Since previously the native CDO was actually the default style, this code will attempt to set the style on assets that were once using this default
if (!Style && !bStyleNoLongerNeedsConversion && !IsRunningDedicatedServer())
{
TSubclassOf<UCommonTextStyle> DefaultStyle = ICommonUIModule::GetEditorSettings().GetTemplateTextStyle();
UCommonUIEditorSettings& Settings = ICommonUIModule::GetEditorSettings();
Settings.ConditionalPostLoad();
TSubclassOf<UCommonTextStyle> DefaultStyle = Settings.GetTemplateTextStyle();
UCommonTextStyle* DefaultStyleCDO = DefaultStyle ? Cast<UCommonTextStyle>(DefaultStyle->ClassDefaultObject) : nullptr;
if (DefaultStyleCDO)
{
DefaultStyleCDO->ConditionalPostLoad();
UCommonTextBlock* CDO = CastChecked<UCommonTextBlock>(GetClass()->GetDefaultObject());
bool bAllDefaults = true;
@@ -445,7 +448,7 @@ void UCommonTextBlock::PostLoad()
if (bAllDefaults)
{
Style = ICommonUIModule::GetEditorSettings().GetTemplateTextStyle();
Style = Settings.GetTemplateTextStyle();
}
}
}