// Find bindings that have write fields with metadata "ViewmodelBlueprintWidgetExtension", these are setter functions for assigning a viewmodel array.
// Use their corresponding read field to get the expected type of entry viewmodel, and compare it against the one that user selected in the details panel.
Compiler->AddMessageForBinding(Binding,FText::Format(LOCTEXT("EntryViewModelTypeMismatch","The entry viewmodel type {0} does not match the array of viewmodels of type {1}."),UserSelectedViewmodelType,ArraySetterFunctionViewmodelType),UE::MVVM::Compiler::EMessageType::Error);
Compiler->MarkPrecompileStepInvalid();
break;
}
}
}
}
}
// No need to look into the next fields of this write path, we have found the field with ViewmodelBlueprintWidgetExtension metadata.
Compiler->AddMessage(FText::Format(LOCTEXT("PreCompileMVVMWidgetExtensionNoSetterBindingFound","No binding found from an array of viewmodels to {0} -> SetItems. Please add this binding or remove the Viewmodel extension on widget {0} from its details panel."),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Warning);
Compiler->AddMessage(FText::Format(LOCTEXT("CouldNotCreateSourceFieldPath","Couldn't create the source field path '{0}'. {1}. Make sure '{0}' is marked as 'Is Variable'."),FText::FromName(WidgetName),FieldPathResult.GetError()),UE::MVVM::Compiler::EMessageType::Error);
// If the stored viewmodel ID invalid, it means the viewmodel was deleted so we clear the value.
// We need to manually clear this value here because the panel widget doesn't get notified when the entry widget viewmodels change.
EntryViewModelId=FGuid();
Compiler->AddMessage(FText::Format(LOCTEXT("PreCompileMVVMWidgetExtensionEntryVMDeleted","No viewmodel selected for Entry widget {0}. Please select a viewmodel for it via the details panel or remove the Viewmodel extension on the containing widget {1}."),FText::FromName(EntryUserWidget->GetFName()),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Error);
}
}
else
{
// If no view is found in the entry widget, we clear the entry viewmodel value.
// We need to manually clear this value here because the panel widget doesn't get notified when the entry widget view is added/removed.
EntryViewModelId=FGuid();
Compiler->AddMessage(FText::Format(LOCTEXT("PreCompileMVVMWidgetExtensionEntryHasNoView","Entry widget {0} doesn't have a View. Consider adding a binding to it or remove the MVVM extension on the containing widget {1}."),FText::FromName(EntryUserWidget->GetFName()),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Error);
}
}
}
else
{
Compiler->AddMessage(FText::Format(LOCTEXT("PreCompileMVVMWidgetExtensionWidgetNoEntryClass","Widget {0} doesn't have an entry widget class. Consider assigning it in the details panel or remove the Viewmodel extension on the widget."),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Error);
}
}
else
{
Compiler->AddMessage(FText::Format(LOCTEXT("PreCompileMVVMWidgetExtensionWidgetNotPanelWidget","Widget {0} is not a UPanelWidget but has a MVVMViewBlueprintPanelWidgetExtension."),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Error);
}
}
else
{
Compiler->AddMessage(FText::Format(LOCTEXT("PreCompileMVVMWidgetExtensionInvalidWidgetName","Widget with name {0} doesn't exist in the widget blueprint but a viewmodel widget extension exists that is attached to it."),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Error);
Compiler->AddMessage(FText::Format(LOCTEXT("CompiledFieldPathForWidgetNotGenerated","The field path for widget {0} was not generated."),FText::FromName(WidgetName)),UE::MVVM::Compiler::EMessageType::Error);
Compiler->MarkCompileStepInvalid();
return;
}
// Check that we have a valid entry view and valid entry viewmodel
// Otherwise, no runtime extension will be created.