mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-11 23:19:00 +08:00
parent
74861c5fff
commit
ddb010482c
@ -1,4 +1,5 @@
|
||||
using UnityEditor;
|
||||
using System.Text;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace nadena.dev.modular_avatar.core.editor
|
||||
@ -28,11 +29,24 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
{
|
||||
foreach (var obj in Selection.objects)
|
||||
{
|
||||
if (!(obj is GameObject gameObj)) return false;
|
||||
var xform = gameObj.transform;
|
||||
|
||||
if (!FindBones(obj, out var _, out var _, out var outfitHips)
|
||||
|| outfitHips.transform.parent.GetComponent<ModularAvatarMergeArmature>() != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Some users have been accidentally running Setup Outfit on the avatar itself, and/or nesting avatar
|
||||
// descriptors when transplanting outfits. Block this (and require that there be only one avdesc) by
|
||||
// refusing to run if we detect multiple avatar descriptors above the current object (or if we're run on
|
||||
// the avdesc object itself)
|
||||
var nearestAvatar = RuntimeUtil.FindAvatarInParents(xform);
|
||||
if (nearestAvatar == null || nearestAvatar.transform == xform) return false;
|
||||
|
||||
var parent = nearestAvatar.transform.parent;
|
||||
if (parent != null && RuntimeUtil.FindAvatarInParents(parent) != null) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user