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