mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Allow restricting only the options forcing redraw in customize drawer and do this for screen actors.
This commit is contained in:
parent
506f4b887e
commit
27281bedfb
7 changed files with 63 additions and 30 deletions
|
|
@ -22,6 +22,7 @@ public partial class CustomizationDrawer
|
||||||
var clan = _service.AwaitedService.GetName(CustomName.Clan);
|
var clan = _service.AwaitedService.GetName(CustomName.Clan);
|
||||||
if (_withApply)
|
if (_withApply)
|
||||||
{
|
{
|
||||||
|
using var disabled = ImRaii.Disabled(_locked);
|
||||||
if (UiHelpers.DrawCheckbox("##applyGender", "Apply gender of this design.", ChangeApply.HasFlag(CustomizeFlag.Gender), out var applyGender, _locked))
|
if (UiHelpers.DrawCheckbox("##applyGender", "Apply gender of this design.", ChangeApply.HasFlag(CustomizeFlag.Gender), out var applyGender, _locked))
|
||||||
ChangeApply = applyGender ? ChangeApply | CustomizeFlag.Gender : ChangeApply & ~CustomizeFlag.Gender;
|
ChangeApply = applyGender ? ChangeApply | CustomizeFlag.Gender : ChangeApply & ~CustomizeFlag.Gender;
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
@ -36,6 +37,7 @@ public partial class CustomizationDrawer
|
||||||
|
|
||||||
private void DrawGenderSelector()
|
private void DrawGenderSelector()
|
||||||
{
|
{
|
||||||
|
using var disabled = ImRaii.Disabled(_locked || _lockedRedraw);
|
||||||
var icon = _customize.Gender switch
|
var icon = _customize.Gender switch
|
||||||
{
|
{
|
||||||
Gender.Male when _customize.Race is Race.Hrothgar => FontAwesomeIcon.MarsDouble,
|
Gender.Male when _customize.Race is Race.Hrothgar => FontAwesomeIcon.MarsDouble,
|
||||||
|
|
@ -53,6 +55,7 @@ public partial class CustomizationDrawer
|
||||||
|
|
||||||
private void DrawRaceCombo()
|
private void DrawRaceCombo()
|
||||||
{
|
{
|
||||||
|
using var disabled = ImRaii.Disabled(_locked || _lockedRedraw);
|
||||||
ImGui.SetNextItemWidth(_raceSelectorWidth);
|
ImGui.SetNextItemWidth(_raceSelectorWidth);
|
||||||
using var combo = ImRaii.Combo("##subRaceCombo", _service.ClanName(_customize.Clan, _customize.Gender));
|
using var combo = ImRaii.Combo("##subRaceCombo", _service.ClanName(_customize.Clan, _customize.Gender));
|
||||||
if (!combo)
|
if (!combo)
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,12 @@ public partial class CustomizationDrawer
|
||||||
}
|
}
|
||||||
|
|
||||||
var icon = _service.AwaitedService.GetIcon(custom!.Value.IconId);
|
var icon = _service.AwaitedService.GetIcon(custom!.Value.IconId);
|
||||||
|
using (var disabled = ImRaii.Disabled(_locked || _currentIndex is CustomizeIndex.Face && _lockedRedraw))
|
||||||
|
{
|
||||||
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
if (ImGui.ImageButton(icon.ImGuiHandle, _iconSize))
|
||||||
ImGui.OpenPopup(IconSelectorPopup);
|
ImGui.OpenPopup(IconSelectorPopup);
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverIconTooltip(icon, _iconSize);
|
ImGuiUtil.HoverIconTooltip(icon, _iconSize);
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
@ -88,6 +92,7 @@ public partial class CustomizationDrawer
|
||||||
private void DrawMultiIconSelector()
|
private void DrawMultiIconSelector()
|
||||||
{
|
{
|
||||||
using var bigGroup = ImRaii.Group();
|
using var bigGroup = ImRaii.Group();
|
||||||
|
using var disabled = ImRaii.Disabled(_locked);
|
||||||
DrawMultiIcons();
|
DrawMultiIcons();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
using var group = ImRaii.Group();
|
using var group = ImRaii.Group();
|
||||||
|
|
@ -110,12 +115,16 @@ public partial class CustomizationDrawer
|
||||||
{
|
{
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
|
using var _ = ImRaii.Enabled();
|
||||||
ImGui.TextUnformatted("(Using Face 1)");
|
ImGui.TextUnformatted("(Using Face 1)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + _spacing.Y);
|
ImGui.SetCursorPosY(ImGui.GetCursorPosY() + _spacing.Y);
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
|
using (var _ = ImRaii.Enabled())
|
||||||
|
{
|
||||||
ImGui.TextUnformatted(_set.Option(CustomizeIndex.LegacyTattoo));
|
ImGui.TextUnformatted(_set.Option(CustomizeIndex.LegacyTattoo));
|
||||||
|
}
|
||||||
|
|
||||||
if (_withApply)
|
if (_withApply)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ public partial class CustomizationDrawer
|
||||||
using var _ = SetId(index);
|
using var _ = SetId(index);
|
||||||
using var bigGroup = ImRaii.Group();
|
using var bigGroup = ImRaii.Group();
|
||||||
|
|
||||||
|
using (var disabled = ImRaii.Disabled(_locked))
|
||||||
|
{
|
||||||
DrawPercentageSlider();
|
DrawPercentageSlider();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
PercentageInputInt();
|
PercentageInputInt();
|
||||||
|
|
@ -23,6 +25,7 @@ public partial class CustomizationDrawer
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ApplyCheckbox();
|
ApplyCheckbox();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
|
|
@ -54,6 +57,7 @@ public partial class CustomizationDrawer
|
||||||
if (_currentIndex is CustomizeIndex.Face && _set.Race is Race.Hrothgar)
|
if (_currentIndex is CustomizeIndex.Face && _set.Race is Race.Hrothgar)
|
||||||
value -= 4;
|
value -= 4;
|
||||||
|
|
||||||
|
using var disabled = ImRaii.Disabled(_locked || _currentIndex is CustomizeIndex.Face && _lockedRedraw);
|
||||||
ImGui.SetNextItemWidth(_inputIntSizeNoButtons);
|
ImGui.SetNextItemWidth(_inputIntSizeNoButtons);
|
||||||
if (ImGui.InputInt("##text", ref value, 0, 0))
|
if (ImGui.InputInt("##text", ref value, 0, 0))
|
||||||
{
|
{
|
||||||
|
|
@ -63,6 +67,7 @@ public partial class CustomizationDrawer
|
||||||
else if (ImGui.GetIO().KeyCtrl)
|
else if (ImGui.GetIO().KeyCtrl)
|
||||||
UpdateValue((CustomizeValue)value);
|
UpdateValue((CustomizeValue)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_withApply)
|
if (!_withApply)
|
||||||
ImGuiUtil.HoverTooltip("Hold Control to force updates with invalid/unknown options at your own risk.");
|
ImGuiUtil.HoverTooltip("Hold Control to force updates with invalid/unknown options at your own risk.");
|
||||||
|
|
||||||
|
|
@ -81,6 +86,7 @@ public partial class CustomizationDrawer
|
||||||
using var _ = SetId(index);
|
using var _ = SetId(index);
|
||||||
using var bigGroup = ImRaii.Group();
|
using var bigGroup = ImRaii.Group();
|
||||||
|
|
||||||
|
using var disabled = ImRaii.Disabled(_locked);
|
||||||
ListCombo();
|
ListCombo();
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ListInputInt();
|
ListInputInt();
|
||||||
|
|
@ -143,13 +149,22 @@ public partial class CustomizationDrawer
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ImGui.Checkbox(_currentIndex.ToDefaultName(), ref tmp))
|
else
|
||||||
|
{
|
||||||
|
using (var disabled = ImRaii.Disabled(_locked))
|
||||||
|
{
|
||||||
|
if (ImGui.Checkbox("##toggle", ref tmp))
|
||||||
{
|
{
|
||||||
_customize.Set(idx, tmp ? CustomizeValue.Max : CustomizeValue.Zero);
|
_customize.Set(idx, tmp ? CustomizeValue.Max : CustomizeValue.Zero);
|
||||||
Changed |= _currentFlag;
|
Changed |= _currentFlag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted(_currentIndex.ToDefaultName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ApplyCheckbox()
|
private void ApplyCheckbox()
|
||||||
{
|
{
|
||||||
if (UiHelpers.DrawCheckbox("##apply", $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked))
|
if (UiHelpers.DrawCheckbox("##apply", $"Apply the {_currentOption} customization in this design.", _currentApply, out _, _locked))
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ public partial class CustomizationDrawer : IDisposable
|
||||||
|
|
||||||
private CustomizeFlag _initialApply;
|
private CustomizeFlag _initialApply;
|
||||||
private bool _locked = false;
|
private bool _locked = false;
|
||||||
|
private bool _lockedRedraw = false;
|
||||||
private Vector2 _defaultSpacing;
|
private Vector2 _defaultSpacing;
|
||||||
private Vector2 _spacing;
|
private Vector2 _spacing;
|
||||||
private Vector2 _iconSize;
|
private Vector2 _iconSize;
|
||||||
|
|
@ -64,32 +65,33 @@ public partial class CustomizationDrawer : IDisposable
|
||||||
_legacyTattoo?.Dispose();
|
_legacyTattoo?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Draw(Customize current, bool locked)
|
public bool Draw(Customize current, bool locked, bool lockedRedraw)
|
||||||
{
|
{
|
||||||
CurrentFlag = CustomizeFlagExtensions.All;
|
CurrentFlag = CustomizeFlagExtensions.All;
|
||||||
_withApply = false;
|
_withApply = false;
|
||||||
Init(current, locked);
|
Init(current, locked, lockedRedraw);
|
||||||
|
|
||||||
return DrawInternal();
|
return DrawInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Draw(Customize current, CustomizeFlag apply, bool locked)
|
public bool Draw(Customize current, CustomizeFlag apply, bool locked, bool lockedRedraw)
|
||||||
{
|
{
|
||||||
CurrentFlag = CustomizeFlagExtensions.All;
|
CurrentFlag = CustomizeFlagExtensions.All;
|
||||||
ChangeApply = apply;
|
ChangeApply = apply;
|
||||||
_initialApply = apply;
|
_initialApply = apply;
|
||||||
_withApply = !_config.HideApplyCheckmarks;
|
_withApply = !_config.HideApplyCheckmarks;
|
||||||
Init(current, locked);
|
Init(current, locked, lockedRedraw);
|
||||||
return DrawInternal();
|
return DrawInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Init(Customize current, bool locked)
|
private void Init(Customize current, bool locked, bool lockedRedraw)
|
||||||
{
|
{
|
||||||
UpdateSizes();
|
UpdateSizes();
|
||||||
_terminate = null;
|
_terminate = null;
|
||||||
Changed = 0;
|
Changed = 0;
|
||||||
_customize.Load(current);
|
_customize.Load(current);
|
||||||
_locked = locked;
|
_locked = locked;
|
||||||
|
_lockedRedraw = lockedRedraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set state for drawing of current customization.
|
// Set state for drawing of current customization.
|
||||||
|
|
@ -136,7 +138,6 @@ public partial class CustomizationDrawer : IDisposable
|
||||||
private bool DrawInternal()
|
private bool DrawInternal()
|
||||||
{
|
{
|
||||||
using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _spacing);
|
using var spacing = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, _spacing);
|
||||||
using var disabled = ImRaii.Disabled(_locked);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ public class ActorPanel
|
||||||
if (!ImGui.CollapsingHeader("Customizations"))
|
if (!ImGui.CollapsingHeader("Customizations"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked))
|
if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _identifier.Type is IdentifierType.Special))
|
||||||
_stateManager.ChangeCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, StateChanged.Source.Manual);
|
_stateManager.ChangeCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, StateChanged.Source.Manual);
|
||||||
|
|
||||||
if (_customizationDrawer.DrawWetnessState(_state!.ModelData.IsWet(), out var newWetness, _state.IsLocked))
|
if (_customizationDrawer.DrawWetnessState(_state!.ModelData.IsWet(), out var newWetness, _state.IsLocked))
|
||||||
|
|
|
||||||
|
|
@ -167,7 +167,7 @@ public class DesignPanel
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_customizationDrawer.Draw(_selector.Selected!.DesignData.Customize, _selector.Selected.ApplyCustomize,
|
if (_customizationDrawer.Draw(_selector.Selected!.DesignData.Customize, _selector.Selected.ApplyCustomize,
|
||||||
_selector.Selected!.WriteProtected()))
|
_selector.Selected!.WriteProtected(), false))
|
||||||
foreach (var idx in Enum.GetValues<CustomizeIndex>())
|
foreach (var idx in Enum.GetValues<CustomizeIndex>())
|
||||||
{
|
{
|
||||||
var flag = idx.ToFlag();
|
var flag = idx.ToFlag();
|
||||||
|
|
|
||||||
|
|
@ -55,18 +55,23 @@ public static class UiHelpers
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DataChange DrawMetaToggle(string label, string tooltip, bool currentValue, bool currentApply, out bool newValue, out bool newApply,
|
public static DataChange DrawMetaToggle(string label, string tooltip, bool currentValue, bool currentApply, out bool newValue,
|
||||||
|
out bool newApply,
|
||||||
bool locked)
|
bool locked)
|
||||||
{
|
{
|
||||||
var flags = currentApply ? currentValue ? 3 : 0 : 2;
|
var flags = currentApply ? currentValue ? 3 : 0 : 2;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, ImGui.GetStyle().ItemInnerSpacing);
|
||||||
using (var disabled = ImRaii.Disabled(locked))
|
using (var disabled = ImRaii.Disabled(locked))
|
||||||
{
|
{
|
||||||
ret = ImGui.CheckboxFlags(label, ref flags, 3);
|
ret = ImGui.CheckboxFlags("##" + label, ref flags, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip(tooltip);
|
ImGuiUtil.HoverTooltip(tooltip);
|
||||||
|
|
||||||
|
ImGui.SameLine();
|
||||||
|
ImGui.TextUnformatted(label);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
(newValue, newApply, var change) = (currentValue, currentApply) switch
|
(newValue, newApply, var change) = (currentValue, currentApply) switch
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue