Files
UnrealEngineUWP/Engine/Plugins/Runtime/ModelViewViewModel/Source/ModelViewViewModelAssetSearch/Private/MVVMAssetSearchIndexer.h
Patrick Boutot 5e36ee3d7c MVVM: Add a blueprint view to the AssetSearch. The module is not added because it depends on the AssetSearch plugin. The code to enable it is ... but the "Optional" doesn't work at the moment and it would always enabled the AssetSearch.
{
    "Name": "ModelViewViewModelAssetSearch",
    "Type": "Editor",
    "LoadingPhase": "Default"
  }
],
"Plugins": [
{
  "Name": "AssetSearch",
  "Enabled": true,
  "Optional": true
  ]
#rb editor-ui-systems
#preflight 6453f968386cf3c273d47cde

[CL 25352167 by Patrick Boutot in ue5-main branch]
2023-05-05 07:10:41 -04:00

55 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Containers/UnrealString.h"
#include "IAssetIndexer.h"
#include "SearchSerializer.h"
#include "Utility/IndexerUtilities.h"
#include "MVVMBlueprintView.h"
#include "MVVMWidgetBlueprintExtension_View.h"
namespace UE::MVVM::Private
{
class FAssetSearchIndexer : public IAssetIndexer
{
private:
enum class EIndexerVersion
{
Initial = 0,
// -----<new versions can be added above this line>-------------------------------------------------
VersionPlusOne,
LatestVersion = VersionPlusOne - 1
};
public:
virtual FString GetName() const override
{
return TEXT("MVVM");
}
virtual int32 GetVersion() const override
{
return (int32)EIndexerVersion::LatestVersion;
}
virtual void IndexAsset(const UObject* InAssetObject, FSearchSerializer& Serializer) const override
{
const UMVVMWidgetBlueprintExtension_View* AssetObject = CastChecked<UMVVMWidgetBlueprintExtension_View>(InAssetObject);
if (const UMVVMBlueprintView* View = AssetObject->GetBlueprintView())
{
Serializer.BeginIndexingObject(View, TEXT("$self"));
FIndexerUtilities::IterateIndexableProperties(View, [&Serializer](const FProperty* Property, const FString& Value) {
Serializer.IndexProperty(Property, Value);
UE_LOG(LogTemp, Warning, TEXT("--%s [Serialized]"), *Property->GetName());
});
Serializer.EndIndexingObject();
}
}
};
} //namespace