Merge remote-tracking branch 'origin/main' into new_actor_assignment_ui
This commit is contained in:
@@ -162,28 +162,23 @@ public unsafe class Armature
|
|||||||
: $"Armature (#{_localId}) on {ActorIdentifier.IncognitoDebug()} ({Profile}) with no skeleton reference";
|
: $"Armature (#{_localId}) on {ActorIdentifier.IncognitoDebug()} ({Profile}) with no skeleton reference";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool NewBonesAvailable(CharacterBase* cBase)
|
public bool IsSkeletonUpdated(CharacterBase* cBase)
|
||||||
{
|
{
|
||||||
if (cBase == null)
|
if (cBase == null)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
else if (cBase->Skeleton->PartialSkeletonCount != _partialSkeletons.Length)
|
||||||
else if (cBase->Skeleton->PartialSkeletonCount > _partialSkeletons.Length)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (var i = 0; i < cBase->Skeleton->PartialSkeletonCount; ++i)
|
for (var i = 0; i < cBase->Skeleton->PartialSkeletonCount; ++i)
|
||||||
{
|
{
|
||||||
var newPose = cBase->Skeleton->PartialSkeletons[i].GetHavokPose(Constants.TruePoseIndex);
|
var newPose = cBase->Skeleton->PartialSkeletons[i].GetHavokPose(Constants.TruePoseIndex);
|
||||||
|
|
||||||
if (newPose != null
|
if (newPose != null
|
||||||
&& newPose->Skeleton->Bones.Length > _partialSkeletons[i].Length)
|
&& newPose->Skeleton->Bones.Length != _partialSkeletons[i].Length)
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -205,43 +200,6 @@ public unsafe class Armature
|
|||||||
Plugin.Logger.Debug($"Rebuilt {this}");
|
Plugin.Logger.Debug($"Rebuilt {this}");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AugmentSkeleton(CharacterBase* cBase)
|
|
||||||
{
|
|
||||||
if (cBase == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var oldPartials = _partialSkeletons.Select(x => x.ToList()).ToList();
|
|
||||||
var newPartials = ParseBonesFromObject(this, cBase);
|
|
||||||
|
|
||||||
//for each of the new partial skeletons discovered...
|
|
||||||
for (var i = 0; i < newPartials.Count; ++i)
|
|
||||||
{
|
|
||||||
//if the old skeleton doesn't contain the new partial at all, add the whole thing
|
|
||||||
if (i > oldPartials.Count)
|
|
||||||
{
|
|
||||||
oldPartials.Add(newPartials[i]);
|
|
||||||
}
|
|
||||||
//otherwise, add every model bone the new partial has that the old one doesn't
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//Case: get carbuncle, enable profile for it, turn carbuncle into human via glamourer
|
|
||||||
if (oldPartials.Count <= i)
|
|
||||||
oldPartials.Add(new List<ModelBone>());
|
|
||||||
|
|
||||||
for (var j = oldPartials[i].Count; j < newPartials[i].Count; ++j)
|
|
||||||
{
|
|
||||||
oldPartials[i].Add(newPartials[i][j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_partialSkeletons = oldPartials.Select(x => x.ToArray()).ToArray();
|
|
||||||
|
|
||||||
RebuildBoneTemplateBinding(); //todo: intentionally not calling ArmatureChanged.Type.Updated because this is pending rewrite
|
|
||||||
|
|
||||||
Plugin.Logger.Debug($"Augmented {this} with new bones");
|
|
||||||
}
|
|
||||||
|
|
||||||
public BoneTransform? GetAppliedBoneTransform(string boneName)
|
public BoneTransform? GetAppliedBoneTransform(string boneName)
|
||||||
{
|
{
|
||||||
if (BoneTemplateBinding.TryGetValue(boneName, out var template)
|
if (BoneTemplateBinding.TryGetValue(boneName, out var template)
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Needed because skeleton sometimes appears to be not ready when armature is created
|
//Needed because skeleton sometimes appears to be not ready when armature is created
|
||||||
//and also because we want to augment armature with new bones if they are available
|
//and also because we want to keep armature up to date with any character skeleton changes
|
||||||
TryLinkSkeleton(armature);
|
TryLinkSkeleton(armature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,39 +207,23 @@ public unsafe sealed class ArmatureManager : IDisposable
|
|||||||
/// Returns whether or not a link can be established between the armature and an in-game object.
|
/// Returns whether or not a link can be established between the armature and an in-game object.
|
||||||
/// If unbuilt, the armature will be rebuilded.
|
/// If unbuilt, the armature will be rebuilded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool TryLinkSkeleton(Armature armature, bool forceRebuild = false)
|
private bool TryLinkSkeleton(Armature armature)
|
||||||
{
|
{
|
||||||
_objectManager.Update();
|
_objectManager.Update();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!_objectManager.Identifiers.ContainsKey(armature.ActorIdentifier))
|
if (!_objectManager.Identifiers.ContainsKey(armature.ActorIdentifier))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var actor = _objectManager[armature.ActorIdentifier].Objects[0];
|
var actor = _objectManager[armature.ActorIdentifier].Objects[0];
|
||||||
|
|
||||||
if (!armature.IsBuilt || forceRebuild)
|
if (!armature.IsBuilt || armature.IsSkeletonUpdated(actor.Model.AsCharacterBase))
|
||||||
{
|
{
|
||||||
|
_logger.Debug($"Skeleton for actor #{actor.AsObject->ObjectIndex} tied to \"{armature}\" has changed");
|
||||||
armature.RebuildSkeleton(actor.Model.AsCharacterBase);
|
armature.RebuildSkeleton(actor.Model.AsCharacterBase);
|
||||||
}
|
}
|
||||||
else if (armature.NewBonesAvailable(actor.Model.AsCharacterBase))
|
|
||||||
{
|
|
||||||
armature.AugmentSkeleton(actor.Model.AsCharacterBase);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// This is on wait until isse #191 on Github responds. Keeping it in code, delete it if I forget and this is longer then a month ago.
|
|
||||||
|
|
||||||
// Disabling this if its any Default Profile due to Log spam. A bit crazy but hey, if its for me id Remove Default profiles all together so this is as much as ill do for now! :)
|
|
||||||
//if(!(Profile.CharacterName.Equals(Constants.DefaultProfileCharacterName) || Profile.CharacterName.Equals("DefaultCutscene"))) {
|
|
||||||
_logger.Error($"Error occured while attempting to link skeleton: {armature}");
|
|
||||||
throw;
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Iterate through the skeleton of the given character base, and apply any transformations
|
/// Iterate through the skeleton of the given character base, and apply any transformations
|
||||||
|
|||||||
@@ -212,10 +212,27 @@ public class StateMonitoringTab
|
|||||||
//ImGui.Text("Profile:");
|
//ImGui.Text("Profile:");
|
||||||
//DrawSingleProfile($"armature-{armature.GetHashCode()}", armature.Profile);
|
//DrawSingleProfile($"armature-{armature.GetHashCode()}", armature.Profile);
|
||||||
|
|
||||||
ImGui.Text($"Bone template bindings:");
|
var bindingsShow = ImGui.CollapsingHeader($"Bone template bindings ({armature.BoneTemplateBinding.Count})###{prefix}-armature-{armature.GetHashCode()}-bindings");
|
||||||
|
|
||||||
|
if (bindingsShow)
|
||||||
|
{
|
||||||
foreach (var kvPair in armature.BoneTemplateBinding)
|
foreach (var kvPair in armature.BoneTemplateBinding)
|
||||||
{
|
{
|
||||||
ImGui.Text($"{BoneData.GetBoneDisplayName(kvPair.Key)} ({kvPair.Key}) -> {kvPair.Value.Name.Text.Incognify()} ({kvPair.Value.UniqueId})");
|
ImGui.Text($"{BoneData.GetBoneDisplayName(kvPair.Key)} ({kvPair.Key}) -> {kvPair.Value.Name.Text.Incognify()} ({kvPair.Value.UniqueId})");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bonesShow = ImGui.CollapsingHeader($"Armature bones###{prefix}-armature-{armature.GetHashCode()}-bones");
|
||||||
|
|
||||||
|
if (!bonesShow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var bones = armature.GetAllBones().ToList();
|
||||||
|
ImGui.Text($"{bones.Count} bones");
|
||||||
|
|
||||||
|
foreach (var bone in bones)
|
||||||
|
{
|
||||||
|
ImGui.Text($"{(bone.IsActive ? "[A] " : "")}{BoneData.GetBoneDisplayName(bone.BoneName)} [{bone.BoneName}] ({bone.PartialSkeletonIndex}-{bone.BoneIndex})");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"Punchline": "Customize your character beyond FFXIV's limitations.",
|
"Punchline": "Customize your character beyond FFXIV's limitations.",
|
||||||
"InternalName": "CustomizePlus",
|
"InternalName": "CustomizePlus",
|
||||||
"AssemblyVersion": "2.0.6.5",
|
"AssemblyVersion": "2.0.6.5",
|
||||||
"TestingAssemblyVersion": "2.0.6.5",
|
"TestingAssemblyVersion": "2.0.6.6",
|
||||||
"RepoUrl": "https://github.com/Aether-Tools/CustomizePlus",
|
"RepoUrl": "https://github.com/Aether-Tools/CustomizePlus",
|
||||||
"ApplicableVersion": "any",
|
"ApplicableVersion": "any",
|
||||||
"DalamudApiLevel": 10,
|
"DalamudApiLevel": 10,
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
"LoadPriority": 0,
|
"LoadPriority": 0,
|
||||||
"DownloadLinkInstall": "https://github.com/Aether-Tools/CustomizePlus/releases/download/2.0.6.5/CustomizePlus.zip",
|
"DownloadLinkInstall": "https://github.com/Aether-Tools/CustomizePlus/releases/download/2.0.6.5/CustomizePlus.zip",
|
||||||
"DownloadLinkUpdate": "https://github.com/Aether-Tools/CustomizePlus/releases/download/2.0.6.5/CustomizePlus.zip",
|
"DownloadLinkUpdate": "https://github.com/Aether-Tools/CustomizePlus/releases/download/2.0.6.5/CustomizePlus.zip",
|
||||||
"DownloadLinkTesting": "https://github.com/Aether-Tools/CustomizePlus/releases/download/2.0.6.5/CustomizePlus.zip",
|
"DownloadLinkTesting": "https://github.com/Aether-Tools/CustomizePlus/releases/download/testing_2.0.6.6/CustomizePlus.zip",
|
||||||
"IconUrl": "https://raw.githubusercontent.com/Aether-Tools/CustomizePlus/main/Data/icon.png",
|
"IconUrl": "https://raw.githubusercontent.com/Aether-Tools/CustomizePlus/main/Data/icon.png",
|
||||||
"Tags": [
|
"Tags": [
|
||||||
"Anamnesis",
|
"Anamnesis",
|
||||||
|
|||||||
Submodule submodules/ECommons updated: 147e12e95f...3570e20725
Submodule submodules/Penumbra.GameData updated: 66bc00dc85...63cbf82417
Reference in New Issue
Block a user