Skip to content

[MISC] Improve readability of entity and morph repr.#2956

Merged
duburcqa merged 2 commits into
Genesis-Embodied-AI:mainfrom
duburcqa:repr_brief_and_inline_morph
Jun 16, 2026
Merged

[MISC] Improve readability of entity and morph repr.#2956
duburcqa merged 2 commits into
Genesis-Embodied-AI:mainfrom
duburcqa:repr_brief_and_inline_morph

Conversation

@duburcqa

@duburcqa duburcqa commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Description

Two related fixes to the artist repr:

  1. repr_base brief no longer probes attributes (hasattr/getattr). Entities and indexed sub-objects own their _repr_brief. Heterogeneous entities now report their variant count (e.g. morph: 2 morph variants) instead of reading the ambiguous .morph property.
  2. File morphs no longer dump inline documents. When an MJCF/URDF is built in memory, the whole serialized document is stored in file; FileMorph/USD.__repr_name__ previously printed it verbatim in both the header and the field listing. They now show a bounded identifier, e.g. file='<inline probe>' for <mujoco model="probe">, so the morph keeps its identity without dumping the document. The identifier comes from a single polymorphic Morph._identifier() that _get_morph_identifier (entity naming) also delegates to, replacing the per-type isinstance chain. get_robot_name now accepts inline URDF content (matching get_model_name). Also fixes USD repr rendering file twice.

Related Issue

Follow-up surfaced while reviewing #2798 (heterogeneous-morph .morph access).

Motivation and Context

repr of a heterogeneous entity silently collapsed to its first morph, and repr of an in-memory MJCF/URDF morph dumped the entire XML into the terminal.

How Has This Been / Can This Be Tested?

pytest tests/test_misc.py::test_repr_does_not_crash - one scene packs a plane, primitive, file-based MJCF, inline MJCF, heterogeneous rigid, and kinematic entity plus a camera, then renders every repr/_repr_brief path and sanity-checks that a file morph shows its path while an inline one shows its parsed model name rather than the document. Entity-naming tests (test_urdf_mjcf_names_from_file, test_auto_and_user_names) confirm the _identifier consolidation preserves names.

Checklist:

  • I read the CONTRIBUTING document.
  • I followed the Submitting Code Changes section of CONTRIBUTING document.
  • I tagged the title correctly (including BUG FIX/FEATURE/MISC/BREAKING)
  • I updated the documentation accordingly or no change is needed.
  • I tested my changes and added instructions on how to test it for reviewers.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@duburcqa duburcqa requested a review from YilingQiao as a code owner June 16, 2026 14:42
@duburcqa duburcqa force-pushed the repr_brief_and_inline_morph branch 4 times, most recently from 81b0d44 to 822d424 Compare June 16, 2026 15:51
@duburcqa duburcqa changed the title [BUG FIX] Keep inline morph documents out of repr and make entity brief repr polymorphic [MISC] Improve readability of entity and morph repr Jun 16, 2026
@duburcqa duburcqa changed the title [MISC] Improve readability of entity and morph repr [MISC] Improve readability of entity and morph repr. Jun 16, 2026
@duburcqa duburcqa force-pushed the repr_brief_and_inline_morph branch from 822d424 to 000f749 Compare June 16, 2026 15:56
@duburcqa duburcqa merged commit 36fe292 into Genesis-Embodied-AI:main Jun 16, 2026
18 of 20 checks passed
@github-actions

Copy link
Copy Markdown

⚠️ Abnormal Benchmark Result Detected ➡️ Report

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