Fix incorrect handling of GPose actors

This commit is contained in:
RisaDev
2024-09-30 22:45:41 +03:00
parent 021f4c8724
commit eea1d90986
2 changed files with 9 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ using Penumbra.GameData.Interop;
//Virtual path is full path to the profile in the virtual folders created by user in the profile list UI
using IPCProfileDataTuple = (System.Guid UniqueId, string Name, string VirtualPath, string CharacterName, bool IsEnabled);
using Penumbra.GameData.Structs;
namespace CustomizePlus.Api;
@@ -265,6 +266,9 @@ public partial class CustomizePlusIpc
if (armature.ActorIdentifier.ToNameWithoutOwnerName() != currentPlayerName)
return;
if (armature.ActorIdentifier.HomeWorld == WorldId.AnyWorld) //Cutscene/GPose actors
return;
ICharacter? localPlayerCharacter = (ICharacter?)_gameObjectService.GetDalamudGameObjectFromActor(_gameObjectService.GetLocalPlayerActor());
if (localPlayerCharacter == null)
return;

View File

@@ -122,7 +122,7 @@ public unsafe sealed class ArmatureManager : IDisposable
var armature = kvPair.Value;
//Only remove armatures which haven't been seen for a while
//But remove armatures of special actors (like examine screen) right away
if (!_objectManager.ContainsKey(kvPair.Value.ActorIdentifier) &&
if (!_objectManager.Identifiers.ContainsKey(kvPair.Value.ActorIdentifier) &&
(armature.LastSeen <= armatureExpirationDateTime || armature.ActorIdentifier.Type == IdentifierType.Special))
{
_logger.Debug($"Removing armature {armature} because {kvPair.Key.IncognitoDebug()} is gone");
@@ -194,9 +194,10 @@ public unsafe sealed class ArmatureManager : IDisposable
foreach (var kvPair in Armatures)
{
var armature = kvPair.Value;
if (armature.IsBuilt && armature.IsVisible && _objectManager.ContainsKey(armature.ActorIdentifier))
if (armature.IsBuilt && armature.IsVisible && _objectManager.TryGetValue(armature.ActorIdentifier, out var actorData))
{
foreach (var actor in _objectManager[armature.ActorIdentifier].Objects)
foreach (var actor in actorData.Objects)
ApplyPiecewiseTransformation(armature, actor, armature.ActorIdentifier);
}
}
@@ -212,7 +213,7 @@ public unsafe sealed class ArmatureManager : IDisposable
try
{
if (!_objectManager.ContainsKey(armature.ActorIdentifier))
if (!_objectManager.Identifiers.ContainsKey(armature.ActorIdentifier))
return false;
var actor = _objectManager[armature.ActorIdentifier].Objects[0];