saphyr-rs / saphyr

Other
27 stars 3 forks source link

Expose Anchors #7

Open jakobhellermann opened 4 days ago

jakobhellermann commented 4 days ago

I'm parsing .unity yaml files, which contain multiple documents like this

--- !u!114 &71353
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}

where the &71353 is the id of the object.

As far as I can tell, the anchor is not exposed, right? The yaml_loader contains an anchor_map and doc_stack which contain anchor_ids but there's no way to get to that.

Ethiraric commented 4 days ago

The anchor is not exposed because it shouldn't be.

anchor names are a serialization detail and are discarded once composing is completed.

Unity should not convey any information in anchor names. Wouldn't be the first time they violate the spec anyway.

When I have enough time to invest in saphyr, I'll make another crate specifically for parsing unity things.