Fix selecting other designs during rename renaming newly selected design.

This commit is contained in:
Ottermandias 2023-07-14 12:17:43 +02:00
parent 8090c370fd
commit a666832419
5 changed files with 22 additions and 26 deletions

View file

@ -272,13 +272,6 @@ public class AutoDesignApplier : IDisposable
if (!state.ModelData.IsHuman || !design.IsHuman)
return;
// Skip invalid designs entirely.
if (_config.SkipInvalidCustomizations
&& (customize.Clan != design.Customize.Clan
|| customize.Gender != design.Customize.Gender
|| customize.Face != design.Customize.Face))
return;
if (customizeFlags.HasFlag(CustomizeFlag.Clan))
{
if (!respectManual || state[CustomizeIndex.Clan] is not StateChanged.Source.Manual)
@ -289,9 +282,6 @@ public class AutoDesignApplier : IDisposable
if (customizeFlags.HasFlag(CustomizeFlag.Gender))
{
if (_config.SkipInvalidCustomizations && customize.Gender != design.Customize.Gender)
return;
if (!respectManual || state[CustomizeIndex.Gender] is not StateChanged.Source.Manual)
fixFlags |= _customizations.ChangeGender(ref customize, design.Customize.Gender);
customizeFlags &= ~CustomizeFlag.Gender;

View file

@ -24,7 +24,6 @@ public class Configuration : IPluginConfiguration, ISavable
public bool EnableAutoDesigns { get; set; } = true;
public bool IncognitoMode { get; set; } = false;
public bool UnlockDetailMode { get; set; } = true;
public bool SkipInvalidCustomizations { get; set; } = false;
public bool HideApplyCheckmarks { get; set; } = false;
public bool SmallEquip { get; set; } = false;
public bool UnlockedItemMode { get; set; } = false;

View file

@ -157,6 +157,7 @@ public unsafe class DebugTab : ITab
ImGui.TableNextColumn();
if (actor.IsCharacter)
{
ImGui.TextUnformatted(actor.AsCharacter->CharacterData.ModelCharaId.ToString());
if (actor.AsCharacter->CharacterData.TransformationId != 0)
ImGui.TextUnformatted($"Transformation Id: {actor.AsCharacter->CharacterData.TransformationId}");
if (actor.AsCharacter->CharacterData.ModelCharaId_2 != -1)

View file

@ -1,6 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Numerics;
using Dalamud.Interface;
using Dalamud.Interface.Internal.Notifications;
@ -25,7 +24,9 @@ public class DesignDetailTab
private string? _newDescription;
private string? _newName;
private bool _editDescriptionMode;
private bool _editDescriptionMode;
private Design? _changeDesign;
private DesignFileSystem.Leaf? _changeLeaf;
public DesignDetailTab(SaveService saveService, DesignFileSystemSelector selector, DesignManager manager, DesignFileSystem fileSystem)
{
@ -62,18 +63,22 @@ public class DesignDetailTab
var name = _newName ?? _selector.Selected!.Name;
ImGui.SetNextItemWidth(width.X);
if (ImGui.InputText("##Name", ref name, 128))
_newName = name;
if (ImGui.IsItemDeactivatedAfterEdit())
{
_manager.Rename(_selector.Selected!, name);
_newName = null;
_newName = name;
_changeDesign = _selector.Selected;
}
if (ImGui.IsItemDeactivatedAfterEdit() && _changeDesign != null)
{
_manager.Rename(_changeDesign, name);
_newName = null;
_changeDesign = null;
}
var identifier = _selector.Selected!.Identifier.ToString();
ImGuiUtil.DrawFrameColumn("Unique Identifier");
ImGui.TableNextColumn();
var fileName = _saveService.FileNames.DesignFile(_selector.Selected!);
var fileName = _saveService.FileNames.DesignFile(_selector.Selected!);
using (var mono = ImRaii.PushFont(UiBuilder.MonoFont))
{
if (ImGui.Button(identifier, width))
@ -95,13 +100,17 @@ public class DesignDetailTab
var path = _newPath ?? _selector.SelectedLeaf!.FullName();
ImGui.SetNextItemWidth(width.X);
if (ImGui.InputText("##Path", ref path, 1024))
_newPath = path;
{
_newPath = path;
_changeLeaf = _selector.SelectedLeaf!;
}
if (ImGui.IsItemDeactivatedAfterEdit())
if (ImGui.IsItemDeactivatedAfterEdit() && _changeLeaf != null)
try
{
_fileSystem.RenameAndMove(_selector.SelectedLeaf!, path);
_newPath = null;
_fileSystem.RenameAndMove(_changeLeaf, path);
_newPath = null;
_changeLeaf = null;
}
catch (Exception ex)
{

View file

@ -44,9 +44,6 @@ public class SettingsTab : ITab
Checkbox("Enabled", "Enable main functionality of keeping and applying state.", _stateListener.Enabled, _stateListener.Enable);
Checkbox("Enable Auto Designs", "Enable the application of designs associated to characters to be applied automatically.",
_config.EnableAutoDesigns, v => _config.EnableAutoDesigns = v);
Checkbox("Skip Invalid Customizations",
"Entirely skip customizations for any automatically applied design that does not have the same race, gender or face as the affected character currently has.",
_config.SkipInvalidCustomizations, v => _config.SkipInvalidCustomizations = v);
Checkbox("Restricted Gear Protection",
"Use gender- and race-appropriate models when detecting certain items not available for a characters current gender and race.",
_config.UseRestrictedGearProtection, v => _config.UseRestrictedGearProtection = v);