engine: autogroup, traits, graph: Extend autogroup API

This extends the autogrouping API so that a child can easily get a
reference to the parent that it is autogrouped in. This can simplify the
API for some resources when it makes sense to allow them access to the
parent handle. Use sparingly and intelligently!
This commit is contained in:
James Shubin
2024-03-20 17:37:45 -04:00
parent 6347e275d3
commit 8a78907977
5 changed files with 29 additions and 4 deletions

View File

@@ -121,6 +121,7 @@ func (obj *wrappedGrouper) VertexMerge(v1, v2 pgraph.Vertex) (v pgraph.Vertex, e
if err = r1.GroupRes(r2); err != nil { // GroupRes skips stupid groupings
return // return early on error
}
r2.SetParent(r1) // store who my parent is
// merging two resources into one should yield the sum of their semas
if semas := r2.MetaParams().Sema; len(semas) > 0 {