Skip to content

Commit

Permalink
feat: Param Field Labels
Browse files Browse the repository at this point in the history
- Added toggles for the param helper labels in the first column (e.g. the yellow enum title, the param titles, etc).
  • Loading branch information
vawser committed Dec 11, 2024
1 parent fa6e5e5 commit 44346ac
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 85 deletions.
4 changes: 2 additions & 2 deletions src/StudioCore/Assets/PARAM/AC6/Meta/EquipParamWeapon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1998,7 +1998,7 @@
AltName="Shield Defense: Coral"
Wiki="The flat value used to reduce incoming damage of the specified type." />

<physicalShield_DefThunder
<physicalShield_DefDark
AltName="Shield Defense: Dark"
Wiki="The flat value used to reduce incoming damage of the specified type."
Obsolete="" />
Expand Down Expand Up @@ -2096,7 +2096,7 @@
Wiki="The SFX ID to use for the particle that is used for the persistent Guard action."
ParticleAlias="" />

<guardOpenStartSfxDmyId
<guardOpenStaySfxId
AltName="Guard - Persistent: Dummy Polygon ID"
Wiki="The dummy polygon ID to use for the particle that is used for the persistent Guard action." />

Expand Down
4 changes: 4 additions & 0 deletions src/StudioCore/Configuration/CFG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ public class CFG
public bool Param_PasteAfterSelection = false;
public bool Param_PasteThenSelect = true;
public bool Param_ShowFieldOffsets = false;
public bool Param_ShowFieldEnumLabels = true;
public bool Param_ShowFieldParamLabels = true;
public bool Param_ShowFieldFmgLabels = true;
public bool Param_ShowFieldTextureLabels = true;
public bool Param_ShowSecondaryNames = true;
public bool Param_ShowVanillaParams = true;
public bool Param_HidePaddingFields = true;
Expand Down
37 changes: 28 additions & 9 deletions src/StudioCore/Configuration/Settings/ParamEditorTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,30 @@ public void Display()
ImGui.Checkbox("Allow field reordering", ref CFG.Current.Param_AllowFieldReorder);
UIHelper.ShowHoverTooltip("Allow the field order to be changed by an alternative order as defined within the PARAM META file.");

ImGui.Separator();

ImGui.Checkbox("Show community field names first", ref CFG.Current.Param_MakeMetaNamesPrimary);
UIHelper.ShowHoverTooltip("Crowd-sourced names will appear before the canonical name in the Field View list.");

ImGui.Checkbox("Show secondary field names", ref CFG.Current.Param_ShowSecondaryNames);
UIHelper.ShowHoverTooltip("The crowd-sourced name (or the canonical name if the above option is enabled) will appear after the initial name in the Field View list.");

ImGui.Checkbox("Show field data offsets", ref CFG.Current.Param_ShowFieldOffsets);
UIHelper.ShowHoverTooltip("The field offset within the .PARAM file will be show to the left in the Field View List.");
UIHelper.ShowHoverTooltip("The field offset within the .PARAM file will be shown to the left in the Field View List.");

ImGui.Checkbox("Show color preview", ref CFG.Current.Param_ShowColorPreview);
UIHelper.ShowHoverTooltip("Show color preview in field column if applicable.");

ImGui.Checkbox("Show graph visualisation", ref CFG.Current.Param_ShowGraphVisualisation);
UIHelper.ShowHoverTooltip("Show graph visualisation in field column if applicable.");

ImGui.Checkbox("Show view in map button", ref CFG.Current.Param_ViewInMapOption);
UIHelper.ShowHoverTooltip("Show the view in map if applicable.");

ImGui.Checkbox("Show view model button", ref CFG.Current.Param_ViewModelOption);
UIHelper.ShowHoverTooltip("Show the view model if applicable.");

ImGui.Separator();

ImGui.Checkbox("Hide field references", ref CFG.Current.Param_HideReferenceRows);
UIHelper.ShowHoverTooltip("Hide the generated param references for fields that link to other params.");
Expand All @@ -142,19 +158,22 @@ public void Display()
ImGui.Checkbox("Hide obsolete fields", ref CFG.Current.Param_HideObsoleteFields);
UIHelper.ShowHoverTooltip("Hides fields that are obsolete in the property editor view.");

ImGui.Checkbox("Show color preview", ref CFG.Current.Param_ShowColorPreview);
UIHelper.ShowHoverTooltip("Show color preview in field column if applicable.");
ImGui.Separator();

ImGui.Checkbox("Show graph visualisation", ref CFG.Current.Param_ShowGraphVisualisation);
UIHelper.ShowHoverTooltip("Show graph visualisation in field column if applicable.");
ImGui.Checkbox("Show field param labels", ref CFG.Current.Param_ShowFieldParamLabels);
UIHelper.ShowHoverTooltip("The field param labels will be shown below the field name.");

ImGui.Checkbox("Show view in map button", ref CFG.Current.Param_ViewInMapOption);
UIHelper.ShowHoverTooltip("Show the view in map if applicable.");
ImGui.Checkbox("Show field enum labels", ref CFG.Current.Param_ShowFieldEnumLabels);
UIHelper.ShowHoverTooltip("The field enum labels will be shown below the field name.");

ImGui.Checkbox("Show view model button", ref CFG.Current.Param_ViewModelOption);
UIHelper.ShowHoverTooltip("Show the view model if applicable.");
ImGui.Checkbox("Show field text labels", ref CFG.Current.Param_ShowFieldFmgLabels);
UIHelper.ShowHoverTooltip("The field fmg reference labels will be shown below the field name.");

ImGui.Checkbox("Show field image labels", ref CFG.Current.Param_ShowFieldTextureLabels);
UIHelper.ShowHoverTooltip("The field texture reference labels will be shown below the field name.");
}

// Field Information
if (ImGui.CollapsingHeader("Field Information", ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.Checkbox("Help Icon: Show field description", ref CFG.Current.Param_ShowFieldDescription_onIcon);
Expand Down
169 changes: 95 additions & 74 deletions src/StudioCore/Editor/EditorDecorations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ public static void ParamRefText(List<ParamRef> paramRefs, Param.Row context)
return;
}

if(!CFG.Current.Param_ShowFieldParamLabels)
{
return;
}

ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, ImGui.GetStyle().ItemSpacing.Y));
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_Default_Text_Color);
ImGui.TextUnformatted(@" <");
Expand Down Expand Up @@ -235,61 +240,63 @@ public static void FmgRefText(List<FMGRef> fmgRef, Param.Row context)
return;
}

if (CFG.Current.Param_HideReferenceRows == false) //Move preference
if (!CFG.Current.Param_ShowFieldFmgLabels)
{
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_Default_Text_Color);
ImGui.TextUnformatted(@" [");
List<string> inactiveRefs = new();
var first = true;
foreach (FMGRef r in fmgRef)
{
Param.Cell? c = context?[r.conditionField];
var inactiveRef = context != null && c != null && Convert.ToInt32(c.Value.Value) != r.conditionValue;
return;
}

if (inactiveRef)
{
inactiveRefs.Add(r.fmg);
}
else
{
if (first)
{
ImGui.SameLine();
ImGui.TextUnformatted(r.fmg);
}
else
{
ImGui.TextUnformatted(" " + r.fmg);
}
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_Default_Text_Color);
ImGui.TextUnformatted(@" [");
List<string> inactiveRefs = new();
var first = true;
foreach (FMGRef r in fmgRef)
{
Param.Cell? c = context?[r.conditionField];
var inactiveRef = context != null && c != null && Convert.ToInt32(c.Value.Value) != r.conditionValue;

first = false;
}
if (inactiveRef)
{
inactiveRefs.Add(r.fmg);
}

ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_FmgRefInactive_Text);
foreach (var inactive in inactiveRefs)
else
{
ImGui.SameLine();
if (first)
{
ImGui.TextUnformatted("!" + inactive);
ImGui.SameLine();
ImGui.TextUnformatted(r.fmg);
}
else
{
ImGui.TextUnformatted("!" + inactive);
ImGui.TextUnformatted(" " + r.fmg);
}

first = false;
}
}

ImGui.PopStyleColor();

ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_FmgRefInactive_Text);
foreach (var inactive in inactiveRefs)
{
ImGui.SameLine();
ImGui.TextUnformatted("]");
ImGui.PopStyleColor();
ImGui.PopStyleVar();
if (first)
{
ImGui.TextUnformatted("!" + inactive);
}
else
{
ImGui.TextUnformatted("!" + inactive);
}

first = false;
}

ImGui.PopStyleColor();

ImGui.SameLine();
ImGui.TextUnformatted("]");
ImGui.PopStyleColor();
ImGui.PopStyleVar();
}

public static void TextureRefText(List<TexRef> textureRef, Param.Row context)
Expand All @@ -303,16 +310,18 @@ public static void TextureRefText(List<TexRef> textureRef, Param.Row context)
return;
}

if (CFG.Current.Param_HideReferenceRows == false) //Move preference
if (!CFG.Current.Param_ShowFieldTextureLabels)
{
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_Default_Text_Color);
return;
}

ImGui.TextUnformatted(@" [Image]");
ImGui.PushStyleVar(ImGuiStyleVar.ItemSpacing, new Vector2(0, 0));
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_Default_Text_Color);

ImGui.PopStyleColor();
ImGui.PopStyleVar();
}
ImGui.TextUnformatted(@" [Image]");

ImGui.PopStyleColor();
ImGui.PopStyleVar();
}

public static void ParamRefsSelectables(ParamBank bank, List<ParamRef> paramRefs, Param.Row context,
Expand Down Expand Up @@ -523,13 +532,19 @@ public static void TextureRefSelectable(EditorScreen ownerScreen, List<TexRef> t

public static void EnumNameText(ParamEnum pEnum)
{
if (pEnum != null && pEnum.Name != null && CFG.Current.Param_HideEnums == false) //Move preference
if (!CFG.Current.Param_ShowFieldEnumLabels)
{
return;
}

if (pEnum != null && pEnum.Name != null)
{
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {pEnum.Name}");
ImGui.PopStyleColor();
}
}

public static void EnumValueText(Dictionary<string, string> enumValues, string value)
{
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumValue_Text);
Expand All @@ -539,21 +554,28 @@ public static void EnumValueText(Dictionary<string, string> enumValues, string v

public static void AliasEnumNameText(string name)
{
if (!CFG.Current.Param_ShowFieldEnumLabels)
{
return;
}

var inactiveEnum = false;

if (CFG.Current.Param_HideEnums == false) //Move preference
if(!inactiveEnum)
{
if(!inactiveEnum)
{
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {name}");
ImGui.PopStyleColor();
}
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {name}");
ImGui.PopStyleColor();
}
}

public static void ConditionalAliasEnumNameText(string name, Param.Row row, string limitField, string limitValue)
{
if (!CFG.Current.Param_ShowFieldEnumLabels)
{
return;
}

var inactiveEnum = false;

if (limitField != "")
Expand All @@ -562,22 +584,19 @@ public static void ConditionalAliasEnumNameText(string name, Param.Row row, stri
inactiveEnum = row != null && c != null && Convert.ToInt32(c.Value.Value) != Convert.ToInt32(limitValue);
}

if (CFG.Current.Param_HideEnums == false) //Move preference
if (!inactiveEnum)
{
if (!inactiveEnum)
{
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {name}");
ImGui.PopStyleColor();
}
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {name}");
ImGui.PopStyleColor();
}
}

public static void AliasEnumValueText(Dictionary<string, string> enumValues, string value)
{
var inactiveEnum = false;

if (CFG.Current.Param_HideEnums == false) //Move preference
if (!CFG.Current.Param_HideEnums) //Move preference
{
if (!inactiveEnum)
{
Expand Down Expand Up @@ -643,23 +662,25 @@ public static bool ProjectEnumsLoaded()

public static void ProjectEnumNameText(string enumType)
{
if (CFG.Current.Param_HideEnums == false) //Move preference
if (!CFG.Current.Param_ShowFieldEnumLabels)
{
var bank = Smithbox.BankHandler.ProjectEnums;
if (ProjectEnumsLoaded())
return;
}

var bank = Smithbox.BankHandler.ProjectEnums;
if (ProjectEnumsLoaded())
{
var enumEntry = bank.Enums.List.Where(e => e.Name == enumType).FirstOrDefault();

if (enumEntry != null)
{
var enumEntry = bank.Enums.List.Where(e => e.Name == enumType).FirstOrDefault();
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {enumEntry.DisplayName}");
ImGui.PopStyleColor();

if (enumEntry != null)
if (enumEntry.Description != "")
{
ImGui.PushStyleColor(ImGuiCol.Text, UI.Current.ImGui_EnumName_Text);
ImGui.TextUnformatted($@" {enumEntry.DisplayName}");
ImGui.PopStyleColor();

if (enumEntry.Description != "")
{
UIHelper.ShowHoverTooltip($"{enumEntry.Description}");
}
UIHelper.ShowHoverTooltip($"{enumEntry.Description}");
}
}
}
Expand Down

0 comments on commit 44346ac

Please sign in to comment.