Agrarsense
Static Public Member Functions | List of all members
UMaterialParameterCollectionUtilities Class Reference

#include <MaterialParameterCollectionUtilities.h>

Inheritance diagram for UMaterialParameterCollectionUtilities:
Inheritance graph
[legend]
Collaboration diagram for UMaterialParameterCollectionUtilities:
Collaboration graph
[legend]

Static Public Member Functions

static bool UpdateMaterialCollectionVectorValue (UMaterialParameterCollectionInstance *MPCInstance, const FName ParameterName, const FVector4 Value)
 
static bool UpdateMaterialCollectionScalarValue (UMaterialParameterCollectionInstance *MPCInstance, const FName ParameterName, const float Value)
 
static UMaterialParameterCollectionInstance * LoadMaterialParameterCollectionInstance (const UObject *WorldContextObject, const FString &Path)
 

Detailed Description

A utility class for loading and manipulating Material Parameter Collections.

Definition at line 18 of file MaterialParameterCollectionUtilities.h.

Member Function Documentation

◆ LoadMaterialParameterCollectionInstance()

UMaterialParameterCollectionInstance * UMaterialParameterCollectionUtilities::LoadMaterialParameterCollectionInstance ( const UObject *  WorldContextObject,
const FString &  Path 
)
static

Loads a Material Parameter Collection Instance from a specified asset path.

Parameters
WorldThe world context where the Material Parameter Collection Instance is used.
PathThe asset path of the Material Parameter Collection to load, e.g., "/Game/Path/To/Collection".
Returns
UMaterialParameterCollectionInstance* The loaded Material Parameter Collection Instance, or nullptr if the load fails.

Definition at line 33 of file MaterialParameterCollectionUtilities.cpp.

34{
35 if (!WorldContextObject || !GEngine)
36 {
37 return nullptr;
38 }
39
40 UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
41 UMaterialParameterCollection* Collection = LoadObject<UMaterialParameterCollection>(nullptr, *Path);
42 if (Collection && World)
43 {
44 return World->GetParameterCollectionInstance(Collection);
45 }
46
47 return nullptr;
48}

Referenced by USimulatorJsonParser::ParseAndSetSemanticColors().

◆ UpdateMaterialCollectionScalarValue()

bool UMaterialParameterCollectionUtilities::UpdateMaterialCollectionScalarValue ( UMaterialParameterCollectionInstance *  MPCInstance,
const FName  ParameterName,
const float  Value 
)
static

Updates a float parameter within a Material Parameter Collection Instance and returns success status.

Parameters
MPCInstanceThe Material Parameter Collection Instance to update.
ParameterNameThe name of the float parameter to update.
ValueThe new float value to set for the parameter.
Returns
bool True if the parameter was successfully updated, False otherwise.

Definition at line 23 of file MaterialParameterCollectionUtilities.cpp.

24{
25 if (MPCInstance)
26 {
27 return MPCInstance->SetScalarParameterValue(ParameterName, Value);
28 }
29
30 return false;
31}

◆ UpdateMaterialCollectionVectorValue()

bool UMaterialParameterCollectionUtilities::UpdateMaterialCollectionVectorValue ( UMaterialParameterCollectionInstance *  MPCInstance,
const FName  ParameterName,
const FVector4  Value 
)
static

Updates a Vector4 parameter within a Material Parameter Collection Instance and returns success status.

Parameters
MPCInstanceThe Material Parameter Collection Instance to update.
ParameterNameThe name of the Vector4 parameter to update.
ValueThe new Vector4 value to set for the parameter.
Returns
bool True if the parameter was successfully updated, False otherwise.

Definition at line 13 of file MaterialParameterCollectionUtilities.cpp.

14{
15 if (MPCInstance)
16 {
17 return MPCInstance->SetVectorParameterValue(ParameterName, Value);
18 }
19
20 return false;
21}

Referenced by USimulatorJsonParser::ParseAndSetSemanticColors().


The documentation for this class was generated from the following files: