Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename and refactorings #942

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions src/StudioCore/AssetBrowser/AssetBrowserScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using StudioCore.Banks.AliasBank;
using StudioCore.Editor;
using StudioCore.Gui;
using StudioCore.Interface;
using StudioCore.Editor;
using StudioCore.MsbEditor;
using StudioCore.Platform;
using StudioCore.Scene;
Expand Down Expand Up @@ -218,7 +218,7 @@ public void OnGui()
if (ImGui.Begin($@"Asset Browser: Category##{SourceType}AssetBrowser_CategoryList"))
{
ImGui.Separator();
ImguiUtils.WrappedText("Categories:");
Editor.EditorDecorations.WrappedText("Categories:");
ImGui.Separator();

DisplayCategoryList();
Expand All @@ -235,7 +235,7 @@ public void OnGui()
DisplayTopSection();

ImGui.Separator();
ImguiUtils.WrappedText("Assets:");
Editor.EditorDecorations.WrappedText("Assets:");
ImGui.Separator();

DisplayBrowserList(AssetCategoryType.Character, _characterNameCache, chrReferenceDict);
Expand All @@ -255,7 +255,7 @@ public void OnGui()
ImGui.Indent(10.0f);

ImGui.Separator();
ImguiUtils.WrappedText("Actions:");
Editor.EditorDecorations.WrappedText("Actions:");
ImGui.Separator();

if (SourceType == AssetBrowserSource.MapEditor)
Expand Down Expand Up @@ -283,7 +283,7 @@ private void DisplayTopSection()
{
ImGui.Separator();
ImGui.InputText($"Search", ref _searchInput, 255);
ImguiUtils.ShowHoverTooltip("Separate terms are split via the + character.");
Editor.EditorDecorations.ShowHoverTooltip("Separate terms are split via the + character.");
}

private void DisplayCategoryList()
Expand Down Expand Up @@ -327,7 +327,7 @@ private void DisplayCategoryList()
if (CFG.Current.AssetBrowser_ShowAliasesInBrowser)
{
var labelName = AliasUtils.GetMapNameAlias(mapId);
AliasUtils.DisplayAlias(labelName);
EditorDecorations.DisplayAlias(labelName);
}
}
}
Expand Down Expand Up @@ -393,14 +393,14 @@ private void DisplayBrowserList(AssetCategoryType assetType, List<string> nameCa
if (CFG.Current.AssetBrowser_ShowAliasesInBrowser)
{
var aliasName = referenceDict[lowerName].name;
AliasUtils.DisplayAlias(aliasName);
EditorDecorations.DisplayAlias(aliasName);
}

// Tags
if (CFG.Current.AssetBrowser_ShowTagsInBrowser)
{
var tagString = string.Join(" ", referenceDict[lowerName].tags);
AliasUtils.DisplayTagAlias(tagString);
EditorDecorations.DisplayTagAlias(tagString);
}
}
}
Expand Down Expand Up @@ -462,14 +462,14 @@ private void DisplayBrowserList_MapPiece(AssetCategoryType assetType, Dictionary
if (CFG.Current.AssetBrowser_ShowAliasesInBrowser)
{
var aliasName = referenceDict[lowerName].name;
AliasUtils.DisplayAlias(aliasName);
EditorDecorations.DisplayAlias(aliasName);
}

// Tags
if (CFG.Current.AssetBrowser_ShowTagsInBrowser)
{
var tagString = string.Join(" ", referenceDict[lowerName].tags);
AliasUtils.DisplayTagAlias(tagString);
EditorDecorations.DisplayTagAlias(tagString);
}
}
}
Expand All @@ -483,41 +483,41 @@ private void DisplayActions_MapEditor()
if (_selectedName == null || _selectedName == "")
return;

ImguiUtils.WrappedText("Apply the selected asset attributes to your current object selection.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.WrappedText("Apply the selected asset attributes to your current object selection.");
Editor.EditorDecorations.WrappedText("");

ImGui.Checkbox("Update Name of Selected Object", ref CFG.Current.AssetBrowser_UpdateName);
ImguiUtils.ShowHoverTooltip("Update the Name property of the selected entity when it is changed to a selected asset.");
Editor.EditorDecorations.ShowHoverTooltip("Update the Name property of the selected entity when it is changed to a selected asset.");

if (Locator.AssetLocator.Type is GameType.EldenRing or GameType.ArmoredCoreVI)
{
ImGui.Checkbox("Update Instance ID of Selected Object", ref CFG.Current.AssetBrowser_UpdateInstanceID);
ImguiUtils.ShowHoverTooltip("Update the Name property of the selected entity when it is changed to a selected asset.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.ShowHoverTooltip("Update the Name property of the selected entity when it is changed to a selected asset.");
Editor.EditorDecorations.WrappedText("");
}

if (ImGui.Button("Apply##action_Asset_Apply", new Vector2(200, 32)))
{
ApplyMapAssetSelection();
}
ImguiUtils.WrappedText("");
Editor.EditorDecorations.WrappedText("");

ImGui.Separator();
ImguiUtils.WrappedText("Alias:");
Editor.EditorDecorations.WrappedText("Alias:");
ImGui.Separator();

ImguiUtils.WrappedText("Update the stored name and tag list for the selected asset here.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.WrappedText("Update the stored name and tag list for the selected asset here.");
Editor.EditorDecorations.WrappedText("");

ImguiUtils.WrappedText("Name:");
Editor.EditorDecorations.WrappedText("Name:");
ImGui.InputText($"##Name", ref _refUpdateName, 255);
ImguiUtils.ShowHoverTooltip("Alias name given to this asset.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.ShowHoverTooltip("Alias name given to this asset.");
Editor.EditorDecorations.WrappedText("");

ImguiUtils.WrappedText("Tags:");
Editor.EditorDecorations.WrappedText("Tags:");
ImGui.InputText($"##Tags", ref _refUpdateTags, 255);
ImguiUtils.ShowHoverTooltip("Tags associated with this asset. Tags are separated with the , character.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.ShowHoverTooltip("Tags associated with this asset. Tags are separated with the , character.");
Editor.EditorDecorations.WrappedText("");

if (ImGui.Button("Update##action_AssetAlias_Update", new Vector2(200, 32)))
{
Expand All @@ -535,31 +535,31 @@ private void DisplayActions_ModelEditor()
if (_selectedName == null || _selectedName == "")
return;

ImguiUtils.WrappedText("Load the selected asset.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.WrappedText("Load the selected asset.");
Editor.EditorDecorations.WrappedText("");

if (ImGui.Button("Load##action_Asset_Load", new Vector2(200, 32)))
{
LoadModelAssetSelection();
}
ImguiUtils.WrappedText("");
Editor.EditorDecorations.WrappedText("");

ImGui.Separator();
ImguiUtils.WrappedText("Alias:");
Editor.EditorDecorations.WrappedText("Alias:");
ImGui.Separator();

ImguiUtils.WrappedText("Update the stored name and tag list for the selected asset here.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.WrappedText("Update the stored name and tag list for the selected asset here.");
Editor.EditorDecorations.WrappedText("");

ImguiUtils.WrappedText("Name:");
Editor.EditorDecorations.WrappedText("Name:");
ImGui.InputText($"##Name", ref _refUpdateName, 255);
ImguiUtils.ShowHoverTooltip("Alias name given to this asset.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.ShowHoverTooltip("Alias name given to this asset.");
Editor.EditorDecorations.WrappedText("");

ImguiUtils.WrappedText("Tags:");
Editor.EditorDecorations.WrappedText("Tags:");
ImGui.InputText($"##Tags", ref _refUpdateTags, 255);
ImguiUtils.ShowHoverTooltip("Tags associated with this asset. Tags are separated with the , character.");
ImguiUtils.WrappedText("");
Editor.EditorDecorations.ShowHoverTooltip("Tags associated with this asset. Tags are separated with the , character.");
Editor.EditorDecorations.WrappedText("");

if (ImGui.Button("Update##action_AssetAlias_Update", new Vector2(200, 32)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,9 @@
using System.Threading.Tasks;
using static Andre.Native.ImGuiBindings;

namespace StudioCore.Interface;
namespace StudioCore.Banks.AliasBank;
public static class AliasUtils
{
public static void DisplayAlias(string aliasName)
{
if (aliasName != "")
{
ImGui.SameLine();
ImGui.PushTextWrapPos(0);
ImGui.TextColored(new Vector4(1.0f, 1.0f, 0.0f, 1.0f), @$"{aliasName}");
ImGui.PopTextWrapPos();
}
}
public static void DisplayTagAlias(string aliasName)
{
if (aliasName != "")
{
ImGui.SameLine();
ImGui.PushTextWrapPos(0);
ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), @$"[{aliasName}]");
ImGui.PopTextWrapPos();
}
}

public static string GetTagListString(List<string> refTagList)
{
var tagListStr = "";
Expand Down
148 changes: 148 additions & 0 deletions src/StudioCore/Editor/EditorDecorations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -924,5 +924,153 @@ public static void ImGui_DisplayPropertyInfo(Type propType, string fieldName, st
}

ImGui.Separator();
}
public static unsafe void ShowMenuIcon(string iconStr)
{
ImGui.PushStyleVarVec2(ImGuiStyleVar.ItemSpacing, new Vector2(0, ImGui.GetStyle()->ItemSpacing.Y));
ImGui.TextUnformatted(iconStr);
ImGui.PopStyleVar(1);
ImGui.SameLine();
}

public static unsafe void ShowActiveStatus(bool isActive)
{
if (isActive)
{
ImGui.SameLine();
ImGui.PushStyleVarVec2(ImGuiStyleVar.ItemSpacing, new Vector2(0, ImGui.GetStyle()->ItemSpacing.Y));
ImGui.TextUnformatted($"{ForkAwesome.CheckSquare}");
ImGui.PopStyleVar(1);
}
else
{
ImGui.SameLine();
ImGui.PushStyleVarVec2(ImGuiStyleVar.ItemSpacing, new Vector2(0, ImGui.GetStyle()->ItemSpacing.Y));
ImGui.TextUnformatted($"{ForkAwesome.Square}");
ImGui.PopStyleVar(1);
}
}

public static void ShowHelpButton(string title, string desc, string id)
{
if (ImGui.Button($"{title}"))
ImGui.OpenPopup($"##{id}HelpPopup");

if (ImGui.BeginPopup($"##{id}HelpPopup"))
{
ImGui.Text($"{desc}");
ImGui.EndPopup();
}
}

public static void ShowHelpMarker(string desc)
{
if (CFG.Current.ShowUITooltips)
{
ImGui.SameLine();
ImGui.TextDisabled("(?)");
if (ImGui.IsItemHovered(0))
{
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(450.0f);
ImGui.TextUnformatted(desc);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
}
}
}

public static void ShowButtonTooltip(string desc)
{
if (CFG.Current.ShowUITooltips)
{
if (ImGui.IsItemHovered(0))
{
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(450.0f);
ImGui.TextUnformatted(desc);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
}
}
}

public static void ShowHoverTooltip(string desc)
{
if (CFG.Current.ShowUITooltips)
{
if (ImGui.IsItemHovered(0))
{
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(450.0f);
ImGui.TextUnformatted(desc);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
}
}
}

public static void ShowWideHoverTooltip(string desc)
{
if (CFG.Current.ShowUITooltips)
{
if (ImGui.IsItemHovered(0))
{
ImGui.BeginTooltip();
ImGui.PushTextWrapPos(800.0f);
ImGui.TextUnformatted(desc);
ImGui.PopTextWrapPos();
ImGui.EndTooltip();
}
}
}

public static string GetKeybindHint(string hint)
{
if (hint == "")
return "None";
else
return hint;
}

public static void WrappedText(string text)
{
var size = ImGui.GetWindowSize();

ImGui.PushTextWrapPos(size.X);
ImGui.TextUnformatted(text);
ImGui.PopTextWrapPos();
}

public static void WrappedTextColored(Vector4 color, string text)
{
var size = ImGui.GetWindowSize();

ImGui.PushTextWrapPos(size.X);
ImGui.PushStyleColorVec4(ImGuiCol.Text, color);
ImGui.TextUnformatted(text);
ImGui.PopStyleColor(1);
ImGui.PopTextWrapPos();
}
public static void DisplayAlias(string aliasName)
{
if (aliasName != "")
{
ImGui.SameLine();
ImGui.PushTextWrapPos(0);
ImGui.TextColored(new Vector4(1.0f, 1.0f, 0.0f, 1.0f), @$"{aliasName}");
ImGui.PopTextWrapPos();
}
}
public static void DisplayTagAlias(string aliasName)
{
if (aliasName != "")
{
ImGui.SameLine();
ImGui.PushTextWrapPos(0);
ImGui.TextColored(new Vector4(0.0f, 1.0f, 0.0f, 1.0f), @$"[{aliasName}]");
ImGui.PopTextWrapPos();
}
}

}
Loading
Loading