mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-12 23:48:59 +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
|
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 RenameParametersHook().OnPreprocessAvatar(avatarGameObject);
|
||||||
new MenuInstallHook().OnPreprocessAvatar(avatarGameObject);
|
new MenuInstallHook().OnPreprocessAvatar(avatarGameObject);
|
||||||
new MergeArmatureHook().OnPreprocessAvatar(avatarGameObject);
|
new MergeArmatureHook().OnPreprocessAvatar(avatarGameObject);
|
||||||
|
@ -271,6 +271,11 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
bool zipMerge
|
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());
|
GameObject mergedSrcBone = new GameObject(src.name + "@" + GUID.Generate());
|
||||||
mergedSrcBone.transform.SetParent(src.transform.parent);
|
mergedSrcBone.transform.SetParent(src.transform.parent);
|
||||||
mergedSrcBone.transform.localPosition = src.transform.localPosition;
|
mergedSrcBone.transform.localPosition = src.transform.localPosition;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user