mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
Fix some issues caused by nesting AvatarDescriptors (#110)
This commit is contained in:
parent
072b5c1ff1
commit
9a38bd8620
@ -121,6 +121,22 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
|
||||
try
|
||||
{
|
||||
// Sometimes people like to nest one avatar in another, when transplanting clothing. To avoid issues
|
||||
// with inconsistently determining the avatar root, we'll go ahead and remove the extra sub-avatars
|
||||
// here.
|
||||
foreach (Transform directChild in avatarGameObject.transform)
|
||||
{
|
||||
foreach (var component in directChild.GetComponentsInChildren<VRCAvatarDescriptor>(true))
|
||||
{
|
||||
Object.DestroyImmediate(component);
|
||||
}
|
||||
|
||||
foreach (var component in directChild.GetComponentsInChildren<PipelineSaver>(true))
|
||||
{
|
||||
Object.DestroyImmediate(component);
|
||||
}
|
||||
}
|
||||
|
||||
new RenameParametersHook().OnPreprocessAvatar(avatarGameObject);
|
||||
new MenuInstallHook().OnPreprocessAvatar(avatarGameObject);
|
||||
new MergeArmatureHook().OnPreprocessAvatar(avatarGameObject);
|
||||
|
@ -271,6 +271,11 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
bool zipMerge
|
||||
)
|
||||
{
|
||||
if (src == newParent)
|
||||
{
|
||||
throw new Exception("[ModularAvatar] Attempted to merge an armature into itself! Aborting build...");
|
||||
}
|
||||
|
||||
GameObject mergedSrcBone = new GameObject(src.name + "@" + GUID.Generate());
|
||||
mergedSrcBone.transform.SetParent(src.transform.parent);
|
||||
mergedSrcBone.transform.localPosition = src.transform.localPosition;
|
||||
|
Loading…
Reference in New Issue
Block a user