new parallax, cpp lvl manager, tagged trigger etc
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "cppFuncLib.h"
|
||||
|
||||
#define LOCTEXT_NAMESPACE "FcppFuncLibModule"
|
||||
|
||||
void FcppFuncLibModule::StartupModule()
|
||||
{
|
||||
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
||||
|
||||
}
|
||||
|
||||
void FcppFuncLibModule::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(FcppFuncLibModule, cppFuncLib)
|
||||
@@ -0,0 +1,110 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#include "cppFuncLibBPLibrary.h"
|
||||
#include "cppFuncLib.h"
|
||||
|
||||
UcppFuncLibBPLibrary::UcppFuncLibBPLibrary(const FObjectInitializer& ObjectInitializer)
|
||||
: Super(ObjectInitializer)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*for working tarray::Contains*/
|
||||
|
||||
//bool operator==(const Fcppcoords& c1, const Fcppcoords& c2) {
|
||||
// return c1.flat == c2.flat &&
|
||||
// c1.floor == c2.floor &&
|
||||
// c1.house == c2.house &&
|
||||
// c1.section == c2.section &&
|
||||
// c1.type == c2.type &&
|
||||
// c1.zone == c2.zone;
|
||||
//}
|
||||
|
||||
|
||||
TArray<FString> UcppFuncLibBPLibrary::cppUniversalParser(FString string, TArray<FString> keys, FString delimiter, bool caseSensitive)
|
||||
{
|
||||
TArray<FString> arr;
|
||||
TArray<FString> out;
|
||||
out.SetNum(keys.Num());
|
||||
|
||||
string.ParseIntoArray(arr, *delimiter, false);
|
||||
for (const auto& str : arr) {
|
||||
int n = 0;
|
||||
for (const auto& str1 : keys) {
|
||||
if (str1.IsEmpty()) continue;
|
||||
FString left_;
|
||||
FString right_;
|
||||
if (str.Split(str1, &left_, &right_, caseSensitive ? ESearchCase::CaseSensitive : ESearchCase::IgnoreCase)) {
|
||||
|
||||
if (out[n].IsEmpty()) out[n] = right_;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
FString UcppFuncLibBPLibrary::cppIntToStrPad(int32 int_, int32 minDigits)
|
||||
{
|
||||
FString temp = FString::FromInt(int_);
|
||||
for (int32 i = temp.Len(); i < minDigits; i++) {
|
||||
temp = FString("0") + temp;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
TSoftObjectPtr<UTexture2D> UcppFuncLibBPLibrary::castSoftTex2D(TSoftObjectPtr<UObject> ptr)
|
||||
{
|
||||
return TSoftObjectPtr<UTexture2D>(ptr.ToSoftObjectPath());//somewhy cant construct from another <T> and cant cast
|
||||
}
|
||||
|
||||
void UcppFuncLibBPLibrary::getMinMaxInRange(TArray<int32> array_, int32 min, int32 max, int32& minId, int32& maxId)
|
||||
{
|
||||
if (min > max) return;
|
||||
int32 minv = array_[min];
|
||||
int32 maxv = minv;
|
||||
|
||||
int32 mini = min;
|
||||
int32 maxi = mini;
|
||||
for (int32 i = 0; i < array_.Num(); i++) {
|
||||
if ((min <= i) && (i <= max)) {
|
||||
if (array_[i] < minv) {
|
||||
minv = array_[i];
|
||||
mini = i;
|
||||
}
|
||||
else if (array_[i] > maxv) {
|
||||
maxv = array_[i];
|
||||
maxi = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
minId = mini;
|
||||
maxId = maxi;
|
||||
return;
|
||||
}
|
||||
|
||||
void UcppFuncLibBPLibrary::getMinMaxInRangeF(TArray<float> array_, int32 min, int32 max, int32& minId, int32& maxId)
|
||||
{
|
||||
if (min > max) return;
|
||||
int32 minv = array_[min];
|
||||
int32 maxv = minv;
|
||||
|
||||
int32 mini = min;
|
||||
int32 maxi = mini;
|
||||
for (int32 i = 0; i < array_.Num(); i++) {
|
||||
if ((min <= i) && (i <= max)) {
|
||||
if (array_[i] < minv) {
|
||||
minv = array_[i];
|
||||
mini = i;
|
||||
}
|
||||
else if (array_[i] > maxv) {
|
||||
maxv = array_[i];
|
||||
maxi = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
minId = mini;
|
||||
maxId = maxi;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Modules/ModuleManager.h"
|
||||
|
||||
class FcppFuncLibModule : public IModuleInterface
|
||||
{
|
||||
public:
|
||||
|
||||
/** IModuleInterface implementation */
|
||||
virtual void StartupModule() override;
|
||||
virtual void ShutdownModule() override;
|
||||
};
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright Epic Games, Inc. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Kismet/BlueprintFunctionLibrary.h"
|
||||
#include "cppFuncLibBPLibrary.generated.h"
|
||||
|
||||
/*
|
||||
* Function library class.
|
||||
* Each function in it is expected to be static and represents blueprint node that can be called in any blueprint.
|
||||
*
|
||||
* When declaring function you can define metadata for the node. Key function specifiers will be BlueprintPure and BlueprintCallable.
|
||||
* BlueprintPure - means the function does not affect the owning object in any way and thus creates a node without Exec pins.
|
||||
* BlueprintCallable - makes a function which can be executed in Blueprints - Thus it has Exec pins.
|
||||
* DisplayName - full name of the node, shown when you mouse over the node and in the blueprint drop down menu.
|
||||
* Its lets you name the node using characters not allowed in C++ function names.
|
||||
* CompactNodeTitle - the word(s) that appear on the node.
|
||||
* Keywords - the list of keywords that helps you to find node when you search for it using Blueprint drop-down menu.
|
||||
* Good example is "Print String" node which you can find also by using keyword "log".
|
||||
* Category - the category your node will be under in the Blueprint drop-down menu.
|
||||
*
|
||||
* For more info on custom blueprint nodes visit documentation:
|
||||
* https://wiki.unrealengine.com/Custom_Blueprint_Node_Creation
|
||||
*/
|
||||
|
||||
|
||||
UCLASS()
|
||||
class UcppFuncLibBPLibrary : public UBlueprintFunctionLibrary
|
||||
{
|
||||
GENERATED_UCLASS_BODY()
|
||||
|
||||
|
||||
/*fast eq just test for qual each element. relevantminus2 makes true if second coord == -2. else only first coord working this way.*/
|
||||
|
||||
UFUNCTION(blueprintcallable, category = "cppFuncLib")
|
||||
static TArray<FString> cppUniversalParser(FString string, TArray<FString> keys, FString delimiter, bool caseSensitive);
|
||||
UFUNCTION(blueprintcallable, category = "cppFuncLib")
|
||||
/*return string contains int with zero pads to accord to min digits value.
|
||||
for example, if minDigits==3 then int 26 -> str 026 and int 2 -> str 002*/
|
||||
static FString cppIntToStrPad(int32 int_, int32 minDigits);
|
||||
UFUNCTION(blueprintcallable, BlueprintPure, category = "cppFuncLib", meta = (BlueprintAutocast, CompactNodeTitle = "obj->t2d"))
|
||||
static TSoftObjectPtr<UTexture2D> castSoftTex2D(TSoftObjectPtr<UObject> ptr);
|
||||
UFUNCTION(blueprintcallable, category = "Math|Integer")
|
||||
static void getMinMaxInRange(TArray<int32> array_, int32 min, int32 max, int32& minId, int32& maxId);
|
||||
UFUNCTION(blueprintcallable, category = "Math|Float")
|
||||
static void getMinMaxInRangeF(TArray<float> array_, int32 min, int32 max, int32& minId, int32& maxId);
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
// Some copyright should be here...
|
||||
|
||||
using UnrealBuildTool;
|
||||
|
||||
public class cppFuncLib : ModuleRules
|
||||
{
|
||||
public cppFuncLib(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 ...
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user