Ejemplo n.º 1
0
        public void SetFrame(int index)
        {
            if (index > _maxFrame || index < 0)
            {
                return;
            }

            index = TargetModel == null ? 0 : index;

            CurrentFrame = index;

            if (stPersonToolStripMenuItem.Checked && _scn0 != null && scn0Editor._camera != null)
            {
                SCN0CameraNode       c = scn0Editor._camera;
                CameraAnimationFrame f = c.GetAnimFrame(index - 1);
                Vector3 r = f.GetRotate(index, c.Type);
                Vector3 t = f.Pos;
                ModelPanel._camera.Reset();
                ModelPanel._camera.Translate(t._x, t._y, t._z);
                ModelPanel._camera.Rotate(r._x, r._y, r._z);
                ModelPanel._aspect = f.Aspect;
                ModelPanel._farZ   = f.FarZ;
                ModelPanel._nearZ  = f.NearZ;
                ModelPanel._fovY   = f.FovY;
                ModelPanel.OnResized();
            }

            pnlPlayback.btnNextFrame.Enabled = _animFrame < _maxFrame;
            pnlPlayback.btnPrevFrame.Enabled = _animFrame > 0;

            pnlPlayback.btnLast.Enabled  = _animFrame != _maxFrame;
            pnlPlayback.btnFirst.Enabled = _animFrame > 1;

            if (_animFrame <= pnlPlayback.numFrameIndex.Maximum)
            {
                pnlPlayback.numFrameIndex.Value = _animFrame;
            }

            if (!_playing)
            {
                if (InterpolationEditor != null && InterpolationEditor.Visible)
                {
                    InterpolationEditor.Frame = CurrentFrame;
                }
                KeyframePanel.numFrame_ValueChanged();
            }
        }
Ejemplo n.º 2
0
        public virtual void SetFrame(int index)
        {
            if (index < 0)
            {
                return;
            }

            NW4RAnimationNode node = TargetAnimation;
            int loopMax            = _maxFrame + (node != null && node.Loop && Interpolated.Contains(node.GetType()) ? 1 : 0);

            if (index > loopMax)
            {
                return;
            }

            CurrentFrame = index;

            if (PlaybackPanel != null)
            {
                if (PlaybackPanel.InvokeRequired)
                {
                    Action <int, int> d = new Action <int, int>(PlaybackPanel.UpdateInterface);
                    this.Invoke(d, new object[] { _animFrame, loopMax });
                }
                else
                {
                    PlaybackPanel.UpdateInterface(_animFrame, loopMax);
                }
            }

            if (!_playing)
            {
                if (InterpolationEditor != null && InterpolationEditor.Visible)
                {
                    InterpolationEditor.Frame = CurrentFrame;
                }

                if (KeyframePanel != null)
                {
                    KeyframePanel.numFrame_ValueChanged();
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void StopAnim()
        {
            if (!_playing && !_timer.IsRunning)
            {
                return;
            }

            _timer.Stop();

            _playing = false;

            if (DisableBonesWhenPlaying)
            {
                if (!_bonesWereOff)
                {
                    RenderBones = true;
                }

                _bonesWereOff = false;
            }

            if (PlaybackPanel != null)
            {
                if (PlaybackPanel.InvokeRequired)
                {
                    Action d = () => { PlaybackPanel.btnPlay.Text = "Play"; };
                    this.Invoke(d);
                }
                else
                {
                    PlaybackPanel.btnPlay.Text = "Play";
                }
            }

            EnableTransformEdit = true;

            if (InterpolationEditor != null && InterpolationEditor.Visible)
            {
                InterpolationEditor.Frame = CurrentFrame;
            }

            if (KeyframePanel != null)
            {
                KeyframePanel.numFrame_ValueChanged();
            }

            if (_capture)
            {
                RenderToGIF(_images, ScreenCaptureFolder);

                _images.Clear();
                _capture = false;

                if (InterpolationEditor != null)
                {
                    InterpolationEditor.Enabled = true;
                }

                ModelPanel.Enabled = true;
                Enabled            = true;
            }
        }