Skip to content

Composition in TinyUSDZ

Syoyo Fujita edited this page Oct 29, 2023 · 1 revision

W.I.P

Currently TinyUSDZ resolves nested composition in breadth-first manner.

for i = 0; i < kMaxIter:
  # solve subLayers
  # solve inherits
  # solve variants
  # solve references, payload
  # solve specializes

  if no unresolved composition item:
    break 

To support asset path correctly in breadth-first resolver , TinyUSDZ stores current working path(asset's base directory) and asset search path to each PrimSpec.

/build
  (workdir)
/test
  composition-001.usda
  /muda
    element.usda
    instance.usda
  /ari
    element.usda
    instance.usda
# composition-001.usda

#usda 1.0
def "bora" {
  
  def "dora" ( references = @./muda/element.usda@</Root> ) {
    # current working path = ../test/
  }

  def "jora" ( references = @./ari/element.usda@</Root> ) {
    # current working path = ../test/
  }
}

# muda/element.usda

#usda 1.0

def "Root" {
  def "item" ( payload = @./instance.usda@ ) {
    # current working path = ../test/muda/
  }  
  
}

# ari/element.usda

#usda 1.0

def "Root" {
  def "item" ( payload = @./instance.usda@ ) {
    # current working path = ../test/ari/
  }  
  
}

Clone this wiki locally