Resolve every into a single self-contained tree. gym-aloha (and many MJCF models) split a robot across fragments rooted in , including files referenced from inside . Unreal's importer must see one flat document so all /<compi
(root, root_dir: Path)
| 201 | |
| 202 | |
| 203 | def flatten_includes(root, root_dir: Path): |
| 204 | """Resolve every <include> into a single self-contained <mujoco> tree. |
| 205 | |
| 206 | gym-aloha (and many MJCF models) split a robot across <include> fragments |
| 207 | rooted in <mujocoinclude>, including files referenced from inside <worldbody>. |
| 208 | Unreal's importer must see one flat document so all <asset>/<compiler>/body |
| 209 | content is visible and there is exactly one worldbody. Returns the new root |
| 210 | element (a <mujoco>). No-op-equivalent for files without includes. |
| 211 | """ |
| 212 | md, txd, ad = _compiler_dirs(root) |
| 213 | visited = set() |
| 214 | new_root = ET.Element("mujoco", dict(root.attrib)) |
| 215 | for child in list(root): |
| 216 | _append_expanded(new_root, child, root_dir, root_dir, md, txd, ad, visited) |
| 217 | return new_root |
| 218 | |
| 219 | |
| 220 | def materialize_inline_meshes(root, mesh_base: Path) -> int: |
no test coverage detected