// Copyright 2020-2024 CesiumGS, Inc. and Contributors #pragma once #include "CesiumGltf/PropertyArrayView.h" #include "CesiumGltf/PropertyTypeTraits.h" #include "CesiumMetadataValueType.h" #include "UObject/ObjectMacros.h" #include #include "CesiumPropertyArray.generated.h" /** * A Blueprint-accessible wrapper for an array property in glTF metadata. */ USTRUCT(BlueprintType) struct CESIUMRUNTIME_API FCesiumPropertyArray { GENERATED_USTRUCT_BODY() private: #pragma region ArrayType template using ArrayPropertyView = CesiumGltf::PropertyArrayView; using ArrayType = swl::variant< ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>, ArrayPropertyView>>; #pragma endregion public: /** * Constructs an empty array instance with an unknown element type. */ FCesiumPropertyArray() : _value(), _elementType() {} /** * Constructs an array instance. * @param value The property array view that will be stored in this struct */ template FCesiumPropertyArray(CesiumGltf::PropertyArrayCopy&& value) : _value(), _elementType(), _storage() { this->_value = std::move(value).toViewAndExternalBuffer(this->_storage); ECesiumMetadataType type = ECesiumMetadataType(CesiumGltf::TypeToPropertyType::value); ECesiumMetadataComponentType componentType = ECesiumMetadataComponentType( CesiumGltf::TypeToPropertyType::component); bool isArray = false; _elementType = {type, componentType, isArray}; } template FCesiumPropertyArray(const CesiumGltf::PropertyArrayCopy& value) : FCesiumPropertyArray(CesiumGltf::PropertyArrayCopy(value)) {} template FCesiumPropertyArray(const CesiumGltf::PropertyArrayView& value) : _value(value), _elementType() { ECesiumMetadataType type = ECesiumMetadataType(CesiumGltf::TypeToPropertyType::value); ECesiumMetadataComponentType componentType = ECesiumMetadataComponentType( CesiumGltf::TypeToPropertyType::component); bool isArray = false; _elementType = {type, componentType, isArray}; } FCesiumPropertyArray(FCesiumPropertyArray&& rhs); FCesiumPropertyArray& operator=(FCesiumPropertyArray&& rhs); FCesiumPropertyArray(const FCesiumPropertyArray& rhs); FCesiumPropertyArray& operator=(const FCesiumPropertyArray& rhs); private: template static bool holdsArrayAlternative(const swl::variant& variant) { return swl::holds_alternative>(variant); } ArrayType _value; FCesiumMetadataValueType _elementType; std::vector _storage; friend class UCesiumPropertyArrayBlueprintLibrary; };