Ejemplo n.º 1
0
	public bool CanLinkCleanly(HamTimelineNode parent, HamTimelineNode child, int i = 0)
	{
		int formerChildID = parent.GetDescendant(i);
		if (formerChildID == InvalidID) { return true; }
		return (child.GetFreeDescendantSlot() != -1);
	}
Ejemplo n.º 2
0
	public void LinkNodes(HamTimelineNode parent, HamTimelineNode child, int i = 0)
	{
		// Check for previous linkage
		int formerChildID = parent.GetDescendant(i);
		if (formerChildID != InvalidID)
		{
			HamTimelineNode formerChild = this.Nodes[formerChildID];

			// Remove former linkage
			formerChild.PreviousNodeIDs.Remove(parent.ID);

			// Set former child's parentage to the new child
			int slot = child.GetFreeDescendantSlot();
			child.SetDescendant(formerChild.ID, slot);
			formerChild.PreviousNodeIDs.Add(child.ID);
		}

		// Set new child's parentage and overwrite parent linkage
		parent.SetDescendant(child.ID, i);
		child.PreviousNodeIDs.Add(parent.ID);

		this.NodeLinkageDirty = true;
		SanityCheck();
	}