Navigation
API > API/Plugins > API/Plugins/AvalancheMaterial
Base class that allows interacting with material containers from any type (Actors, ActorComponents, etc.). A Material Bridge allows:
1) Access material slots:
- Access can either be to read or write.
- Read access allows only getting the material
- Write access allows getting the material slot and replacing its material.
2) Apply and store material container state
- Prior to replacing materials in a slot, the state of a material container can be stored via StoreState.
- The Material Bridge can then revert the material container back to its original state via ApplyState with the data that was stored prior to change.
- The expected flow could look like the following: 1) Call StoreState. Caller owns the state data. 2) Call AccessSlots (with write context) and replace slot material with a new one. 3) When needing to revert back, call ApplyState with the state data saved from (1)
Things to note:
- The Material Bridge does not own material container state data. It can only create and interact with it via Apply/Store. The responsibility of the ownership lies with the caller.
- ApplyState and StoreState is only concerned with the state of the material container, not the material itself. For example the parameters of a Material Instance Dynamic or any other property within a material object are not considered.
| Name | FMaterialBridge |
| Type | class |
| Header File | /Engine/Plugins/VirtualProduction/Avalanche/Source/AvalancheMaterial/Public/MaterialBridge/AvaMaterialBridge.h |
| Include Path | #include "MaterialBridge/AvaMaterialBridge.h" |
Syntax
class FMaterialBridge
Derived Classes
FMaterialBridge derived class hierarchy
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FMaterialBridge() |
MaterialBridge/AvaMaterialBridge.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FApplyStateContext | FMaterialBridgeApplyStateContext | MaterialBridge/AvaMaterialBridge.h | |
| FApplyStateOptions | FMaterialBridgeApplyStateOptions | MaterialBridge/AvaMaterialBridge.h | |
| FReadSlot | FMaterialBridgeReadSlot | MaterialBridge/AvaMaterialBridge.h | |
| FReadSlotContext | FMaterialBridgeReadSlotContext | MaterialBridge/AvaMaterialBridge.h | |
| FReadSlotOptions | FMaterialBridgeReadSlotOptions | MaterialBridge/AvaMaterialBridge.h | |
| FSlotId | FAvaMaterialBridgeSlotId | MaterialBridge/AvaMaterialBridge.h | |
| FStoreStateContext | FMaterialBridgeStoreStateContext | MaterialBridge/AvaMaterialBridge.h | |
| FStoreStateOptions | FMaterialBridgeStoreStateOptions | MaterialBridge/AvaMaterialBridge.h | |
| FWriteSlot | FMaterialBridgeWriteSlot | MaterialBridge/AvaMaterialBridge.h | |
| FWriteSlotContext | FMaterialBridgeWriteSlotContext | MaterialBridge/AvaMaterialBridge.h | |
| FWriteSlotOptions | FMaterialBridgeWriteSlotOptions | MaterialBridge/AvaMaterialBridge.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| BridgedType | TObjectPtr< const UStruct > | The type that this Material Bridge works on | MaterialBridge/AvaMaterialBridge.h | |
| ContainerStateType | TSubScriptStructOf< FAvaMaterialContainerState > | The material container state type of this bridge, if any | MaterialBridge/AvaMaterialBridge.h | |
| Priority | uint32 | The priority of this bridge in relation to other bridges of the same bridged type | MaterialBridge/AvaMaterialBridge.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
EControlFlow AccessSlots
(
const FWriteSlotContext& InContext, |
Access the found material slots in the given context for write. | MaterialBridge/AvaMaterialBridge.h | |
EControlFlow AccessSlots
(
const FReadSlotContext& InContext, |
Access the found material slots in the given context for read. | MaterialBridge/AvaMaterialBridge.h | |
bool ApplyState
(
const FApplyStateContext& InContext, |
Applies the material container state to the context object. | MaterialBridge/AvaMaterialBridge.h | |
bool CanCreateContainerState() |
Returns whether this material bridge supports container states | MaterialBridge/AvaMaterialBridge.h | |
TInstancedStruct< FAvaMaterialContainerState > CreateContainerState() |
Creates a material container state instance that can be used for this material bridge | MaterialBridge/AvaMaterialBridge.h | |
const UStruct * GetBridgedType() |
Retrieves the type that this bridge supports | MaterialBridge/AvaMaterialBridge.h | |
uint32 GetPriority() |
Get the priority of this bridge in relation to other bridges of the same bridged type | MaterialBridge/AvaMaterialBridge.h | |
void Initialize
(
uint32 InPriority |
Initializes the bridge for use | MaterialBridge/AvaMaterialBridge.h | |
bool IsMaterialContainerSupported
(
FConstDataView InMaterialContainer |
Whether this Material Bridge supports the given Material Container. | MaterialBridge/AvaMaterialBridge.h | |
bool StoreState
(
const FStoreStateContext& InContext, |
Stores the state of the context object in the material container state This overload initializes the container state if it is invalid. | MaterialBridge/AvaMaterialBridge.h | |
bool StoreState
(
const FStoreStateContext& InContext, |
Stores the state of the context object in the material container state | MaterialBridge/AvaMaterialBridge.h |
Public Virtual
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const UStruct * OnGetBridgedType () |
Retrieves the type that this bridge supports. | MaterialBridge/AvaMaterialBridge.h |
Protected Virtual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual EControlFlow OnAccessSlots
(
const FWriteSlotContext& InContext, |
Accesses the found material slots in the given context for write | MaterialBridge/AvaMaterialBridge.h | |
virtual EControlFlow OnAccessSlots
(
const FReadSlotContext& InContext, |
Accesses the found material slots in the given context for read | MaterialBridge/AvaMaterialBridge.h | |
virtual void OnApplyState
(
const FApplyStateContext& InContext, |
Applies the container state to the context object | MaterialBridge/AvaMaterialBridge.h | |
virtual TSubScriptStructOf< FAvaMaterialContainerState > OnGetContainerStateType() |
Returns the material container state type required by this bridge, if any | MaterialBridge/AvaMaterialBridge.h | |
virtual bool OnIsMaterialContainerSupported
(
FConstDataView InMaterialContainer |
Whether this material bridge supports the given material container. | MaterialBridge/AvaMaterialBridge.h | |
virtual void OnStoreState
(
const FStoreStateContext& InContext, |
Stores the state of the context object in the container state | MaterialBridge/AvaMaterialBridge.h |