Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

- Declaration

static void DefineColorPropertyDefaultValue(FCavrnusSpaceConnection SpaceConnection, const FString& ContainerName, const FString& PropertyName, FLinearColor PropertyValue);

static void DefineBoolPropertyDefaultValue(FCavrnusSpaceConnection SpaceConnection, const FString& ContainerName, const FString& PropertyName, bool PropertyValue);

static void DefineFloatPropertyDefaultValue(FCavrnusSpaceConnection SpaceConnection, const FString& ContainerName, const FString& PropertyName, float PropertyValue);

static void DefineStringPropertyDefaultValue(FCavrnusSpaceConnection SpaceConnection, const FString& ContainerName, const FString& PropertyName, FString PropertyValue);

static void DefineVectorPropertyDefaultValue(FCavrnusSpaceConnection SpaceConnection, const FString& ContainerName, const FString& PropertyName, FVector4 PropertyValue);

static void DefineTransformPropertyDefaultValue(FCavrnusSpaceConnection SpaceConnection, const FString& ContainerName, const FString& PropertyName, FTransform PropertyValue);

- Description

Defines what the application will show if a new prop value has not been assigned.

...

Once an update has been posted to the journal for this property value the default becomes irrelevant.

- Blueprint Sample

...

- Code Sample

Example case - color and height of a flag.

...

Code Block
languagecpp
#include "GameFramework/Actor.h"
#include "Types/CavrnusSpaceConnection.h"
#include "FlagActor.generated.h"

UCLASS()
class MODULE_API AFlagActor : public AActor
{
  GENERATED_BODY()
  
public:
  void InitializeProperties(FString& InContainerName, FCavrnusSpaceConnection& InSpaceConnection);
  
private:
  UPROPERTY()
  LinearColor FlagColor;
  
  UPROPERTY()
  float FlagHeight;
  
  // Objects that synchronize properties should be created using UCavrnusFunctionLibrary::SpawnObject. This gives the spawner back the properties container name that this object will use in the journal.
  FString ContainerName;
  
  FCavrnusSpaceConnection SpaceConnection;
};

FlagActor.cpp

Code Block
languagecpp
#include "FlagActor.h"
#include "CavrnusFunctionLibrary.h"

void AFlagActor::InitializeProperties(FString& InContainerName, FCavrnusSpaceConnection& InSpaceConnection)
{
  ContainerName = InContainerName;
  SpaceConnection = InSpaceConnection;
  
  UCavrnusFunctionLibrary::DefineColorPropertyDefaultValue(InSpaceConnection, InContainerName, "FlagColor", FlagColor);
  UCavrnusFunctionLibrary::DefineFloatPropertyDefaultValue(InSpaceConnection, InContainerName, "FlagHeight", FlagHeight);
}