Implement USD Layer diff functionality and usddiff command-line tool

## Features Added

### Core diff-and-compare implementation:
- Complete rewrite of src/tydra/diff-and-compare.cc with full diff algorithm
- Hierarchical PrimSpec comparison (added/deleted/modified primitives)
- Property comparison for attributes and relationships
- Recursive traversal with depth limits for security
- Memory-safe implementation using standard containers

### Text and JSON output formats:
- DiffToText(): Unix diff-style output with +/- symbols
- DiffToJSON(): Structured JSON format for programmatic use
- Proper JSON escaping and formatting
- Sorted output for consistent results

### usddiff command-line tool:
- Full-featured CLI application in examples/usddiff/
- Support for --json and --help options
- USD file loading with error handling
- Support for all USD formats (.usd, .usda, .usdc, .usdz)
- Comprehensive documentation and usage examples

## Implementation Details

- Path-based diff organization using USD scene graph paths
- Efficient O(n log n) sorting for consistent output
- Configurable depth limits (default: 1M levels) for security
- Proper error handling and input validation
- CMake integration with TinyUSDZ build system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Syoyo Fujita
2025-08-21 03:21:43 +09:00
parent f5a961029b
commit f85b4664d3
6 changed files with 714 additions and 57 deletions

View File

@@ -1461,10 +1461,15 @@ if(TINYUSDZ_BUILD_EXAMPLES)
if (TINYUSDZ_WITH_TYDRA)
add_subdirectory(examples/tydra_api)
add_subdirectory(examples/tydra_to_renderscene)
add_subdirectory(examples/usddiff)
if (TINYUSDZ_WITH_MCP_SERVER)
add_subdirectory(examples/mcp_server)
endif()
if (TINYUSDZ_WITH_QJS)
add_subdirectory(examples/js-script)
endif()
endif ()
add_subdirectory(examples/api_tutorial)