Beispiel #1
0
        public AnimationTreeData Load()
        {
            AnimationTreeData tree = null;

            if (!string.IsNullOrEmpty(XmlData))
            {
                try
                {
                    Skill.Framework.IO.XmlDocument document = new Framework.IO.XmlDocument();
                    document.LoadXml(XmlData);
                    tree = new AnimationTreeData();
                    tree.Load(document.FirstChild);
                }
                catch (System.Exception ex)
                {
                    tree = null;
                    Debug.LogException(ex, this);
                }
            }
            else
            {
                tree      = new AnimationTreeData();
                tree.Zoom = 1;
                tree.PanX = 0;
                tree.PanY = 0;
                Save(tree);
            }
            tree.Name     = this.name;
            tree.SkinMesh = (this.SkinMesh != null) ? this.SkinMesh.name : string.Empty;
            return(tree);
        }
Beispiel #2
0
 public static void Build(Skill.Editor.Animation.AnimationTreeData tree, string localDir, string name)
 {
     ValidateGenerator();
     _Generator.Reset();
     _Generator.Generate(tree);
     CreateFile(_Generator, localDir, name);
 }
 private void Rebuild()
 {
     _RefreshStyles = true;
     Clear();
     if (_Asset != null)
     {
         _AnimationTreeData = _Asset.Load();
     }
     if (_AnimationTreeData != null)
     {
         _Graph.Rebuild();
         _Parameters.Rebuild();
         _Profiles.Rebuild();
     }
 }
Beispiel #4
0
 public void Save(AnimationTreeData tree)
 {
     if (!this)
     {
         return;        // if deleted
     }
     if (tree == null)
     {
         return;
     }
     tree.Name = this.name;
     Skill.Framework.IO.XmlDocument document = new Framework.IO.XmlDocument();
     document.AppendChild(tree.ToXmlElement());
     XmlData = document.OuterXml;
     UnityEditor.EditorUtility.SetDirty(this);
 }
Beispiel #5
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);
            }
        }
Beispiel #6
0
        public static bool Compile(AnimationTreeData data, SkinMeshData skin)
        {
            _ErrorFound = false;
            _Tree       = data;
            _Skin       = skin;

            if (skin == null)
            {
                return(false);
            }

            CheckProfileErrors();
            CheckParameterErrors();
            CheckAnimNodeErrors();
            CheckUnusedAnimNodes();

            _Tree = null;
            _Skin = null;
            return(!_ErrorFound);
        }
Beispiel #7
0
        private void Build()
        {
            if (_Data.SkinMesh == null)
            {
                Debug.LogError("SkinMesh of AnimationTree is unasigned.");
                return;
            }

            SkinMeshData skin = _Data.SkinMesh.Load();

            if (skin != null)
            {
                AnimationTreeData data = _Data.Load();
                if (data != null)
                {
                    bool compiled = AnimationTreeCompiler.Compile(data, skin);
                    if (compiled)
                    {
                        Builder.Build(data, _Data.BuildPath, _Data.name);
                    }
                }
            }
        }
Beispiel #8
0
 internal ConnectionData(AnimationTreeData animationTree)
 {
     this._AnimationTree = animationTree;
 }