Beispiel #1
0
		public void AddChild(DBObject child)
		{
			if(child == null)
			{
				throw new ArgumentException();
			}
			
			if(child == this || (child is Bone && (child as Bone).Contains(this)))
			{
				throw new ArgumentException("An Bone cannot be added as a child to itself or one of its children (or children's children, etc.)");
			}
			
			if(child.Parent!=null)
			{
				child.Parent.RemoveChild(child);
			}
			//_children.fixed = false;
			_children.Add(child);
			//_children.fixed = true;
			child.setParent(this);
			child.setArmature(this._armature);
			
			if(_slot==null && child is Slot)
			{
				_slot = child as Slot;
			}
		}
Beispiel #2
0
		public void RemoveChild(DBObject child)
		{
			if(child==null)
			{
				throw new ArgumentException();
			}
			
			int index = _children.IndexOf(child);
			if (index >= 0)
			{
				//_children.fixed = false;
				_children.RemoveAt(index);
				//_children.fixed = true;
				child.setParent(null);
				child.setArmature(null);
				
				if(child == _slot)
				{
					_slot = null;
				}
			}
			else
			{
				throw new ArgumentException();
			}
		}
Beispiel #3
0
		public bool Contains(DBObject child)
		{
			if(child == null)
			{
				throw new ArgumentException();
			}
			if(child == this)
			{
				return false;
			}
			DBObject ancestor = child;
			while (!(ancestor == this || ancestor == null))
			{
				ancestor = ancestor.Parent;
			}
			return ancestor == this;
		}