mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-01 20:25:07 +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 avatarArmature = avatarHips.transform.parent;
|
||||||
var outfitArmature = outfitHips.transform.parent;
|
var outfitArmature = outfitHips.transform.parent;
|
||||||
|
|
||||||
|
if (outfitArmature.GetComponent<ModularAvatarMergeArmature>() != null) return;
|
||||||
|
|
||||||
var merge = Undo.AddComponent<ModularAvatarMergeArmature>(outfitArmature.gameObject);
|
var merge = Undo.AddComponent<ModularAvatarMergeArmature>(outfitArmature.gameObject);
|
||||||
merge.mergeTarget = new AvatarObjectReference();
|
merge.mergeTarget = new AvatarObjectReference();
|
||||||
merge.mergeTarget.referencePath = RuntimeUtil.RelativePath(avatarRoot, avatarArmature.gameObject);
|
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)]
|
[MenuItem("GameObject/[ModularAvatar] Setup Outfit", true, PRIORITY)]
|
||||||
static bool ValidateSetupOutfit()
|
static bool ValidateSetupOutfit()
|
||||||
{
|
{
|
||||||
|
if (Selection.objects.Length == 0) return false;
|
||||||
|
|
||||||
foreach (var obj in Selection.objects)
|
foreach (var obj in Selection.objects)
|
||||||
{
|
{
|
||||||
if (!(obj is GameObject gameObj)) return false;
|
if (!(obj is GameObject gameObj)) return false;
|
||||||
var xform = gameObj.transform;
|
var xform = gameObj.transform;
|
||||||
|
|
||||||
if (!FindBones(obj, out var _, out var _, out var outfitHips)
|
if (!FindBones(obj, out var _, out var _, out var outfitHips))
|
||||||
|| outfitHips.transform.parent.GetComponent<ModularAvatarMergeArmature>() != null)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user