2022-09-09 11:40:52 +08:00
|
|
|
|
/*
|
|
|
|
|
* MIT License
|
2023-08-20 12:02:36 +08:00
|
|
|
|
*
|
2022-09-09 11:40:52 +08:00
|
|
|
|
* Copyright (c) 2022 bd_
|
2023-08-20 12:02:36 +08:00
|
|
|
|
*
|
2022-09-09 11:40:52 +08:00
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
* in the Software without restriction, including without limitation the rights
|
|
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
* furnished to do so, subject to the following conditions:
|
2023-08-20 12:02:36 +08:00
|
|
|
|
*
|
2022-09-09 11:40:52 +08:00
|
|
|
|
* The above copyright notice and this permission notice shall be included in all
|
|
|
|
|
* copies or substantial portions of the Software.
|
2023-08-20 12:02:36 +08:00
|
|
|
|
*
|
2022-09-09 11:40:52 +08:00
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
|
* SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2023-09-30 16:00:18 +08:00
|
|
|
|
using System;
|
2023-01-05 20:10:22 +08:00
|
|
|
|
using System.Runtime.CompilerServices;
|
2022-08-28 04:38:52 +08:00
|
|
|
|
using UnityEditor;
|
2022-09-12 05:19:05 +08:00
|
|
|
|
using UnityEngine;
|
2022-08-28 04:38:52 +08:00
|
|
|
|
|
2023-01-05 20:10:22 +08:00
|
|
|
|
[assembly: InternalsVisibleTo("Tests")]
|
|
|
|
|
|
2022-11-11 12:39:58 +08:00
|
|
|
|
namespace nadena.dev.modular_avatar.core.editor
|
2022-08-28 04:38:52 +08:00
|
|
|
|
{
|
2023-08-05 14:47:03 +08:00
|
|
|
|
public class AvatarProcessor
|
2022-08-28 04:38:52 +08:00
|
|
|
|
{
|
2023-05-11 18:42:31 +08:00
|
|
|
|
[MenuItem("GameObject/ModularAvatar/Manual bake avatar", true, 100)]
|
2023-03-23 18:09:41 +08:00
|
|
|
|
static bool ValidateApplyToCurrentAvatarGameobject()
|
|
|
|
|
{
|
|
|
|
|
return ValidateApplyToCurrentAvatar();
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-11 18:42:31 +08:00
|
|
|
|
[MenuItem("GameObject/ModularAvatar/Manual bake avatar", false, 100)]
|
2023-03-23 18:09:41 +08:00
|
|
|
|
static void ApplyToCurrentAvatarGameobject()
|
|
|
|
|
{
|
|
|
|
|
ApplyToCurrentAvatar();
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-26 07:32:04 +08:00
|
|
|
|
[MenuItem("Tools/Modular Avatar/Manual bake avatar", true)]
|
|
|
|
|
private static bool ValidateApplyToCurrentAvatar()
|
|
|
|
|
{
|
2023-08-05 14:47:03 +08:00
|
|
|
|
return ndmf.AvatarProcessor.CanProcessObject(Selection.activeGameObject);
|
2022-11-26 07:32:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[MenuItem("Tools/Modular Avatar/Manual bake avatar", false)]
|
2022-09-26 11:04:58 +08:00
|
|
|
|
private static void ApplyToCurrentAvatar()
|
|
|
|
|
{
|
2023-08-05 14:47:03 +08:00
|
|
|
|
ndmf.AvatarProcessor.ProcessAvatarUI(Selection.activeGameObject);
|
2022-09-12 05:19:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ProcessAvatar(GameObject avatarGameObject)
|
|
|
|
|
{
|
2023-08-05 14:47:03 +08:00
|
|
|
|
ndmf.AvatarProcessor.ProcessAvatar(avatarGameObject);
|
2022-09-12 05:19:05 +08:00
|
|
|
|
}
|
2023-09-30 16:00:18 +08:00
|
|
|
|
|
|
|
|
|
// ReSharper disable once InconsistentNaming
|
|
|
|
|
// ReSharper disable once MemberCanBeMadeStatic.Global
|
|
|
|
|
[Obsolete("This is only for compile time compatibility with legacy AAO")]
|
|
|
|
|
public int callbackOrder => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
[Obsolete("This is only for compile time compatibility with legacy AAO")]
|
|
|
|
|
// ReSharper disable once MemberCanBeMadeStatic.Global
|
|
|
|
|
public bool OnPreprocessAvatar(GameObject avatarGameObject) => throw new NotImplementedException();
|
2022-08-28 04:38:52 +08:00
|
|
|
|
}
|
2023-08-05 14:47:03 +08:00
|
|
|
|
}
|