66
77ECesiumMetadataBlueprintType
88UCesiumPropertyArrayBlueprintLibrary::GetElementBlueprintType (
9- UPARAM (ref) const FCesiumPropertyArray& array ) {
10- return CesiumMetadataValueTypeToBlueprintType (array ._elementType );
9+ UPARAM (ref) const FCesiumPropertyArray& Array ) {
10+ return CesiumMetadataValueTypeToBlueprintType (Array ._elementType );
1111}
1212
1313ECesiumMetadataBlueprintType
1414UCesiumPropertyArrayBlueprintLibrary::GetBlueprintComponentType (
15- UPARAM (ref) const FCesiumPropertyArray& array ) {
16- return CesiumMetadataValueTypeToBlueprintType (array ._elementType );
15+ UPARAM (ref) const FCesiumPropertyArray& Array ) {
16+ return CesiumMetadataValueTypeToBlueprintType (Array ._elementType );
1717}
1818
1919FCesiumMetadataValueType
2020UCesiumPropertyArrayBlueprintLibrary::GetElementValueType (
21- UPARAM (ref) const FCesiumPropertyArray& array ) {
22- return array ._elementType ;
21+ UPARAM (ref) const FCesiumPropertyArray& Array ) {
22+ return Array ._elementType ;
2323}
2424
2525int64 UCesiumPropertyArrayBlueprintLibrary::GetArraySize (
26- UPARAM (ref) const FCesiumPropertyArray& array) {
27- return swl::visit ([](const auto & view) { return view.size (); }, array._value );
26+ UPARAM (ref) const FCesiumPropertyArray& Array) {
27+ if (Array._valueArray .IsSet ()) {
28+ return Array._valueArray ->Num ();
29+ }
30+
31+ return swl::visit (
32+ [](const auto & view) { return view.size (); },
33+ Array._valueView );
2834}
2935
3036int64 UCesiumPropertyArrayBlueprintLibrary::GetSize (
31- UPARAM (ref) const FCesiumPropertyArray& array ) {
32- return swl::visit ([]( const auto & view) { return view. size (); }, array. _value );
37+ UPARAM (ref) const FCesiumPropertyArray& Array ) {
38+ return UCesiumPropertyArrayBlueprintLibrary::GetArraySize (Array );
3339}
3440
3541FCesiumMetadataValue UCesiumPropertyArrayBlueprintLibrary::GetValue (
36- UPARAM (ref) const FCesiumPropertyArray& array,
37- int64 index) {
42+ UPARAM (ref) const FCesiumPropertyArray& Array,
43+ int64 Index) {
44+ int64 arraySize = UCesiumPropertyArrayBlueprintLibrary::GetArraySize (Array);
45+ if (Index < 0 || Index >= arraySize) {
46+ FFrame::KismetExecutionMessage (
47+ *FString::Printf (
48+ TEXT (
49+ " Attempted to access index %d from CesiumPropertyArray of length %d!" ),
50+ Index,
51+ arraySize),
52+ ELogVerbosity::Warning,
53+ FName (" CesiumPropertyArrayOutOfBoundsWarning" ));
54+ return FCesiumMetadataValue ();
55+ }
56+
57+ if (Array._valueArray .IsSet ()) {
58+ return (*Array._valueArray )[Index];
59+ }
60+
3861 return swl::visit (
39- [index , &pEnumDefinition = array ._pEnumDefinition ](
62+ [Index , &pEnumDefinition = Array ._pEnumDefinition ](
4063 const auto & v) -> FCesiumMetadataValue {
41- if (index < 0 || index >= v.size ()) {
42- FFrame::KismetExecutionMessage (
43- *FString::Printf (
44- TEXT (
45- " Attempted to access index %d from CesiumPropertyArray of length %d!" ),
46- index,
47- v.size ()),
48- ELogVerbosity::Warning,
49- FName (" CesiumPropertyArrayOutOfBoundsWarning" ));
50- return FCesiumMetadataValue ();
51- }
52- return FCesiumMetadataValue (v[index], pEnumDefinition);
64+ return FCesiumMetadataValue (v[Index], pEnumDefinition);
5365 },
54- array. _value );
66+ Array. _valueView );
5567}
5668
69+ PRAGMA_DISABLE_DEPRECATION_WARNINGS
5770ECesiumMetadataTrueType_DEPRECATED
5871UCesiumPropertyArrayBlueprintLibrary::GetTrueComponentType (
5972 UPARAM (ref) const FCesiumPropertyArray& array) {
@@ -64,130 +77,64 @@ bool UCesiumPropertyArrayBlueprintLibrary::GetBoolean(
6477 UPARAM (ref) const FCesiumPropertyArray& array,
6578 int64 index,
6679 bool defaultValue) {
67- return swl::visit (
68- [index, defaultValue](const auto & v) -> bool {
69- if (index < 0 || index >= v.size ()) {
70- return defaultValue;
71- }
72- auto value = v[index];
73- return CesiumGltf::MetadataConversions<bool , decltype (value)>::convert (
74- value)
75- .value_or (defaultValue);
76- },
77- array._value );
80+ FCesiumMetadataValue value =
81+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
82+ return UCesiumMetadataValueBlueprintLibrary::GetBoolean (value, defaultValue);
7883}
7984
8085uint8 UCesiumPropertyArrayBlueprintLibrary::GetByte (
8186 UPARAM (ref) const FCesiumPropertyArray& array,
8287 int64 index,
8388 uint8 defaultValue) {
84- return swl::visit (
85- [index, defaultValue](const auto & v) -> uint8 {
86- if (index < 0 || index >= v.size ()) {
87- return defaultValue;
88- }
89- auto value = v[index];
90- return CesiumGltf::MetadataConversions<uint8, decltype (value)>::convert (
91- value)
92- .value_or (defaultValue);
93- },
94- array._value );
89+ FCesiumMetadataValue value =
90+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
91+ return UCesiumMetadataValueBlueprintLibrary::GetByte (value, defaultValue);
9592}
9693
9794int32 UCesiumPropertyArrayBlueprintLibrary::GetInteger (
9895 UPARAM (ref) const FCesiumPropertyArray& array,
9996 int64 index,
10097 int32 defaultValue) {
101- return swl::visit (
102- [index, defaultValue](const auto & v) -> int32 {
103- if (index < 0 || index >= v.size ()) {
104- return defaultValue;
105- }
106- auto value = v[index];
107- return CesiumGltf::MetadataConversions<int32, decltype (value)>::convert (
108- value)
109- .value_or (defaultValue);
110- },
111- array._value );
98+ FCesiumMetadataValue value =
99+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
100+ return UCesiumMetadataValueBlueprintLibrary::GetInteger (value, defaultValue);
112101}
113102
114103int64 UCesiumPropertyArrayBlueprintLibrary::GetInteger64 (
115104 UPARAM (ref) const FCesiumPropertyArray& array,
116105 int64 index,
117106 int64 defaultValue) {
118- return swl::visit (
119- [index, defaultValue](const auto & v) -> int64 {
120- if (index < 0 || index >= v.size ()) {
121- return defaultValue;
122- }
123- auto value = v[index];
124- return CesiumGltf::MetadataConversions<int64_t , decltype (value)>::
125- convert (value)
126- .value_or (defaultValue);
127- },
128- array._value );
107+ FCesiumMetadataValue value =
108+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
109+ return UCesiumMetadataValueBlueprintLibrary::GetInteger64 (
110+ value,
111+ defaultValue);
129112}
130113
131114float UCesiumPropertyArrayBlueprintLibrary::GetFloat (
132115 UPARAM (ref) const FCesiumPropertyArray& array,
133116 int64 index,
134117 float defaultValue) {
135- return swl::visit (
136- [index, defaultValue](const auto & v) -> float {
137- if (index < 0 || index >= v.size ()) {
138- return defaultValue;
139- }
140- auto value = v[index];
141- return CesiumGltf::MetadataConversions<float , decltype (value)>::convert (
142- value)
143- .value_or (defaultValue);
144- },
145- array._value );
118+ FCesiumMetadataValue value =
119+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
120+ return UCesiumMetadataValueBlueprintLibrary::GetFloat (value, defaultValue);
146121}
147122
148123double UCesiumPropertyArrayBlueprintLibrary::GetFloat64 (
149124 UPARAM (ref) const FCesiumPropertyArray& array,
150125 int64 index,
151126 double defaultValue) {
152- return swl::visit (
153- [index, defaultValue](const auto & v) -> double {
154- auto value = v[index];
155- return CesiumGltf::MetadataConversions<double , decltype (value)>::
156- convert (value)
157- .value_or (defaultValue);
158- },
159- array._value );
127+ FCesiumMetadataValue value =
128+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
129+ return UCesiumMetadataValueBlueprintLibrary::GetFloat64 (value, defaultValue);
160130}
161131
162132FString UCesiumPropertyArrayBlueprintLibrary::GetString (
163133 UPARAM (ref) const FCesiumPropertyArray& array,
164134 int64 index,
165135 const FString& defaultValue) {
166- return swl::visit (
167- [index, defaultValue, &EnumDefinition = array._pEnumDefinition ](
168- const auto & v) -> FString {
169- if (index < 0 || index >= v.size ()) {
170- return defaultValue;
171- }
172- auto value = v[index];
173- using ValueType = decltype (value);
174-
175- if constexpr (CesiumGltf::IsMetadataInteger<ValueType>::value) {
176- if (EnumDefinition.IsValid ()) {
177- TOptional<FString> MaybeName = EnumDefinition->GetName (value);
178- if (MaybeName.IsSet ()) {
179- return MaybeName.GetValue ();
180- }
181- }
182- }
183-
184- auto maybeString =
185- CesiumGltf::MetadataConversions<std::string, ValueType>::convert (
186- value);
187- if (!maybeString) {
188- return defaultValue;
189- }
190- return UnrealMetadataConversions::toString (*maybeString);
191- },
192- array._value );
136+ FCesiumMetadataValue value =
137+ UCesiumPropertyArrayBlueprintLibrary::GetValue (array, index);
138+ return UCesiumMetadataValueBlueprintLibrary::GetString (value, defaultValue);
193139}
140+ PRAGMA_ENABLE_DEPRECATION_WARNINGS
0 commit comments