A fix for #16 is to just remove all KiField support entirely.
KiField exists to support multiple different "families" (step children), which is really useful for the giv.TreeView which has "proper" children that are the other tree nodes (which thus remain in 1-to-1 correspondence with the tree structure being represented), but it also has widget "Parts" children. Putting the Parts in a separate container solves this problem. It is also conceivable that other container-like widgets (e.g., Frames) might need some part elements too.
To be consistent, all GoGi Widget parts are managed via the Parts KiField. There is a lot of special code there for managing and styling the parts, etc, and it does seem to make sense overall to have these separated out from regular Children, which are generally supposed to be more generic & flexibly constructed, and could go down indefinitely deep etc.
The only places that KiFields are used:
-
FuncDown calls in node.go
-- it is fine for the node itself to call FuncDown on its Parts or other such KiFields manually, in the relevant function. This way it is explicit, and can be omitted where irrelevant, etc. The cost is an additional manual function call..
-
FindPath
where the path element has a '.' -- we can just add a FindPathField
interface method that gets called in this case, so it is up to the type to deal with it.
-
InitNode
in admin.go
-- this can be replaced with manual calls in OnInit
or OnAdd
, happening at the right time and place instead of automatically.
I'm pretty sure Parts is the main use-case for this, although a few other Ki-type fields were probably relying on the automatic InitNode calls.
Overall, this will be much simpler and cleaner, and the vast majority of cases don't need the KiFields so it just makes sense. There may be something overlooked here but there is only one way to find out..