Skip to content

Commit

Permalink
feat: Pinned Search Filters + AC6 Regulation
Browse files Browse the repository at this point in the history
- Pinned the search filters in Model Editor
- Pinned the search filters in Gparam Editor
- Pinned the search filters in EMEVD Editor
- Pinned the search filters in ESD Editor
- Added AC6 regulation 1.0.7.2 support
  • Loading branch information
vawser committed Oct 29, 2024
1 parent 9452e8e commit 6c62496
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 54 deletions.
33 changes: 21 additions & 12 deletions src/StudioCore/Assets/ESD/AC6/Talk.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
{
"name": "talkParamId",
"displayName": "Talk Param ID",
"description": ""
"description": "",
"argLink": "param/TalkParam"
},
{
"name": "unknown",
Expand Down Expand Up @@ -585,7 +586,8 @@
{
"name": "spEffectId",
"displayName": "SpEffect ID",
"description": ""
"description": "",
"argLink": "param/SpEffectParam"
}
]
},
Expand All @@ -599,7 +601,8 @@
{
"name": "feTextEffectParamId",
"displayName": "Text Effect Param ID",
"description": "The ID of a param row from the FeTextEffectParam param."
"description": "The ID of a param row from the FeTextEffectParam param.",
"argLink": "param/FeTextEffectParam"
}
]
},
Expand Down Expand Up @@ -1216,7 +1219,7 @@
"name": "machineId",
"displayName": "Machine ID",
"description": "Unverified",
"argLink": "StateGroup"
"argLink": "esd/StateGroup"
}
]
},
Expand All @@ -1231,7 +1234,7 @@
"name": "machineId",
"displayName": "Machine ID",
"description": "Unverified",
"argLink": "StateGroup"
"argLink": "esd/StateGroup"
}
]
},
Expand Down Expand Up @@ -1346,7 +1349,8 @@
{
"name": "tutorialParamId",
"displayName": "Tutorial Param ID",
"description": ""
"description": "",
"argLink": "param/TutorialParam"
}
]
},
Expand All @@ -1361,7 +1365,7 @@
"name": "machineId",
"displayName": "Machine ID",
"description": "",
"argLink": "StateGroup"
"argLink": "esd/StateGroup"
}
]
},
Expand Down Expand Up @@ -1513,7 +1517,8 @@
{
"name": "feTextEffectParamId",
"displayName": "Text Effect Param ID",
"description": ""
"description": "",
"argLink": "param/FeTextEffectParam"
},
{
"name": "value",
Expand Down Expand Up @@ -1579,7 +1584,8 @@
{
"name": "tutorialParamId",
"displayName": "Tutorial Param ID",
"description": ""
"description": "",
"argLink": "param/TutorialParam"
},
{
"name": "unknown",
Expand Down Expand Up @@ -2236,7 +2242,8 @@
{
"name": "spEffectId",
"displayName": "SpEffect ID",
"description": ""
"description": "",
"argLink": "param/SpEffectParam"
}
]
},
Expand All @@ -2249,7 +2256,8 @@
{
"name": "spEffectId",
"displayName": "SpEffect ID",
"description": ""
"description": "",
"argLink": "param/SpEffectParam"
}
]
},
Expand Down Expand Up @@ -2564,7 +2572,8 @@
{
"name": "arenaParamId",
"displayName": "Arena Param ID",
"description": ""
"description": "",
"argLink": "param/ArenaParam"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/StudioCore/Assets/Paramdex/AC6/Upgrader/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1_07_1_0016L
1_07_2_0018L
Binary file not shown.
5 changes: 4 additions & 1 deletion src/StudioCore/Editors/EmevdEditor/Core/EmevdEventView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void Display()
ImGui.Begin("Events##EventListView");

Filters.DisplayEventFilterSearch();
ImGui.Separator();

ImGui.BeginChild("EventListSection");

if (Selection.SelectedScript != null)
{
Expand Down Expand Up @@ -101,6 +102,8 @@ public void Display()
}
}

ImGui.EndChild();

ImGui.End();
}
}
4 changes: 3 additions & 1 deletion src/StudioCore/Editors/EmevdEditor/Core/EmevdFileView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Display()

Filters.DisplayFileFilterSearch();

ImGui.Separator();
ImGui.BeginChild("FileListSection");

foreach (var (info, binder) in EmevdBank.ScriptBank)
{
Expand Down Expand Up @@ -92,6 +92,8 @@ public void Display()
}
}

ImGui.EndChild();

ImGui.End();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public void Display()
ImGui.Begin("Instructions##EventInstructionView");

Filters.DisplayInstructionFilterSearch();
ImGui.Separator();

ImGui.BeginChild("InstructionListSection");

if (Selection.SelectedEvent != null)
{
Expand Down Expand Up @@ -92,6 +93,8 @@ public void Display()

}

ImGui.EndChild();

ImGui.End();
}

Expand Down
5 changes: 3 additions & 2 deletions src/StudioCore/Editors/EsdEditor/Core/EsdFileView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public void Display()

Filters.DisplayFileFilterSearch();

ImGui.Text($"File");
ImGui.Separator();
ImGui.BeginChild("FileListSection");

foreach (var (info, binder) in EsdBank.TalkBank)
{
Expand Down Expand Up @@ -90,6 +89,8 @@ public void Display()
}
}

ImGui.EndChild();

ImGui.End();
}
}
4 changes: 4 additions & 0 deletions src/StudioCore/Editors/EsdEditor/Core/EsdScriptView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public void Display()

Filters.DisplayScriptFilterSearch();

ImGui.BeginChild("ScriptListSection");

if (info != null)
{
for (int i = 0; i < info.EsdFiles.Count; i++)
Expand Down Expand Up @@ -99,6 +101,8 @@ public void Display()
}
}

ImGui.EndChild();

ImGui.End();
}
}
4 changes: 4 additions & 0 deletions src/StudioCore/Editors/EsdEditor/Core/EsdStateGroupView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public void Display()

Filters.DisplayStateGroupFilterSearch();

ImGui.BeginChild("StateGroupSection");

if (script != null)
{
foreach (var entry in script.StateGroups)
Expand Down Expand Up @@ -95,6 +97,8 @@ public void Display()
}
}

ImGui.EndChild();

ImGui.End();
}
}
90 changes: 75 additions & 15 deletions src/StudioCore/Editors/EsdEditor/Core/EsdStateNodePropertiesView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using ImGuiNET;
using Google.Protobuf.WellKnownTypes;
using ImGuiNET;
using Org.BouncyCastle.Utilities;
using SoulsFormats;
using StudioCore.Editor;
Expand All @@ -11,8 +12,10 @@
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static SoulsFormats.ESD;
using static StudioCore.Editors.EsdEditor.EsdLang.AST;

namespace StudioCore.Editors.EsdEditor;

Expand Down Expand Up @@ -87,6 +90,7 @@ public void DisplayCommands(ESD.State node, List<CommandCall> commands, string i
ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0);

ImGui.AlignTextToFramePadding();
UIHelper.WrappedText("Command");

ImGui.TableSetColumnIndex(1);
Expand All @@ -96,32 +100,42 @@ public void DisplayCommands(ESD.State node, List<CommandCall> commands, string i
ImGui.TableNextRow();
ImGui.TableSetColumnIndex(0);

ImGui.AlignTextToFramePadding();
UIHelper.WrappedText("Parameters");

ImGui.TableSetColumnIndex(1);

DisplayerCommandParameterSection(node, commands, cmd);
}

ImGui.EndTable();
}
}

/// <summary>
/// Command ID
/// </summary>
private void DisplayCommandIdSection(ESD.State node, List<CommandCall> commands, CommandCall cmd)
{
var displayIdentifier = $"{cmd.CommandBank} [{cmd.CommandID}]";

ImGui.AlignTextToFramePadding();
UIHelper.WrappedText(displayIdentifier);

var cmdMeta = EsdMeta.GetCommandMeta(cmd.CommandBank, cmd.CommandID);
if (cmdMeta != null)
{
var displayAlias = cmdMeta.displayName;
ImGui.AlignTextToFramePadding();
UIHelper.DisplayAlias(displayAlias);
}

ImGui.SameLine();

// Go to State Group
if (cmd.CommandBank == 6)
{
if (ImGui.Button("Go To", new Vector2(80 * DPI.GetUIScale(), 18 * DPI.GetUIScale())))
ImGui.SameLine();
ImGui.AlignTextToFramePadding();
if (ImGui.Button("Go To", new Vector2(150 * DPI.GetUIScale(), 24 * DPI.GetUIScale())))
{
var targetStateGroup = cmd.CommandID;
var groups = Selection._selectedEsdScript.StateGroups;
Expand All @@ -138,32 +152,78 @@ private void DisplayCommandIdSection(ESD.State node, List<CommandCall> commands,
}
}

/// <summary>
/// Command Parameters
/// </summary>
private void DisplayerCommandParameterSection(ESD.State node, List<CommandCall> commands, CommandCall cmd)
{
UIHelper.WrappedText("Parameters");

ImGui.TableSetColumnIndex(1);

var cmdArgMeta = EsdMeta.GetCommandArgMeta(cmd.CommandBank, cmd.CommandID);

for(int i = 0; i < cmd.Arguments.Count; i++)
{
var arg = cmd.Arguments[i];

var expr = EzInfixor.BytecodeToInfix(arg);
UIHelper.WrappedText($"{expr.AsInt()}");

EsdMeta_Arg argMeta = null;
if (cmdArgMeta.Count > i)
// Value expr
if(expr is ConstExpr constExpr)
{
ImGui.AlignTextToFramePadding();
UIHelper.WrappedText($"{constExpr}");

if (cmdArgMeta.Count > i)
{
var argMeta = cmdArgMeta[i];

var displayAlias = argMeta.displayName;
ImGui.AlignTextToFramePadding();
UIHelper.DisplayAlias(displayAlias);

// Display quick-link button if applicable
DisplayGoToButton(argMeta, constExpr);
}
}
}
}

private void DisplayGoToButton(EsdMeta_Arg argMeta, ConstExpr expr)
{
if (argMeta.argLink != null)
{
ImGui.SameLine();
ImGui.AlignTextToFramePadding();
if (ImGui.Button("Go To", new Vector2(150 * DPI.GetUIScale(), 24 * DPI.GetUIScale())))
{
argMeta = cmdArgMeta[i];
var linkExpression = argMeta.argLink.Split("/");
var source = linkExpression[0];
var target = linkExpression[1];

var displayAlias = argMeta.displayName;
UIHelper.DisplayAlias(displayAlias);
// ESD
if (source == "esd")
{
if (target == "StateGroup")
{
var targetStateGroup = expr.AsInt();
var groups = Selection._selectedEsdScript.StateGroups;

foreach (var (key, entry) in groups)
{
if (key == targetStateGroup)
{
Selection.ResetStateGroupNode();
Selection.SetStateGroup(key, entry);
}
}
}
}

if (argMeta.argLink != null && argMeta.argLink == "StateGroup")
// PARAM
if (source == "param")
{
var paramName = target;
var rowID = expr.AsInt();

EditorCommandQueue.AddCommand($@"param/select/-1/{paramName}/{rowID}");
}
}
}
Expand Down
Loading

0 comments on commit 6c62496

Please sign in to comment.