diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs index 632d7f3..5ad6369 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs @@ -41,6 +41,7 @@ public class ActorPanel private Actor _actor = Actor.Null; private ActorData _data; private ActorState? _state; + private bool _lockedRedraw; public ActorPanel(ActorSelector selector, StateManager stateManager, CustomizationDrawer customizationDrawer, EquipmentDrawer equipmentDrawer, IdentifierService identification, AutoDesignApplier autoDesignApplier, @@ -59,10 +60,14 @@ public class ActorPanel _datFileService = datFileService; } + private CustomizeFlag CustomizeApplicationFlags + => _lockedRedraw ? CustomizeFlagExtensions.AllRelevant & ~CustomizeFlagExtensions.RedrawRequired : CustomizeFlagExtensions.AllRelevant; + public void Draw() { using var group = ImRaii.Group(); (_identifier, _data) = _selector.Selection; + _lockedRedraw = _identifier.Type is IdentifierType.Special; (_actorName, _actor) = GetHeaderName(); DrawHeader(); DrawPanel(); @@ -71,7 +76,7 @@ public class ActorPanel return; if (_datFileService.CreateImGuiTarget(out var dat)) - _stateManager.ChangeCustomize(_state!, dat.Customize, CustomizeFlagExtensions.AllRelevant, StateChanged.Source.Manual); + _stateManager.ChangeCustomize(_state!, dat.Customize, CustomizeApplicationFlags, StateChanged.Source.Manual); _datFileService.CreateSource(); } diff --git a/Glamourer/State/ActorState.cs b/Glamourer/State/ActorState.cs index 29b188c..e9ee35b 100644 --- a/Glamourer/State/ActorState.cs +++ b/Glamourer/State/ActorState.cs @@ -22,6 +22,9 @@ public class ActorState public readonly ActorIdentifier Identifier; + public bool AllowsRedraw + => Identifier.Type is not IdentifierType.Special; + /// This should always represent the unmodified state of the draw object. public DesignData BaseData; diff --git a/Glamourer/State/StateListener.cs b/Glamourer/State/StateListener.cs index fec1a34..c2bf8ac 100644 --- a/Glamourer/State/StateListener.cs +++ b/Glamourer/State/StateListener.cs @@ -177,8 +177,14 @@ public class StateListener : IDisposable { case UpdateState.Transformed: break; case UpdateState.Change: - var set = _customizations.AwaitedService.GetList(state.ModelData.Customize.Clan, state.ModelData.Customize.Gender); var model = state.ModelData.Customize; + if (customize.Gender != model.Gender || customize.Clan != model.Clan) + { + _manager.ChangeCustomize(state, in customize, CustomizeFlagExtensions.AllRelevant, StateChanged.Source.Game); + return; + } + + var set = _customizations.AwaitedService.GetList(model.Clan, model.Gender); foreach (var index in CustomizationExtensions.AllBasic) { if (state[index] is not StateChanged.Source.Fixed) diff --git a/Glamourer/State/StateManager.cs b/Glamourer/State/StateManager.cs index 998b789..65cde61 100644 --- a/Glamourer/State/StateManager.cs +++ b/Glamourer/State/StateManager.cs @@ -378,7 +378,8 @@ public class StateManager : IReadOnlyDictionary if (design.DoApplyVisorToggle()) _editor.ChangeMetaState(state, ActorState.MetaIndex.VisorState, design.DesignData.IsVisorToggled(), source, out _, key); - _editor.ChangeHumanCustomize(state, design.DesignData.Customize, design.ApplyCustomize, source, out _, out var applied, key); + var flags = state.AllowsRedraw ? design.ApplyCustomize : design.ApplyCustomize & ~CustomizeFlagExtensions.RedrawRequired; + _editor.ChangeHumanCustomize(state, design.DesignData.Customize, flags, source, out _, out var applied, key); redraw |= applied.RequiresRedraw(); foreach (var slot in EquipSlotExtensions.FullSlots)