func UniqueNameCheckAll(kn Ki) bool {
	allunq := true
	kn.FuncDownMeFirst(0, nil, func(k Ki, level int, d interface{}) bool {
		unq := UniqueNameCheck(k)
		if !unq {
			allunq = false
			return Break
		}
		return Continue
	})
	return allunq
}
UniqueNameCheckAll checks entire tree from given node,
if all the children names are unique or not.
returns true if all names are unique; false if not
if not unique, call UniquifyNames or take other steps to ensure uniqueness.
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
		})
	}
}
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
}
func KiFieldOffs(n *Node) []uintptr {
	if n.fieldOffs != nil {
		return n.fieldOffs
	}
	tprops := *kit.Types.Properties(Type(n.This()), true)  
	if foff, ok := kit.TypeProp(tprops, "__FieldOffs"); ok {
		n.fieldOffs = foff.([]uintptr)
		return n.fieldOffs
	}
	foff, _ := KiFieldsInit(n)
	return foff
}
func KiHasKiFields(n *Node) bool {
	if n.HasFlag(int(HasKiFields)) {
		return true
	}
	if n.HasFlag(int(HasNoKiFields)) {
		return false
	}
	foffs := KiFieldOffs(n)
	if len(foffs) == 0 {
		n.SetFlag(int(HasNoKiFields))
		return false
	}
	n.SetFlag(int(HasKiFields))
	return true
}
func NumKiFields(n *Node) int {
	if !KiHasKiFields(n) {
		return 0
	}
	foffs := KiFieldOffs(n)
	return len(foffs)
}
func KiField(n *Node, idx int) Ki {
	if !KiHasKiFields(n) {
		return nil
	}
	foffs := KiFieldOffs(n)
	if idx >= len(foffs) || idx < 0 {
		return nil
	}
	fn := (*Node)(unsafe.Pointer(uintptr(unsafe.Pointer(n)) + foffs[idx]))
	return fn.This()
}
func KiFieldByName(n *Node, name string) Ki {
	if !KiHasKiFields(n) {
		return nil
	}
	foffs := KiFieldOffs(n)
	op := uintptr(unsafe.Pointer(n))
	for _, fo := range foffs {
		fn := (*Node)(unsafe.Pointer(op + fo))
		if fn.Nm == name {
			return fn.This()
		}
	}
	return nil
}
func KiFieldNames(n *Node) []string {
	tprops := *kit.Types.Properties(Type(n.This()), true)  
	if fnms, ok := kit.TypeProp(tprops, "__FieldNames"); ok {
		return fnms.([]string)
	}
	_, fnm := KiFieldsInit(n)
	return fnm
}
func KiFieldsInit(n *Node) (foff []uintptr, fnm []string) {
	foff = make([]uintptr, 0)
	fnm = make([]string, 0)
	kitype := KiType
	FlatFieldsValueFunc(n.This(), func(stru interface{}, typ reflect.Type, field reflect.StructField, fieldVal reflect.Value) bool {
		if fieldVal.Kind() == reflect.Struct && kit.EmbedImplements(field.Type, kitype) {
			foff = append(foff, field.Offset)
			fnm = append(fnm, field.Name)
		}
		return true
	})
	tprops := *kit.Types.Properties(Type(n), true)  
	kit.SetTypeProp(tprops, "__FieldOffs", foff)
	n.fieldOffs = foff
	kit.SetTypeProp(tprops, "__FieldNames", fnm)
	return
}
func FieldByName(kn Ki, field string) interface{} {
	return kit.FlatFieldInterfaceByName(kn.This(), field)
}
func FieldByNameTry(kn Ki, field string) (interface{}, error) {
	fld := FieldByName(kn, field)
	if fld != nil {
		return fld, nil
	}
	return nil, fmt.Errorf("ki %v: field named: %v not found", kn.Path(), field)
}
func FieldTag(kn Ki, field, tag string) string {
	return kit.FlatFieldTag(Type(kn.This()), field, tag)
}
func UniqueNameCheck(k Ki) bool {
	kk := *k.Children()
	sz := len(kk)
	nmap := make(map[string]struct{}, sz)
	for _, child := range kk {
		if child == nil {
			continue
		}
		nm := child.Name()
		_, hasnm := nmap[nm]
		if hasnm {
			return false
		}
		nmap[nm] = struct{}{}
	}
	return true
}