mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 18:55:06 +08:00
Enable (but no-op) setup outfit when outfit is already setup (#148)
Closes: #132
This commit is contained in:
parent
811c934f40
commit
5911973e9d
@ -18,6 +18,8 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
var avatarArmature = avatarHips.transform.parent;
|
||||
var outfitArmature = outfitHips.transform.parent;
|
||||
|
||||
if (outfitArmature.GetComponent<ModularAvatarMergeArmature>() != null) return;
|
||||
|
||||
var merge = Undo.AddComponent<ModularAvatarMergeArmature>(outfitArmature.gameObject);
|
||||
merge.mergeTarget = new AvatarObjectReference();
|
||||
merge.mergeTarget.referencePath = RuntimeUtil.RelativePath(avatarRoot, avatarArmature.gameObject);
|
||||
@ -27,13 +29,14 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
[MenuItem("GameObject/[ModularAvatar] Setup Outfit", true, PRIORITY)]
|
||||
static bool ValidateSetupOutfit()
|
||||
{
|
||||
if (Selection.objects.Length == 0) return false;
|
||||
|
||||
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)
|
||||
if (!FindBones(obj, out var _, out var _, out var outfitHips))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user