tinyusdz icon indicating copy to clipboard operation
tinyusdz copied to clipboard

[USDA writer] Add option to print Path as relative Path

Open syoyo opened this issue 1 year ago • 0 comments

USD internally does not support relative Path. Path must be absolute Path in its internal representation and USDC(Crate) binary format.

When USDA is parsed, relative Paths are converted to absolute Path internally. (Precisely say, relative Path is all resolved to absolute and implicitly represented as absolute Path)

When printing USD in ASCII format(e.g. usdcat in pxrUSD, usda_parser in tinyusdz), path is printed as an absolute Path.

This makes a bit inconvenient when processing USD ascii in other tools(copy and paste USD scene in an editor, regex, ...).

It'd be nice to have an option in USDA printer to support printing Path as relative Path, for example

def "ari" {
}

def "bora" {
  rel myrel = </bora/dora>
  rel myrel2 = </ari>

  def "dora" {
    ....
  }
}

=> 

def "ari" {
}

def "bora" {
  rel myrel = <dora>
  rel myrel2 = <../ari>

  def "dora" {
    ....
  }
}

syoyo avatar Jun 20 '23 20:06 syoyo