You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-157830 [REVIEW] [at]vincent.gauthier #rnx #ROBOMERGE-AUTHOR: sebastian.nordgren #ROBOMERGE-SOURCE: CL 20871525 via CL 20880386 via CL 20880495 #ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v971-20777995) [CL 20885605 by sebastian nordgren in ue5-main branch]
110 lines
2.5 KiB
C++
110 lines
2.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "MVVMBlueprintViewBinding.h"
|
|
#include "MVVMBlueprintView.h"
|
|
#include "MVVMWidgetBlueprintExtension_View.h"
|
|
#include "WidgetBlueprintExtension.h"
|
|
|
|
FName FMVVMBlueprintViewBinding::GetFName(const UMVVMBlueprintView* View) const
|
|
{
|
|
TStringBuilder<256> BindingName;
|
|
|
|
const FMVVMBlueprintViewModelContext* ViewModel = nullptr;
|
|
if (View != nullptr)
|
|
{
|
|
ViewModel = View->FindViewModel(ViewModelPath.GetViewModelId());
|
|
}
|
|
|
|
if (ViewModel != nullptr)
|
|
{
|
|
BindingName << ViewModel->GetViewModelName();
|
|
}
|
|
else
|
|
{
|
|
BindingName << TEXT("Invalid");
|
|
}
|
|
|
|
BindingName << TEXT("_");
|
|
BindingName << ViewModelPath.GetBasePropertyPath();
|
|
|
|
if (BindingType == EMVVMBindingMode::TwoWay)
|
|
{
|
|
BindingName << TEXT("_Both_");
|
|
}
|
|
else if (UE::MVVM::IsForwardBinding(BindingType))
|
|
{
|
|
BindingName << TEXT("_To_");
|
|
}
|
|
else if (UE::MVVM::IsBackwardBinding(BindingType))
|
|
{
|
|
BindingName << TEXT("_From_");
|
|
}
|
|
|
|
if (View == nullptr || WidgetPath.GetWidgetName().IsNone())
|
|
{
|
|
BindingName << TEXT("Invalid_");
|
|
}
|
|
else if (View->GetOuterUMVVMWidgetBlueprintExtension_View()->GetWidgetBlueprint()->GetFName() != WidgetPath.GetWidgetName())
|
|
{
|
|
BindingName << WidgetPath.GetWidgetName();
|
|
BindingName << TEXT("_");
|
|
}
|
|
|
|
BindingName << WidgetPath.GetBasePropertyPath();
|
|
|
|
return BindingName.ToString();
|
|
}
|
|
|
|
FString FMVVMBlueprintViewBinding::GetDisplayNameString(const UMVVMBlueprintView* View) const
|
|
{
|
|
const FMVVMBlueprintViewModelContext* ViewModel = nullptr;
|
|
if (View != nullptr)
|
|
{
|
|
ViewModel = View->FindViewModel(ViewModelPath.GetViewModelId());
|
|
}
|
|
|
|
TStringBuilder<512> BindingName;
|
|
if (ViewModel != nullptr)
|
|
{
|
|
BindingName << ViewModel->GetViewModelName();
|
|
}
|
|
else
|
|
{
|
|
BindingName << TEXT("<none>");
|
|
}
|
|
|
|
BindingName << TEXT(".");
|
|
BindingName << ViewModelPath.GetBasePropertyPath();
|
|
|
|
if (BindingType == EMVVMBindingMode::TwoWay)
|
|
{
|
|
BindingName << TEXT(" <-> ");
|
|
}
|
|
else if (UE::MVVM::IsForwardBinding(BindingType))
|
|
{
|
|
BindingName << TEXT(" -> ");
|
|
}
|
|
else if (UE::MVVM::IsBackwardBinding(BindingType))
|
|
{
|
|
BindingName << TEXT(" <- ");
|
|
}
|
|
else
|
|
{
|
|
BindingName << TEXT(" ??? "); // shouldn't happen
|
|
}
|
|
|
|
if (View == nullptr || WidgetPath.GetWidgetName().IsNone())
|
|
{
|
|
BindingName << TEXT("<none>.");
|
|
}
|
|
else if (View->GetOuterUMVVMWidgetBlueprintExtension_View()->GetWidgetBlueprint()->GetFName() != WidgetPath.GetWidgetName())
|
|
{
|
|
BindingName << WidgetPath.GetWidgetName();
|
|
BindingName << TEXT(".");
|
|
}
|
|
|
|
BindingName << WidgetPath.GetBasePropertyPath();
|
|
|
|
return BindingName.ToString();
|
|
}
|