MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / _shapes_compatible

Function _shapes_compatible

Scripts/codegen/_codegen_core.py:339–355  ·  view source on GitHub ↗

True when ``ue_shape`` can legitimately back ``c_shape``. A ``TArray `` (array) is shape-compatible with a fixed-size C array (vec) because the codegen writes ``prop.Num()`` elements into the C array. Vec-to-vec requires the dim to match exactly. Scalar↔array always mismatches

(ue_shape: tuple, c_shape: tuple)

Source from the content-addressed store, hash-verified

337
338
339def _shapes_compatible(ue_shape: tuple, c_shape: tuple) -> bool:
340 """True when ``ue_shape`` can legitimately back ``c_shape``.
341
342 A ``TArray<X>`` (array) is shape-compatible with a fixed-size C
343 array (vec) because the codegen writes ``prop.Num()`` elements
344 into the C array.
345 Vec-to-vec requires the dim to match exactly.
346 Scalar↔array always mismatches. Opaque C shapes are skipped."""
347 if c_shape[0] == "opaque":
348 return True
349 if ue_shape[0] == c_shape[0]:
350 if ue_shape[0] == "vec":
351 return ue_shape[1] == c_shape[1]
352 return True
353 if ue_shape[0] == "array" and c_shape[0] == "vec":
354 return True
355 return False
356
357
358# ---------------------------------------------------------------------------

Callers 1

_check_type_shape_driftFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected