// Copyright 2020-2024 CesiumGS, Inc. and Contributors #pragma once #include "CesiumPropertyTable.h" #include "CesiumPropertyTexture.h" #include "Containers/Array.h" #include "Containers/Map.h" #include "Containers/UnrealString.h" #include "CesiumModelMetadata.generated.h" namespace CesiumGltf { struct ExtensionModelExtStructuralMetadata; struct Model; } // namespace CesiumGltf /** * @brief A blueprint-accessible wrapper for metadata contained in a glTF model. * Provides access to views of property tables, property textures, and property * attributes available on the glTF. */ USTRUCT(BlueprintType) struct CESIUMRUNTIME_API FCesiumModelMetadata { GENERATED_USTRUCT_BODY() public: FCesiumModelMetadata() {} FCesiumModelMetadata( const CesiumGltf::Model& InModel, const CesiumGltf::ExtensionModelExtStructuralMetadata& Metadata); private: TArray _propertyTables; TArray _propertyTextures; // TODO: property attributes friend class UCesiumModelMetadataBlueprintLibrary; }; UCLASS() class CESIUMRUNTIME_API UCesiumModelMetadataBlueprintLibrary : public UBlueprintFunctionLibrary { GENERATED_BODY() public: /** * Gets the model metadata of a glTF primitive component. If component is * not a Cesium glTF primitive component, the returned metadata is empty. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const FCesiumModelMetadata& GetModelMetadata(const UPrimitiveComponent* component); PRAGMA_DISABLE_DEPRECATION_WARNINGS /** * @brief Get all the feature tables for this model metadata. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Metadata|Model", Meta = (DeprecatedFunction, DeprecationMessage = "Use GetPropertyTables to get an array of property tables instead.")) static const TMap GetFeatureTables(UPARAM(ref) const FCesiumModelMetadata& ModelMetadata); /** * @brief Get all the feature textures for this model metadata. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Metadata|Model", Meta = (DeprecatedFunction, DeprecationMessage = "Use GetPropertyTextures to get an array of property textures instead.")) static const TMap GetFeatureTextures(UPARAM(ref) const FCesiumModelMetadata& ModelMetadata); PRAGMA_ENABLE_DEPRECATION_WARNINGS /** * Gets an array of all the property tables for this model metadata. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const TArray& GetPropertyTables(UPARAM(ref) const FCesiumModelMetadata& ModelMetadata); /** * Gets the property table at the specified index for this model metadata. If * the index is out-of-bounds, this returns an invalid property table. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const FCesiumPropertyTable& GetPropertyTable( UPARAM(ref) const FCesiumModelMetadata& ModelMetadata, const int64 Index); /** * Gets the property table at the specified indices for this model metadata. * An invalid property table will be returned for any out-of-bounds index. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const TArray GetPropertyTablesAtIndices( UPARAM(ref) const FCesiumModelMetadata& ModelMetadata, const TArray& Indices); /** * Gets an array of all the property textures for this model metadata. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const TArray& GetPropertyTextures(UPARAM(ref) const FCesiumModelMetadata& ModelMetadata); /** * Gets the property table at the specified index for this model metadata. If * the index is out-of-bounds, this returns an invalid property table. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const FCesiumPropertyTexture& GetPropertyTexture( UPARAM(ref) const FCesiumModelMetadata& ModelMetadata, const int64 Index); /** * Gets an array of the property textures at the specified indices for this * model metadata. */ UFUNCTION( BlueprintCallable, BlueprintPure, Category = "Cesium|Model|Metadata") static const TArray GetPropertyTexturesAtIndices( UPARAM(ref) const FCesiumModelMetadata& ModelMetadata, const TArray& Indices); };