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];
Undo.RecordObjects(targets, "Set targets");
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;
}
}
@ -159,4 +159,4 @@ namespace nadena.dev.modular_avatar.core.editor
}
}
}
}
}

View File

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