Exemplo n.º 1
0
        public override void OnPopulate()
        {
            for (int i = 0; i < _indexCount; i++)
            {
                string name;
                if (_indices[i] < ((SHP0Node)Parent)._strings.Count && _indices[i] >= 0)
                {
                    name = ((SHP0Node)Parent)._strings[_indices[i]];
                }
                else
                {
                    name = "Unknown";
                }

                SHP0VertexSetNode n = new SHP0VertexSetNode(name);

                if (((_fixedFlags >> i) & 1) == 0)
                {
                    n.Initialize(this, new DataSource(Header->GetEntry(i), 0x14 + Header->_numIndices * 6));
                }
                else
                {
                    n._isFixed = true;
                    _children.Add(n);
                    n._parent = this;

                    n.Keyframes[0] = ((bfloat *)Header->EntryOffset)[i];
                }
            }
        }
Exemplo n.º 2
0
        public void CreateEntry()
        {
            SHP0VertexSetNode morph = new SHP0VertexSetNode(FindName("NewMorphTarget"));

            morph.isFixed = true;
            AddChild(morph);
        }
Exemplo n.º 3
0
        public void AverageKeys(string baseName, string morphName)
        {
            SHP0EntryNode w = FindChild(baseName, false) as SHP0EntryNode;

            if (w == null)
            {
                return;
            }

            SHP0VertexSetNode t = w.FindChild(morphName, false) as SHP0VertexSetNode;

            if (t == null)
            {
                return;
            }

            if (t.Keyframes._keyCount > 1)
            {
                KeyframeEntry root = t.Keyframes._keyRoot;
                if (root._next != root && root._prev != root && root._prev != root._next)
                {
                    float tan = (root._next._tangent + root._prev._tangent) / 2.0f;
                    float val = (root._next._value + root._prev._value) / 2.0f;

                    root._next._tangent = tan;
                    root._prev._tangent = tan;

                    root._next._value = val;
                    root._prev._value = val;
                }
            }

            SignalPropertyChange();
        }
Exemplo n.º 4
0
        public unsafe SHP0VertexSetNode FindOrCreateEntry(string name)
        {
            foreach (SHP0VertexSetNode t in Children)
            {
                if (t.Name == name)
                {
                    return(t);
                }
            }

            SHP0VertexSetNode entry = new SHP0VertexSetNode(name);

            AddChild(entry);
            return(entry);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(SHP0Node external)
        {
            KeyframeEntry kfe;

            int origIntCount = FrameCount;

            FrameCount += external.FrameCount;

            foreach (SHP0EntryNode w in external.Children)
            {
                foreach (SHP0VertexSetNode extEntry in w.Children)
                {
                    SHP0VertexSetNode intEntry = null;
                    if ((intEntry = (SHP0VertexSetNode)FindChild(w.Name + "/" + extEntry.Name, false)) == null)
                    {
                        SHP0EntryNode wi = null;
                        if ((wi = (SHP0EntryNode)FindChild(w.Name, false)) == null)
                        {
                            AddChild(wi = new SHP0EntryNode()
                            {
                                Name = FindName(null), _flags = w._flags
                            });
                        }

                        SHP0VertexSetNode newIntEntry = new SHP0VertexSetNode(extEntry.Name);
                        newIntEntry.SetSize(extEntry.FrameCount + origIntCount, Loop);
                        for (int x = 0; x < extEntry.FrameCount; x++)
                        {
                            if ((kfe = extEntry.GetKeyframe(x)) != null)
                            {
                                newIntEntry.Keyframes.SetFrameValue(x + origIntCount, kfe._value)._tangent = kfe._tangent;
                            }
                        }
                        wi.AddChild(newIntEntry);
                    }
                    else
                    {
                        for (int x = 0; x < extEntry.FrameCount; x++)
                        {
                            if ((kfe = extEntry.GetKeyframe(x)) != null)
                            {
                                intEntry.Keyframes.SetFrameValue(x + origIntCount, kfe._value)._tangent = kfe._tangent;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        public unsafe SHP0VertexSetNode FindOrCreateEntry(string name)
        {
            foreach (SHP0VertexSetNode t in Children)
            {
                if (t.Name == name)
                {
                    return(t);
                }
            }

            SHP0VertexSetNode entry = new SHP0VertexSetNode(name)
            {
                _numFrames = ((SHP0Node)Parent).FrameCount
            };

            AddChild(entry);
            return(entry);
        }
Exemplo n.º 7
0
 public override void OnPopulate()
 {
     for (int i = 0; i < _indexCount; i++)
     {
         if ((_fixedFlags >> i & 1) == 0)
         {
             new SHP0VertexSetNode(_indices[i] < ((SHP0Node)Parent)._strings.Count ? ((SHP0Node)Parent)._strings[_indices[i]] : "Unknown").Initialize(this, new DataSource(Header->GetEntry(i), 0x14 + Header->_numIndices * 6));
         }
         else
         {
             SHP0VertexSetNode n = new SHP0VertexSetNode(_indices[i] < ((SHP0Node)Parent)._strings.Count ? ((SHP0Node)Parent)._strings[_indices[i]] : "Unknown")
             {
                 _isFixed = true
             };
             n.Keyframes[0] = ((bfloat *)Header->EntryOffset)[i];
             n._numFrames   = ((SHP0Node)Parent).FrameCount;
             _children.Add(n);
             n._parent = this;
         }
     }
 }
Exemplo n.º 8
0
 protected override void OnPopulate()
 {
     for (int i = 0; i < indexCount; i++)
     {
         if ((fixedFlags >> i & 1) == 0)
         {
             new SHP0VertexSetNode(_indices[i] < ((SHP0Node)Parent)._strings.Count ? ((SHP0Node)Parent)._strings[_indices[i]] : "Unknown").Initialize(this, new DataSource(Header->GetEntry(i), 0x14 + Header->_numIndices * 6));
         }
         else
         {
             SHP0VertexSetNode n = new SHP0VertexSetNode(_indices[i] < ((SHP0Node)Parent)._strings.Count ? ((SHP0Node)Parent)._strings[_indices[i]] : "Unknown")
             {
                 isFixed = true
             };
             n.Keyframes[KeyFrameMode.ScaleX, 0] = ((bfloat *)Header->EntryOffset)[i];
             n._numFrames = ((SHP0Node)Parent).FrameCount;
             //n.Parent = this;
             AddChild(n, false);
         }
     }
 }
Exemplo n.º 9
0
        public unsafe SHP0EntryNode FindOrCreateEntry(string name)
        {
            foreach (SHP0EntryNode t in Children)
            {
                if (t.Name == name)
                {
                    return(t);
                }
            }

            SHP0EntryNode entry = new SHP0EntryNode();

            entry.Name   = name;
            entry._flags = 3;
            AddChild(entry);
            SHP0VertexSetNode morph = new SHP0VertexSetNode(FindName("NewMorphTarget"));

            morph.isFixed = true;
            entry.AddChild(morph);
            return(entry);
        }
Exemplo n.º 10
0
        public unsafe SHP0VertexSetNode FindOrCreateEntry(string name)
        {
            foreach (SHP0VertexSetNode t in Children)
                if (t.Name == name)
                    return t;

            SHP0VertexSetNode entry = new SHP0VertexSetNode(name) { _numFrames = ((SHP0Node)Parent).FrameCount };
            AddChild(entry);
            return entry;
        }
Exemplo n.º 11
0
 public void CreateEntry()
 {
     SHP0VertexSetNode morph = new SHP0VertexSetNode(FindName("NewMorphTarget"));
     AddChild(morph);
 }
Exemplo n.º 12
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(SHP0Node external)
        {
            KeyframeEntry kfe;

            int origIntCount = FrameCount;
            FrameCount += external.FrameCount;

            foreach (SHP0EntryNode w in external.Children)
                foreach (SHP0VertexSetNode _extEntry in w.Children)
                {
                    SHP0VertexSetNode _intEntry = null;
                    if ((_intEntry = (SHP0VertexSetNode)FindChild(w.Name + "/" + _extEntry.Name, false)) == null)
                    {
                        SHP0EntryNode wi = null;
                        if ((wi = (SHP0EntryNode)FindChild(w.Name, false)) == null)
                            AddChild(wi = new SHP0EntryNode() { Name = FindName(null), _flags = w._flags });

                        SHP0VertexSetNode newIntEntry = new SHP0VertexSetNode(_extEntry.Name);
                        newIntEntry._numFrames = _extEntry.FrameCount + origIntCount;
                        for (int x = 0; x < _extEntry.FrameCount; x++)
                                if ((kfe = _extEntry.GetKeyframe(x)) != null)
                                    newIntEntry.Keyframes.SetFrameValue(x + origIntCount, kfe._value)._tangent = kfe._tangent;
                        wi.AddChild(newIntEntry);
                    }
                    else
                        for (int x = 0; x < _extEntry.FrameCount; x++)
                            if ((kfe = _extEntry.GetKeyframe(x)) != null)
                                _intEntry.Keyframes.SetFrameValue(x + origIntCount, kfe._value)._tangent = kfe._tangent;
                }
        }
Exemplo n.º 13
0
 public override void OnPopulate()
 {
     for (int i = 0; i < _indexCount; i++)
         if ((_fixedFlags >> i & 1) == 0)
             new SHP0VertexSetNode(_indices[i] < ((SHP0Node)Parent)._strings.Count ? ((SHP0Node)Parent)._strings[_indices[i]] : "Unknown").Initialize(this, new DataSource(Header->GetEntry(i), 0x14 + Header->_numIndices * 6));
         else
         {
             SHP0VertexSetNode n = new SHP0VertexSetNode(_indices[i] < ((SHP0Node)Parent)._strings.Count ? ((SHP0Node)Parent)._strings[_indices[i]] : "Unknown") { _isFixed = true };
             n.Keyframes[0] = ((bfloat*)Header->EntryOffset)[i];
             n._numFrames = ((SHP0Node)Parent).FrameCount;
             _children.Add(n);
             n._parent = this;
         }
 }