Skip to content

Fix MjSpec zip includes, deep-copy attach assets, and WASM lifetimes - #3441

Open
Ayush7614 wants to merge 1 commit into
google-deepmind:mainfrom
Ayush7614:fix/mjspec-zip-attach-wasm-lifetime
Open

Fix MjSpec zip includes, deep-copy attach assets, and WASM lifetimes#3441
Ayush7614 wants to merge 1 commit into
google-deepmind:mainfrom
Ayush7614:fix/mjspec-zip-attach-wasm-lifetime

Conversation

@Ayush7614

@Ayush7614 Ayush7614 commented Jul 28, 2026

Copy link
Copy Markdown

Summary

  • MjSpec.from_zip now keeps sibling XML members and passes them as include= after selecting a non-included root XML (previously every .xml entry overwrote the root and includes were dropped).
  • Deep-copy attach prefixes mesh/texture file fields on the parent after attach, so in-memory assets resolve; the child stays reusable for later deep-copy attaches.
  • WASM: default MjvScene() initializes model = nullptr and returns empty views instead of null-dereferencing model-backed accessors; MjVFS destructor deletes the wrapper after mj_deleteVFS.

Distinct from #3104 / PR #3372 (those cover to_zip file-referenced assets). No existing issue claimed for these paths.

Test plan

  • from_zip still loads testdata/MJCF_Root.zip and MJCF_NoRoot.zip
  • New include-containing zip round-trips and compiles (test_from_zip_with_includes)
  • Deep-copy attach asset failure reproduced before the fix; regression test added (test_deepcopy_attach_renames_parent_asset_files) — needs CI Python bindings build
  • CI Python + WASM codegen checks on this PR

@google-cla

google-cla Bot commented Jul 28, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

from_zip now selects a root XML and passes sibling XML members as
includes; deep-copy attach prefixes mesh/texture files on the parent
instead of the child; default MjvScene no longer null-dereferences model
accessors; and MjVFS frees its wrapper allocation after mj_deleteVFS.
@Ayush7614
Ayush7614 force-pushed the fix/mjspec-zip-attach-wasm-lifetime branch from 2d5f33f to c191cfa Compare July 28, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant