Fixed MjSpec introspection with visual.rgba and visual.headlight. Added access to MjSpec.visual.global_.

This commit is contained in:
AaronYoung5
2024-12-14 07:47:24 -05:00
parent 644dfc7fb5
commit 0cf5500b6a
3 changed files with 24 additions and 1 deletions
@@ -227,8 +227,13 @@ def _binding_code(field: ast_nodes.StructFieldDecl, key: str) -> str:
if isinstance(field.type, ast_nodes.ValueType):
return _value_binding_code(field.type, key, field.name)
elif isinstance(field.type, ast_nodes.AnonymousStructDecl):
code = ""
if field.name in ['headlight', 'rgba']:
for subfield in field.type.fields:
code += _binding_code(subfield, 'mjVisual'+field.name.title())
field.type = ast_nodes.ValueType(name='mjVisual'+field.name.title())
return _value_binding_code(field.type, key, field.name)
code += _value_binding_code(field.type, key, field.name)
return code
elif isinstance(field.type, ast_nodes.PointerType):
return _ptr_binding_code(field.type, key, field.name)
elif isinstance(field.type, ast_nodes.ArrayType):