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

                _currentFrame = _target.GetAnimFrame(_currentPage);

                numStartX.Value = _currentFrame.Start._x;
                numStartY.Value = _currentFrame.Start._y;
                numStartZ.Value = _currentFrame.Start._z;

                numEndX.Value = _currentFrame.End._x;
                numEndY.Value = _currentFrame.End._y;
                numEndZ.Value = _currentFrame.End._z;

                numSpotCut.Value    = _currentFrame.SpotCutoff;
                numSpotBright.Value = _currentFrame.SpotBright;
                numRefDist.Value    = _currentFrame.RefDist;
                numRefBright.Value  = _currentFrame.RefBright;

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

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

                listKeyframes.SelectedIndex = FindKeyframe(_currentPage);
            }
        }
        private void listKeyframes_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = listKeyframes.SelectedIndex;

            if (index >= 0)
            {
                LightAnimationFrame f = (LightAnimationFrame)listKeyframes.SelectedItem;
                numFrame.Value = f.Index + 1;
            }
        }
Exemplo n.º 3
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;
        }