You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
MVVM: Always assign the viewmodel value to the property value. It's a bug to not assign it when it's null.
#rb daren.cheng [CL 31587293 by patrick boutot in ue5-main branch]
This commit is contained in:
@@ -173,25 +173,26 @@ void UMVVMView::InitializeSourceInternal(UObject* NewSource, FMVVMViewClass_Sour
|
||||
if (NewSource)
|
||||
{
|
||||
ValidSources |= SourceKey.GetBit();
|
||||
if (ClassSource.RequireSettingUserWidgetProperty())
|
||||
{
|
||||
UUserWidget* UserWidget = GetUserWidget();
|
||||
FObjectPropertyBase* FoundObjectProperty = FindFProperty<FObjectPropertyBase>(UserWidget->GetClass(), ClassSource.GetUserWidgetPropertyName());
|
||||
if (ensureAlwaysMsgf(FoundObjectProperty, TEXT("The compiler should have added the property")))
|
||||
{
|
||||
if (ensure(NewSource->GetClass()->IsChildOf(FoundObjectProperty->PropertyClass)))
|
||||
{
|
||||
FoundObjectProperty->SetObjectPropertyValue_InContainer(UserWidget, NewSource);
|
||||
ViewSource.bAssignedToUserWidgetProperty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ValidSources &= ~SourceKey.GetBit();
|
||||
}
|
||||
|
||||
if (ClassSource.RequireSettingUserWidgetProperty())
|
||||
{
|
||||
UUserWidget* UserWidget = GetUserWidget();
|
||||
FObjectPropertyBase* FoundObjectProperty = FindFProperty<FObjectPropertyBase>(UserWidget->GetClass(), ClassSource.GetUserWidgetPropertyName());
|
||||
if (ensureAlwaysMsgf(FoundObjectProperty, TEXT("The compiler should have added the property")))
|
||||
{
|
||||
if (NewSource == nullptr || ensure(NewSource->GetClass()->IsChildOf(FoundObjectProperty->PropertyClass)))
|
||||
{
|
||||
FoundObjectProperty->SetObjectPropertyValue_InContainer(UserWidget, NewSource);
|
||||
ViewSource.bAssignedToUserWidgetProperty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ViewSource.Source = NewSource;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user