Cesium for Unreal 2.13.2
Loading...
Searching...
No Matches
CesiumPropertyArrayBlueprintLibrary.h
Go to the documentation of this file.
1// Copyright 2020-2024 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 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 PRAGMA_DISABLE_DEPRECATION_WARNINGS
77 /**
78 * Gets the best-fitting Blueprints type for the elements of this array.
79 *
80 * @param array The array.
81 */
82 UFUNCTION(
83 BlueprintCallable,
84 BlueprintPure,
85 Meta =
86 (DeprecatedFunction,
87 DeprecationMessage = "Use GetElementBlueprintType instead."))
89 GetBlueprintComponentType(UPARAM(ref) const FCesiumPropertyArray& array);
90
91 /**
92 * Gets true type of the elements in the array. Many of these types are not
93 * accessible from Blueprints, but can be converted to a Blueprint-accessible
94 * type.
95 *
96 * @param array The array.
97 */
98 UFUNCTION(
99 BlueprintCallable,
100 BlueprintPure,
101 Meta =
102 (DeprecatedFunction,
103 DeprecationMessage =
104 "CesiumMetadataTrueType is deprecated. Use GetElementValueType instead."))
106 GetTrueComponentType(UPARAM(ref) const FCesiumPropertyArray& array);
107
108 /**
109 * Gets the number of elements in the array. Returns 0 if the elements have
110 * an unknown type.
111 *
112 * @param Array The array.
113 * @return The number of elements in the array.
114 */
115 UFUNCTION(
116 BlueprintCallable,
117 BlueprintPure,
118 Meta =
119 (DeprecatedFunction,
120 DeprecationMessage = "Use GetArraySize instead."))
121 static int64 GetSize(UPARAM(ref) const FCesiumPropertyArray& Array);
122
123 /**
124 * Retrieves an element from the array and attempts to convert it to a Boolean
125 * value.
126 *
127 * If the element is boolean, it is returned directly.
128 *
129 * If the element is numeric, zero is converted to false, while any other
130 * value is converted to true.
131 *
132 * If the element is a string, "0", "false", and "no" (case-insensitive) are
133 * converted to false, while "1", "true", and "yes" are converted to true.
134 * All other strings, including strings that can be converted to numbers,
135 * will return the default value.
136 *
137 * Other types of elements will return the default value.
138 *
139 * @param Array The array.
140 * @param Index The index of the array element to retrieve.
141 * @param DefaultValue The default value to use if the index is invalid
142 * or the element's value cannot be converted.
143 * @return The element value.
144 */
145 UFUNCTION(
146 BlueprintCallable,
147 BlueprintPure,
148 Meta =
149 (DeprecatedFunction,
150 DeprecationMessage =
151 "GetBoolean is deprecated for metadata arrays. Use GetValue instead."))
152 static bool GetBoolean(
153 UPARAM(ref) const FCesiumPropertyArray& Array,
154 int64 Index,
155 bool DefaultValue = false);
156
157 /**
158 * Retrieves an element from the array and attempts to convert it to an
159 * unsigned 8-bit integer value.
160 *
161 * If the element is an integer and between 0 and 255, it is returned
162 * directly.
163 *
164 * If the element is a floating-point number, it is truncated (rounded
165 * toward zero).
166 *
167 * If the element is a boolean, 0 is returned for false and 1 for true.
168 *
169 * If the element is a string and the entire string can be parsed as an
170 * integer between 0 and 255, the parsed value is returned. The string is
171 * parsed in a locale-independent way and does not support use of a comma or
172 * other character to group digits.
173 *
174 * Otherwise, the default value is returned.
175 *
176 * @param Array The array.
177 * @param Index The index of the array element to retrieve.
178 * @param DefaultValue The default value to use if the index is invalid
179 * or the element's value cannot be converted.
180 * @return The element value.
181 */
182 UFUNCTION(
183 BlueprintCallable,
184 BlueprintPure,
185 Meta =
186 (DeprecatedFunction,
187 DeprecationMessage =
188 "GetByte is deprecated on arrays. Use GetValue instead."))
189 static uint8 GetByte(
190 UPARAM(ref) const FCesiumPropertyArray& Array,
191 int64 Index,
192 uint8 DefaultValue = 0);
193
194 /**
195 * Retrieves an element from the array and attempts to convert it to a signed
196 * 32-bit integer value.
197 *
198 * If the element is an integer and between -2,147,483,647 and 2,147,483,647,
199 * it is returned directly.
200 *
201 * If the element is a floating-point number, it is truncated (rounded
202 * toward zero).
203 *
204 * If the element is a boolean, 0 is returned for false and 1 for true.
205 *
206 * If the element is a string and the entire string can be parsed as an
207 * integer in the valid range, the parsed value is returned. If it can be
208 * parsed as a floating-point number, the parsed value is truncated (rounded
209 * toward zero). In either case, the string is parsed in a locale-independent
210 * way and does not support use of a comma or other character to group digits.
211 *
212 * Otherwise, the default value is returned.
213 *
214 * @param Array The array.
215 * @param Index The index of the array element to retrieve.
216 * @param DefaultValue The default value to use if the index is invalid
217 * or the element's value cannot be converted.
218 * @return The element value.
219 */
220 UFUNCTION(
221 BlueprintCallable,
222 BlueprintPure,
223 Meta =
224 (DeprecatedFunction,
225 DeprecationMessage =
226 "GetInteger is deprecated for metadata arrays. Use GetValue instead."))
227 static int32 GetInteger(
228 UPARAM(ref) const FCesiumPropertyArray& Array,
229 int64 Index,
230 int32 DefaultValue = 0);
231
232 /**
233 * This function is deprecated. Use Cesium > Metadata > Property Array >
234 * GetValue instead.
235 *
236 * Retrieves an element from the array and attempts to convert it to a signed
237 * 64-bit integer value.
238 *
239 * If the element is an integer and between -2^63-1 and 2^63-1, it is returned
240 * directly.
241 *
242 * If the element is a floating-point number, it is truncated (rounded
243 * toward zero).
244 *
245 * If the element is a boolean, 0 is returned for false and 1 for true.
246 *
247 * If the element is a string and the entire string can be parsed as an
248 * integer in the valid range, the parsed value is returned. If it can be
249 * parsed as a floating-point number, the parsed value is truncated (rounded
250 * toward zero). In either case, the string is parsed in a locale-independent
251 * way and does not support use of a comma or other character to group digits.
252 *
253 * Otherwise, the default value is returned.
254 *
255 * @param Array The array.
256 * @param Index The index of the array element to retrieve.
257 * @param DefaultValue The default value to use if the index is invalid
258 * or the element's value cannot be converted.
259 * @return The element value.
260 */
261 UFUNCTION(
262 BlueprintCallable,
263 BlueprintPure,
264 Meta =
265 (DeprecatedFunction,
266 DeprecationMessage =
267 "GetInteger64 is deprecated for metadata arrays. Use GetValue instead."))
268 static int64 GetInteger64(
269 UPARAM(ref) const FCesiumPropertyArray& Array,
270 int64 Index,
271 int64 DefaultValue = 0);
272
273 /**
274 * Retrieves an element from the array and attempts to convert it to a 32-bit
275 * floating-point value.
276 *
277 * If the element is a single-precision floating-point number, is is returned.
278 *
279 * If the element is an integer or double-precision floating-point number,
280 * it is converted to the closest representable single-precision
281 * floating-point number.
282 *
283 * If the element is a boolean, 0.0 is returned for false and 1.0 for true.
284 *
285 * If the element is a string and the entire string can be parsed as a
286 * number, the parsed value is returned. The string is parsed in a
287 * locale-independent way and does not support use of a comma or other
288 * character to group digits.
289 *
290 * Otherwise, the default value is returned.
291 *
292 * @param array The array.
293 * @param index The index of the array element to retrieve.
294 * @param DefaultValue The default value to use if the index is invalid
295 * or the element's value cannot be converted.
296 * @return The element value.
297 */
298 UFUNCTION(
299 BlueprintCallable,
300 BlueprintPure,
301 Meta =
302 (DeprecatedFunction,
303 DeprecationMessage =
304 "GetFloat is deprecated for metadata arrays. Use GetValue instead."))
305 static float GetFloat(
306 UPARAM(ref) const FCesiumPropertyArray& array,
307 int64 index,
308 float DefaultValue = 0.0f);
309
310 /**
311 * Retrieves an element from the array and attempts to convert it to a 64-bit
312 * floating-point value.
313 *
314 * If the element is a single- or double-precision floating-point number, is
315 * is returned.
316 *
317 * If the element is an integer, it is converted to the closest representable
318 * double-precision floating-point number.
319 *
320 * If the element is a boolean, 0.0 is returned for false and 1.0 for true.
321 *
322 * If the element is a string and the entire string can be parsed as a
323 * number, the parsed value is returned. The string is parsed in a
324 * locale-independent way and does not support use of a comma or other
325 * character to group digits.
326 *
327 * Otherwise, the default value is returned.
328 *
329 * @param array The array.
330 * @param index The index of the array element to retrieve.
331 * @param DefaultValue The default value to use if the index is invalid
332 * or the element's value cannot be converted.
333 * @return The element value.
334 */
335 UFUNCTION(
336 BlueprintCallable,
337 BlueprintPure,
338 Meta =
339 (DeprecatedFunction,
340 DeprecationMessage =
341 "GetFloat64 is deprecated for metadata arrays. Use GetValue instead."))
342 static double GetFloat64(
343 UPARAM(ref) const FCesiumPropertyArray& array,
344 int64 index,
345 double DefaultValue);
346
347 /**
348 * Retrieves an element from the array and attempts to convert it to a string
349 * value.
350 *
351 * Numeric elements are converted to a string with `FString::Format`, which
352 * uses the current locale.
353 *
354 * Boolean elements are converted to "true" or "false".
355 *
356 * String elements are returned directly.
357 *
358 * @param Array The array.
359 * @param Index The index of the array element to retrieve.
360 * @param DefaultValue The default value to use if the index is invalid
361 * or the element's value cannot be converted.
362 * @return The element value.
363 */
364 UFUNCTION(
365 BlueprintCallable,
366 BlueprintPure,
367 Meta =
368 (DeprecatedFunction,
369 DeprecationMessage =
370 "GetString is deprecated for metadata arrays. Use GetValue instead."))
371 static FString GetString(
372 UPARAM(ref) const FCesiumPropertyArray& Array,
373 int64 Index,
374 const FString& DefaultValue = "");
375
376 PRAGMA_ENABLE_DEPRECATION_WARNINGS
377};
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 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.
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 property in glTF metadata.