fix: BoneProxy target couldn't be empty after assigned (#1192)

This commit is contained in:
Sayamame-beans 2024-09-24 11:14:26 +09:00 committed by GitHub
parent 032e7a692e
commit 8e49df703f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -95,7 +95,7 @@ namespace nadena.dev.modular_avatar.core.editor
var t = (ModularAvatarBoneProxy) targets[i]; var t = (ModularAvatarBoneProxy) targets[i];
Undo.RecordObjects(targets, "Set targets"); Undo.RecordObjects(targets, "Set targets");
var xform = ((TempObjRef) objRefs[i]).target; var xform = ((TempObjRef) objRefs[i]).target;
if (RuntimeUtil.FindAvatarTransformInParents(xform)?.gameObject != parentAvatar) continue; if (xform != null && RuntimeUtil.FindAvatarTransformInParents(xform)?.gameObject != parentAvatar) continue;
t.target = xform; t.target = xform;
} }
} }

View File

@ -205,6 +205,13 @@ namespace nadena.dev.modular_avatar.core
Transform iter = newTarget; Transform iter = newTarget;
if (newTarget == null)
{
boneReference = HumanBodyBones.LastBone;
subPath = null;
return;
}
if (newTarget == avatarTransform) if (newTarget == avatarTransform)
{ {
boneReference = HumanBodyBones.LastBone; boneReference = HumanBodyBones.LastBone;