Example #1
0
 public override void CopyFrom(AnimNodeData other)
 {
     if (other.NodeType != this.NodeType)
     {
         return;
     }
     base.CopyFrom(other);
 }
Example #2
0
        public AnimNodeItem(AnimNodeData data)
        {
            this.Data = data;
            this.RowDefinitions.Add(TitleHeight, GridUnitType.Pixel);
            this.RowDefinitions.Add(1, GridUnitType.Star);

            _Border = new Box()
            {
                Row = 0, Column = 0, RowSpan = 2
            };
            this.Controls.Add(_Border);

            _Drag = new AnimNodeItemDragThumb(this)
            {
                Row = 0, Column = 0
            };
            this.Controls.Add(_Drag);

            _LblTitle = new Label()
            {
                Row = 0, Column = 0, Height = TitleHeight, VerticalAlignment = Framework.UI.VerticalAlignment.Center
            };
            this.Controls.Add(_LblTitle);

            _PnlItems = new StackPanel()
            {
                Row = 1, Column = 0, Orientation = Orientation.Vertical, Height = 20
            };
            this.Controls.Add(_PnlItems);
            _RefreshSyles = true;

            if (HasOutput)
            {
                CreateOutputConnector();
            }

            this.Header = data.Name;
            this.X      = Data.X;
            this.Y      = Data.Y;

            if (Data.Inputs != null)
            {
                for (int i = 0; i < Data.Inputs.Length; i++)
                {
                    if (string.IsNullOrEmpty(Data.Inputs[i].Name))
                    {
                        Data.Inputs[i].Name = "Input";
                    }
                    AddInputConnector(Data.Inputs[i].Name);
                }
            }

            this.ContextMenu = AnimNodeItemContextMenu.Instance;
        }
Example #3
0
        public override void CopyFrom(AnimNodeData other)
        {
            if (other.NodeType != this.NodeType)
            {
                return;
            }
            base.CopyFrom(other);
            AnimNodeBlendBaseData s = other as AnimNodeBlendBaseData;

            this.NewLayer = s.NewLayer;
        }
Example #4
0
 public override void CopyFrom(AnimNodeData other)
 {
     if (other.NodeType != this.NodeType)
     {
         return;
     }
     this.BlendTime = ((AnimNodeBlendByIndexData)other).BlendTime;
     this.Enum      = (string)((AnimNodeBlendByIndexData)other).Enum.Clone();
     this.Parameter = (string)((AnimNodeBlendByIndexData)other).Parameter.Clone();
     base.CopyFrom(other);
 }
Example #5
0
        public override void CopyFrom(AnimNodeData other)
        {
            if (other.NodeType != this.NodeType)
            {
                return;
            }
            base.CopyFrom(other);
            AnimNodeAdditiveBlendingData s = other as AnimNodeAdditiveBlendingData;

            this.Parameter = s.Parameter;
        }
Example #6
0
        public override void CopyFrom(AnimNodeData other)
        {
            if (other.NodeType != this.NodeType)
            {
                return;
            }
            base.CopyFrom(other);
            AnimNodeBlend1DData s = other as AnimNodeBlend1DData;

            this.Thresholds = (float[])s.Thresholds.Clone();
            this.Parameter  = s.Parameter;
        }
Example #7
0
        public override void CopyFrom(AnimNodeData other)
        {
            if (other.NodeType != this.NodeType)
            {
                return;
            }
            base.CopyFrom(other);
            AnimNodeBlend2DData s = other as AnimNodeBlend2DData;

            this.Thresholds = (Vector2Data[])s.Thresholds.Clone();
            this.Parameter1 = s.Parameter1;
            this.Parameter2 = s.Parameter2;
        }
Example #8
0
 private AnimNodeItem Find(AnimNodeData data)
 {
     foreach (var item in this._Panel.Controls)
     {
         if (item is AnimNodeItem)
         {
             if (((AnimNodeItem)item).Data == data)
             {
                 return((AnimNodeItem)item);
             }
         }
     }
     return(null);
 }
Example #9
0
 private static bool IsAnyNodeConnectedTo(AnimNodeData node)
 {
     if (_Tree.Connections != null)
     {
         foreach (ConnectionData connection in _Tree.Connections)
         {
             if (connection.End.Id == node.Id)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #10
0
        public override void CopyFrom(AnimNodeData other)
        {
            if (other.NodeType != this.NodeType)
            {
                return;
            }
            base.CopyFrom(other);
            AnimNodeSequenceData sequence = other as AnimNodeSequenceData;

            this.AnimationName  = sequence.AnimationName;
            this.Speed          = sequence.Speed;
            this.WrapMode       = sequence.WrapMode;
            this.UseTreeProfile = sequence.UseTreeProfile;
            this.Sync           = sequence.Sync;
        }
Example #11
0
        private void New(AnimNodeType type, Vector2 position)
        {
            position   -= _Panel.PanPosition;
            position   /= _Panel.ZoomFactor;
            position.x -= this.RenderArea.x;
            position.y -= this.RenderArea.y;

            AnimNodeData data = AnimationTreeData.CreateNode(type);

            if (data != null)
            {
                data.Name = GetUniqueName(string.Format("new{0}", type));
                data.X    = position.x;
                data.Y    = position.y;

                AnimNodeItem item = CreateItem(data);
                _Panel.Controls.Add(item);
            }
        }
Example #12
0
        private AnimNodeItem CreateItem(AnimNodeData data)
        {
            AnimNodeItem item = null;

            switch (data.NodeType)
            {
            case AnimNodeType.Sequence:
                item = new AnimNodeSequenceItem((AnimNodeSequenceData)data)
                {
                };
                break;

            case AnimNodeType.Override:
                item = new AnimNodeOverrideItem((AnimNodeOverrideData)data);
                break;

            case AnimNodeType.Blend1D:
                item = new AnimNodeBlend1DItem((AnimNodeBlend1DData)data);
                break;

            case AnimNodeType.Blend2D:
                item = new AnimNodeBlend2DItem((AnimNodeBlend2DData)data);
                break;

            case AnimNodeType.Additive:
                item = new AnimNodeAdditiveBlendingItem((AnimNodeAdditiveBlendingData)data);
                break;

            case AnimNodeType.BlendByIndex:
                item = new AnimNodeBlendByIndexItem((AnimNodeBlendByIndexData)data);
                break;

            case AnimNodeType.Root:
                item = new AnimationTreeRootItem((AnimationTreeRootData)data);
                break;
                //case AnimNodeType.SubTree:
                //    item = new AnimNodeSubTreeItem((AnimNodeSubTreeData)data);
                //    break;
            }
            return(item);
        }
Example #13
0
        public virtual void CopyFrom(AnimNodeData other)
        {
            this.X              = other.X;
            this.Y              = other.Y;
            this.Id             = other.Id;
            this.BecameRelevant = other.BecameRelevant;
            this.CeaseRelevant  = other.CeaseRelevant;
            this.Comment        = other.Comment;
            this.Name           = (other.Name == null ? "" : other.Name);

            if (other.Inputs != null)
            {
                this.Inputs = new ConnectorData[other.Inputs.Length];
                for (int i = 0; i < other.Inputs.Length; i++)
                {
                    this.Inputs[i] = other.Inputs[i].Clone();
                }
            }
            else
            {
                this.Inputs = new ConnectorData[0];
            }
        }
Example #14
0
 public ConnectionData(AnimNodeData start, AnimNodeData end, int endConnectorIndex)
 {
     this.Start             = start;
     this.End               = end;
     this.EndConnectorIndex = endConnectorIndex;
 }