public void Update(float elapsedSeconds, bool allowMouseUpdate)
        {
            if (!allowMouseUpdate)
            {
                return;
            }

            ScrollViewer.UpdateInput(MainScreen.Input, elapsedSeconds, true);

            if (Rect.Contains(MainScreen.Input.MousePositionPoint))
            {
                // MainScreen.Input.CursorType = MouseCursorType.Arrow;

                if (MainScreen.Input.LeftClickDown)
                {
                    var mouseCheckPoint = new Point(
                        (int)(MainScreen.Input.MousePosition.X - Rect.X + ScrollViewer.Scroll.X),
                        (int)(MainScreen.Input.MousePosition.Y - Rect.Y + ScrollViewer.Scroll.Y));

                    float offset = 0;
                    foreach (var taeSection in AnimTaeSections.Values)
                    {
                        var thisGroupRect = new Rectangle(0, (int)offset, ScrollViewer.Viewport.Width, AnimSectionHeaderHeight);

                        if (thisGroupRect.Contains(mouseCheckPoint))
                        {
                            taeSection.Collapsed = !taeSection.Collapsed;
                        }

                        offset += AnimSectionHeaderHeight; //Section Header

                        if (taeSection.Collapsed)
                        {
                            continue;
                        }

                        float groupStartOffset = offset;
                        foreach (var anim in taeSection.InfoMap)
                        {
                            var thisAnimRect = new Rectangle(0, (int)(groupStartOffset + anim.Value.VerticalOffset),
                                                             ScrollViewer.Viewport.Width, AnimHeight);
                            if (thisAnimRect.Contains(mouseCheckPoint))
                            {
                                if (MainScreen.Graph?.ViewportInteractor?.EntityType == TaeViewportInteractor.TaeEntityType.REMO)
                                {
                                    MainScreen.REMO_HOTFIX_REQUEST_CUT_ADVANCE_NEXT_FRAME   = true;
                                    MainScreen.REMO_HOTFIX_REQUEST_CUT_ADVANCE_CUT_TAE      = taeSection.Tae;
                                    MainScreen.REMO_HOTFIX_REQUEST_CUT_ADVANCE_CUT_TAE_ANIM = anim.Value.Ref;
                                }
                                else
                                {
                                    MainScreen.Graph?.ViewportInteractor?.CancelCombo();
                                    RemoManager.CancelFullPlayback();
                                    MainScreen.SelectNewAnimRef(taeSection.Tae, anim.Value.Ref);
                                }
                            }
                            offset += AnimHeight;
                        }
                    }
                }
            }

            if (MainScreen.Input.KeyDown(Microsoft.Xna.Framework.Input.Keys.Insert))
            {
                MainScreen.DuplicateCurrentAnimation();
            }
        }
Exemple #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.");
                }
            }