mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-18 06:34:19 +01:00
Use validation logic for new material field
This commit is contained in:
parent
078688454a
commit
9063d131ba
1 changed files with 15 additions and 9 deletions
|
|
@ -337,7 +337,7 @@ public partial class ModEditWindow
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
ImGui.SetNextItemWidth(-1);
|
ImGui.SetNextItemWidth(-1);
|
||||||
ImGui.InputTextWithHint("##newMaterial", "Add new material...", ref _modelNewMaterial, Utf8GamePath.MaxGamePathLength, inputFlags);
|
ImGui.InputTextWithHint("##newMaterial", "Add new material...", ref _modelNewMaterial, Utf8GamePath.MaxGamePathLength, inputFlags);
|
||||||
var validName = _modelNewMaterial.Length > 0 && _modelNewMaterial[0] == '/';
|
var validName = tab.ValidateMaterial(_modelNewMaterial);
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Plus.ToIconString(), UiHelpers.IconButtonSize, string.Empty, !validName, true))
|
if (ImGuiUtil.DrawDisabledButton(FontAwesomeIcon.Plus.ToIconString(), UiHelpers.IconButtonSize, string.Empty, !validName, true))
|
||||||
{
|
{
|
||||||
|
|
@ -346,6 +346,8 @@ public partial class ModEditWindow
|
||||||
_modelNewMaterial = string.Empty;
|
_modelNewMaterial = string.Empty;
|
||||||
}
|
}
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
|
if (!validName && _modelNewMaterial.Length > 0)
|
||||||
|
DrawInvalidMaterialMarker();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -392,18 +394,22 @@ public partial class ModEditWindow
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
// Add markers to invalid materials.
|
// Add markers to invalid materials.
|
||||||
if (!tab.ValidateMaterial(temp))
|
if (!tab.ValidateMaterial(temp))
|
||||||
using (var colorHandle = ImRaii.PushColor(ImGuiCol.TextDisabled, 0xFF0000FF, true))
|
DrawInvalidMaterialMarker();
|
||||||
{
|
|
||||||
ImGuiComponents.HelpMarker(
|
|
||||||
"Materials must be either relative (e.g. \"/filename.mtrl\")\n"
|
|
||||||
+ "or absolute (e.g. \"bg/full/path/to/filename.mtrl\"),\n"
|
|
||||||
+ "and must end in \".mtrl\".",
|
|
||||||
FontAwesomeIcon.TimesCircle);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawInvalidMaterialMarker()
|
||||||
|
{
|
||||||
|
using var colorHandle = ImRaii.PushColor(ImGuiCol.TextDisabled, 0xFF0000FF, true);
|
||||||
|
|
||||||
|
ImGuiComponents.HelpMarker(
|
||||||
|
"Materials must be either relative (e.g. \"/filename.mtrl\")\n"
|
||||||
|
+ "or absolute (e.g. \"bg/full/path/to/filename.mtrl\"),\n"
|
||||||
|
+ "and must end in \".mtrl\".",
|
||||||
|
FontAwesomeIcon.TimesCircle);
|
||||||
|
}
|
||||||
|
|
||||||
private bool DrawModelLodDetails(MdlTab tab, int lodIndex, bool disabled)
|
private bool DrawModelLodDetails(MdlTab tab, int lodIndex, bool disabled)
|
||||||
{
|
{
|
||||||
using var lodNode = ImRaii.TreeNode($"Level of Detail #{lodIndex + 1}", ImGuiTreeNodeFlags.DefaultOpen);
|
using var lodNode = ImRaii.TreeNode($"Level of Detail #{lodIndex + 1}", ImGuiTreeNodeFlags.DefaultOpen);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue