Program Listing for File ZagalaSpecFeatureBuilder.h#
↰ Return to documentation for file (ZagalaSpecImportExport/Public/Builder/ZagalaSpecFeatureBuilder.h)
// Copyright (c) 2026, Zagala Game Solutions. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameplayTagContainer.h"
#include "IR/ZagalaSpecFeatureIR.h"
#include "ZagalaSpecStepPhase.h"
class ZAGALASPECIMPORTEXPORT_API FZagalaSpecFeatureBuilder
{
public:
static UObject* Build(
const FZagalaSpecFeatureIR& ImportedFeature,
UObject* InOuter,
const FName& InAssetName,
TArray<FString>& OutWarnings);
static void BuildFeatureScenarios(
const FZagalaSpecFeatureIR& ImportedFeature,
UObject* Feature,
const FString& FeatureTagPath,
TArray<FString>& OutWarnings,
const FName& InAssetName);
static void BuildScenarioSteps(
const FZagalaSpecFeatureIR& ImportedFeature,
const FZagalaSpecScenarioIR& ImportedScenario,
UObject* Scenario,
TArray<FString>& OutWarnings);
static void SetScenarioDescription(const FZagalaSpecScenarioIR& ImportedScenario, UObject* Scenario);
static void SetFeatureBasicProperties(
UObject* Feature,
const FGameplayTag& Identifier,
const FZagalaSpecFeatureIR& ImportedFeature);
static void InjectTextStepsIntoProperty(
const TArray<FZagalaSpecStepIR>& IntermediateSteps,
UObject* PropertyHolder,
FName PropertyName);
static FString SlugifyTitle(const FString& Title);
static EZagalaSpecStepPhase ResolvePhase(EZagalaSpecStepIRPhase RawPhase, EZagalaSpecStepPhase PreviousExplicit);
static FGameplayTag EnsureGameplayTag(const FString& TagPath, TArray<FString>& OutWarnings);
static FName MakeScenarioObjectName(const FString& Title);
static FString RetrieveExamplesEntryMatchingText();
template<typename T>
static bool SetPropertyValue(UObject* Object, FName PropName, const T& Value)
{
FProperty* Prop = FindFProperty<FProperty>(Object->GetClass(), PropName);
if (!Prop) return false;
*Prop->ContainerPtrToValuePtr<T>(Object) = Value;
return true;
}
static bool SetGameplayTagProp(UObject* Object, FName PropName, const FGameplayTag& Tag);
static bool SetObjectProp(UObject* Object, FName PropName, UObject* Value);
template<typename T>
static bool AppendToArrayProp(UObject* Object, FName PropName, T* Item)
{
FArrayProperty* Prop = FindFProperty<FArrayProperty>(Object->GetClass(), PropName);
if (!Prop) return false;
TArray<TObjectPtr<T>>* Arr = Prop->ContainerPtrToValuePtr<TArray<TObjectPtr<T>>>(Object);
Arr->Add(Item);
return true;
}
};