Class: OpenUSD::Relationship
- Inherits:
-
Object
- Object
- OpenUSD::Relationship
- Defined in:
- lib/openusd/relationship.rb
Overview
Composed relationship view on a Stage.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#prim ⇒ Object
readonly
Returns the value of attribute prim.
Instance Method Summary collapse
-
#add_target(path) ⇒ Relationship
Add one target in the edit target.
-
#initialize(prim, name) ⇒ Relationship
constructor
A new instance of Relationship.
-
#metadata ⇒ MetadataView
Composed, writable metadata.
-
#set_targets(paths) ⇒ Relationship
Replace targets in the edit target.
-
#targets ⇒ Array<Path>
Strongest authored targets.
Constructor Details
#initialize(prim, name) ⇒ Relationship
Returns a new instance of Relationship.
8 9 10 11 |
# File 'lib/openusd/relationship.rb', line 8 def initialize(prim, name) @prim = prim @name = name.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/openusd/relationship.rb', line 6 def name @name end |
#prim ⇒ Object (readonly)
Returns the value of attribute prim.
6 7 8 |
# File 'lib/openusd/relationship.rb', line 6 def prim @prim end |
Instance Method Details
#add_target(path) ⇒ Relationship
Add one target in the edit target.
20 21 22 23 24 |
# File 'lib/openusd/relationship.rb', line 20 def add_target(path) .add_target(path) prim.stage.invalidate! self end |
#metadata ⇒ MetadataView
Returns composed, writable metadata.
35 36 37 38 |
# File 'lib/openusd/relationship.rb', line 35 def values = opinions.reverse_each.with_object({}) { |opinion, result| result.merge!(opinion.) } MetadataView.new(values, writer: method(:write_metadata)) end |
#set_targets(paths) ⇒ Relationship
Replace targets in the edit target.
28 29 30 31 32 |
# File 'lib/openusd/relationship.rb', line 28 def set_targets(paths) .targets = paths prim.stage.invalidate! self end |
#targets ⇒ Array<Path>
Returns strongest authored targets.
14 15 16 |
# File 'lib/openusd/relationship.rb', line 14 def targets opinions.find(&:targets_authored?)&.targets || [] end |