Skip to content

Commit

Permalink
Folders and UI adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Limiana committed Mar 31, 2024
1 parent f5673c3 commit 1d5c27d
Show file tree
Hide file tree
Showing 11 changed files with 189 additions and 86 deletions.
1 change: 1 addition & 0 deletions DynamicBridge/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class Config : IEzConfig
public bool ShowTutorial = true;
public bool UnifyJobs = true;
public bool HonotificUnfiltered = false;
public bool AutofillFromGlam = false;
}

public enum GlamourerNoRuleBehavior
Expand Down
2 changes: 2 additions & 0 deletions DynamicBridge/Configuration/Profile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class Profile
public List<Profile> Subprofiles = [];
public HashSet<ulong> Characters = [];
public List<string> Pathes = [];
public List<string> CustomizePathes = [];
public List<string> MoodlesPathes = [];
public Preset FallbackPreset = new();

internal bool IsGlobal => C.GlobalProfile == this;
Expand Down
4 changes: 2 additions & 2 deletions DynamicBridge/Gui/Debug.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static void Draw()
}
}
}
if(ImGui.CollapsingHeader("Pathes"))
/*if(ImGui.CollapsingHeader("Pathes"))
{
foreach(var x in Utils.GetCombinedPathes())
{
Expand All @@ -189,7 +189,7 @@ public static void Draw()
}
ImGuiEx.TextV($"{x.Name}");
}
}
}*/
if (ImGui.CollapsingHeader("Items"))
{
ImGuiEx.Text($"Current: {Utils.GetCurrentGear().Print()}");
Expand Down
77 changes: 53 additions & 24 deletions DynamicBridge/Gui/GuiPresets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ void FiltersSelection()
{
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
FiltersSelection();
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 5f);
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, Utils.IndentSpacing);
// normal
{
List<(string[], Action)> items = [];
Expand All @@ -417,7 +417,15 @@ void FiltersSelection()
var contains = preset.Glamourer.Contains(id);
if (OnlySelected[filterCnt] && !contains) continue;

items.Add((transformedName.SplitDirectories()[0..^1], () => Utils.CollectionSelectable(contains ? Colors.TabGreen : null, $"{name} ##{x.Identifier}", id, preset.Glamourer)));
items.Add((transformedName.SplitDirectories()[0..^1], () =>
{
if(Utils.CollectionSelectable(contains ? Colors.TabGreen : null, $"{name} ##{x.Identifier}", id, preset.Glamourer))
{
if (C.AutofillFromGlam && preset.Name == "" && preset.Glamourer.Contains(id)) preset.Name = name;
}
}

));
}
foreach (var x in preset.Glamourer)
{
Expand All @@ -444,7 +452,15 @@ void FiltersSelection()
foreach (var x in preset.ComplexGlamourer)
{
if (designs.Any(d => d.Name == x)) continue;
items.Add(([], () => Utils.CollectionSelectable(ImGuiColors.DalamudRed, $"{x}", x, preset.ComplexGlamourer, true)));
items.Add(([], () =>
{
if (Utils.CollectionSelectable(ImGuiColors.DalamudRed, $"{x}", x, preset.ComplexGlamourer, true))
{
if (C.AutofillFromGlam && preset.Name == "" && preset.ComplexGlamourer.Contains(x)) preset.Name = x;
}
}

));
}
if (items.Count > 0)
{
Expand All @@ -471,21 +487,26 @@ void FiltersSelection()
if (C.EnableCustomize)
{
ImGui.TableNextColumn();
if (isGlobal)
{
ImGuiEx.HelpMarker("All registered profiles are displayed in global profile, but only ones that are assigned to your current character will be used.", EColor.OrangeBright, FontAwesomeIcon.ExclamationTriangle.ToIconString(), false);
ImGui.SameLine();
}
ImGuiEx.SetNextItemFullWidth();
if (ImGui.BeginCombo("##customize", preset.Customize.Select(P.CustomizePlusManager.TransformName).PrintRange(out var fullList, "- None -"), C.ComboSize))
{
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 5f);
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, Utils.IndentSpacing);
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
FiltersSelection();
var profiles = P.CustomizePlusManager.GetProfiles(currentProfile.Characters.Select(Utils.GetCharaNameFromCID).Select(z => z.Split("@")[0])).OrderBy(x => P.CustomizePlusManager.TransformName($"{x.ID}"));
var profiles = P.CustomizePlusManager.GetProfiles(isGlobal?null:currentProfile.Characters.Select(Utils.GetCharaNameFromCID).Select(z => z.Split("@")[0])).OrderBy(x => P.CustomizePlusManager.TransformName($"{x.ID}"));
var index = 0;
List<(string[], Action)> items = [];
foreach (var x in profiles)
{
index++;
ImGui.PushID(index);
var name = P.CustomizePlusManager.TransformName($"{x.ID}");
if (C.GlamourerFullPath && currentProfile.Pathes.Count > 0 && !name.StartsWithAny(currentProfile.Pathes)) continue;
if (C.GlamourerFullPath && currentProfile.CustomizePathes.Count > 0 && !name.StartsWithAny(currentProfile.CustomizePathes)) continue;
if (Filters[filterCnt].Length > 0 && !name.Contains(Filters[filterCnt], StringComparison.OrdinalIgnoreCase)) continue;
if (OnlySelected[filterCnt] && !preset.Customize.Contains($"{x.ID}")) continue;
var contains = preset.Customize.Contains($"{x.ID}");
Expand Down Expand Up @@ -516,34 +537,40 @@ void FiltersSelection()
ImGui.TableNextColumn();
if (isGlobal && !C.HonotificUnfiltered)
{
ImGuiEx.HelpMarker("All registered titles are displayed in global profile, but only ones that are assigned to current character will be used UNLESS \"Allow selecting titles registered for other characters\" is enabled in settings.", EColor.RedBright, FontAwesomeIcon.ExclamationTriangle.ToIconString());
ImGuiEx.HelpMarker("All registered titles are displayed in global profile, but only ones that are assigned to your current character will be used UNLESS \"Allow selecting titles registered for other characters\" is enabled in settings.", EColor.OrangeBright, FontAwesomeIcon.ExclamationTriangle.ToIconString(), false);
ImGui.SameLine();
}
ImGuiEx.SetNextItemFullWidth();
if (ImGui.BeginCombo("##honorific", preset.Honorific.PrintRange(out var fullList, "- None -"), C.ComboSize))
{
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 5f);
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, Utils.IndentSpacing);
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
FiltersSelection();
var titles = P.HonorificManager.GetTitleData(C.HonotificUnfiltered || isGlobal?null:currentProfile.Characters).OrderBy(x => x.Title);
var index = 0;
IEnumerable<ulong> charas = C.HonotificUnfiltered || isGlobal ? C.SeenCharacters.Keys : currentProfile.Characters;
List<(string[], Action)> items = [];
foreach (var x in titles)
List<TitleData> allTitles = [];
foreach (var chara in charas)
{
index++;
ImGui.PushID(index);
var name = x.Title;
if (Filters[filterCnt].Length > 0 && !name.Contains(Filters[filterCnt], StringComparison.OrdinalIgnoreCase)) continue;
if (OnlySelected[filterCnt] && !preset.Honorific.Contains(name)) continue;
if (x.Color != null) ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(x.Color.Value, 1f));
var contains = preset.Honorific.Contains(x.Title);
items.Add(([], () => Utils.CollectionSelectable(contains ? Colors.TabGreen : null, $"{name} ", x.Title, preset.Honorific)));
if (x.Color != null) ImGui.PopStyleColor();
ImGui.PopID();
var titles = P.HonorificManager.GetTitleData([chara]).OrderBy(x => x.Title);
allTitles.AddRange(titles);
var index = 0;
foreach (var x in titles)
{
index++;
ImGui.PushID(index);
var name = x.Title;
if (Filters[filterCnt].Length > 0 && !name.Contains(Filters[filterCnt], StringComparison.OrdinalIgnoreCase)) continue;
if (OnlySelected[filterCnt] && !preset.Honorific.Contains(name)) continue;
if (x.Color != null) ImGui.PushStyleColor(ImGuiCol.Text, new Vector4(x.Color.Value, 1f));
var contains = preset.Honorific.Contains(x.Title);
items.Add(([Utils.GetCharaNameFromCID(chara)], () => Utils.CollectionSelectable(contains ? Colors.TabGreen : null, $"{name} ", x.Title, preset.Honorific)));
if (x.Color != null) ImGui.PopStyleColor();
ImGui.PopID();
}
}
foreach (var x in preset.Honorific)
{
if (titles.Any(d => d.Title == x)) continue;
if (allTitles.Any(d => d.Title == x)) continue;
items.Add(([], () => Utils.CollectionSelectable(ImGuiColors.DalamudRed, $"{x} ", x, preset.Honorific, true)));
}
Utils.DrawFolder(items);
Expand All @@ -565,7 +592,7 @@ void FiltersSelection()
string fullList = null;
if (ImGui.BeginCombo("##penumbra", preset.PenumbraType != SpecialPenumbraAssignment.Use_Named_Collection ? preset.PenumbraType.ToString().Replace("_", " ") : preset.Penumbra.PrintRange(out fullList, "- None -"), C.ComboSize))
{
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 5f);
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, Utils.IndentSpacing);
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
ImGuiEx.Text($"Assignment Type:");
ImGuiEx.EnumCombo($"##asstype", ref preset.PenumbraType);
Expand Down Expand Up @@ -609,7 +636,7 @@ void FiltersSelection()
ImGuiEx.SetNextItemFullWidth();
if (ImGui.BeginCombo("##moodles", preset.Moodles.Select(Utils.GetName).PrintRange(out var fullList, "- None -"), C.ComboSize))
{
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, 5f);
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, Utils.IndentSpacing);
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
void ToggleMoodle(Vector4 selectedCol, Guid id, string name)
{
Expand Down Expand Up @@ -663,6 +690,7 @@ void ToggleMoodle(Vector4 selectedCol, Guid id, string name)
var name = x.FullPath;
if (Filters[filterCnt].Length > 0 && !name.Contains(Filters[filterCnt], StringComparison.OrdinalIgnoreCase)) continue;
if (OnlySelected[filterCnt] && !preset.Moodles.Any(z => z.Guid == x.ID)) continue;
if (currentProfile.MoodlesPathes.Count > 0 && !name.StartsWithAny(currentProfile.MoodlesPathes)) continue;
var parts = name.SplitDirectories();
items.Add((parts[0..^1], () => ToggleMoodle(Colors.TabGreen, x.ID, parts[^1])));
ImGui.PopID();
Expand All @@ -680,6 +708,7 @@ void ToggleMoodle(Vector4 selectedCol, Guid id, string name)
var name = x.FullPath;
if (Filters[filterCnt].Length > 0 && !name.Contains(Filters[filterCnt], StringComparison.OrdinalIgnoreCase)) continue;
if (OnlySelected[filterCnt] && !preset.Moodles.Any(z => z.Guid == x.ID)) continue;
if (currentProfile.MoodlesPathes.Count > 0 && !name.StartsWithAny(currentProfile.MoodlesPathes)) continue;
var parts = name.SplitDirectories();
items.Add((parts[0..^1], () => ToggleMoodle(Colors.TabYellow, x.ID, parts[^1])));
ImGui.PopID();
Expand Down
57 changes: 35 additions & 22 deletions DynamicBridge/Gui/GuiProfiles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,38 +89,51 @@ public static void Draw()
ImGui.TableNextColumn();

ImGuiEx.SetNextItemFullWidth();
if(ImGui.BeginCombo($"##FoldersWhitelist", profile.Pathes.PrintRange(out _), C.ComboSize))
if (ImGui.BeginCombo($"##FoldersWhitelist", profile.Pathes.Union(profile.CustomizePathes).Union(profile.MoodlesPathes).PrintRange(out _), C.ComboSize))
{
if(profile.Pathes.Count > 1) ImGuiEx.Tooltip(profile.Pathes.Join("\n"));
if (profile.Pathes.Count > 1) ImGuiEx.Tooltip(profile.Pathes.Join("\n"));
if (ImGui.IsWindowAppearing()) Utils.ResetCaches();
var pathes = Utils.GetCombinedPathes();
foreach (var x in pathes)
void DrawPathes(List<PathInfo> pathes, List<string> targetCollection)
{
for (int q = 0; q < x.Indentation; q++)
foreach (var x in pathes)
{
ImGuiEx.Spacing();
for (int q = 0; q < x.Indentation; q++)
{
ImGuiEx.Spacing();
}
Utils.CollectionSelectable(null, $"{x.Name}", x.Name, targetCollection);
}
ImGuiEx.CollectionCheckbox($"{x.Name}", x.Name, profile.Pathes);
if (x.Glamourer)
foreach (var x in targetCollection)
{
ImGui.SameLine();
ImGuiEx.Text(ImGuiColors.DalamudGrey3, UiBuilder.IconFont, "\uf630");
ImGuiEx.Tooltip("This folder is present in Glamourer");
}
if (x.Customize)
{
ImGui.SameLine();
ImGuiEx.Text(ImGuiColors.DalamudGrey3, UiBuilder.IconFont, "\ue541");
ImGuiEx.Tooltip("This folder is present in Customize+");
if (pathes.Any(z => z.Name == x)) continue;
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
Utils.CollectionSelectable(null, $"{x}", x, targetCollection, true);
ImGui.PopStyleColor();
}
}
foreach(var x in profile.Pathes)
ImGui.PushStyleVar(ImGuiStyleVar.IndentSpacing, Utils.IndentSpacing);
if (C.EnableGlamourer && ImGuiEx.TreeNode(Colors.TabBlue, "Glamourer", ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.PushID("Glam");
DrawPathes(P.GlamourerManager.GetCombinedPathes(), profile.Pathes);
ImGui.PopID();
ImGui.TreePop();
}
if (C.EnableCustomize && ImGuiEx.TreeNode(Colors.TabBlue, "Customize+", ImGuiTreeNodeFlags.DefaultOpen))
{
ImGui.PushID("Customize");
DrawPathes(P.CustomizePlusManager.GetCombinedPathes(), profile.CustomizePathes);
ImGui.PopID();
ImGui.TreePop();
}
if (C.EnableMoodles && ImGuiEx.TreeNode(Colors.TabBlue, "Moodles", ImGuiTreeNodeFlags.DefaultOpen))
{
if (pathes.Any(z => z.Name == x)) continue;
ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudRed);
ImGuiEx.CollectionCheckbox($"{x}", x, profile.Pathes);
ImGui.PopStyleColor();
ImGui.PushID("Moodles");
DrawPathes(P.MoodlesManager.GetCombinedPathes(), profile.MoodlesPathes);
ImGui.PopID();
ImGui.TreePop();
}
ImGui.PopStyleVar();
ImGui.EndCombo();
}
else
Expand Down
Loading

0 comments on commit 1d5c27d

Please sign in to comment.