func FieldRoot(kn Ki) Ki {
	var root Ki
	gotField := false
	kn.FuncUpParent(0, kn, func(k Ki, level int, d interface{}) bool {
		if !gotField {
			if k.IsField() {
				gotField = true
			}
			return Continue
		}
		if !k.IsField() {
			root = k
			return Break
		}
		return Continue
	})
	return root
}
////////////////////////////////////////////////////////////////
Fields
FieldRoot returns the field root object for this node -- the node that
owns the branch of the tree rooted in one of its fields -- i.e., the
first non-Field parent node after the first Field parent node -- can be
nil if no such thing exists for this node.
package ki
import (
	"fmt"
	"log"
	"reflect"
	"strings"
	"sync"
	"unsafe"
	"github.com/goki/ki/kit"
)
func InitNode(this Ki) {
	n := this.AsNode()
	this.ClearFlagMask(int64(UpdateFlagsMask))
	if n.Ths != this {
		n.Ths = this
		if !KiHasKiFields(n) {
			return
		}
		fnms := KiFieldNames(n)
		val := reflect.ValueOf(this).Elem()
		for _, fnm := range fnms {
			fldval := val.FieldByName(fnm)
			fk := kit.PtrValue(fldval).Interface().(Ki)
			fk.SetFlag(int(IsField))
			fk.InitName(fk, fnm)
			SetParent(fk, this)
		}
	}
}
func ThisCheck(k Ki) error {
	if k.This() == nil {
		err := fmt.Errorf("Ki Node %v ThisCheck: node has null 'this' pointer -- must call Init or InitName on root nodes!", k.Name())
		log.Print(err)
		return err
	}
	return nil
}
func SetParent(kid Ki, parent Ki) {
	n := kid.AsNode()
	n.Par = parent
	if parent != nil && !parent.OnlySelfUpdate() {
		parup := parent.IsUpdating()
		n.FuncDownMeFirst(0, nil, func(k Ki, level int, d interface{}) bool {
			k.SetFlagState(parup, int(Updating))
			return true
		})
	}
}
func MoveToParent(kid Ki, parent Ki) {
	oldPar := kid.Parent()
	if oldPar != nil {
		SetParent(kid, nil)
		oldPar.DeleteChild(kid, false)
	}
	parent.AddChild(kid)
}
func IsRoot(k Ki) bool {
	if k.This() == nil || k.Parent() == nil || k.Parent().This() == nil {
		return true
	}
	return false
}
func Root(k Ki) Ki {
	if IsRoot(k) {
		return k.This()
	}
	return Root(k.Parent())
}
func Depth(kn Ki) int {
	return kn.AsNode().depth
}
func SetDepth(kn Ki, depth int) {
	kn.AsNode().depth = depth
}
func UpdateReset(kn Ki) {
	if kn.OnlySelfUpdate() {
		kn.ClearFlag(int(Updating))
	} else {
		kn.FuncDownMeFirst(0, nil, func(k Ki, level int, d interface{}) bool {
			k.ClearFlag(int(Updating))
			return true
		})
	}
}