/// <summary> /// TODO: test this, i think this doesnt work correctly. Objects seem to remain in the tree /// </summary> /// <param name="cullable"></param> public void RemoveCullable(ICullable cullable) { cullables.Remove(cullable); CullNode node = cullableContainingNodes[cullable]; node.RemoveCullable(cullableItemMap[cullable]); }
public void UpdateCullable(ICullable cullable) { CullNode oldNode = cullableContainingNodes[cullable]; CullNode newNode; //This check is cheatfix and this bug should be fixed if (oldNode == null) { newNode = null; } else { newNode = oldNode.FindEncapsulatingNodeUpwards(cullable); newNode = newNode.FindContainingNode(cullable); } if (newNode == null) { newNode = RootNode; } if (newNode == oldNode) { return; } cullableContainingNodes[cullable] = newNode; var item = cullableItemMap[cullable]; //This check is cheatfix and this bug should be fixed if (oldNode != null) { oldNode.RemoveCullable(item); } newNode.PlaceCullable(item); }