Ejemplo n.º 1
0
            protected override void BuildInsideOfWindow()
            {
                if (TaeAnimID_Value != null)
                {
                    TaeAnimID_Error = null;
                }

                if (ImportFromAnimID_Value != null)
                {
                    ImportFromAnimID_Error = null;
                }

                bool isCurrentlyStandard    = TaeAnimHeader.Type == TAE.Animation.MiniHeaderType.Standard;
                bool isCurrentlyImportOther = TaeAnimHeader.Type == TAE.Animation.MiniHeaderType.ImportOtherAnim;

                if (TaeAnimID_Value == null)
                {
                    ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(1, 0, 0, 1));
                }
                ImGui.InputText("Animation ID", ref TaeAnimID_String, 256);
                if (ImGui.IsItemHovered() && TaeAnimID_Error != null)
                {
                    ImGui.SetTooltip(TaeAnimID_Error);
                }
                if (TaeAnimID_Value == null)
                {
                    ImGui.PopStyleColor();
                }
                if (string.IsNullOrWhiteSpace(TaeAnimID_String))
                {
                    TaeAnimID_Value = null;
                    TaeAnimID_Error = "Animation entry ID must be specified.";
                }
                else if (long.TryParse(TaeAnimID_String.Replace("a", "").Replace("A", "").Replace("_", ""), out long animIdParsed))
                {
                    if (IsMultiTaeSubID && animIdParsed < 0)
                    {
                        TaeAnimID_Error = "Animation sub-ID cannot be a negative value.";
                        TaeAnimID_Value = null;
                    }
                    else if (IsMultiTaeSubID && animIdParsed > (GameDataManager.GameTypeHasLongAnimIDs ? 999999 : 9999))
                    {
                        TaeAnimID_Error = $"Animation sub-ID cannot be so high it overflows into the next category (over {(GameDataManager.GameTypeHasLongAnimIDs ? 999999 : 9999)} for {GameDataManager.GameTypeName}).";
                        TaeAnimID_Value = null;
                    }
                    else
                    {
                        TaeAnimID_Value = animIdParsed;
                    }
                }
                else
                {
                    TaeAnimID_Value = null;

                    if (IsMultiTaeSubID)
                    {
                        TaeAnimID_Error = "Not a valid integer.";
                    }
                    else
                    {
                        if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXXX_YYYYYY)
                        {
                            TaeAnimID_Error = "Invalid ID specified. Enter an ID in either 'aXXX_YYYYYY' format or 'XXXYYYYYY' format.";
                        }
                        else if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YY_ZZZZ)
                        {
                            TaeAnimID_Error = "Invalid ID specified. Enter an ID in either 'aXX_YY_ZZZZ' format or 'XXYYZZZZ' format.";
                        }
                        else if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YYYY)
                        {
                            TaeAnimID_Error = "Invalid ID specified. Enter an ID in either 'aXX_YYYY' format or 'XXYYYY' format.";
                        }
                        else
                        {
                            throw new NotImplementedException();
                        }
                    }
                }

                ImGui.Separator();

                ImGui.InputText("Animation Name", ref TaeAnimName, 256);

                ImGui.Separator();

                ImGui.Text("Animation Type:");

                ImGui.Indent();
                {
                    ImGui.MenuItem("Standard Animation", "", isCurrentlyStandard);
                    bool clickedStandard = ImGui.IsItemClicked();

                    ImGui.MenuItem("Duplicate of Other Anim Entry", "", TaeAnimHeader.Type == TAE.Animation.MiniHeaderType.ImportOtherAnim);
                    bool clickedImportOther = ImGui.IsItemClicked();

                    if (clickedStandard && !isCurrentlyStandard)
                    {
                        DialogManager.AskForMultiChoice("Change Animation Type",
                                                        "Change animation type, losing the values you entered?",
                                                        (cancelType, answer) =>
                        {
                            if (cancelType != CancelTypes.None)
                            {
                                return;
                            }

                            if (answer == "YES")
                            {
                                TaeAnimHeader = new TAE.Animation.AnimMiniHeader.Standard();
                            }
                        }, CancelTypes.Combo_ClickTitleBarX_PressEscape, "YES", "NO");
                    }
                    else if (clickedImportOther && !isCurrentlyImportOther)
                    {
                        DialogManager.AskForMultiChoice("Change Animation Type",
                                                        "Change animation type, losing the values you entered?",
                                                        (cancelType, answer) =>
                        {
                            if (cancelType != CancelTypes.None)
                            {
                                return;
                            }

                            if (answer == "YES")
                            {
                                TaeAnimHeader = new TAE.Animation.AnimMiniHeader.ImportOtherAnim();
                            }
                        }, CancelTypes.Combo_ClickTitleBarX_PressEscape, "YES", "NO");
                    }
                }
                ImGui.Unindent();



                if (TaeAnimHeader is TAE.Animation.AnimMiniHeader.ImportOtherAnim asImportOtherAnim)
                {
                    ImGui.Text("Properties - Duplicate of Other Anim Entry:");
                    ImGui.Indent();
                    {
                        if (ImportFromAnimID_Value == null)
                        {
                            ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(1, 0, 0, 1));
                        }
                        ImGui.InputText("Duplicate of Animation ID", ref ImportFromAnimID_String, 256);
                        if (ImGui.IsItemHovered() && ImportFromAnimID_Error != null)
                        {
                            ImGui.SetTooltip(ImportFromAnimID_Error);
                        }
                        if (ImportFromAnimID_Value == null)
                        {
                            ImGui.PopStyleColor();
                        }
                        if (string.IsNullOrWhiteSpace(ImportFromAnimID_String))
                        {
                            ImportFromAnimID_Value = asImportOtherAnim.ImportFromAnimID = -1;
                        }
                        else if (int.TryParse(ImportFromAnimID_String.Replace("a", "").Replace("A", "").Replace("_", ""), out int importFromIdParsed))
                        {
                            ImportFromAnimID_Value = asImportOtherAnim.ImportFromAnimID = importFromIdParsed;
                        }
                        else
                        {
                            ImportFromAnimID_Value = null;
                            if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXXX_YYYYYY)
                            {
                                ImportFromAnimID_Error = "Invalid ID specified. Leave the box blank to specify no animation or enter an ID in either 'aXXX_YYYYYY' format or 'XXXYYYYYY' format.";
                            }
                            else if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YY_ZZZZ)
                            {
                                ImportFromAnimID_Error = "Invalid ID specified. Leave the box blank to specify no animation or enter an ID in either 'aXX_YY_ZZZZ' format or 'XXYYZZZZ' format.";
                            }
                            else if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YYYY)
                            {
                                ImportFromAnimID_Error = "Invalid ID specified. Leave the box blank to specify no animation or enter an ID in either 'aXX_YYYY' format or 'XXYYYY' format.";
                            }
                            else
                            {
                                throw new NotImplementedException();
                            }
                        }

                        asImportOtherAnim.Unknown = MenuBar.IntItem("Unknown Value", asImportOtherAnim.Unknown);
                    }
                    ImGui.Unindent();
                }
                else if (TaeAnimHeader is TAE.Animation.AnimMiniHeader.Standard asStandard)
                {
                    ImGui.Text("Properties - Standard Animation:");
                    ImGui.Indent();
                    {
                        asStandard.ImportsHKX = MenuBar.CheckboxBig("Import Other HKX", asStandard.ImportsHKX);

                        if (ImportFromAnimID_Value == null)
                        {
                            ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(1, 0, 0, 1));
                        }
                        ImGui.InputText("Import HKX ID", ref ImportFromAnimID_String, 256);
                        if (ImGui.IsItemHovered() && ImportFromAnimID_Error != null)
                        {
                            ImGui.SetTooltip(ImportFromAnimID_Error);
                        }
                        if (ImportFromAnimID_Value == null)
                        {
                            ImGui.PopStyleColor();
                        }
                        if (string.IsNullOrWhiteSpace(ImportFromAnimID_String))
                        {
                            ImportFromAnimID_Value = asStandard.ImportHKXSourceAnimID = -1;
                        }
                        else if (int.TryParse(ImportFromAnimID_String.Replace("a", "").Replace("A", "").Replace("_", ""), out int importFromIdParsed))
                        {
                            ImportFromAnimID_Value = asStandard.ImportHKXSourceAnimID = importFromIdParsed;
                        }
                        else
                        {
                            ImportFromAnimID_Value = null;
                            if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXXX_YYYYYY)
                            {
                                ImportFromAnimID_Error = "Invalid ID specified. Leave the box blank to specify no animation or enter an ID in either 'aXXX_YYYYYY' format or 'XXXYYYYYY' format.";
                            }
                            else if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YY_ZZZZ)
                            {
                                ImportFromAnimID_Error = "Invalid ID specified. Leave the box blank to specify no animation or enter an ID in either 'aXX_YY_ZZZZ' format or 'XXYYZZZZ' format.";
                            }
                            else if (GameDataManager.CurrentAnimIDFormatType == GameDataManager.AnimIDFormattingType.aXX_YYYY)
                            {
                                ImportFromAnimID_Error = "Invalid ID specified. Leave the box blank to specify no animation or enter an ID in either 'aXX_YYYY' format or 'XXYYYY' format.";
                            }
                            else
                            {
                                throw new NotImplementedException();
                            }
                        }

                        asStandard.AllowDelayLoad  = MenuBar.CheckboxBig("Allow loading from DelayLoad ANIBNDs", asStandard.AllowDelayLoad);
                        asStandard.IsLoopByDefault = MenuBar.CheckboxBig("Enable Looping", asStandard.IsLoopByDefault);
                    }
                    ImGui.Unindent();
                }

                ImGui.Separator();
                ImGui.Button("Delete This Animation...");
                if (ImGui.IsItemClicked())
                {
                    DialogManager.AskForMultiChoice("Permanently Delete Animation Entry?", $"Are you sure you want to delete the current animation?\nThis can NOT be undone!", (cancelType, answer) =>
                    {
                        if (answer == "YES")
                        {
                            WasAnimDeleted = true;
                            CancelType     = CancelTypes.ClickedAcceptButton;
                            Dismiss();
                            DialogManager.DialogOK("Success", "Animation deleted successfully.");
                        }
                    }, CancelTypes.Combo_ClickTitleBarX_PressEscape, "YES", "NO");
                }
                ImGui.Separator();

                ImGui.Button("Cancel & Discard Changes");
                if (ImGui.IsItemClicked())
                {
                    CancelType = CancelTypes.ClickTitleBarX;
                    Dismiss();
                }

                bool invalidState = (ImportFromAnimID_Value == null || TaeAnimID_Value == null);

                if (invalidState)
                {
                    Tools.PushGrayedOut();
                }
                ImGui.Button("Apply & Save Changes");
                if (invalidState)
                {
                    Tools.PopGrayedOut();
                    if (ImGui.IsItemHovered())
                    {
                        ImGui.SetTooltip("Cannot accept changes until the animation ID formatting errors (shown in red) are fixed.");
                    }
                }
                if (ImGui.IsItemClicked())
                {
                    if (!invalidState)
                    {
                        CancelType = CancelTypes.ClickedAcceptButton;
                        Dismiss();
                    }
                }

                //throw new NotImplementedException();
            }
Ejemplo n.º 2
0
            protected override void BuildContents()
            {
                var entityType = Tae.Graph?.ViewportInteractor?.EntityType;

                if (entityType == TaeViewportInteractor.TaeEntityType.NPC)
                {
                    ImGui.Button("Load Additional Texture File(s)...");
                    if (ImGui.IsItemClicked())
                    {
                        Tae.BrowseForMoreTextures();
                    }

                    var mdl = Tae.Graph?.ViewportInteractor?.CurrentModel;

                    if (mdl != null)
                    {
                        if (ImGui.TreeNode("NPC Param Selection"))
                        {
                            lock (mdl._lock_NpcParams)
                            {
                                foreach (var npc in mdl.PossibleNpcParams)
                                {
                                    bool oldSelected = npc == mdl.NpcParam;

                                    var selected = MenuBar.CheckboxBig(npc.GetDisplayName(), oldSelected);

                                    ImGui.Indent();
                                    ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(0, 1, 1, 1));
                                    {
                                        ImGui.Text($"BehaviorVariationID: {npc.BehaviorVariationID}");

                                        if (mdl.NpcMaterialNamesPerMask.Any(kvp => kvp.Key >= 0))
                                        {
                                            ImGui.Text($"Meshes Visible:");

                                            ImGui.Indent();
                                            {
                                                foreach (var kvp in mdl.NpcMaterialNamesPerMask)
                                                {
                                                    if (kvp.Key < 0)
                                                    {
                                                        continue;
                                                    }

                                                    if (mdl.NpcMasksEnabledOnAllNpcParams.Contains(kvp.Key))
                                                    {
                                                        continue;
                                                    }

                                                    if (npc.DrawMask[kvp.Key])
                                                    {
                                                        foreach (var v in kvp.Value)
                                                        {
                                                            ImGui.BulletText(v);
                                                        }
                                                    }
                                                }
                                            }
                                            ImGui.Unindent();
                                        }
                                    }
                                    ImGui.PopStyleColor();
                                    ImGui.Unindent();

                                    if (selected != oldSelected)
                                    {
                                        mdl.NpcParam = npc;
                                        npc.ApplyToNpcModel(mdl);
                                    }
                                }
                            }
                            ImGui.TreePop();
                        }
                    }

                    ImGui.Separator();

                    ImGui.Button("Open NPC Model Importer");
                    if (ImGui.IsItemClicked())
                    {
                        Tae.BringUpImporter_FLVER2();
                    }
                }
                else if (entityType == TaeViewportInteractor.TaeEntityType.OBJ)
                {
                    ImGui.Button("Load Additional Texture File(s)...");
                    if (ImGui.IsItemClicked())
                    {
                        Tae.BrowseForMoreTextures();
                    }
                }
                else if (entityType == TaeViewportInteractor.TaeEntityType.PC)
                {
                    OSD.WindowEditPlayerEquip.IsOpen = MenuBar.CheckboxBig("Show Player Equipment Editor Window", OSD.WindowEditPlayerEquip.IsOpen);

                    if (Tae.Graph?.ViewportInteractor?.EventSim != null)
                    {
                        var currentHitViewSource = Tae.Config.HitViewDummyPolySource;

                        int currentHitViewSourceIndex = BehaviorHitboxSrcEnum_Values.IndexOf(currentHitViewSource);
                        ImGui.ListBox("Behavior / Hitbox Source", ref currentHitViewSourceIndex, BehaviorHitboxSrcEnum_Names, BehaviorHitboxSrcEnum_Names.Length);
                        var newHitViewSource = currentHitViewSourceIndex >= 0 ? BehaviorHitboxSrcEnum_Values[currentHitViewSourceIndex] : ParamData.AtkParam.DummyPolySource.Body;

                        if (currentHitViewSource != newHitViewSource)
                        {
                            lock (Tae.Graph._lock_EventBoxManagement)
                            {
                                Tae.Graph.ViewportInteractor.EventSim.OnNewAnimSelected(Tae.Graph.EventBoxes);
                                Tae.Config.HitViewDummyPolySource = newHitViewSource;
                                Tae.Graph.ViewportInteractor.EventSim.OnNewAnimSelected(Tae.Graph.EventBoxes);
                                Tae.Graph.ViewportInteractor.OnScrubFrameChange();
                            }
                        }
                    }
                }
                else if (entityType == TaeViewportInteractor.TaeEntityType.REMO)
                {
                    RemoManager.EnableRemoCameraInViewport = MenuBar.CheckboxBig("Show Cutscene Camera View", RemoManager.EnableRemoCameraInViewport);
                    RemoManager.EnableDummyPrims           = MenuBar.CheckboxBig("Enable Dummy Node Helpers", RemoManager.EnableDummyPrims);
                    Main.Config.LockAspectRatioDuringRemo  = MenuBar.CheckboxBig("Lock Aspect Ratio to 16:9", Main.Config.LockAspectRatioDuringRemo);

                    ImGui.Button("Preview Full Cutscene With Streamed Audio");
                    if (ImGui.IsItemClicked())
                    {
                        RemoManager.StartFullPreview();
                    }
                }
                else
                {
                    ImGui.Text("No entity loaded.");
                }
            }