Cesium for Unreal 2.22.1
Loading...
Searching...
No Matches
CesiumFeaturesMetadataComponent.h
Go to the documentation of this file.
1// Copyright 2020-2025 CesiumGS, Inc. and Contributors
2
3#pragma once
4
6#include "Components/ActorComponent.h"
7
8#if WITH_EDITOR
9#include "Materials/MaterialFunctionMaterialLayer.h"
10#endif
11
12#include "CesiumFeaturesMetadataComponent.generated.h"
13
14/**
15 * @brief A component that can be added to Cesium3DTileset actors to
16 * dictate what feature ID sets or metadata to encode for access on the GPU.
17 * "Add Properties" allows users to find and select desired feature ID sets and
18 * metadata properties. Once a selection is made, "Generate Material" can be
19 * used to auto-generated the boiler-plate code to access the selected
20 * properties in the Unreal material.
21 */
22UCLASS(ClassGroup = Cesium, Meta = (BlueprintSpawnableComponent))
23class CESIUMRUNTIME_API UCesiumFeaturesMetadataComponent
24 : public UActorComponent {
25 GENERATED_BODY()
26
27public:
28#if WITH_EDITOR
29 /**
30 * Opens a window to add feature ID sets and metadata properties from the
31 * current view of the tileset.
32 */
33 UFUNCTION(
34 CallInEditor,
35 Category = "Cesium",
36 Meta = (DisplayName = "Add Properties"))
37 void AddProperties();
38
39 /**
40 * This button can be used to create a boiler-plate material layer that
41 * exposes the requested metadata properties in the current description. The
42 * nodes to access the metadata will be added to TargetMaterialLayer if it
43 * exists. Otherwise a new material layer will be created in the /Content/
44 * folder and TargetMaterialLayer will be set to the new material layer.
45 */
46 UFUNCTION(
47 CallInEditor,
48 Category = "Cesium",
49 Meta = (DisplayName = "Generate Material"))
50 void GenerateMaterial();
51#endif
52
53#if WITH_EDITORONLY_DATA
54 /**
55 * This is the target UMaterialFunctionMaterialLayer that the
56 * boiler-plate material generation will use. When pressing
57 * "Generate Material", nodes will be added to this material to enable access
58 * to the requested metadata. If this is left blank, a new material layer
59 * will be created in the /Game/ folder.
60 */
61 UPROPERTY(EditAnywhere, Category = "Cesium")
62 UMaterialFunctionMaterialLayer* TargetMaterialLayer = nullptr;
63#endif
64
65 /**
66 * @brief Description of both feature IDs and metadata from a glTF via the
67 * EXT_mesh_features, EXT_instance_features, and EXT_structural_metadata
68 * extensions. Indicates what parts of the extension should be uploaded to the
69 * GPU for access in Unreal materials.
70 */
71 UPROPERTY(
72 EditAnywhere,
73 Category = "Cesium",
74 Meta =
75 (TitleProperty = "Name",
76 DisplayAfter = "TargetMaterialLayer",
77 ShowOnlyInnerProperties))
79
80 // Previously the properties of FCesiumFeaturesMetadataDescription were
81 // deconstructed here in order to flatten the Details panel UI. However, the
82 // ShowOnlyInnerProperties attribute accomplishes the same thing. These
83 // properties are deprecated but migrated over in PostLoad().
84
85 /**
86 * Description of the feature ID sets in the visible glTF primitives across
87 * the tileset.
88 */
89 UPROPERTY(
90 Meta =
91 (DeprecatedProperty,
92 DeprecationMessage =
93 "Use FeatureIdSets on the CesiumFeaturesMetadataDescription's Features instead."))
95
96 /**
97 * Names of the property textures used by the glTF primitives across the
98 * tileset.
99 *
100 * This should be a subset of the property textures listed in the model
101 * metadata. Property textures can be passed to the material even if they are
102 * not explicitly used by a glTF primitive, but the primitive may lack the
103 * corresponding sets of texture coordinates intended to sample them.
104 */
105 UPROPERTY(
106 Meta =
107 (DeprecatedProperty,
108 DeprecationMessage =
109 "Use PropertyTextureNames on the CesiumFeaturesMetadataDescription's PrimitiveMetadata instead."))
110 TSet<FString> PropertyTextureNames;
111
112 /**
113 * Descriptions of the property tables in the visible glTF
114 * models across the tileset.
115 */
116 UPROPERTY(
117 Meta =
118 (DeprecatedProperty,
119 DeprecationMessage =
120 "Use PropertyTables on the CesiumFeaturesMetadataDescription's ModelMetadata instead."))
122
123 /**
124 * Descriptions of property textures in the visible glTF models across
125 * the tileset.
126 */
127 UPROPERTY(
128 Meta =
129 (DeprecatedProperty,
130 DeprecationMessage =
131 "Use PropertyTextures on the CesiumFeaturesMetadataDescription's ModelMetadata instead."))
133
134protected:
135 /** PostLoad override. */
136 virtual void PostLoad() override;
137};
A component that can be added to Cesium3DTileset actors to dictate what feature ID sets or metadata t...
TArray< FCesiumFeatureIdSetDescription > FeatureIdSets
Description of the feature ID sets in the visible glTF primitives across the tileset.
TArray< FCesiumPropertyTextureDescription > PropertyTextures
Descriptions of property textures in the visible glTF models across the tileset.
virtual void PostLoad() override
PostLoad override.
FCesiumFeaturesMetadataDescription Description
Description of both feature IDs and metadata from a glTF via the EXT_mesh_features,...
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.
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.