Skip to content

Fix ListPrims returning invalid path information#264

Closed
syoyo with Copilot wants to merge 4 commits into
releasefrom
copilot/fix-listprims-path-information
Closed

Fix ListPrims returning invalid path information#264
syoyo with Copilot wants to merge 4 commits into
releasefrom
copilot/fix-listprims-path-information

Conversation

Copilot AI commented Nov 20, 2025

Copy link
Copy Markdown
Contributor

ListPrims was returning Prims with <#INVALID#> paths because TraverseRec used prim.local_path() (reserved for composition, often unset) instead of the computed absolute path.

Changes

  • src/tydra/scene-access.cc: Updated TraverseRec and TraverseShaderRec to:

    • Use prim.absolute_path() when available (set by Stage::compute_absolute_prim_path_and_assign_prim_id())
    • Fall back to constructing path from prim.element_name() otherwise
  • tests/unit/unit-listprims.{h,cc}: Added unit test covering both scenarios (with/without computed absolute paths)

Example

// Before fix: returns <#INVALID#> paths
MeshMap meshes;
tinyusdz::tydra::ListPrims(stage, meshes);
for (const auto &mesh : meshes) {
    std::cout << mesh.first << "\n";  // Was: /#INVALID#/#INVALID#
}

// After fix: returns correct paths
// Output: /root/mesh0

The fix maintains backward compatibility for both file-loaded Stages (where absolute paths are computed automatically) and programmatically created Stages (where they may not be).

Original prompt

This section details on the original issue you should resolve

<issue_title>ListPrims not populating path information</issue_title>
<issue_description>Describe the bug
When calling ListPrims the prims returned all seem to have an <#INVALID#> path (absolute_path, local_path & element_path)

To Reproduce
Steps to reproduce the behavior:

  MeshMap meshes;
  tinyusdz::tydra::ListPrims(stage, meshes);
  for (const auto &mesh : meshes) {
    const tinyusdz::Prim &prim = *(mesh.second);
    std::cout << prim.element_name() << " : " << prim.absolute_path() << "\n";
  }  

Expected behavior
I'd expect to be able to access the path information.

But, perhaps I'm using it wrong?

Desktop (please complete the following information):

  • OS: Windows
  • latest build
    </issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes lighttransport/tinyusdz#263

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits November 20, 2025 01:18
Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com>
Updated TraverseRec and TraverseShaderRec functions to:
- Use prim.absolute_path() when it's valid and non-empty
- Fall back to constructing path from element_name() otherwise

This fixes the issue where ListPrims would return prims with
<#INVALID#> path information when absolute paths weren't set.

Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com>
- Added proper unit test in tests/unit/unit-listprims.cc
- Removed test binaries from git tracking
- Added test binaries to .gitignore
- All unit tests passing including new listprims_test

Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ListPrims not populating path information Fix ListPrims returning invalid path information Nov 20, 2025
Copilot AI requested a review from syoyo November 20, 2025 01:28
@syoyo syoyo closed this Nov 20, 2025
@syoyo
syoyo deleted the copilot/fix-listprims-path-information branch November 20, 2025 13:45
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.

2 participants