flatdata done

This commit is contained in:
2025-11-18 18:36:36 +05:00
parent 091ca4a881
commit 0b448529e8
28 changed files with 227 additions and 0 deletions
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,7 @@
{
"BuildId": "27405482",
"Modules":
{
"ElgBlueprintLibrary": "UnrealEditor-ElgBlueprintLibrary-Win64-DebugGame.dll"
}
}
@@ -0,0 +1,7 @@
{
"BuildId": "27405482",
"Modules":
{
"ElgBlueprintLibrary": "UnrealEditor-ElgBlueprintLibrary.dll"
}
}
@@ -0,0 +1,23 @@
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.0",
"FriendlyName": "ElgBlueprintLibrary",
"Description": "Blueprint function library",
"Category": "Other",
"CreatedBy": "ElgSoft",
"CreatedByURL": "ElgSoft.com",
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"EngineVersion": "5.3",
"CanContainContent": true,
"Installed": true,
"Modules": [
{
"Name": "ElgBlueprintLibrary",
"Type": "Runtime",
"LoadingPhase": "PreLoadingScreen"
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

@@ -0,0 +1,53 @@
// Some copyright should be here...
using UnrealBuildTool;
public class ElgBlueprintLibrary : ModuleRules
{
public ElgBlueprintLibrary(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
PublicIncludePaths.AddRange(
new string[] {
// ... add public include paths required here ...
}
);
PrivateIncludePaths.AddRange(
new string[] {
// ... add other private include paths required here ...
}
);
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
// ... add other public dependencies that you statically link with here ...
}
);
PrivateDependencyModuleNames.AddRange(
new string[]
{
"CoreUObject",
"Engine",
"Slate",
"SlateCore",
// ... add private dependencies that you statically link with here ...
}
);
DynamicallyLoadedModuleNames.AddRange(
new string[]
{
// ... add any modules that your module loads dynamically here ...
}
);
}
}
@@ -0,0 +1,25 @@
// Copyright 2019-2020 ElgSoft. All rights reserved.
#include "ElgBP_DataTable.h"
#include <Engine/DataTable.h>
bool UElgBP_DataTable::AddRowToDataTable(UDataTable* InDataTable, FName InRowName, UStruct* InAnyStruct)
{
// dummy function, it's Generic_AddRowToDataTable that are called for real
return true;
}
bool UElgBP_DataTable::Generic_AddRowToDataTable(UDataTable* InDataTable, FName InRowName, void* StructPtr)
{
FTableRowBase* TableRowBase = (FTableRowBase*)StructPtr;
InDataTable->AddRow(InRowName, *TableRowBase);
#if WITH_EDITOR
// let the editor know that the data table has changed so it can get it's star.
InDataTable->Modify();
#endif
return true;
}
@@ -0,0 +1,22 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "ElgBlueprintLibrary.h"
#define LOCTEXT_NAMESPACE "FElgBlueprintLibraryModule"
void FElgBlueprintLibraryModule::StartupModule()
{
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
}
void FElgBlueprintLibraryModule::ShutdownModule()
{
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
}
#undef LOCTEXT_NAMESPACE
IMPLEMENT_MODULE(FElgBlueprintLibraryModule, ElgBlueprintLibrary)
@@ -0,0 +1,76 @@
// Copyright 2019-2020 ElgSoft. All rights reserved.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include <Engine/DataTable.h>
#include "ElgBP_DataTable.generated.h"
/**
*
*/
UCLASS()
class UElgBP_DataTable : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
/* Add or Edit a row in the data table */
UFUNCTION(BlueprintCallable, CustomThunk, Category = "DataTable", meta = (CustomStructureParam = "InAnyStruct"))
static bool AddRowToDataTable(UDataTable* InDataTable, FName InRowName, UStruct* InAnyStruct);
static bool Generic_AddRowToDataTable(UDataTable* InDataTable, FName InRowName, void* StructPtr);
/** Based on UElgBP_DataTable::AddRowToDataTable */
DECLARE_FUNCTION(execAddRowToDataTable) {
P_GET_OBJECT(UDataTable, InDataTable);
P_GET_PROPERTY(FNameProperty, InRowName);
Stack.StepCompiledIn<FStructProperty>(NULL);
void* StructPtr = Stack.MostRecentPropertyAddress;
FStructProperty* StructProp = CastField<FStructProperty>(Stack.MostRecentProperty);
UScriptStruct* InAnyStruct = StructProp->Struct;
P_FINISH;
bool bSuccess = false;
if (!InDataTable) {
FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::AccessViolation, FText::FromString("Failed to resolve the table input. Be sure the InDataTable is valid.")
);
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
} else if (!InAnyStruct) {
FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::AccessViolation, FText::FromString("Failed to resolve the struct input. Be sure the InAnyStruct is valid.")
);
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
} else if (InRowName.IsNone()) {
FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::AccessViolation, FText::FromString("Be sure the InRowName is valid.")
);
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
} else {
const UScriptStruct* TableType = InDataTable->GetRowStruct();
const bool bCompatible = (InAnyStruct == TableType) || (InAnyStruct->IsChildOf(TableType) && FStructUtils::TheSameLayout(InAnyStruct, TableType));
if (bCompatible) {
P_NATIVE_BEGIN;
bSuccess = Generic_AddRowToDataTable(InDataTable, InRowName, StructPtr);
P_NATIVE_END;
} else {
FBlueprintExceptionInfo ExceptionInfo(
EBlueprintExceptionType::AccessViolation, FText::FromString("The InAnyStruct is incompatible with the data table's struct.")
);
FBlueprintCoreDelegates::ThrowScriptException(P_THIS, Stack, ExceptionInfo);
}
}
*(bool*)RESULT_PARAM = bSuccess;
}
#pragma endregion
};
@@ -0,0 +1,14 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "Modules/ModuleManager.h"
class FElgBlueprintLibraryModule : public IModuleInterface
{
public:
/** IModuleInterface implementation */
virtual void StartupModule() override;
virtual void ShutdownModule() override;
};