Class: OpenUSD::Reference

Inherits:
Object
  • Object
show all
Defined in:
lib/openusd/value.rb

Overview

A layer reference and optional target prim.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(asset_path = nil, prim_path = nil) ⇒ Reference

Returns a new instance of Reference.

Raises:



66
67
68
69
70
71
72
73
74
75
76
# File 'lib/openusd/value.rb', line 66

def initialize(asset_path = nil, prim_path = nil)
  if asset_path.is_a?(Path) && prim_path.nil?
    prim_path = asset_path
    asset_path = nil
  end
  raise OpenUSD::TypeError, "a reference requires an asset path or prim path" if asset_path.nil? && prim_path.nil?

  @asset_path = normalize_asset_path(asset_path)
  @prim_path = prim_path.nil? ? nil : Path.parse(prim_path)
  freeze
end

Instance Attribute Details

#asset_pathObject (readonly)

Returns the value of attribute asset_path.



56
57
58
# File 'lib/openusd/value.rb', line 56

def asset_path
  @asset_path
end

#prim_pathObject (readonly)

Returns the value of attribute prim_path.



56
57
58
# File 'lib/openusd/value.rb', line 56

def prim_path
  @prim_path
end

Class Method Details

.internal(prim_path) ⇒ Reference

Build an internal reference to a prim in the same layer stack.

Returns:



61
62
63
# File 'lib/openusd/value.rb', line 61

def internal(prim_path)
  new(nil, prim_path)
end

Instance Method Details

#==(other) ⇒ Object

Compare asset and target paths.



84
85
86
# File 'lib/openusd/value.rb', line 84

def ==(other)
  other.is_a?(self.class) && asset_path == other.asset_path && prim_path == other.prim_path
end

#internal?Boolean

Whether this reference targets the current layer stack.

Returns:

  • (Boolean)


79
80
81
# File 'lib/openusd/value.rb', line 79

def internal?
  asset_path.nil?
end