Cesium for Unreal 2.28.0
Loading...
Searching...
No Matches
CesiumFeaturesMetadataComponent.h
Go to the documentation of this file.
1// Copyright 2020-2026 CesiumGS, Inc. and Contributors
2
3#pragma once
4
8
9#if WITH_EDITOR
10#include "Materials/MaterialFunctionMaterialLayer.h"
11#endif
12
13#include "CesiumFeaturesMetadataComponent.generated.h"
14
15/**
16 * @brief A component that can be added to Cesium3DTileset actors to
17 * dictate what feature ID sets or metadata to encode for access on the GPU.
18 * "Add Properties" allows users to find and select desired feature ID sets and
19 * metadata properties. Once a selection is made, "Generate Material" can be
20 * used to auto-generated the boiler-plate code to access the selected
21 * properties in the Unreal material.
22 */
23UCLASS(ClassGroup = Cesium, Meta = (BlueprintSpawnableComponent))
24class CESIUMRUNTIME_API UCesiumFeaturesMetadataComponent
26 GENERATED_BODY()
27
28public:
29#if WITH_EDITOR
30 /**
31 * Opens a window to add feature ID sets and metadata properties from the
32 * current view of the tileset.
33 */
34 UFUNCTION(
35 CallInEditor,
36 Category = "Cesium",
37 Meta = (DisplayName = "Add Properties"))
38 void AddProperties();
39
40 /**
41 * Creates or overwrites a boiler-plate material layer that exposes the
42 * requested metadata properties in the current description. The nodes to
43 * access the metadata will be added to TargetMaterialLayer if it is already
44 * specified. Otherwise a new material layer will be created in the /Content/
45 * folder and TargetMaterialLayer will be set to the new material layer.
46 */
47 UFUNCTION(
48 CallInEditor,
49 Category = "Cesium",
50 Meta = (DisplayName = "Generate Material"))
51 void GenerateMaterial();
52#endif
53
54#if WITH_EDITORONLY_DATA
55 /**
56 * This is the target UMaterialFunctionMaterialLayer that the
57 * boiler-plate material generation will use. When pressing
58 * "Generate Material", nodes will be added to this material to enable access
59 * to the requested metadata. If this is left blank, a new material layer
60 * will be created in the /Content/ folder.
61 */
62 UPROPERTY(EditAnywhere, Category = "Cesium")
63 UMaterialFunctionMaterialLayer* TargetMaterialLayer = nullptr;
64#endif
65
66 /**
67 * The Blueprint class to instantiate for feature styling. This is used for
68 * any feature ID sets with StylingMode set to Blueprint.
69 */
70 UPROPERTY(
71 EditAnywhere,
72 BlueprintReadWrite,
73 Category = "Cesium",
74 meta =
75 (MustImplement =
76 "/Script/CesiumRuntime.Cesium3DTilesStylingProvider"))
77 TSubclassOf<UObject> BlueprintStyleClass;
78
79 /**
80 * @brief Description of both feature IDs and metadata from a glTF via the
81 * EXT_mesh_features, EXT_instance_features, and EXT_structural_metadata
82 * extensions. Indicates what parts of the extension should be uploaded to the
83 * GPU for access in Unreal materials.
84 */
85 UPROPERTY(
86 EditAnywhere,
87 Category = "Cesium",
88 Meta =
89 (TitleProperty = "Name",
90 DisplayAfter = "TargetMaterialLayer",
91 ShowOnlyInnerProperties))
93
94 PRAGMA_DISABLE_DEPRECATION_WARNINGS
95 // Previously the properties of FCesiumFeaturesMetadataDescription were
96 // deconstructed here in order to flatten the Details panel UI. However, the
97 // ShowOnlyInnerProperties attribute accomplishes the same thing. These
98 // properties are deprecated but migrated over in PostLoad().
99
100 /**
101 * Description of the feature ID sets in the visible glTF primitives across
102 * the tileset.
103 */
104 UPROPERTY(
105 Meta =
106 (DeprecatedProperty,
107 DeprecationMessage =
108 "Use FeatureIdSets on the CesiumFeaturesMetadataDescription's Features instead."))
110
111 /**
112 * Names of the property textures used by the glTF primitives across the
113 * tileset.
114 *
115 * This should be a subset of the property textures listed in the model
116 * metadata. Property textures can be passed to the material even if they are
117 * not explicitly used by a glTF primitive, but the primitive may lack the
118 * corresponding sets of texture coordinates intended to sample them.
119 */
120 UPROPERTY(
121 Meta =
122 (DeprecatedProperty,
123 DeprecationMessage =
124 "Use PropertyTextureNames on the CesiumFeaturesMetadataDescription's PrimitiveMetadata instead."))
125 TSet<FString> PropertyTextureNames;
126
127 /**
128 * Descriptions of the property tables in the visible glTF
129 * models across the tileset.
130 */
131 UPROPERTY(
132 Meta =
133 (DeprecatedProperty,
134 DeprecationMessage =
135 "Use PropertyTables on the CesiumFeaturesMetadataDescription's ModelMetadata instead."))
137
138 /**
139 * Descriptions of property textures in the visible glTF models across
140 * the tileset.
141 */
142 UPROPERTY(
143 Meta =
144 (DeprecatedProperty,
145 DeprecationMessage =
146 "Use PropertyTextures on the CesiumFeaturesMetadataDescription's ModelMetadata instead."))
148 PRAGMA_ENABLE_DEPRECATION_WARNINGS
149
150 virtual void PostLoad() override;
151
152#if WITH_EDITOR
153 virtual void
154 PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
155 virtual void PostEditChangeChainProperty(
156 FPropertyChangedChainEvent& PropertyChangedChainEvent) override;
157#endif
158
159 /**
160 * Gets the instance of BlueprintStyleClass that has been created to style
161 * features in this tileset. If no BlueprintStyleClass was specified, this
162 * will be null.
163 *
164 * This function may be used to modify variables on the instance of the style
165 * at runtime.
166 */
167 UFUNCTION(BlueprintCallable, Category = "Cesium|Styling")
168 UObject* GetStyleInstance() const { return this->_pStyleInstance; }
169
170protected:
171 virtual void OnFetchMetadata(
172 ACesium3DTileset* pActor,
173 const Cesium3DTilesSelection::TilesetMetadata* pMetadata) override;
174 virtual void ClearStatistics() override;
175
176private:
177 void recreateStyleInstance();
178
179 UPROPERTY(Transient)
180 UObject* _pStyleInstance;
181};
A component that can be added to Cesium3DTileset actors to dictate what feature ID sets or metadata t...
TSubclassOf< UObject > BlueprintStyleClass
The Blueprint class to instantiate for feature styling.
TArray< FCesiumPropertyTextureDescription > PropertyTextures
Descriptions of property textures in the visible glTF models across the tileset.
virtual PRAGMA_ENABLE_DEPRECATION_WARNINGS void PostLoad() override
PRAGMA_DISABLE_DEPRECATION_WARNINGS TArray< FCesiumFeatureIdSetDescription > FeatureIdSets
Description of the feature ID sets in the visible glTF primitives across the tileset.
FCesiumFeaturesMetadataDescription Description
Description of both feature IDs and metadata from a glTF via the EXT_mesh_features,...
virtual void OnFetchMetadata(ACesium3DTileset *pActor, const Cesium3DTilesSelection::TilesetMetadata *pMetadata) override
Event that occurs once metadata is successfully synced from the tileset during SyncStatistics.
UObject * GetStyleInstance() const
Gets the instance of BlueprintStyleClass that has been created to style features in this tileset.
TArray< FCesiumPropertyTableDescription > PropertyTables
Descriptions of the property tables in the visible glTF models across the tileset.
TSet< FString > PropertyTextureNames
Names of the property textures used by the glTF primitives across the tileset.
virtual void ClearStatistics() override
Called during various parts of the sync process.
A base component interface for interacting with metadata in a Cesium3DTileset.
Description of a feature ID set from either EXT_mesh_features or EXT_instance_features.
Description of both feature IDs and metadata from a glTF via the EXT_mesh_features and EXT_structural...
Description of a property table containing properties to be encoded for access in Unreal materials.
Description of a property texture with properties that should be made accessible to Unreal materials.