コード例 #1
0
        public unsafe SRT0TextureNode FindOrCreateEntry(string name, int index, bool ind)
        {
            foreach (SRT0EntryNode t in Children)
            {
                if (t.Name == name)
                {
                    int value = 0;
                    foreach (SRT0TextureNode x in t.Children)
                    {
                        if (x._textureIndex == value && x._indirect == ind)
                        {
                            return(x);
                        }
                    }

                    SRT0TextureNode child = new SRT0TextureNode(index, ind);
                    t.AddChild(child);
                    return(child);
                }
            }
            SRT0EntryNode entry = new SRT0EntryNode();

            entry.Name = name;
            AddChild(entry);
            SRT0TextureNode tex = new SRT0TextureNode(index, ind);

            entry.AddChild(tex);
            return(tex);
        }
コード例 #2
0
ファイル: SRT0Node.cs プロジェクト: KingAtreyu/super-sawndz
        internal unsafe SRT0TextureNode FindOrCreateEntry(string name, int index)
        {
            foreach (SRT0EntryNode t in Children)
            {
                if (t.Name == name)
                {
                    foreach (SRT0TextureNode n in t.Children)
                    {
                        if (n.TextureIndex == index)
                        {
                            return(n);
                        }
                    }
                    SRT0TextureNode child = new SRT0TextureNode(index)
                    {
                        _numFrames = _numFrames
                    };
                    t.AddChild(child);
                    return(child);
                }
            }
            SRT0EntryNode entry = new SRT0EntryNode();

            entry.Name = name;
            AddChild(entry);
            SRT0TextureNode tex = new SRT0TextureNode(index)
            {
                _numFrames = _numFrames
            };

            entry.AddChild(tex);
            return(tex);
        }
コード例 #3
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(SRT0Node external)
        {
            KeyframeEntry kfe;

            int origIntCount = FrameCount;

            FrameCount += external.FrameCount;

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

                        SRT0TextureNode newIntEntry = new SRT0TextureNode(extEntry.Index, extEntry.Indirect)
                        {
                            Name = extEntry.Name
                        };
                        newIntEntry.SetSize(extEntry.FrameCount + origIntCount, Loop);

                        for (int x = 0; x < extEntry.FrameCount; x++)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                if ((kfe = extEntry.GetKeyframe(i, x)) != null)
                                {
                                    newIntEntry.Keyframes.SetFrameValue(i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                                }
                            }
                        }
                        wi.AddChild(newIntEntry);
                    }
                    else
                    {
                        for (int x = 0; x < extEntry.FrameCount; x++)
                        {
                            for (int i = 0; i < 5; i++)
                            {
                                if ((kfe = extEntry.GetKeyframe(i, x)) != null)
                                {
                                    intEntry.Keyframes.SetFrameValue(i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #4
0
        public void AverageKeys(string matName, int index)
        {
            SRT0EntryNode w = FindChild(matName, false) as SRT0EntryNode;

            if (w == null)
            {
                return;
            }

            if (index < 0 || index >= w.Children.Count)
            {
                return;
            }

            SRT0TextureNode t = w.Children[index] as SRT0TextureNode;

            for (int i = 0; i < 5; i++)
            {
                if (t.Keyframes._keyArrays[i]._keyCount > 1)
                {
                    KeyframeEntry root = t.Keyframes._keyArrays[i]._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();
        }
コード例 #5
0
        public unsafe SRT0TextureNode FindOrCreateEntry(string name, int index, bool ind)
        {
            foreach (SRT0EntryNode t in Children)
                if (t.Name == name)
                {
                    int value = 0;
                    foreach (SRT0TextureNode x in t.Children)
                        if (x._textureIndex == value && x._indirect == ind)
                            return x;

                    SRT0TextureNode child = new SRT0TextureNode(index, ind) { _numFrames = _numFrames };
                    t.AddChild(child);
                    return child;
                }
            SRT0EntryNode entry = new SRT0EntryNode();
            entry.Name = name;
            AddChild(entry);
            SRT0TextureNode tex = new SRT0TextureNode(index, ind) { _numFrames = _numFrames };
            entry.AddChild(tex);
            return tex;
        }
コード例 #6
0
        /// <summary>
        /// Adds an animation to the end of this one
        /// </summary>
        public void Append(SRT0Node external)
        {
            KeyframeEntry kfe;

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

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

                        SRT0TextureNode newIntEntry = new SRT0TextureNode(_extEntry.Index, _extEntry.Indirect) { Name = _extEntry.Name };
                        newIntEntry._numFrames = _extEntry.FrameCount + origIntCount;
                        for (int x = 0; x < _extEntry.FrameCount; x++)
                            for (int i = 0x10; i < 0x19; i++)
                                if ((kfe = _extEntry.GetKeyframe((KeyFrameMode)i, x)) != null)
                                    newIntEntry.Keyframes.SetFrameValue((KeyFrameMode)i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                        wi.AddChild(newIntEntry);
                    }
                    else
                        for (int x = 0; x < _extEntry.FrameCount; x++)
                            for (int i = 0x10; i < 0x19; i++)
                                if ((kfe = _extEntry.GetKeyframe((KeyFrameMode)i, x)) != null)
                                    _intEntry.Keyframes.SetFrameValue((KeyFrameMode)i, x + origIntCount, kfe._value)._tangent = kfe._tangent;
                }
        }