Section 2. The ArdActor

The ArdActor is the main player in the Instance Game, just SubClass off it and you have all these methods and properties available to your C++ or Blueprint code:

Initialize Methods

// Changes the Seed used for the Random Generation and rebuilds the Actor
void rdRandomize();

Build Methods
// Applies the Randomizations on this and its Children and creates the ISMs
void rdBuild();

// Event called when in Build Mode, just fires the rdBuild Event where you can process your actors in the Blueprint
void rdBuildEvent();

// Assimilate all StaticMesh Instances from the specified rdActor
void rdAssimilateChildInstances(const ArdActor* rdActor,bool justVisible,bool recurse);

Instance Methods
// Returns the HierarchicalInstancedStaticMeshComponent for the StaticMesh
UHierarchicalInstancedStaticMeshComponent* rdGetInstanceGen(UStaticMesh* mesh);

// Adds an Instance to the scene of the StaticMesh.
int32 rdAddInstance(UStaticMesh* mesh,const FTransform& transform);

// Adds an Instance of the StaticMesh from the passed HISMC to the level using the passed in Transform
int32 rdAddInstanceFast(UHierarchicalInstancedStaticMeshComponent* instGen,const FTransform& transform);

// Removes all the StaticMesh Instances in our Actors Instance List
void rdClearInstanceList();

// Adds a new Instance of the StaticMesh to our Actors Instance List
void rdAddInstanceToList(UStaticMesh* mesh,const FTransform& transform);

// Adds a new Instance of the StaticMesh to our Actors Instance List with Folder name and Component with Randomization settings
void rdAddAdvInstanceToList(UStaticMesh* mesh,const FTransform& transform,const FString& folder,UActorComponent* comp);

// Returns the last Instance Index created for the StaticMesh, returns -1 if there are none
int32 rdGetLastInstanceIndex(UStaticMesh* mesh);

// Removes the Instance referred to by index for the specified StaticMesh
void rdRemoveInstance(UStaticMesh* mesh,int32 index);

// Removes the Instance referred to by index in the HISMC
void rdRemoveInstanceFast(UHierarchicalInstancedStaticMeshComponent* instGen,int32 index);

// Removes all Instanced Static Meshes associated with this Actor
void rdRemoveInstances();

// Builds the InstanceData for this Actor from the passed in Arrays (must be the same length)
bool rdSetInstanceData(const TArray<UStaticMesh*>& meshList,const TArray<FTransform>& transformList);

// Sets the Specified Instance of the UStaticMeshes FTransform
void rdSetInstanceTransform(UStaticMesh* mesh,int32 index,const FTransform& transform);

// Gets the Transform of the Specified Instance of the UStaticMeshe
FORCEINLINE bool rdGetInstanceTransform(UStaticMesh* mesh,int32 index,FTransform& transform);

// Adds to the Specified Instances Transform with the specified FTransform
void rdAddInstanceTransform(UStaticMesh* mesh,int32 index,const FTransform& transform);

// Updates this Actors Instances to reflect the Actors new Transform
void rdUpdateISMTransforms();

// Returns the StaticMesh belonging to the HISMC or a nullptr if the passed in component is not a HISMC
UStaticMesh* rdGetStaticMeshFromInstanceIndex(UPrimitiveComponent* comp);

// Returns the rdActor that owns the Instance or a nullptr if the passed in component is not a HISMC or index not valid
ArdActor* rdGetrdActorFromInstanceIndex(UPrimitiveComponent* comp,int32 index);

// Converts the Instance to a ChildActorComponent
UChildActorComponent* rdConvertInstanceToChildActor(UStaticMesh* mesh,int32 index);

// Converts the Instance to a new Actor in the level (spawn)
AActor* rdConvertInstanceToLevelActor(UStaticMesh* mesh,int32 index);
Randomization Methods
// Goes through all the Child Components of this Actor applying their Randomization Settings
void rdBuildRandomizedComponents();

// Builds the Instanced Static Meshes for this Actor with their Randomizations
void rdBuildRandomizedISMs();

// Like rdBuildRandomizedISMs, but it resets the rdInst BaseActor as well
void rdRecreateBPInstances();

// Builds the Instanced Static meshes from our InstanceList, ignoring Hidden Folders. No Randomization is applied
void rdBuildShowOnlyOneISMs();

// Usually called internally, this hides all but one folder of Actors contained as children of this Actor
void rdThereCanBeOnlyOne();
Visibility Methods
// Shows or Hides the Folder of Actors
void rdSetFolderVisibility(USceneComponent* comp,const FString& folder,bool vis);

// Removes all Instanced Static Meshes associated with this Actor
void rdRemoveInstances();

// Hides all Children and ISMs of this Actor
void rdHideAllChildren();
Actor Spawning Methods
// Helper Function that Spawns an actor - this can be called from the ConstructionScript (just call rdDestroyAttachedActors() first)
AActor* rdSpawnActor(UClass* actorClass,const FTransform& transform);

// Helper Function that Spawns an actor, with extra Position information - this can be called from the ConstructionScript (just call rdDestroyAttachedActors() first)
AActor* rdSpawnActorPos(UClass* actorClass,const FTransform& transform,const FrdPositionInfo& pos);

// Destroys all Actors that have been Spawned with the rdSpawnActor Node
void rdDestroyAttachedActors();

// Helper Function that adds a ChildActorComponent - this can be called from the ConstructionScript (just call rdDestroyAttachedActors() first)
UChildActorComponent* rdAddChildComponent(UClass* actorClass,const FTransform& transform);

// Helper Function that adds a ChildActorComponent, with extra Position information - this can be called from the ConstructionScript (just call rdDestroyAttachedActors() first)
UChildActorComponent* rdAddChildComponentPos(UClass* actorClass,const FTransform& transform,const FrdPositionInfo& pos);

// Destroys all ChildComponents that have been added with the rdAddChildComponent Node
void rdDestroyAttachedComponents();

Utility Methods
// Adds the Randomization from the RandomSettings to the Transform. If this Actor is reliant on another Actor that has not been processed yet, processed is set to false
bool rdAddRandomization(FTransform& outTransform,FrdRandomSettings* rnd,bool& processed);

// Utility Node that returns a Random Vector between the two passed in Vector limits
FVector rdRandomVectorInRange(const FVector& v1,const FVector& v2);

// Utility Node that returns a Random Rotator between the two passed in rotation limits, and the Flip Probability Vector
FRotator rdRandomRotatorInRange(const FRotator& r1,const FRotator& r2,const FVector& flipProb);

// Returns the Current Theme, if this Actor has Parents, the Eldest Parents Theme is returned
FString rdGetTheme();

// Tests to see if the passed in Component is included with the current theme. If there is no theme, this returns True
bool rdFolderIncludedWithCurrentTheme(USceneComponent* comp);

// Node to get the current RandomStream for the Actor. If this Actor has parents, the Eldest's RandomStream is returned
FRandomStream& rdGetRandomStream();
New Methods for version 1.10
// The singular Base Actor for Instance Handling and Actor Pooling
ArdInstBaseActor* rdGetBase();

// Gets a reference to the Per-Instance CustomData for the mesh
TArray<float>& rdGetCustomDataPtr(UStaticMesh* mesh,int32& numData);

// Updates the Per-Instance CustomData for the mesh
void rdUpdateCustomData(UStaticMesh* mesh);

// Call regularly to maintain profile information
void rdGetFunctionCycles();

// Implement this Event with your Blueprint code you want to profile
void rdFunctionCyclesFunction();

// Converts the Instance to a new Actor - actorClass, in the level (spawn)
AActor* rdConvertInstanceToActor(UStaticMesh* mesh,UClass* actorClass,int32 index);

// Converts the Instance to a new Actor in the level from the ActorPool
AActor* rdConvertInstanceToActorFromPool(UStaticMesh* mesh,UClass* actorClass,int32 index);

// Allocates "numToPool" number of the componentClass for rapid reuse
void rdPoolComponent(UClass* compClass,int32 numToPool,bool premake);

// ReAllocates "numToPool" number of the compClass
bool rdSetComponentPoolSize(UClass* compClass,int32 numToPool,bool premake);

// Removes the Pool of Components for the compClass
void rdRemoveComponentPool(UClass* compClass);

// Gets the next free compClass in the Component Pool, returns nullptr if none are free
UActorComponent* rdGetComponentFromPool(UClass* compClass);

// Removes an allocated Component from the Component Pool
void rdRemoveComponentFromPool(UActorComponent* comp);

New Methods for version 1.20
// Adds to the InstanceData for this Actor from the passed in Array of Transforms for the specified StaticMesh
bool rdAddInstances(UStaticMesh* mesh,const TArray<FTransform>& transforms);

// Adds Instances for the passed in Array of Transforms for the specified StaticMesh
int32 rdAddInstancesFast(UStaticMesh* mesh,const TArray<FTransform>& transforms);

// Adds Unmanaged Instances for each of the transforms in the passed in Array for the specified StaticMesh (Distributed Transaction)
bool rdAddInstances_DT(UStaticMesh* mesh,const TArray<FTransform>& transforms,int32 transactionsPerTick);

// Event called when an actor is created from the pool
void rdOnActorPooled_Implementation(AActor* actor);

// Event called when an actor is removed back to the pool
void rdOnActorDepooled_Implementation(AActor* actor);

// Event called when a component is created from the pool
void rdOnCompPooled_Implementation(AActor* actor,UActorComponent* comp);

// Event called when a component is removed back to the pool
void rdOnCompDepooled_Implementation(AActor* actor,UActorComponent* comp);


Changed for version 1.24
// Adds a new Instance of the StaticMesh to our Actors Instance List with the passed in Randomized properties
void rdAddInstanceLong(UStaticMesh* mesh,UChildActorComponent* comp,const FTransform& transform,const FString& name,const FString& folder);

// Helper Function that Converts all the Instances into Actors in the level
void rdConvertInstancesToActors(bool stripFolders,bool useRandom,bool group,const FTransform& destTransform,const FVector& centerLocation,const FString& baseFolder,TArray<AActor*>& addedActors);

New for version 1.24
// Removes all Instanced Static Meshes on all actors
void rdResetAllInstances();

// Gets the Bounds of all the instances in this blueprint
void rdGetInstancesBounds(const FVector& inMin,const FVector& inMax,FVector& outMin,FVector& outMax);

// Mirror the instances in this blueprint
void rdMirrorInstanceLocations(int32 axis,const FVector& center);

// Sets a value to the Per-Instance CustomData for the mesh
void rdSetCustomData(UStaticMesh* mesh,int32 instanceIndex,int32 dataIndex,float value);

// Place the instances in this blueprint on the ground
void rdPlaceOnGround();

Properties

// The Current Theme name, can be blank meaning themes are disabled
FString currentTheme;

// When True, the whole actor and all ISMs will be hidden by default
bool bStartHidden;

// The Location Randomization for each of the child Actors is multiplied with this
FVector locMultiplier;

// The Rotation Randomization for each of the child Actors is multiplied with this
FRotator rotMultiplier;

// The Scale Randomization for each of the child Actors is multiplied with this
FVector scaleMultiplier;

// The Show Probability for each of the child Actors is multiplied with this
float showMultiplier;

// When True, other rdActors can copy our InstanceData and delete us (we're just a container)
bool bCanBeAssimilated;

// When True, a new Random Seed is generated every time this Actor is Constructed
bool bRandomStart;

// When this is True, the RandomStream specified in this Actor is used, otherwise the OuterMost ArdActor's one is used
bool bOverrideRandom;

// The Seed to use for the RandomStream
int32 randomSeed;

// The RandomStream used by this Actor. If this Actor has Outer ArdActors, their RandomStream is used for congruity
FRandomStream randomStream;

// When this is True, the Theme specified in this Actor is used, otherwise the OuterMost ArdActor's Theme is used
bool overrideTheme;

// The Mode this ArdActor is. Each Mode behaves differently, see the rdActorMode Enumeration
TEnumAsByte<rdActorMode> actorMode;

// The Folder of Actors to Show when this Actor is in ThereCanBeOnlyOne Mode
FString showFolder;

// This is the Map of UStaticMeshes as the Key, and InstanceSettingsArray as the Values - each Array contains all Instances wanted by this Actor
TMap<UStaticMesh*,FrdInstanceSettingsArray> InstanceData;

These methods and properties marry up to the Nodes in the Blueprint section. Check out the later sections of the main manual for details on how to create Instances and set Randomization data etc.