/// <summary> /// Called only when the animation frame or frame data changes /// </summary> public virtual void UpdatePropDisplay() { switch (TargetAnimType) { case NW4RAnimType.CHR: if (CHR0Editor != null) { TryInvoke(CHR0Editor, CHR0Editor.UpdatePropDisplay); } break; case NW4RAnimType.SRT: if (SRT0Editor != null) { TryInvoke(SRT0Editor, SRT0Editor.UpdatePropDisplay); } break; case NW4RAnimType.SHP: if (SHP0Editor != null) { TryInvoke(SHP0Editor, SHP0Editor.UpdatePropDisplay); } break; case NW4RAnimType.PAT: if (PAT0Editor != null) { TryInvoke(PAT0Editor, PAT0Editor.UpdatePropDisplay); } break; case NW4RAnimType.SCN: if (SCN0Editor != null) { TryInvoke(SCN0Editor, SCN0Editor.UpdatePropDisplay); } break; case NW4RAnimType.CLR: break; case NW4RAnimType.VIS: if (KeyframePanel != null) { if (KeyframePanel.InvokeRequired) { Action <int> d = new Action <int>(KeyframePanel.UpdateCurrentFrame); this.Invoke(d, new object[] { _animFrame }); } KeyframePanel.UpdateCurrentFrame(_animFrame); } break; } }
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(); } }
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(); } } }
private void InitializeComponent() { this.components = new System.ComponentModel.Container(); this.dlgOpen = new System.Windows.Forms.OpenFileDialog(); this.dlgSave = new System.Windows.Forms.SaveFileDialog(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.pnlKeyframes = new System.Windows.Forms.Panel(); this.spltBones = new System.Windows.Forms.Splitter(); this.pnlBones = new System.Windows.Forms.Panel(); this.lstBones = new System.Windows.Forms.CheckedListBox(); this.ctxBones = new System.Windows.Forms.ContextMenuStrip(this.components); this.boneIndex = new System.Windows.Forms.ToolStripMenuItem(); this.renameBoneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.chkAllBones = new System.Windows.Forms.CheckBox(); this.playLayer = new System.Windows.Forms.KeyframePanel(); this.keyLayer = new System.Windows.Forms.KeyframePanel(); this.bgLayer = new System.Windows.Forms.KeyframePanel(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.pnlKeyframes.SuspendLayout(); this.pnlBones.SuspendLayout(); this.ctxBones.SuspendLayout(); this.SuspendLayout(); // // pnlKeyframes // this.pnlKeyframes.AutoScroll = true; this.pnlKeyframes.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.pnlKeyframes.Controls.Add(this.spltBones); this.pnlKeyframes.Controls.Add(this.pnlBones); this.pnlKeyframes.Controls.Add(this.playLayer); this.pnlKeyframes.Controls.Add(this.keyLayer); this.pnlKeyframes.Controls.Add(this.bgLayer); this.pnlKeyframes.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlKeyframes.Location = new System.Drawing.Point(0, 0); this.pnlKeyframes.Name = "pnlKeyframes"; this.pnlKeyframes.Size = new System.Drawing.Size(376, 398); this.pnlKeyframes.TabIndex = 26; // // spltBones // this.spltBones.Location = new System.Drawing.Point(0, 0); this.spltBones.Name = "spltBones"; this.spltBones.Size = new System.Drawing.Size(3, 394); this.spltBones.TabIndex = 9; this.spltBones.TabStop = false; this.spltBones.Visible = false; // // pnlBones // this.pnlBones.Controls.Add(this.lstBones); this.pnlBones.Controls.Add(this.chkAllBones); this.pnlBones.Dock = System.Windows.Forms.DockStyle.Fill; this.pnlBones.Location = new System.Drawing.Point(0, 0); this.pnlBones.Name = "pnlBones"; this.pnlBones.Size = new System.Drawing.Size(372, 394); this.pnlBones.TabIndex = 10; // // lstBones // this.lstBones.BorderStyle = System.Windows.Forms.BorderStyle.None; this.lstBones.CausesValidation = false; this.lstBones.ContextMenuStrip = this.ctxBones; this.lstBones.Cursor = System.Windows.Forms.Cursors.Default; this.lstBones.Dock = System.Windows.Forms.DockStyle.Fill; this.lstBones.IntegralHeight = false; this.lstBones.Location = new System.Drawing.Point(0, 20); this.lstBones.Margin = new System.Windows.Forms.Padding(0); this.lstBones.Name = "lstBones"; this.lstBones.Size = new System.Drawing.Size(372, 374); this.lstBones.TabIndex = 8; this.lstBones.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lstBones_ItemCheck_1); this.lstBones.SelectedValueChanged += new System.EventHandler(this.lstBones_SelectedValueChanged_1); this.lstBones.KeyDown += new System.Windows.Forms.KeyEventHandler(this.lstBones_KeyDown_1); this.lstBones.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstBones_MouseDown); // // ctxBones // this.ctxBones.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.boneIndex, this.renameBoneToolStripMenuItem }); this.ctxBones.Name = "ctxBones"; this.ctxBones.Size = new System.Drawing.Size(153, 70); // // boneIndex // this.boneIndex.Enabled = false; this.boneIndex.Name = "boneIndex"; this.boneIndex.Size = new System.Drawing.Size(152, 22); this.boneIndex.Text = "Bone Index"; // // renameBoneToolStripMenuItem // this.renameBoneToolStripMenuItem.Name = "renameBoneToolStripMenuItem"; this.renameBoneToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.renameBoneToolStripMenuItem.Text = "Rename"; this.renameBoneToolStripMenuItem.Click += new System.EventHandler(this.renameBoneToolStripMenuItem_Click); // // chkAllBones // this.chkAllBones.Checked = true; this.chkAllBones.CheckState = System.Windows.Forms.CheckState.Checked; this.chkAllBones.Dock = System.Windows.Forms.DockStyle.Top; this.chkAllBones.Location = new System.Drawing.Point(0, 0); this.chkAllBones.Margin = new System.Windows.Forms.Padding(0); this.chkAllBones.Name = "chkAllBones"; this.chkAllBones.Padding = new System.Windows.Forms.Padding(1, 0, 0, 0); this.chkAllBones.Size = new System.Drawing.Size(372, 20); this.chkAllBones.TabIndex = 28; this.chkAllBones.Text = "All"; this.chkAllBones.UseVisualStyleBackColor = false; this.chkAllBones.CheckStateChanged += new System.EventHandler(this.chkAllBones_CheckStateChanged_1); // // playLayer // this.playLayer.Dock = System.Windows.Forms.DockStyle.Fill; this.playLayer.Location = new System.Drawing.Point(0, 0); this.playLayer.Name = "playLayer"; this.playLayer.Size = new System.Drawing.Size(372, 394); this.playLayer.TabIndex = 1; this.playLayer.Visible = false; // // keyLayer // this.keyLayer.Dock = System.Windows.Forms.DockStyle.Fill; this.keyLayer.Location = new System.Drawing.Point(0, 0); this.keyLayer.Name = "keyLayer"; this.keyLayer.Size = new System.Drawing.Size(372, 394); this.keyLayer.TabIndex = 0; this.keyLayer.Visible = false; // // bgLayer // this.bgLayer.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(80))))); this.bgLayer.Dock = System.Windows.Forms.DockStyle.Fill; this.bgLayer.Location = new System.Drawing.Point(0, 0); this.bgLayer.Name = "bgLayer"; this.bgLayer.Size = new System.Drawing.Size(372, 394); this.bgLayer.TabIndex = 27; this.bgLayer.Visible = false; this.bgLayer.Paint += new System.Windows.Forms.PaintEventHandler(this.keyframes_Paint); this.bgLayer.MouseDown += new System.Windows.Forms.MouseEventHandler(this.keyframes_MouseDown); // // imageList1 // this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; this.imageList1.ImageSize = new System.Drawing.Size(16, 16); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // ModelAnimPanel // this.Controls.Add(this.pnlKeyframes); this.Name = "ModelAnimPanel"; this.Size = new System.Drawing.Size(376, 398); this.pnlKeyframes.ResumeLayout(false); this.pnlBones.ResumeLayout(false); this.ctxBones.ResumeLayout(false); this.ResumeLayout(false); }
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; } }