Sharing a child between two nodes
Is it possible to make two SBStructuralNodeGroup share childs? I would like to have access in the document view to the childs at two points, like:
-- Model -- parent --child --child2 --child3 -- ... -- parent 2 --child
The child can be owned by only one of them, but I would like that parent 2 also has a reference to it and it is shown in the document view. Is it possible? Unfortunately SBNodeGroup is not a solution for me since I want the hierarchy to access next and previous nodes, and I would like the SBNodeGroups to be contained also in a hierarchy. Like:
My Group (with next/previous getters) -- sub group 1 -- "shared" child 1 -- sub group 2 -- sub group 3
Thank you and best regards,
Stephane last edited by
Hi Elisa, it's indeed not possible since a child can have only one parent. One possible workaround is to have the second potential parent to store a reference to the node, and expose the node as an attribute. You'll then see the referenced node in the inspector.
For example, let's say this referenced node is called "Target", you write an accessor
SBNode* MyNode::getTarget() constand you expose this attribute in the descriptor (where you expose functions, see https://documentation.samson-connect.net/developers/latest/page_introspection.html) with:
SB_ATTRIBUTE_READ_ONLY(SBNode*, MyNode, Target, "Target", "References");
By the way, maybe you mean SBStructuralGroup (to have groups and sub-groups in a structural model)? A SBNodeGroup is essentially a stored, named selection, and is not hierarchical.
I will try it with this.
Yes, I meant SBStructuralGroup :)