diff --git a/CustomizePlus/Armatures/Services/ArmatureManager.cs b/CustomizePlus/Armatures/Services/ArmatureManager.cs index 9601642..e0b6423 100644 --- a/CustomizePlus/Armatures/Services/ArmatureManager.cs +++ b/CustomizePlus/Armatures/Services/ArmatureManager.cs @@ -18,6 +18,7 @@ using CustomizePlus.Core.Extensions; using CustomizePlus.GameData.Data; using CustomizePlus.GameData.Services; using CustomizePlus.GameData.Extensions; +using FFXIVClientStructs.FFXIV.Client.Graphics.Scene; namespace CustomizePlus.Armatures.Services; @@ -345,6 +346,7 @@ public unsafe sealed class ArmatureManager : IDisposable if (type is not TemplateChanged.Type.NewBone && type is not TemplateChanged.Type.DeletedBone && type is not TemplateChanged.Type.EditorCharacterChanged && + type is not TemplateChanged.Type.EditorLimitLookupToOwnedChanged && type is not TemplateChanged.Type.EditorEnabled && type is not TemplateChanged.Type.EditorDisabled) return; @@ -390,6 +392,21 @@ public unsafe sealed class ArmatureManager : IDisposable return; } + if(type == TemplateChanged.Type.EditorLimitLookupToOwnedChanged) + { + var profile = (Profile)arg3!; + + if (profile.Armatures.Count == 0) + return; + + foreach (var armature in profile.Armatures) + armature.IsPendingProfileRebind = true; + + _logger.Debug($"ArmatureManager.OnTemplateChange Editor profile limit lookup setting changed, armature rebind scheduled: {type}, profile: {profile.Name.Text.Incognify()}->{profile.Enabled}"); + + return; + } + if (type == TemplateChanged.Type.EditorEnabled || type == TemplateChanged.Type.EditorDisabled) { diff --git a/CustomizePlus/Profiles/Data/Profile.cs b/CustomizePlus/Profiles/Data/Profile.cs index 0e889dc..9577359 100644 --- a/CustomizePlus/Profiles/Data/Profile.cs +++ b/CustomizePlus/Profiles/Data/Profile.cs @@ -5,6 +5,7 @@ using CustomizePlus.Armatures.Data; using CustomizePlus.Core.Data; using CustomizePlus.Core.Extensions; using CustomizePlus.Core.Services; +using CustomizePlus.Profiles.Enums; using CustomizePlus.Templates; using CustomizePlus.Templates.Data; using Newtonsoft.Json; @@ -46,11 +47,13 @@ public sealed class Profile : ISavable public bool IsWriteProtected { get; internal set; } + public ProfileType ProfileType { get; set; } + /// - /// Specifies if this profile is not persistent (ex. was made via IPC calls) and should not be displayed in UI. + /// Tells us if this profile is not persistent (ex. was made via IPC calls) and should have specific treatement like not being shown in UI, etc. /// WARNING, TEMPLATES FOR TEMPORARY PROFILES *ARE NOT* STORED IN TemplateManager /// - public bool IsTemporary { get; set; } + public bool IsTemporary => ProfileType == ProfileType.Temporary; /// /// Identificator specifying specific actor this profile applies to, only works for temporary profiles diff --git a/CustomizePlus/Profiles/Enums/ProfileType.cs b/CustomizePlus/Profiles/Enums/ProfileType.cs new file mode 100644 index 0000000..cf0567f --- /dev/null +++ b/CustomizePlus/Profiles/Enums/ProfileType.cs @@ -0,0 +1,8 @@ +namespace CustomizePlus.Profiles.Enums; + +public enum ProfileType +{ + Normal, + Temporary, + Editor +} diff --git a/CustomizePlus/Profiles/ProfileManager.cs b/CustomizePlus/Profiles/ProfileManager.cs index 90989fb..6e2a3e2 100644 --- a/CustomizePlus/Profiles/ProfileManager.cs +++ b/CustomizePlus/Profiles/ProfileManager.cs @@ -21,6 +21,7 @@ using CustomizePlus.Templates.Data; using CustomizePlus.GameData.Data; using CustomizePlus.GameData.Services; using CustomizePlus.GameData.Extensions; +using CustomizePlus.Profiles.Enums; namespace CustomizePlus.Profiles; @@ -378,7 +379,7 @@ public class ProfileManager : IDisposable return; profile.Enabled = true; - profile.IsTemporary = true; + profile.ProfileType = ProfileType.Temporary; profile.TemporaryActor = identifier; profile.CharacterName = identifier.ToNameWithoutOwnerName(); profile.LimitLookupToOwnedObjects = false; @@ -500,6 +501,10 @@ public class ProfileManager : IDisposable private void SaveProfile(Profile profile) { + //disallow saving special profiles + if (profile.ProfileType != ProfileType.Normal) + return; + profile.ModifiedDate = DateTimeOffset.UtcNow; _saveService.QueueSave(profile); } diff --git a/CustomizePlus/Templates/Events/TemplateChanged.cs b/CustomizePlus/Templates/Events/TemplateChanged.cs index d118bd3..0ac4702 100644 --- a/CustomizePlus/Templates/Events/TemplateChanged.cs +++ b/CustomizePlus/Templates/Events/TemplateChanged.cs @@ -20,6 +20,7 @@ public class TemplateChanged() : EventWrapper(), Enabled = false, Name = "Template editor profile" }; + EditorProfile = new Profile() { Templates = new List