public static List <TaeFindResult> FindEventTypeName(TaeEditorScreen editor, string paramVal, bool requireWholeValue) { List <TaeFindResult> result = new List <TaeFindResult>(); foreach (var taeKvp in editor.FileContainer.AllTAEDict) { var tae = taeKvp.Value; foreach (var anim in tae.Animations) { foreach (var ev in anim.Events.Where(evt => evt.Template != null)) { if (requireWholeValue ? ev.TypeName.Equals(paramVal) : ev.TypeName.Contains(paramVal)) { var animID_Lower = GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID % 1_000000) : (anim.ID % 1_0000); var animID_Upper = taeKvp.Key.StartsWith("a") ? long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeKvp.Key).Substring(1)) : ((GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID / 1_000000) : (anim.ID / 1_0000))); var sb = new StringBuilder($"{ev.Template.Name}[{ev.Type}]("); bool first = true; foreach (var kvp in ev.Parameters.Template) { if (kvp.Value.ValueToAssert == null) { if (first) { first = false; } else { sb.Append(", "); } sb.Append(ev.Parameters[kvp.Key].ToString()); } } sb.Append(")"); result.Add(new TaeFindResult() { TAEName = Utils.GetFileNameWithoutDirectoryOrExtension(taeKvp.Key), TAERef = tae, AnimRef = anim, AnimName = (GameDataManager.GameTypeHasLongAnimIDs ? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"), EventTypeString = ev.TypeName, EventRef = ev, ParameterName = "Event Name", MatchedValue = sb.ToString(), }); } } } } return(result); }
public static List <TaeFindResult> FindParameterValue(TaeEditorScreen editor, string paramVal, bool requireWholeValue) { List <TaeFindResult> result = new List <TaeFindResult>(); foreach (var taeKvp in editor.FileContainer.AllTAEDict) { var tae = taeKvp.Value; foreach (var anim in tae.Animations) { foreach (var ev in anim.Events) { if (ev.Parameters == null) { continue; } foreach (var kvp in ev.Parameters.Template) { if (kvp.Value.ValueToAssert == null) { var thisVal = kvp.Value.ValueToString(ev.Parameters[kvp.Key]); if (requireWholeValue ? thisVal.Equals(paramVal) : thisVal.Contains(paramVal)) { var animID_Lower = GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID % 1_000000) : (anim.ID % 1_0000); var animID_Upper = taeKvp.Key.StartsWith("a") ? long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeKvp.Key).Substring(1)) : ((GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID / 1_000000) : (anim.ID / 1_0000))); result.Add(new TaeFindResult() { TAEName = Utils.GetFileNameWithoutDirectoryOrExtension(taeKvp.Key), TAERef = tae, AnimRef = anim, AnimName = (GameDataManager.GameTypeHasLongAnimIDs ? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"), EventTypeString = ev.TypeName, EventRef = ev, ParameterName = kvp.Key, MatchedValue = thisVal, }); } } } } } } return(result); }
public void BeforeSaving(TaeEditorScreen editor) { lock (DBG._lock_DebugDrawEnablers) { CategoryEnableDraw = DBG.CategoryEnableDraw.ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value); CategoryEnableDbgLabelDraw = DBG.CategoryEnableDbgLabelDraw.ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value); CategoryEnableNameDraw = DBG.CategoryEnableNameDraw.ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value); } LastCubemapUsed = Environment.CurrentCubemapName; MSAA = GFX.MSAA; SSAA = GFX.SSAA; Colors = Main.Colors; Colors.WriteColorsToConfig(); ShowFullWeaponDummyPolyIDs = NewDummyPolyManager.ShowGlobalIDOffset; CamAngleSnapEnable = GFX.World.AngleSnapEnable; MouseSpeedMult = GFX.World.OverallMouseSpeedMult; ViewportStatusTextSize = TaeViewportInteractor.StatusTextScale; ToolboxGuiScale = OSD.RenderScale * 100; ToolboxItemWidthScale = OSD.WidthScale * 100; SkyboxBrightness = Environment.SkyboxBrightnessMult; ShowCubemapAsSkybox = Environment.DrawCubemap; ShowCameraPivotCube = GFX.World.PivotPrimIsEnabled; LayoutAnimListWidth = editor?.LeftSectionWidth ?? -1; LayoutViewportWidth = editor?.RightSectionWidth ?? -1; LayoutViewportHeight = editor?.TopRightPaneHeight ?? -1; LayoutWindowWidth = Main.WinForm.Size.Width; LayoutWindowHeight = Main.WinForm.Size.Height; LayoutWindowX = Main.WinForm.Location.X; LayoutWindowY = Main.WinForm.Location.Y; LoopEnabled = LoopEnabled_BeforeCombo; DisableConfigFileAutoSave = Main.DisableConfigFileAutoSave; }
public static List <TaeFindResult> FindEventTypeNum(TaeEditorScreen editor, int eventType) { List <TaeFindResult> result = new List <TaeFindResult>(); foreach (var taeKvp in editor.FileContainer.AllTAEDict) { var tae = taeKvp.Value; foreach (var anim in tae.Animations) { foreach (var ev in anim.Events) { if (ev.Type == eventType) { var animID_Lower = GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID % 1_000000) : (anim.ID % 1_0000); var animID_Upper = taeKvp.Key.StartsWith("a") ? long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeKvp.Key).Substring(1)) : ((GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID / 1_000000) : (anim.ID / 1_0000))); result.Add(new TaeFindResult() { TAEName = Utils.GetFileNameWithoutDirectoryOrExtension(taeKvp.Key), TAERef = tae, AnimRef = anim, AnimName = (GameDataManager.GameTypeHasLongAnimIDs ? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"), EventTypeString = ev.TypeName, EventRef = ev, ParameterName = "Event Type Num", MatchedValue = $"[{ev.Type}]({string.Join(" ", ev.GetParameterBytes(false).Select(b => b.ToString("X2")))})", }); } } } } return(result); }
public void AfterLoadingFirstTime(TaeEditorScreen editor) { Main.DisableConfigFileAutoSave = DisableConfigFileAutoSave; Main.IgnoreSizeChanges = true; int w = LayoutWindowWidth; int h = LayoutWindowHeight; int x = LayoutWindowX >= 0 ? LayoutWindowX : Main.WinForm.Location.X; int y = LayoutWindowY >= 0 ? LayoutWindowY : Main.WinForm.Location.Y; bool isPointVisibleOnAScreen(Point p) { foreach (System.Windows.Forms.Screen s in System.Windows.Forms.Screen.AllScreens) { if (p.X < s.Bounds.Right && p.X > s.Bounds.Left && p.Y > s.Bounds.Top && p.Y < s.Bounds.Bottom) { return(true); } } return(false); } bool isEntireWindowVisibleWithLocationSavedInConfig = isPointVisibleOnAScreen(new Point(x, y)) && isPointVisibleOnAScreen(new Point(x + w, y)) && isPointVisibleOnAScreen(new Point(x, y + h)) && isPointVisibleOnAScreen(new Point(x + w, y + h)); if (isEntireWindowVisibleWithLocationSavedInConfig) { Main.WinForm.Location = new System.Drawing.Point(x, y); Main.WinForm.Size = new System.Drawing.Size(w, h); } Main.IgnoreSizeChanges = false; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); eventLabelFont = Content.Load <SpriteFont>("DbgMenuFontSmall"); Blank = new Texture2D(GraphicsDevice, 1, 1, false, SurfaceFormat.Color); Blank.SetData(new Color[] { Color.White }, 0, 1); var winForm = (System.Windows.Forms.Form)System.Windows.Forms.Form.FromHandle(Window.Handle); testEditorScreen = new TaeEditorScreen(winForm); //testEditorScreen.TaeFileName = @"G:\SteamLibrary\steamapps\common\Dark Souls Prepare to Die Edition\DATA\chr\c0000.anibnd.yabber\Model\chr\c0000\taeNew\win32\a20.tae"; //testEditorScreen.LoadCurrentFile(); if (AutoLoadAnibnd != null) { if (System.IO.File.Exists(AutoLoadAnibnd)) { testEditorScreen.FileContainerName = AutoLoadAnibnd; testEditorScreen.LoadCurrentFile(); } } }
public TaeEditAnimList(TaeEditorScreen mainScreen) { MainScreen = mainScreen; //if (MainScreen.FileContainer.StandardTAE != null) //{ // foreach (var kvp in MainScreen.FileContainer.StandardTAE) // { // var taeSection = new TaeEditAnimListTaeSection(); // taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; // taeSection.Tae = kvp.Value; // taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); // foreach (var anim in kvp.Value.Animations) // { // var animID_Lower = anim.ID % 10000; // var animID_Upper = anim.ID / 10000; // var info = new TaeEditAnimInfo() // { // GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", // Ref = anim, // VerticalOffset = taeSection.HeightOfAllAnims, // TaePrefix = kvp.Key, // }; // taeSection.InfoMap.Add(anim, info); // taeSection.HeightOfAllAnims += AnimHeight; // } // AnimTaeSections.Add(taeSection); // } //} //if (MainScreen.FileContainer.PlayerTAE != null) //{ // foreach (var kvp in MainScreen.FileContainer.PlayerTAE) // { // var taeSection = new TaeEditAnimListTaeSection(); // taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; // taeSection.Tae = kvp.Value; // taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); // foreach (var anim in kvp.Value.Animations) // { // var animID_Lower = anim.ID % 10000; // var animID_Upper = anim.ID / 10000; // var info = new TaeEditAnimInfo() // { // GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", // Ref = anim, // VerticalOffset = taeSection.HeightOfAllAnims, // TaePrefix = kvp.Key, // }; // taeSection.InfoMap.Add(anim, info); // taeSection.HeightOfAllAnims += AnimHeight; // } // AnimTaeSections.Add(taeSection); // } //} foreach (var kvp in MainScreen.FileContainer.AllTAEDict) { var tae = kvp.Value; var taeSection = new TaeEditAnimListTaeSection(); taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; taeSection.Tae = tae; taeSection.SectionName = System.IO.Path.GetFileName(kvp.Key); foreach (var anim in tae.Animations) { var animID_Lower = GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID % 1_000000) : (anim.ID % 1_0000); var animID_Upper = taeSection.SectionName.StartsWith("a") ? long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeSection.SectionName).Substring(1)) : ((GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID / 1_000000) : (anim.ID / 1_0000))); var info = new TaeEditAnimInfo() { GetName = () => (GameDataManager.GameTypeHasLongAnimIDs ? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"), Ref = anim, VerticalOffset = taeSection.HeightOfAllAnims, TaePrefix = animID_Upper, IsLargeID = GameDataManager.GameTypeHasLongAnimIDs }; taeSection.InfoMap.Add(anim, info); taeSection.HeightOfAllAnims += AnimHeight; } AnimTaeSections.Add(taeSection); } ScrollViewer = new TaeScrollViewer(); UpdateScrollViewerRect(); }
public void AfterLoading(TaeEditorScreen editor) { lock (DBG._lock_DebugDrawEnablers) { DBG.CategoryEnableDraw.Clear(); DBG.CategoryEnableDbgLabelDraw.Clear(); DBG.CategoryEnableNameDraw.Clear(); var categories = (DbgPrimCategory[])Enum.GetValues(typeof(DbgPrimCategory)); foreach (var c in categories) { if (!CategoryEnableDraw.ContainsKey(c.ToString())) { CategoryEnableDraw.Add(c.ToString(), true); } if (!CategoryEnableDbgLabelDraw.ContainsKey(c.ToString())) { CategoryEnableDbgLabelDraw.Add(c.ToString(), true); } if (!CategoryEnableNameDraw.ContainsKey(c.ToString())) { CategoryEnableNameDraw.Add(c.ToString(), true); } } foreach (var kvp in CategoryEnableDraw) { if (Enum.TryParse <DbgPrimCategory>(kvp.Key, out DbgPrimCategory category)) { DBG.CategoryEnableDraw[category] = kvp.Value; } } foreach (var kvp in CategoryEnableDbgLabelDraw) { if (Enum.TryParse <DbgPrimCategory>(kvp.Key, out DbgPrimCategory category)) { DBG.CategoryEnableDbgLabelDraw[category] = kvp.Value; } } foreach (var kvp in CategoryEnableNameDraw) { if (Enum.TryParse <DbgPrimCategory>(kvp.Key, out DbgPrimCategory category)) { DBG.CategoryEnableNameDraw[category] = kvp.Value; } } } Environment.CubemapNameIndex = !string.IsNullOrWhiteSpace(LastCubemapUsed) ? Environment.CubemapNames.ToList().IndexOf(LastCubemapUsed) : 0; GFX.MSAA = MSAA; GFX.SSAA = SSAA; Main.RequestViewportRenderTargetResolutionChange = true; Colors.ReadColorsFromConfig(); Main.Colors = Colors; NewDummyPolyManager.ShowGlobalIDOffset = ShowFullWeaponDummyPolyIDs; GFX.World.AngleSnapEnable = CamAngleSnapEnable; GFX.World.OverallMouseSpeedMult = MouseSpeedMult; TaeViewportInteractor.StatusTextScale = ViewportStatusTextSize; OSD.RenderScale = Main.DPICustomMultX = Main.DPICustomMultY = (OSD.RenderScaleTarget = ToolboxGuiScale) / 100; OSD.WidthScale = (OSD.WidthScaleTarget = ToolboxItemWidthScale) / 100; Environment.SkyboxBrightnessMult = SkyboxBrightness; Environment.DrawCubemap = ShowCubemapAsSkybox; GFX.World.PivotPrimIsEnabled = ShowCameraPivotCube; }
public TaeUndoMan(TaeEditorScreen mainScreen) { MainScreen = mainScreen; }
public void GoThere(TaeEditorScreen editor) { editor.SelectNewAnimRef(TAERef, AnimRef); editor.SelectEvent(EventRef); }
public TaeTransport(TaeEditorScreen mainScreen) { MainScreen = mainScreen; Buttons.Add(new TransportButton() { GetDebugText = () => "|<<", GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != 0), OnClick = () => { PlaybackCursor.IsPlaying = false; PlaybackCursor.CurrentTime = 0; MainScreen.Graph?.ViewportInteractor?.CurrentModel?.AnimContainer?.ResetAll(); PlaybackCursor.StartTime = 0; MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0); MainScreen.Graph.ViewportInteractor.CurrentModel.AnimContainer.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel0?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel1?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel2?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel3?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel0?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel1?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel2?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel3?.AnimContainer?.ResetRootMotion(); MainScreen.Graph.ViewportInteractor.ResetRootMotion(); MainScreen.Graph.ScrollToPlaybackCursor(1); PlaybackCursor.IgnoreCurrentRelativeScrub(); }, GetHotkey = b => MainScreen.Input.KeyHeld(Keys.Home), }); Buttons.Add(new TransportButton() { GetDebugText = () => "[]", GetIsEnabled = () => PlaybackCursor.CurrentTime != PlaybackCursor.StartTime,//MainScreen.Graph.PlaybackCursor.IsPlaying, OnClick = () => { var start = PlaybackCursor.StartTime; PlaybackCursor.IsPlaying = false; PlaybackCursor.CurrentTime = start; //MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0); MainScreen.Graph.PlaybackCursor.UpdateScrubbing(); //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.StartTime); MainScreen.Graph.ScrollToPlaybackCursor(1); }, GetHotkey = b => (MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyHeld(Keys.Space), }); Buttons.Add(new TransportButton() { GetDebugText = () => PlaybackCursor.IsPlaying ? "||" : ">", GetIsEnabled = () => true, OnClick = () => PlaybackCursor.Transport_PlayPause(), GetHotkey = b => (!MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyDown(Keys.Space), }); Buttons.Add(new TransportButton() { GetDebugText = () => ">>|", GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != PlaybackCursor.MaxTime), OnClick = () => { PlaybackCursor.IsPlaying = false; PlaybackCursor.CurrentTime = PlaybackCursor.MaxTime; PlaybackCursor.StartTime = PlaybackCursor.MaxTime; MainScreen.Graph.PlaybackCursor.UpdateScrubbing(); //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.MaxTime); MainScreen.Graph.ScrollToPlaybackCursor(1); }, GetHotkey = b => MainScreen.Input.KeyHeld(Keys.End), }); Buttons.Add(new TransportButtonSeparator()); Buttons.Add(new TransportButton() { GetDebugText = () => MainScreen.Config.LoopEnabled_BeforeCombo ? "[LOOP]" : "[ONCE]", GetIsEnabled = () => (MainScreen.Graph?.ViewportInteractor?.CurrentComboIndex ?? -1) < 0, OnClick = () => MainScreen.Config.LoopEnabled_BeforeCombo = MainScreen.Config.LoopEnabled = !MainScreen.Config.LoopEnabled, GetHotkey = b => (!MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyDown(Keys.L), CustomWidth = 48, GetActiveBackColor = () => MainScreen.Config.LoopEnabled_BeforeCombo ? new Color(0, 100, 0, 255) : new Color(150, 0, 0, 255), GetHoverBackColor = () => MainScreen.Config.LoopEnabled_BeforeCombo ? new Color(0, 150, 0, 255) : new Color(200, 0, 0, 255), GetPressedBackColor = () => MainScreen.Config.LoopEnabled_BeforeCombo ? new Color(175, 210, 175, 255) : new Color(255, 130, 130, 255), }); Buttons.Add(new TransportButtonSeparator()); Buttons.Add(new TransportButton() { GetDebugText = () => "<|", GetIsEnabled = () => true, OnClick = () => MainScreen.TransportPreviousFrame(), GetHotkey = b => { if (MainScreen.Input.KeyUp(Keys.Left)) { b.prevState = b.state = TransportButton.TransportButtonState.Normal; } return(MainScreen.Input.KeyHeld(Keys.Left)); }, }); Buttons.Add(new TransportButton() { GetDebugText = () => "|>", GetIsEnabled = () => true, OnClick = () => MainScreen.TransportNextFrame(), GetHotkey = b => { if (MainScreen.Input.KeyUp(Keys.Right)) { b.prevState = b.state = TransportButton.TransportButtonState.Normal; } return(MainScreen.Input.KeyHeld(Keys.Right)); }, }); }
public TaeEditAnimList(TaeEditorScreen mainScreen) { MainScreen = mainScreen; //if (MainScreen.FileContainer.StandardTAE != null) //{ // foreach (var kvp in MainScreen.FileContainer.StandardTAE) // { // var taeSection = new TaeEditAnimListTaeSection(); // taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; // taeSection.Tae = kvp.Value; // taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); // foreach (var anim in kvp.Value.Animations) // { // var animID_Lower = anim.ID % 10000; // var animID_Upper = anim.ID / 10000; // var info = new TaeEditAnimInfo() // { // GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", // Ref = anim, // VerticalOffset = taeSection.HeightOfAllAnims, // TaePrefix = kvp.Key, // }; // taeSection.InfoMap.Add(anim, info); // taeSection.HeightOfAllAnims += AnimHeight; // } // AnimTaeSections.Add(taeSection); // } //} //if (MainScreen.FileContainer.PlayerTAE != null) //{ // foreach (var kvp in MainScreen.FileContainer.PlayerTAE) // { // var taeSection = new TaeEditAnimListTaeSection(); // taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; // taeSection.Tae = kvp.Value; // taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); // foreach (var anim in kvp.Value.Animations) // { // var animID_Lower = anim.ID % 10000; // var animID_Upper = anim.ID / 10000; // var info = new TaeEditAnimInfo() // { // GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", // Ref = anim, // VerticalOffset = taeSection.HeightOfAllAnims, // TaePrefix = kvp.Key, // }; // taeSection.InfoMap.Add(anim, info); // taeSection.HeightOfAllAnims += AnimHeight; // } // AnimTaeSections.Add(taeSection); // } //} foreach (var kvp in MainScreen.FileContainer.AllTAEDict) { var tae = kvp.Value; var taeSection = new TaeEditAnimListTaeSection(); taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; taeSection.Tae = tae; taeSection.SectionName = System.IO.Path.GetFileName(kvp.Key); foreach (var anim in tae.Animations) { var animID_Lower = MainScreen.FileContainer.ContainerType == TaeFileContainer.TaeFileContainerType.BND4 ? (anim.ID % 1000000) : (anim.ID % 10000); var animID_Upper = MainScreen.FileContainer.ContainerType == TaeFileContainer.TaeFileContainerType.BND4 ? (anim.ID / 1000000) : (anim.ID / 10000); var info = new TaeEditAnimInfo() { GetName = () => MainScreen.FileContainer.ContainerType == TaeFileContainer.TaeFileContainerType.BND4 ? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}", Ref = anim, VerticalOffset = taeSection.HeightOfAllAnims, TaePrefix = animID_Upper, }; taeSection.InfoMap.Add(anim, info); taeSection.HeightOfAllAnims += AnimHeight; } AnimTaeSections.Add(taeSection); } ScrollViewer = new TaeScrollViewer(); }
public TaeEditAnimList(TaeEditorScreen mainScreen) { MainScreen = mainScreen; //if (MainScreen.FileContainer.StandardTAE != null) //{ // foreach (var kvp in MainScreen.FileContainer.StandardTAE) // { // var taeSection = new TaeEditAnimListTaeSection(); // taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; // taeSection.Tae = kvp.Value; // taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); // foreach (var anim in kvp.Value.Animations) // { // var animID_Lower = anim.ID % 10000; // var animID_Upper = anim.ID / 10000; // var info = new TaeEditAnimInfo() // { // GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", // Ref = anim, // VerticalOffset = taeSection.HeightOfAllAnims, // TaePrefix = kvp.Key, // }; // taeSection.InfoMap.Add(anim, info); // taeSection.HeightOfAllAnims += AnimHeight; // } // AnimTaeSections.Add(taeSection); // } //} //if (MainScreen.FileContainer.PlayerTAE != null) //{ // foreach (var kvp in MainScreen.FileContainer.PlayerTAE) // { // var taeSection = new TaeEditAnimListTaeSection(); // taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; // taeSection.Tae = kvp.Value; // taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); // foreach (var anim in kvp.Value.Animations) // { // var animID_Lower = anim.ID % 10000; // var animID_Upper = anim.ID / 10000; // var info = new TaeEditAnimInfo() // { // GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", // Ref = anim, // VerticalOffset = taeSection.HeightOfAllAnims, // TaePrefix = kvp.Key, // }; // taeSection.InfoMap.Add(anim, info); // taeSection.HeightOfAllAnims += AnimHeight; // } // AnimTaeSections.Add(taeSection); // } //} bool isMultiSectionTae = MainScreen.FileContainer.AllTAEDict.Count > 1; foreach (var kvp in MainScreen.FileContainer.AllTAEDict) { var tae = kvp.Value; var taeSection = new TaeEditAnimListTaeSection(); taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; taeSection.Tae = tae; taeSection.SectionName = System.IO.Path.GetFileName(kvp.Key); foreach (var anim in tae.Animations) { var animID_Lower = isMultiSectionTae ? anim.ID : GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID % 1_000000) : (anim.ID % 1_0000); var animID_Upper = taeSection.SectionName.StartsWith("a") ? long.Parse(Utils.GetFileNameWithoutAnyExtensions(taeSection.SectionName).Substring(1)) : ((GameDataManager.GameTypeHasLongAnimIDs ? (anim.ID / 1_000000) : (anim.ID / 1_0000))); var info = new TaeEditAnimInfo() { GetName = () => { if (MainScreen?.Graph?.ViewportInteractor?.EntityType == TaeViewportInteractor.TaeEntityType.REMO) { return(anim.ID < 1_0000 ? $"cut{anim.ID:D4}" : $"[Entry {anim.ID}]"); } else if (GameDataManager.GameTypeHasLongAnimIDs) { bool ds2Meme = GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YY_ZZZZ; string res = ds2Meme ? $"a{(animID_Upper):D2}_{animID_Lower:D6}" : $"a{(animID_Upper):D3}_{animID_Lower:D6}"; if (ds2Meme) { res = res.Insert(res.Length - 4, "_"); } return(res); } else { return($"a{(animID_Upper):D2}_{animID_Lower:D4}"); } // (GameDataManager.GameTypeHasLongAnimIDs //? $"a{(animID_Upper):D3}_{animID_Lower:D6}" : $"a{(animID_Upper):D2}_{animID_Lower:D4}"), }, Ref = anim, VerticalOffset = taeSection.HeightOfAllAnims, TaePrefix = MainScreen.FileContainer.AllTAEDict.Count == 1 ? 0 : animID_Upper, IsLargeID = GameDataManager.GameTypeHasLongAnimIDs, IsRedErrorPrefix = isMultiSectionTae && ((anim.ID > (GameDataManager.GameTypeHasLongAnimIDs ? 999999 : 9999) || anim.ID < 0)) }; taeSection.InfoMap.Add(anim, info); taeSection.HeightOfAllAnims += AnimHeight; } int taeKey = taeSection.SectionName.StartsWith("a") ? int.Parse(Utils.GetFileNameWithoutAnyExtensions(taeSection.SectionName).Substring(1)) : 0; AnimTaeSections.Add(taeKey, taeSection); } ScrollViewer = new TaeScrollViewer(); UpdateScrollViewerRect(); }
public TaeEditAnimList(TaeEditorScreen mainScreen) { MainScreen = mainScreen; if (MainScreen.FileContainer.StandardTAE != null) { foreach (var kvp in MainScreen.FileContainer.StandardTAE) { var taeSection = new TaeEditAnimListTaeSection(); taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; taeSection.Tae = kvp.Value; taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); foreach (var anim in kvp.Value.Animations) { var animID_Lower = anim.ID % 10000; var animID_Upper = anim.ID / 10000; var info = new TaeEditAnimInfo() { GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", Ref = anim, VerticalOffset = taeSection.HeightOfAllAnims, TaePrefix = kvp.Key, }; taeSection.InfoMap.Add(anim, info); taeSection.HeightOfAllAnims += AnimHeight; } AnimTaeSections.Add(taeSection); } } if (MainScreen.FileContainer.PlayerTAE != null) { foreach (var kvp in MainScreen.FileContainer.PlayerTAE) { var taeSection = new TaeEditAnimListTaeSection(); taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; taeSection.Tae = kvp.Value; taeSection.SectionName = System.IO.Path.GetFileName(kvp.Value.FilePath ?? kvp.Value.VirtualUri); foreach (var anim in kvp.Value.Animations) { var animID_Lower = anim.ID % 10000; var animID_Upper = anim.ID / 10000; var info = new TaeEditAnimInfo() { GetName = () => $"a{(kvp.Key + animID_Upper):D2}_{animID_Lower:D4}", Ref = anim, VerticalOffset = taeSection.HeightOfAllAnims, TaePrefix = kvp.Key, }; taeSection.InfoMap.Add(anim, info); taeSection.HeightOfAllAnims += AnimHeight; } AnimTaeSections.Add(taeSection); } } if (AnimTaeSections.Count == 0) { foreach (var tae in MainScreen.FileContainer.AllTAE) { var taeSection = new TaeEditAnimListTaeSection(); taeSection.Collapsed = MainScreen.Config.AutoCollapseAllTaeSections; taeSection.Tae = tae; taeSection.SectionName = System.IO.Path.GetFileName(tae.FilePath ?? tae.VirtualUri); foreach (var anim in tae.Animations) { var animID_Lower = anim.ID % 10000; var animID_Upper = anim.ID / 10000; var info = new TaeEditAnimInfo() { GetName = () => $"a{(animID_Upper):D2}_{animID_Lower:D4}", Ref = anim, VerticalOffset = taeSection.HeightOfAllAnims, TaePrefix = animID_Upper, }; taeSection.InfoMap.Add(anim, info); taeSection.HeightOfAllAnims += AnimHeight; } AnimTaeSections.Add(taeSection); } } ScrollViewer = new TaeScrollViewer(); }
public TaeTransport(TaeEditorScreen mainScreen) { MainScreen = mainScreen; Buttons.Add(new TransportButton() { GetDebugText = () => "|<<", GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != 0), OnClick = () => { PlaybackCursor.IsPlaying = false; PlaybackCursor.CurrentTime = 0; MainScreen.Graph?.ViewportInteractor?.CurrentModel?.AnimContainer?.ResetAll(); PlaybackCursor.StartTime = 0; MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0); MainScreen.Graph.ViewportInteractor.CurrentModel.CurrentDirection = 0; MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel0?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel1?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel2?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.RightWeaponModel3?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel0?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel1?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel2?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.CurrentModel.ChrAsm?.LeftWeaponModel3?.ResetCurrentDirection(); MainScreen.Graph.ViewportInteractor.ResetRootMotion(); MainScreen.Graph.ScrollToPlaybackCursor(1); PlaybackCursor.IgnoreCurrentRelativeScrub(); }, GetHotkey = b => MainScreen.Input.KeyHeld(Keys.Home), }); Buttons.Add(new TransportButton() { GetDebugText = () => "[]", GetIsEnabled = () => PlaybackCursor.CurrentTime != PlaybackCursor.StartTime,//MainScreen.Graph.PlaybackCursor.IsPlaying, OnClick = () => { var start = PlaybackCursor.StartTime; PlaybackCursor.IsPlaying = false; PlaybackCursor.CurrentTime = PlaybackCursor.StartTime; //MainScreen.Graph.ViewportInteractor.OnScrubFrameChange(forceCustomTimeDelta: 0); MainScreen.Graph.PlaybackCursor.UpdateScrubbing(); //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.StartTime); MainScreen.Graph.ScrollToPlaybackCursor(1); }, GetHotkey = b => (MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyHeld(Keys.Space), }); Buttons.Add(new TransportButton() { GetDebugText = () => PlaybackCursor.IsPlaying ? "||" : ">", GetIsEnabled = () => true, OnClick = () => PlaybackCursor.Transport_PlayPause(), GetHotkey = b => (!MainScreen.Input.ShiftHeld && !MainScreen.Input.AltHeld && !MainScreen.Input.CtrlHeld) && MainScreen.Input.KeyDown(Keys.Space), }); Buttons.Add(new TransportButton() { GetDebugText = () => ">>|", GetIsEnabled = () => PlaybackCursor.IsPlaying || (PlaybackCursor.CurrentTime != PlaybackCursor.MaxTime), OnClick = () => { PlaybackCursor.IsPlaying = false; PlaybackCursor.CurrentTime = PlaybackCursor.MaxTime; PlaybackCursor.StartTime = PlaybackCursor.MaxTime; MainScreen.Graph.PlaybackCursor.UpdateScrubbing(); //MainScreen.Graph.ViewportInteractor.ResetRootMotion((float)MainScreen.Graph.PlaybackCursor.MaxTime); MainScreen.Graph.ScrollToPlaybackCursor(1); }, GetHotkey = b => MainScreen.Input.KeyHeld(Keys.End), }); Buttons.Add(new TransportButtonSeparator()); Buttons.Add(new TransportButton() { GetDebugText = () => "<|", GetIsEnabled = () => true, OnClick = () => MainScreen.TransportPreviousFrame(), GetHotkey = b => { if (MainScreen.Input.KeyUp(Keys.Left)) { b.prevState = b.state = TransportButton.TransportButtonState.Normal; } return(MainScreen.Input.KeyHeld(Keys.Left)); }, }); Buttons.Add(new TransportButton() { GetDebugText = () => "|>", GetIsEnabled = () => true, OnClick = () => MainScreen.TransportNextFrame(), GetHotkey = b => { if (MainScreen.Input.KeyUp(Keys.Right)) { b.prevState = b.state = TransportButton.TransportButtonState.Normal; } return(MainScreen.Input.KeyHeld(Keys.Right)); }, }); }