UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MaterialAggregate.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "MaterialValueType.h"
7#include "Engine/DataAsset.h"
8#include "SceneTypes.h"
9#include "MaterialAggregate.generated.h"
10
12
13// Specifies the type of an individual material aggregate attribute.
14UENUM()
16{
17 Bool1,
18 Bool2,
19 Bool3,
20 Bool4,
21
22 UInt1,
23 UInt2,
24 UInt3,
25 UInt4,
26
27 Float1,
28 Float2,
29 Float3,
30 Float4,
31
32 // Attribute is a shading mode. Used in by MaterialAttributes aggregate.
34
35 // Attribute is of type MaterialAttributes aggregate.
37
38 // Attribute is of specified user aggregate type.
40};
41
42#if WITH_EDITOR
43
44// Converts a EMaterialValueType to the equivalent EMaterialAggregateAttributeTypeKind, if possible.
46
47#endif
48
49// Represents a single attribute within a material aggregate.
50USTRUCT(MinimalAPI)
52{
54
55 // The name of the attribute.
56 UPROPERTY(EditAnywhere, Category=MaterialAggregateAttribute)
58
59 // The type of the attribute.
60 UPROPERTY(EditAnywhere, Category=MaterialAggregateAttribute)
62
63 // The nested aggregate reference, used only if TypeKind is Aggregate.
64 UPROPERTY(EditAnywhere, Category=MaterialAggregateAttribute, meta=(EditCondition="Type == EMaterialAggregateAttributeType::Aggregate", EditConditionHides))
66
67 // This attribute default value, assigned when the parent aggregate is constructed without an assignment to this attribute.
68 UPROPERTY(EditAnywhere, Category=MaterialAggregateAttribute)
69 FVector4f DefaultValue;
70
71#if WITH_EDITOR
72 // Converts this attribute's type to a corresponding material value type.
73 EMaterialValueType ToMaterialValueType() const;
74#endif
75};
76
77// It defines a collection of arithmetic material values to be bundled together.
78// A material aggregate works similarly to a struct in C/C++. Each attribute has a name and specifies a type, either a
79// primitive one like float4 or another aggregate (for nested structures).
80UCLASS(MinimalAPI)
82{
84
85public:
86 // List of material aggregate attributes.
87 UPROPERTY(EditAnywhere, Category=MaterialAggregate)
89
90public:
91#if WITH_EDITOR
92
94
95 // Returns a reference to the global material attributes aggregate used by the engine.
96 static const UMaterialAggregate* GetMaterialAttributes();
97
98 // Returns a single cached aggregate for the specified material property.
99 static const FMaterialAggregateAttribute* GetMaterialAttribute(EMaterialProperty Property);
100
101 // Maps a material property to the corresponding attribute index in the aggregate.
103
104 // Maps an attribute index back to the corresponding material property.
106
108 {
110 }
111
112 // Finds the index of an attribute in the aggregate by name.
114
115 virtual void PostLoad() override;
116 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
117
118#endif // #if WITH_EDITOR
119};
@ INDEX_NONE
Definition CoreMiscDefines.h:150
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EMaterialAggregateAttributeType
Definition MaterialAggregate.h:16
EMaterialValueType
Definition MaterialValueType.h:15
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
EMaterialProperty
Definition SceneTypes.h:148
Definition NameTypes.h:617
Definition Array.h:670
Definition DataAsset.h:21
Definition MaterialAggregate.h:82
TArray< FMaterialAggregateAttribute > Attributes
Definition MaterialAggregate.h:88
Definition MaterialAggregate.h:52
Definition UnrealType.h:6865
Definition ObjectPtr.h:488