Hello
Currently I am aware of the following functions that affect the state of the node:
SetEnabled
SetDeepEnabled
ResetDeepEnabled
SetEnabledRecursive
Is there a reason why there needs to be 4 of them?
I found it very tricky to use it and keep a mental note on whats deep enabled or not.
In my own fork of urho3d I have modified SetEnabled to act recursively such that nodes beneath it preserve their state as “enabled” but their components are disabled following a recursive check performed on each SetEnabled call.
I noticed that after applying this change I didn’t have to use any other functions besides SetEnabled to control node state. I would want to consider providing this for other people to use however I am worried this might not go down well in terms of expected usage as old code would need to be adjusted. Personally I only had to adjust my own project code to reflect the changes ( removal of SetDeepEnabled and SetEnabledRecursive for SetEnabled ).
Is there any significant reason why accessible Deep state is preferred over a recursive SetEnabled?
By recursive I mean child nodes maintaining their Enabled state but the parent node sends a event down the chain updating the state of all its child nodes creating a “deep” state but this state is never accessible to the programmer and only adjusted by its parent node. This deep state is then used to determine if components are enabled or not.
so when you have a node tree like this:
Key:
“+” visible
“-” hidden
E enabled
D disabled
Start
E + NodeParent
_E + NodeChildA
_E + NodeChildB
NodeParent:SetEnabled(false)
D - NodeParent
_E - NodeChildA
_E - NodeChildB
NodeChildA:SetEnabled(false)
D - NodeParent
_D - NodeChildA
_E - NodeChildB
NodeParent:SetEnabled(true)
E + NodeParent
_D - NodeChildA
_E + NodeChildB
Similarly if you have a node tree with many parents:
NodeParentA:SetEnabled(false)
D - NodeParentA
_E - NodeParentB
__E - NodeBChildA
_E - NodeChildB
NodeParentA:SetEnabled(true)
E + NodeParentA
_E + NodeParentB
___E + NodeBChildA
_E + NodeChildB
NodeParentB:SetEnabled(false)
D + NodeParentA
_D - NodeParentB
___E - NodeBChildA
_E + NodeChildB