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

Function _mjs_fields_for

Scripts/codegen/generate_ue_components.py:2091–2100  ·  view source on GitHub ↗

Pull the field-name set for a category's mjs_struct out of the mjspec snapshot. Returns empty set if snapshot is missing — codegen then falls back to using the raw schema attr name.

(cat_rules: Dict[str, Any], mjspec: Dict[str, Any] | None)

Source from the content-addressed store, hash-verified

2089 if ue_type.startswith("TArray"):
2090 if dim == 1:
2091 setup_lines.append(
2092 f" double {buf_name}[1] = {{ (bOverride_{ue_prop} && "
2093 f"{ue_prop}.Num() > 0) ? (double){ue_prop}[0] : {sentinel} }};"
2094 )
2095 else:
2096 inits = ", ".join(
2097 f"(bOverride_{ue_prop} && {ue_prop}.Num() > {i}) ? "
2098 f"(double){ue_prop}[{i}] : {sentinel}"
2099 for i in range(dim)
2100 )
2101 setup_lines.append(f" double {buf_name}[{dim}] = {{ {inits} }};")
2102 else:
2103 # Scalar UE type wrapped in a 1-element buffer (e.g. position.kv:float -> double[1]).

Callers 3

emit_subclass_filesFunction · 0.85
emit_multi_uclassFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected