mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-04 19:49:02 +08:00
fix: null/missing expressions params/menus breaking builds (#441)
This commit is contained in:
parent
cda95408d5
commit
7ed0179b91
@ -6,17 +6,40 @@ using UnityEditor;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Experimental.Rendering;
|
using UnityEngine.Experimental.Rendering;
|
||||||
using VRC.SDK3.Avatars.ScriptableObjects;
|
using VRC.SDK3.Avatars.ScriptableObjects;
|
||||||
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace nadena.dev.modular_avatar.core.editor
|
namespace nadena.dev.modular_avatar.core.editor
|
||||||
{
|
{
|
||||||
internal class FixupExpressionsMenuPass
|
internal class FixupExpressionsMenuPass
|
||||||
{
|
{
|
||||||
|
private const string DEFAULT_EXP_MENU_GUID = "024fb8ef5b3988c46b446863c92f4522";
|
||||||
|
private const string DEFAULT_EXP_PARAM_GUID = "03a6d797deb62f0429471c4e17ea99a7";
|
||||||
|
|
||||||
internal static void FixupExpressionsMenu(BuildContext context)
|
internal static void FixupExpressionsMenu(BuildContext context)
|
||||||
{
|
{
|
||||||
var expressionsMenu = context.AvatarDescriptor.expressionsMenu;
|
context.AvatarDescriptor.customExpressions = true;
|
||||||
if (expressionsMenu == null) return;
|
|
||||||
|
|
||||||
var parameters = context.AvatarDescriptor.expressionParameters?.parameters
|
var expressionsMenu = context.AvatarDescriptor.expressionsMenu;
|
||||||
|
if (expressionsMenu == null)
|
||||||
|
{
|
||||||
|
var defaultExpMenu = AssetDatabase.LoadAssetAtPath<VRCExpressionsMenu>(
|
||||||
|
AssetDatabase.GUIDToAssetPath(DEFAULT_EXP_MENU_GUID)
|
||||||
|
);
|
||||||
|
|
||||||
|
expressionsMenu = Object.Instantiate(defaultExpMenu);
|
||||||
|
context.AvatarDescriptor.expressionsMenu = expressionsMenu;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.AvatarDescriptor.expressionParameters == null)
|
||||||
|
{
|
||||||
|
var defaultExpParam = AssetDatabase.LoadAssetAtPath<VRCExpressionParameters>(
|
||||||
|
AssetDatabase.GUIDToAssetPath(DEFAULT_EXP_PARAM_GUID)
|
||||||
|
);
|
||||||
|
|
||||||
|
context.AvatarDescriptor.expressionParameters = Object.Instantiate(defaultExpParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
var parameters = context.AvatarDescriptor.expressionParameters.parameters
|
||||||
?? new VRCExpressionParameters.Parameter[0];
|
?? new VRCExpressionParameters.Parameter[0];
|
||||||
var parameterNames = parameters.Select(p=> p.name).ToImmutableHashSet();
|
var parameterNames = parameters.Select(p=> p.name).ToImmutableHashSet();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user