/// <summary> /// Retrieves corresponding animations to the target animation type. /// If NW4RAnimType.None is sent as the focus type, all animations but the target animation are cleared. /// </summary> /// <param name="focusType"></param> public virtual void GetFiles(NW4RAnimType focusType) { if (focusType == NW4RAnimType.None) { focusType = TargetAnimType; if (focusType == NW4RAnimType.SCN) { return; } for (int i = 0; i < ResourceTypeList.Length; i++) { if ((int)focusType != i && (NW4RAnimType)i != NW4RAnimType.SCN) { SetAnimation((NW4RAnimType)i, null); } } } else { if (focusType == NW4RAnimType.SCN) { return; } for (int i = 0; i < ResourceTypeList.Length; i++) { if ((int)focusType != i && (NW4RAnimType)i != NW4RAnimType.SCN) { SetCorrespondingAnimation(focusType, (NW4RAnimType)i); } } } }
public virtual void UpdateKeyframePanel(NW4RAnimType type) { if (KeyframePanel == null) { return; } KeyframePanel.TargetSequence = null; //btnRightToggle.Enabled = true; switch (type) { case NW4RAnimType.CHR: if (_chr0 != null && SelectedBone != null) { KeyframePanel.TargetSequence = _chr0.FindChild(SelectedBone.Name, false); } break; case NW4RAnimType.SRT: if (_srt0 != null && TargetTexRef != null) { KeyframePanel.TargetSequence = SRT0Editor.TexEntry; } break; case NW4RAnimType.SHP: if (_shp0 != null) { KeyframePanel.TargetSequence = SHP0Editor.VertexSetDest; } break; } }
public virtual void SetCorrespondingAnimation(NW4RAnimType focusType, NW4RAnimType targetType) { _updating = true; NW4RAnimationNode focusFile = GetAnimation(focusType); SetAnimation(targetType, focusFile == null ? null : FindCorrespondingAnimation(focusFile, targetType)); _updating = false; }
/// <summary> /// Called only when the animation changes /// </summary> public virtual void UpdateEditor(NW4RAnimType type) { if (type != NW4RAnimType.SRT) { UpdateSRT0FocusControls(null); } if (type != NW4RAnimType.PAT) { UpdatePAT0FocusControls(null); } switch (type) { case NW4RAnimType.CHR: break; case NW4RAnimType.SRT: UpdateSRT0FocusControls(SelectedSRT0); break; case NW4RAnimType.SHP: if (SHP0Editor != null) { SHP0Editor.AnimationChanged(); } break; case NW4RAnimType.PAT: if (PAT0Editor != null) { PAT0Editor.UpdateBoxes(); } UpdatePAT0FocusControls(SelectedPAT0); break; case NW4RAnimType.VIS: if (VIS0Editor != null) { VIS0Editor.AnimationChanged(); } break; case NW4RAnimType.SCN: if (SCN0Editor != null) { SCN0Editor.tabControl1_Selected(null, new TabControlEventArgs(null, SCN0Editor._tabIndex, TabControlAction.Selected)); } break; case NW4RAnimType.CLR: if (CLR0Editor != null) { CLR0Editor.AnimationChanged(); } break; } }
public void SetAnimation(NW4RAnimType type, NW4RAnimationNode value) { switch (type) { case NW4RAnimType.CHR: SelectedCHR0 = value as CHR0Node; break; case NW4RAnimType.SRT: SelectedSRT0 = value as SRT0Node; break; case NW4RAnimType.SHP: SelectedSHP0 = value as SHP0Node; break; case NW4RAnimType.PAT: SelectedPAT0 = value as PAT0Node; break; case NW4RAnimType.VIS: SelectedVIS0 = value as VIS0Node; break; case NW4RAnimType.SCN: SelectedSCN0 = value as SCN0Node; break; case NW4RAnimType.CLR: SelectedCLR0 = value as CLR0Node; break; } }
public NW4RAnimationNode GetAnimation(NW4RAnimType type) { switch (type) { case NW4RAnimType.CHR: return(SelectedCHR0); case NW4RAnimType.SRT: return(SelectedSRT0); case NW4RAnimType.SHP: return(SelectedSHP0); case NW4RAnimType.PAT: return(SelectedPAT0); case NW4RAnimType.VIS: return(SelectedVIS0); case NW4RAnimType.SCN: return(SelectedSCN0); case NW4RAnimType.CLR: return(SelectedCLR0); default: return(null); } }
protected override NW4RAnimationNode FindCorrespondingAnimation(NW4RAnimationNode focusFile, NW4RAnimType targetType) { string name = focusFile.Name; if (listPanel._animations.ContainsKey(name) && listPanel._animations[name].ContainsKey(targetType)) { return(listPanel._animations[name][targetType]); } return(null); }
private NW4RAnimationNode FindAnimation(ResourceNode searchNode, string name, NW4RAnimType targetType) { return(searchNode.RootNode.FindChildByType(name, true, ResourceTypeList[(int)targetType]) as NW4RAnimationNode); }
protected virtual NW4RAnimationNode FindCorrespondingAnimation(NW4RAnimationNode focusFile, NW4RAnimType targetType) { NW4RAnimationNode node; if (TargetModel != null && (node = FindAnimation((ResourceNode)TargetModel, focusFile.Name, targetType)) != null) { return(node); } foreach (ResourceNode r in _openedFiles) { if (r != null && (node = FindAnimation(r, focusFile.Name, targetType)) != null) { return(node); } } return(null); }
/// <summary> /// Updates controls when the target animation has changed. /// Does nothing if the type does not match the current target type. /// </summary> public void AnimChanged(NW4RAnimType type) { if (type != TargetAnimType && type != NW4RAnimType.None) { return; } UpdateEditor(); UpdateKeyframePanel(); NW4RAnimationNode node = GetAnimation(type); if (node == null) { _maxFrame = 0; EnableTransformEdit = true; _updating = true; PlaybackPanel.numFrameIndex.Maximum = _maxFrame; PlaybackPanel.numTotalFrames.Minimum = 0; PlaybackPanel.numTotalFrames.Value = 0; PlaybackPanel.btnPlay.Enabled = PlaybackPanel.numTotalFrames.Enabled = PlaybackPanel.numFrameIndex.Enabled = PlaybackPanel.btnLast.Enabled = PlaybackPanel.btnFirst.Enabled = PlaybackPanel.Enabled = false; _updating = false; GetFiles(NW4RAnimType.None); SetFrame(0); } else { int loopBias = node.Loop && Interpolated.Contains(node.GetType()) ? 1 : 0; _maxFrame = node.FrameCount; EnableTransformEdit = !_playing; _updating = true; PlaybackPanel.btnPlay.Enabled = PlaybackPanel.numFrameIndex.Enabled = PlaybackPanel.numTotalFrames.Enabled = PlaybackPanel.Enabled = true; PlaybackPanel.numTotalFrames.Minimum = loopBias + 1; PlaybackPanel.numTotalFrames.Value = (decimal)(_maxFrame + loopBias); PlaybackPanel.numFrameIndex.Maximum = (decimal)(_maxFrame + loopBias); _updating = false; GetFiles(TargetAnimType); SetFrame(1); } //UpdateModel(); //UpdatePropDisplay(); OnAnimationChanged(); }