Skip to main content

Module simulation_assets

Module simulation_assets 

Source
Expand description

Layout convention for where a scaffolded project’s bundled demo simulation images live under <project>/assets/images/ (asset layout consolidation follow-up to the “unsupported content tyoe” MuJoCo crash fix).

Two independent places need to agree on this exact convention so a scaffolded project ends up with exactly one copy of each bundled demo image, never a silently duplicated one under simulation/environments/<env>/assets/...:

  • scripts/release/build/package-templates.sh, which stages the downloaded-templates tarball (statically, from packages/mecha10-templates/templates/assets/) - the single template-resolution path mecha10 init copies from (LAB-2034).
  • mecha10_cli::handlers::init::rewrite_bundled_image_source_paths, which fixes up a copied environment.json’s type: "image" source fields to point at wherever the tarball above actually placed the file.

§The rule

  • An image referenced by exactly one bundled environment’s type: "image" objects is environment-specific: it lands at assets/images/<env_name>/<basename>.
  • An image referenced by more than one bundled environment is shared: it lands at assets/images/<basename> directly - written/copied once, not once per environment.

As of this writing only basic_arena is bundled, so every one of its demo images (aiko.jpg/phoebe.jpg) lands in the env-specific tier at assets/images/basic_arena/. This module’s logic re-derives the tier from whatever set of environments is actually present, so a second bundled environment sharing one of these files would automatically start landing it in the shared tier.

A user’s own hand-authored image (e.g. dropped at assets/images/my_photo.jpg and referenced from their own edited environment.json) is untouched by any of this - it was never part of the bundled catalog, so it never appears in the references this module reasons about.

Functions§

bundled_image_project_path
Where a bundled demo image with the given basename, declared by env_name, belongs under a project’s canonical assets/images/ tree - see the module docs for the shared-vs-env-specific rule. referencing_env_count is the number of distinct environments that reference this basename (from count_referencing_environments).
count_referencing_environments
Count how many distinct environments reference each image basename, given every (environment_name, image_basename) pair found across a set of bundled environments’ type: "image" objects.