ralpha-assets/Plugins/CesiumForUnreal/Source/CesiumRuntime/Public/CesiumMaterialUserData.h

38 lines
1.2 KiB
C++

// Copyright 2020-2024 CesiumGS, Inc. and Contributors
#pragma once
#include "CesiumCommon.h"
#include "Engine/AssetUserData.h"
#include "CesiumMaterialUserData.generated.h"
/**
* Instances of this user data class are automatically attached to all materials
* that are used by Cesium for Unreal and that have a Layer Stack named
* "Cesium". It provides a way for Cesium for Unreal to access the names of the
* individual layers in the stack at runtime (i.e. outside the Editor) so that
* they can be mapped to raster overlays.
*
* It works by responding, in the Editor, to changes in the Material to which
* it's attached via the `PostEditChangeOwner` and updating its internal mirror
* of the layer names. At runtime, these layer names that were configured in the
* Editor can't be further changed, so the the mirrored list is still valid.
*/
UCLASS()
class UCesiumMaterialUserData : public UAssetUserData {
GENERATED_BODY()
public:
#if ENGINE_VERSION_5_6_OR_HIGHER
virtual void PostEditChangeOwner(
const FPropertyChangedEvent& PropertyChangedEvent) override;
#else
virtual void PostEditChangeOwner() override;
#endif
void UpdateLayerNames();
UPROPERTY()
TArray<FString> LayerNames;
};