UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MaterialOverlayHelper.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
7#include "UObject/Object.h"
9#include "UObject/ObjectPtr.h"
11
13{
14public:
16 {
17 bOutHaveNullEntry = false;
18 for(const TObjectPtr<UMaterialInterface>& SourceMaterial : SourceMaterials)
19 {
20 if (SourceMaterial)
21 {
22 OutMaterials.Add(SourceMaterial);
23 }
24 else
25 {
26 bOutHaveNullEntry = true;
27 }
28 }
29 }
30
36
38 {
39 for (int32 SlotIndex = 0; SlotIndex < SourceMaterials.Num(); ++SlotIndex)
40 {
41 SourceMaterials[SlotIndex] = ForceMaterial;
42 }
43 }
44
46 {
47 if (SourceMaterials.IsValidIndex(SlotIndex))
48 {
49 SourceMaterials[SlotIndex] = ForceMaterial;
50 return true;
51 }
52 return false;
53 }
54
56 {
57 return SourceMaterials.IsValidIndex(SlotIndex) ? SourceMaterials[SlotIndex] : nullptr;
58 }
59};
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
Definition MaterialOverlayHelper.h:13
static void AppendAllOverlayMaterial(const TArray< TObjectPtr< UMaterialInterface > > &SourceMaterials, TArray< UMaterialInterface * > &OutMaterials, bool &bOutHaveNullEntry)
Definition MaterialOverlayHelper.h:15
static UMaterialInterface * GetOverlayMaterial(TArray< TObjectPtr< UMaterialInterface > > &SourceMaterials, const int32 SlotIndex)
Definition MaterialOverlayHelper.h:55
static bool ForceMaterial(TArray< TObjectPtr< UMaterialInterface > > &SourceMaterials, const int32 SlotIndex, UMaterialInterface *ForceMaterial)
Definition MaterialOverlayHelper.h:45
static void ForceMaterial(TArray< TObjectPtr< UMaterialInterface > > &SourceMaterials, UMaterialInterface *ForceMaterial)
Definition MaterialOverlayHelper.h:37
static void AppendAllOverlayMaterial(const TArray< TObjectPtr< UMaterialInterface > > &SourceMaterials, TArray< UMaterialInterface * > &OutMaterials)
Definition MaterialOverlayHelper.h:31
Definition Array.h:670
Definition MaterialInterface.h:296
Definition ObjectPtr.h:488