Ejemplo n.º 1
0
        private void RefreshPage()
        {
            if (_target != null)
            {
                //_currentPage = (int)numFrame.Value - 1;

                _currentFrame = _target.GetAnimFrame(_currentPage);

                numScaleX.Value = _currentFrame.Scale._x;
                numScaleY.Value = _currentFrame.Scale._y;
                numRot.Value    = _currentFrame.Rotation;
                numTransX.Value = _currentFrame.Translation._x;
                numTransY.Value = _currentFrame.Translation._y;

                for (int i = 0; i < 5; i++)
                {
                    UpdateBox(i);
                }

                btnPrev.Enabled = _currentPage > 0;
                btnNext.Enabled = _currentPage < (_numFrames - 1);

                listKeyframes.SelectedIndex = FindKeyframe(_currentPage);
            }
        }
Ejemplo n.º 2
0
        public void SetKeyframeOnlyScale(int index, SRTAnimationFrame frame)
        {
            float *v = (float *)&frame.Scale;

            for (int i = 0; i < 2; i++)
            {
                SetKeyframe(i, index, *v++);
            }
        }
Ejemplo n.º 3
0
        public void SetKeyframeOnlyTrans(int index, SRTAnimationFrame frame)
        {
            float *v = (float *)&frame.Translation;

            for (int i = 3; i < 5; i++)
            {
                SetKeyframe(i, index, *v++);
            }
        }
Ejemplo n.º 4
0
        private void listKeyframes_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listKeyframes.SelectedIndex;

            if (index >= 0)
            {
                SRTAnimationFrame f = (SRTAnimationFrame)listKeyframes.SelectedItem;
                numFrame.Value = (decimal)(f.Index + 1);
            }
        }
Ejemplo n.º 5
0
        public TextureFrameState(SRTAnimationFrame frame, TexMatrixMode matrixMode, bool indirect)
        {
            _scale      = frame.Scale;
            _rotate     = frame.Rotation;
            _translate  = frame.Translation;
            _matrixMode = matrixMode;
            _flags      = 0;
            _indirect   = indirect;

            CalcTransforms();
        }
Ejemplo n.º 6
0
        public SRTAnimationFrame GetAnimFrame(int index)
        {
            SRTAnimationFrame frame = new SRTAnimationFrame()
            {
                Index = index
            };
            float *dPtr = (float *)&frame;

            for (int x = 0; x < 5; x++)
            {
                frame.SetBool(x, Keyframes.GetKeyframe(x, index) != null);
                *dPtr++ = GetFrameValue(x, index);
            }
            return(frame);
        }
Ejemplo n.º 7
0
        private void UpdateTarget()
        {
            listKeyframes.BeginUpdate();
            listKeyframes.Items.Clear();
            if (_target != null)
            {
                if (_target.FrameCount > 0)
                {
                    SRTAnimationFrame a = new SRTAnimationFrame();
                    bool check          = false;
                    for (int x = 0; x < _target.FrameCount; x++)
                    {
                        a       = _target.GetAnimFrame(x);
                        a.Index = x;
                        for (int i = 0; i < 5; i++)
                        {
                            if (_target.GetKeyframe(i, x) != null)
                            {
                                check = true;
                                a.SetBool(i, true);
                            }
                        }
                        if (check == true)
                        {
                            listKeyframes.Items.Add(a);
                            check = false;
                        }
                    }
                    //foreach (AnimationKeyframe f in _target.Keyframes.Keyframes)
                    //    listKeyframes.Items.Add(f);

                    _numFrames = _target.FrameCount;

                    _currentPage       = 0;
                    numFrame.Value     = 1;
                    numFrame.Maximum   = _numFrames;
                    lblFrameCount.Text = String.Format("/ {0}", _numFrames);
                }
                else
                {
                    numFrame.Value = 1;
                }
            }
            listKeyframes.EndUpdate();

            RefreshPage();
        }
Ejemplo n.º 8
0
        public void UpdateKeyframe(int x)
        {
            if (!Visible)
            {
                return;
            }

            _updating = true;
            if (_target is CHR0EntryNode || _target is SRT0TextureNode)
            {
                IKeyframeSource entry = _target as IKeyframeSource;
                for (int w = 0; w < listKeyframes.Items.Count; w++)
                {
                    if (_target is CHR0EntryNode)
                    {
                        CHRAnimationFrame a = (CHRAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            CHRAnimationFrame r = ((CHR0EntryNode)entry).GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }
                    else if (_target is SRT0TextureNode)
                    {
                        SRTAnimationFrame a = (SRTAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            SRTAnimationFrame r = ((SRT0TextureNode)entry).GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }
                }

                UpdateKeyframes();
            }
            else if (_target is SHP0VertexSetNode)
            {
                SHP0VertexSetNode entry = _target as SHP0VertexSetNode;
                int w = 0;
                foreach (FloatKeyframe a in listKeyframes.Items)
                {
                    if (a.Index == x)
                    {
                        KeyframeEntry e = entry.GetKeyframe(x);

                        if (e != null)
                        {
                            listKeyframes.Items[w] = new FloatKeyframe(e);
                        }
                        else
                        {
                            listKeyframes.Items.RemoveAt(w);
                        }

                        _updating = false;
                        return;
                    }
                    w++;
                }

                UpdateKeyframes();
            }
            else if (_target is SCN0EntryNode)
            {
                if (_target is SCN0CameraNode)
                {
                    SCN0CameraNode entry = _target as SCN0CameraNode;
                    for (int w = 0; w < listKeyframes.Items.Count; w++)
                    {
                        CameraAnimationFrame a = (CameraAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            CameraAnimationFrame r = entry.GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }

                    UpdateKeyframes();
                }
                else if (_target is SCN0LightNode)
                {
                    SCN0LightNode entry = _target as SCN0LightNode;
                    for (int w = 0; w < listKeyframes.Items.Count; w++)
                    {
                        LightAnimationFrame a = (LightAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            LightAnimationFrame r = entry.GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }

                    UpdateKeyframes();
                }
                else if (_target is SCN0FogNode)
                {
                    SCN0FogNode entry = _target as SCN0FogNode;
                    for (int w = 0; w < listKeyframes.Items.Count; w++)
                    {
                        FogAnimationFrame a = (FogAnimationFrame)listKeyframes.Items[w];
                        if (a.Index == x)
                        {
                            FogAnimationFrame r = entry.GetAnimFrame(x);

                            if (r.HasKeys)
                            {
                                listKeyframes.Items[w] = r;
                            }
                            else
                            {
                                listKeyframes.Items.RemoveAt(w);
                            }

                            _updating = false;
                            return;
                        }
                    }

                    UpdateKeyframes();
                }
            }
            _updating = false;
        }
Ejemplo n.º 9
0
 public void SetKeyframeOnlyRot(int index, SRTAnimationFrame frame)
 {
     SetKeyframe(2, index, frame.Rotation);
 }