mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-04 13:45:04 +08:00
feat: improve usability of manual bake options
* select output avatar on manual bake * add GameObject context menus
This commit is contained in:
parent
f584f38303
commit
7d97c75ef8
@ -66,6 +66,18 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/[ModularAvatar] Manual bake avatar", true, 49)]
|
||||
static bool ValidateApplyToCurrentAvatarGameobject()
|
||||
{
|
||||
return ValidateApplyToCurrentAvatar();
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/[ModularAvatar] Manual bake avatar", false, 49)]
|
||||
static void ApplyToCurrentAvatarGameobject()
|
||||
{
|
||||
ApplyToCurrentAvatar();
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Modular Avatar/Manual bake avatar", true)]
|
||||
private static bool ValidateApplyToCurrentAvatar()
|
||||
{
|
||||
@ -102,6 +114,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
BuildReport.Clear();
|
||||
|
||||
ProcessAvatar(avatar);
|
||||
Selection.objects = new Object[] { avatar };
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -320,13 +333,13 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
var animator = avatarGameObject.GetComponent<Animator>();
|
||||
var builder = ty_VRCSdkControlPanelAvatarBuilder3A.GetConstructor(Type.EmptyTypes)
|
||||
.Invoke(Array.Empty<object>());
|
||||
var perfStats = ty_AvatarPerformanceStats.GetConstructor(new[] {typeof(bool)})
|
||||
.Invoke(new object[] {false});
|
||||
var perfStats = ty_AvatarPerformanceStats.GetConstructor(new[] { typeof(bool) })
|
||||
.Invoke(new object[] { false });
|
||||
ty_VRCSdkControlPanelAvatarBuilder3A
|
||||
.GetMethod("RegisterBuilder", BindingFlags.Public | BindingFlags.Instance)
|
||||
.Invoke(builder, new object[] {tempControlPanel});
|
||||
.Invoke(builder, new object[] { tempControlPanel });
|
||||
ty_VRCSdkControlPanelAvatarBuilder3A.GetMethod("ValidateFeatures").Invoke(
|
||||
builder, new object[] {avatar, animator, perfStats}
|
||||
builder, new object[] { avatar, animator, perfStats }
|
||||
);
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -341,4 +354,4 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user