Cesium for Unreal 2.24.1
Loading...
Searching...
No Matches
CesiumPropertyArrayBlueprintLibrary.h
Go to the documentation of this file.
1// Copyright 2020-2025 CesiumGS, Inc. and Contributors
2
3#pragma once
4
7#include "CesiumPropertyArrayBlueprintLibrary.generated.h"
8
9/**
10 * Blueprint library functions for acting on an array value from a property in
11 * EXT_structural_metadata.
12 */
13UCLASS()
15 : public UBlueprintFunctionLibrary {
16 GENERATED_BODY()
17
18public:
19 /**
20 * Gets the best-fitting Blueprints type for the elements of this array.
21 *
22 * @param array The array.
23 */
24 UFUNCTION(
25 BlueprintCallable,
26 BlueprintPure,
27 Category = "Cesium|Metadata|PropertyArray")
30
31 /**
32 * Gets the true value type of the elements in the array. Many of these types
33 * are not accessible from Blueprints, but can be converted to a
34 * Blueprint-accessible type.
35 *
36 * @param array The array.
37 */
38 UFUNCTION(
39 BlueprintCallable,
40 BlueprintPure,
41 Category = "Cesium|Metadata|PropertyArray")
43 GetElementValueType(UPARAM(ref) const FCesiumPropertyArray& array);
44
45 /**
46 * Gets the number of elements in the array. Returns 0 if the elements have
47 * an unknown type.
48 *
49 * @param Array The array.
50 * @return The number of elements in the array.
51 */
52 UFUNCTION(
53 BlueprintCallable,
54 BlueprintPure,
55 Category = "Cesium|Metadata|PropertyArray")
56 static int64 GetArraySize(UPARAM(ref) const FCesiumPropertyArray& Array);
57
58 /**
59 * Retrieves an element from the array as a FCesiumMetadataValue. The value
60 * can then be retrieved as a specific Blueprints type.
61 *
62 * If the index is out-of-bounds, this returns a bogus FCesiumMetadataValue of
63 * an unknown type.
64 *
65 * @param Array The array.
66 * @param Index The index of the array element to retrieve.
67 * @return The element as a FCesiumMetadataValue.
68 */
69 UFUNCTION(
70 BlueprintCallable,
71 BlueprintPure,
72 Category = "Cesium|Metadata|PropertyArray")
74 GetValue(UPARAM(ref) const FCesiumPropertyArray& Array, int64 Index);
75
76 /**
77 * Prints the contents of the array to a human-readable string in the format
78 * "[A, B, C, ... Z]".
79 * @param Array The array.
80 * @return A string capturing the contents of the array.
81 */
82 UFUNCTION(
83 BlueprintCallable,
84 BlueprintPure,
85 Category = "Cesium|Metadata|PropertyArray")
86 static FString ToString(UPARAM(ref) const FCesiumPropertyArray& Array);
87
88 PRAGMA_DISABLE_DEPRECATION_WARNINGS
89 /**
90 * Gets the best-fitting Blueprints type for the elements of this array.
91 *
92 * @param array The array.
93 */
94 UFUNCTION(
95 BlueprintCallable,
96 BlueprintPure,
97 Meta =
98 (DeprecatedFunction,
99 DeprecationMessage = "Use GetElementBlueprintType instead."))
102
103 /**
104 * Gets true type of the elements in the array. Many of these types are not
105 * accessible from Blueprints, but can be converted to a Blueprint-accessible
106 * type.
107 *
108 * @param array The array.
109 */
110 UFUNCTION(
111 BlueprintCallable,
112 BlueprintPure,
113 Meta =
114 (DeprecatedFunction,
115 DeprecationMessage =
116 "CesiumMetadataTrueType is deprecated. Use GetElementValueType instead."))
119
120 /**
121 * Gets the number of elements in the array. Returns 0 if the elements have
122 * an unknown type.
123 *
124 * @param Array The array.
125 * @return The number of elements in the array.
126 */
127 UFUNCTION(
128 BlueprintCallable,
129 BlueprintPure,
130 Meta =
131 (DeprecatedFunction,
132 DeprecationMessage = "Use GetArraySize instead."))
133 static int64 GetSize(UPARAM(ref) const FCesiumPropertyArray& Array);
134
135 /**
136 * Retrieves an element from the array and attempts to convert it to a Boolean
137 * value.
138 *
139 * If the element is boolean, it is returned directly.
140 *
141 * If the element is numeric, zero is converted to false, while any other
142 * value is converted to true.
143 *
144 * If the element is a string, "0", "false", and "no" (case-insensitive) are
145 * converted to false, while "1", "true", and "yes" are converted to true.
146 * All other strings, including strings that can be converted to numbers,
147 * will return the default value.
148 *
149 * Other types of elements will return the default value.
150 *
151 * @param Array The array.
152 * @param Index The index of the array element to retrieve.
153 * @param DefaultValue The default value to use if the index is invalid
154 * or the element's value cannot be converted.
155 * @return The element value.
156 */
157 UFUNCTION(
158 BlueprintCallable,
159 BlueprintPure,
160 Meta =
161 (DeprecatedFunction,
162 DeprecationMessage =
163 "GetBoolean is deprecated for metadata arrays. Use GetValue instead."))
164 static bool GetBoolean(
165 UPARAM(ref) const FCesiumPropertyArray& Array,
166 int64 Index,
167 bool DefaultValue = false);
168
169 /**
170 * Retrieves an element from the array and attempts to convert it to an
171 * unsigned 8-bit integer value.
172 *
173 * If the element is an integer and between 0 and 255, it is returned
174 * directly.
175 *
176 * If the element is a floating-point number, it is truncated (rounded
177 * toward zero).
178 *
179 * If the element is a boolean, 0 is returned for false and 1 for true.
180 *
181 * If the element is a string and the entire string can be parsed as an
182 * integer between 0 and 255, the parsed value is returned. The string is
183 * parsed in a locale-independent way and does not support use of a comma or
184 * other character to group digits.
185 *
186 * Otherwise, the default value is returned.
187 *
188 * @param Array The array.
189 * @param Index The index of the array element to retrieve.
190 * @param DefaultValue The default value to use if the index is invalid
191 * or the element's value cannot be converted.
192 * @return The element value.
193 */
194 UFUNCTION(
195 BlueprintCallable,
196 BlueprintPure,
197 Meta =
198 (DeprecatedFunction,
199 DeprecationMessage =
200 "GetByte is deprecated on arrays. Use GetValue instead."))
201 static uint8 GetByte(
202 UPARAM(ref) const FCesiumPropertyArray& Array,
203 int64 Index,
204 uint8 DefaultValue = 0);
205
206 /**
207 * Retrieves an element from the array and attempts to convert it to a signed
208 * 32-bit integer value.
209 *
210 * If the element is an integer and between -2,147,483,647 and 2,147,483,647,
211 * it is returned directly.
212 *
213 * If the element is a floating-point number, it is truncated (rounded
214 * toward zero).
215 *
216 * If the element is a boolean, 0 is returned for false and 1 for true.
217 *
218 * If the element is a string and the entire string can be parsed as an
219 * integer in the valid range, the parsed value is returned. If it can be
220 * parsed as a floating-point number, the parsed value is truncated (rounded
221 * toward zero). In either case, the string is parsed in a locale-independent
222 * way and does not support use of a comma or other character to group digits.
223 *
224 * Otherwise, the default value is returned.
225 *
226 * @param Array The array.
227 * @param Index The index of the array element to retrieve.
228 * @param DefaultValue The default value to use if the index is invalid
229 * or the element's value cannot be converted.
230 * @return The element value.
231 */
232 UFUNCTION(
233 BlueprintCallable,
234 BlueprintPure,
235 Meta =
236 (DeprecatedFunction,
237 DeprecationMessage =
238 "GetInteger is deprecated for metadata arrays. Use GetValue instead."))
239 static int32 GetInteger(
240 UPARAM(ref) const FCesiumPropertyArray& Array,
241 int64 Index,
242 int32 DefaultValue = 0);
243
244 /**
245 * This function is deprecated. Use Cesium > Metadata > Property Array >
246 * GetValue instead.
247 *
248 * Retrieves an element from the array and attempts to convert it to a signed
249 * 64-bit integer value.
250 *
251 * If the element is an integer and between -2^63-1 and 2^63-1, it is returned
252 * directly.
253 *
254 * If the element is a floating-point number, it is truncated (rounded
255 * toward zero).
256 *
257 * If the element is a boolean, 0 is returned for false and 1 for true.
258 *
259 * If the element is a string and the entire string can be parsed as an
260 * integer in the valid range, the parsed value is returned. If it can be
261 * parsed as a floating-point number, the parsed value is truncated (rounded
262 * toward zero). In either case, the string is parsed in a locale-independent
263 * way and does not support use of a comma or other character to group digits.
264 *
265 * Otherwise, the default value is returned.
266 *
267 * @param Array The array.
268 * @param Index The index of the array element to retrieve.
269 * @param DefaultValue The default value to use if the index is invalid
270 * or the element's value cannot be converted.
271 * @return The element value.
272 */
273 UFUNCTION(
274 BlueprintCallable,
275 BlueprintPure,
276 Meta =
277 (DeprecatedFunction,
278 DeprecationMessage =
279 "GetInteger64 is deprecated for metadata arrays. Use GetValue instead."))
280 static int64 GetInteger64(
281 UPARAM(ref) const FCesiumPropertyArray& Array,
282 int64 Index,
283 int64 DefaultValue = 0);
284
285 /**
286 * Retrieves an element from the array and attempts to convert it to a 32-bit
287 * floating-point value.
288 *
289 * If the element is a single-precision floating-point number, is is returned.
290 *
291 * If the element is an integer or double-precision floating-point number,
292 * it is converted to the closest representable single-precision
293 * floating-point number.
294 *
295 * If the element is a boolean, 0.0 is returned for false and 1.0 for true.
296 *
297 * If the element is a string and the entire string can be parsed as a
298 * number, the parsed value is returned. The string is parsed in a
299 * locale-independent way and does not support use of a comma or other
300 * character to group digits.
301 *
302 * Otherwise, the default value is returned.
303 *
304 * @param array The array.
305 * @param index The index of the array element to retrieve.
306 * @param DefaultValue The default value to use if the index is invalid
307 * or the element's value cannot be converted.
308 * @return The element value.
309 */
310 UFUNCTION(
311 BlueprintCallable,
312 BlueprintPure,
313 Meta =
314 (DeprecatedFunction,
315 DeprecationMessage =
316 "GetFloat is deprecated for metadata arrays. Use GetValue instead."))
317 static float GetFloat(
318 UPARAM(ref) const FCesiumPropertyArray& array,
319 int64 index,
320 float DefaultValue = 0.0f);
321
322 /**
323 * Retrieves an element from the array and attempts to convert it to a 64-bit
324 * floating-point value.
325 *
326 * If the element is a single- or double-precision floating-point number, is
327 * is returned.
328 *
329 * If the element is an integer, it is converted to the closest representable
330 * double-precision floating-point number.
331 *
332 * If the element is a boolean, 0.0 is returned for false and 1.0 for true.
333 *
334 * If the element is a string and the entire string can be parsed as a
335 * number, the parsed value is returned. The string is parsed in a
336 * locale-independent way and does not support use of a comma or other
337 * character to group digits.
338 *
339 * Otherwise, the default value is returned.
340 *
341 * @param array The array.
342 * @param index The index of the array element to retrieve.
343 * @param DefaultValue The default value to use if the index is invalid
344 * or the element's value cannot be converted.
345 * @return The element value.
346 */
347 UFUNCTION(
348 BlueprintCallable,
349 BlueprintPure,
350 Meta =
351 (DeprecatedFunction,
352 DeprecationMessage =
353 "GetFloat64 is deprecated for metadata arrays. Use GetValue instead."))
354 static double GetFloat64(
355 UPARAM(ref) const FCesiumPropertyArray& array,
356 int64 index,
357 double DefaultValue);
358
359 /**
360 * Retrieves an element from the array and attempts to convert it to a string
361 * value.
362 *
363 * Numeric elements are converted to a string with `FString::Format`, which
364 * uses the current locale.
365 *
366 * Boolean elements are converted to "true" or "false".
367 *
368 * String elements are returned directly.
369 *
370 * @param Array The array.
371 * @param Index The index of the array element to retrieve.
372 * @param DefaultValue The default value to use if the index is invalid
373 * or the element's value cannot be converted.
374 * @return The element value.
375 */
376 UFUNCTION(
377 BlueprintCallable,
378 BlueprintPure,
379 Meta =
380 (DeprecatedFunction,
381 DeprecationMessage =
382 "GetString is deprecated for metadata arrays. Use GetValue instead."))
383 static FString GetString(
384 UPARAM(ref) const FCesiumPropertyArray& Array,
385 int64 Index,
386 const FString& DefaultValue = "");
387
388 PRAGMA_ENABLE_DEPRECATION_WARNINGS
389};
ECesiumMetadataTrueType_DEPRECATED
The type of a metadata property in EXT_feature_metadata.
ECesiumMetadataBlueprintType
The Blueprint type that can losslessly represent values of a given property.
Blueprint library functions for acting on an array value from a property in EXT_structural_metadata.
static ECesiumMetadataBlueprintType GetElementBlueprintType(UPARAM(ref) const FCesiumPropertyArray &array)
Gets the best-fitting Blueprints type for the elements of this array.
static FCesiumMetadataValue GetValue(UPARAM(ref) const FCesiumPropertyArray &Array, int64 Index)
Retrieves an element from the array as a FCesiumMetadataValue.
static FString ToString(UPARAM(ref) const FCesiumPropertyArray &Array)
Prints the contents of the array to a human-readable string in the format "[A, B, C,...
static int32 GetInteger(UPARAM(ref) const FCesiumPropertyArray &Array, int64 Index, int32 DefaultValue=0)
Retrieves an element from the array and attempts to convert it to a signed 32-bit integer value.
static int64 GetArraySize(UPARAM(ref) const FCesiumPropertyArray &Array)
Gets the number of elements in the array.
static double GetFloat64(UPARAM(ref) const FCesiumPropertyArray &array, int64 index, double DefaultValue)
Retrieves an element from the array and attempts to convert it to a 64-bit floating-point value.
static bool GetBoolean(UPARAM(ref) const FCesiumPropertyArray &Array, int64 Index, bool DefaultValue=false)
Retrieves an element from the array and attempts to convert it to a Boolean value.
static FCesiumMetadataValueType GetElementValueType(UPARAM(ref) const FCesiumPropertyArray &array)
Gets the true value type of the elements in the array.
static int64 GetInteger64(UPARAM(ref) const FCesiumPropertyArray &Array, int64 Index, int64 DefaultValue=0)
This function is deprecated.
static PRAGMA_DISABLE_DEPRECATION_WARNINGS ECesiumMetadataBlueprintType GetBlueprintComponentType(UPARAM(ref) const FCesiumPropertyArray &array)
Gets the best-fitting Blueprints type for the elements of this array.
static int64 GetSize(UPARAM(ref) const FCesiumPropertyArray &Array)
Gets the number of elements in the array.
static float GetFloat(UPARAM(ref) const FCesiumPropertyArray &array, int64 index, float DefaultValue=0.0f)
Retrieves an element from the array and attempts to convert it to a 32-bit floating-point value.
static FString GetString(UPARAM(ref) const FCesiumPropertyArray &Array, int64 Index, const FString &DefaultValue="")
Retrieves an element from the array and attempts to convert it to a string value.
static uint8 GetByte(UPARAM(ref) const FCesiumPropertyArray &Array, int64 Index, uint8 DefaultValue=0)
Retrieves an element from the array and attempts to convert it to an unsigned 8-bit integer value.
static ECesiumMetadataTrueType_DEPRECATED GetTrueComponentType(UPARAM(ref) const FCesiumPropertyArray &array)
Gets true type of the elements in the array.
Represents the true value type of a metadata value, akin to the property types in EXT_structural_meta...
A Blueprint-accessible wrapper for a glTF metadata value.
A Blueprint-accessible wrapper for an array value from 3D Tiles or glTF metadata.