Improvements in the class picker functionality

This commit is contained in:
aollero 2022-03-09 12:31:55 +01:00 committed by bernat
parent 339df37c4e
commit f2f71ba4cd
3 changed files with 14 additions and 26 deletions

View File

@ -14,27 +14,10 @@
#include "Engine/World.h"
#include "UObject/ConstructorHelpers.h"
// #define DEBUG_MSG(x, ...) if(GEngine){GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::White, FString::Printf(TEXT(x), __VA_ARGS__));}
// Sets default values
UProceduralWaterManager::UProceduralWaterManager()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
//PrimaryActorTick.bCanEverTick = true;
// static ConstructorHelpers::FObjectFinder<UBlueprint> DummyBlueprint(TEXT("Blueprint'/CarlaTools/ProceduralWaterManager/DummyActor.DummyActor'"));
// if (DummyBlueprint.Object){
// MyDummyBlueprint = (UClass*)DummyBlueprint.Object->GeneratedClass;
// }
static ConstructorHelpers::FObjectFinder<UBlueprint> RiverBlueprint(TEXT("Blueprint'/Game/racer-sim/Blueprints/Water/BP_River.BP_River'"));
if (RiverBlueprint.Object){
RiverBlueprintClass = (UClass*)RiverBlueprint.Object->GeneratedClass;
}
static ConstructorHelpers::FObjectFinder<UBlueprint> LakeBlueprint(TEXT("Blueprint'/CarlaTools/ProceduralWaterManager/DummyActor.DummyActor'"));
if (LakeBlueprint.Object){
LakeBlueprintClass = (UClass*)LakeBlueprint.Object->GeneratedClass;
}
// Pass
}
FString UProceduralWaterManager::StartWaterGeneration(const FProceduralRiversMetaInfo metaInfo)
@ -182,11 +165,6 @@ FString UProceduralWaterManager::LakeGeneration(const FProceduralRiversMetaInfo
}
else
{
// if(!line.Split(TEXT(" "), &centerX_str, &centerY_str, &sizeX_str, &sizeY_str, &angle_str))
// {
// return "ERROR: Coordinated cannot be proccess... Check file format";
// }
TArray<FString> lineArray;
line.ParseIntoArray(lineArray, TEXT(" "));

View File

@ -60,6 +60,14 @@ public:
UProceduralWaterManager();
public:
/// River blueprint class, set by the user using the widget interface
UPROPERTY(BlueprintReadWrite)
TSubclassOf<class AActor> RiverBlueprintClass;
/// Lake blueprint class, set by the user using the widget interface
UPROPERTY(BlueprintReadWrite)
TSubclassOf<class AActor> LakeBlueprintClass;
/// Main function to be called from the widget to start all the generation process
/// @a metaInfo is the input data for this process
UFUNCTION(BlueprintCallable)
@ -77,12 +85,14 @@ public:
void CheckAndReverseWaterFlow(AActor* riverActor);
private:
TSubclassOf<class AActor> RiverBlueprintClass;
TSubclassOf<class AActor> LakeBlueprintClass;
/// It is responsible of the rivers generation, parsing the file,
/// intantiating the actors and setting its splline points
UFUNCTION()
FString RiverGeneration(const FProceduralRiversMetaInfo metaInfo);
/// It is responsible of the lakes generation, pasing the file,
/// instantiating the actors and setting its properties
UFUNCTION()
FString LakeGeneration(const FProceduralRiversMetaInfo metaInfo);