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

@@ -93,6 +93,7 @@ func ResCopy(r CopyableRes) (CopyableRes, error) {
if !ok {
return nil, fmt.Errorf("resource wasn't groupable")
}
g2.SetParent(dst) // store who my parent is
grouped = append(grouped, g2)
}
dst.SetGroup(grouped)