MCPcopy Create free account
hub / github.com/cogentcore/core / Clone

Method Clone

tree/nodebase.go:696–702  ·  view source on GitHub ↗

Clone creates and returns a deep copy of the tree from this node down. Any pointers within the cloned tree will correctly point within the new cloned tree (see [Node.CopyFrom] for more information).

()

Source from the content-addressed store, hash-verified

694// Any pointers within the cloned tree will correctly point within the new
695// cloned tree (see [Node.CopyFrom] for more information).
696func (n *NodeBase) Clone() Node {
697 nc := n.NewInstance()
698 InitNode(nc)
699 nc.AsTree().SetName(n.Name)
700 nc.AsTree().CopyFrom(n.This)
701 return nc
702}
703
704// CopyFieldsFrom copies the fields of the node from the given node.
705// By default, it is [NodeBase.CopyFieldsFrom], which automatically does

Callers

nothing calls this directly

Calls 5

NewInstanceMethod · 0.95
InitNodeFunction · 0.85
SetNameMethod · 0.65
AsTreeMethod · 0.65
CopyFromMethod · 0.65

Tested by

no test coverage detected