From c52dbbe3cb57b302cd7a2d6724fb7c1a0be1c0d4 Mon Sep 17 00:00:00 2001 From: kaikoga Date: Sat, 4 Nov 2023 14:45:47 +0900 Subject: [PATCH] hack: null check AvatarDescriptors before ndmf is aware of environments --- Editor/Animation/AnimationDatabase.cs | 2 ++ Editor/Animation/AnimationUtil.cs | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Editor/Animation/AnimationDatabase.cs b/Editor/Animation/AnimationDatabase.cs index 728d1afe..5033d395 100644 --- a/Editor/Animation/AnimationDatabase.cs +++ b/Editor/Animation/AnimationDatabase.cs @@ -128,6 +128,8 @@ namespace nadena.dev.modular_avatar.animation #if MA_VRCSDK3_AVATARS var avatarDescriptor = context.AvatarDescriptor; + if (!avatarDescriptor) return; + foreach (var layer in avatarDescriptor.baseAnimationLayers) { BootstrapLayer(layer); diff --git a/Editor/Animation/AnimationUtil.cs b/Editor/Animation/AnimationUtil.cs index 61e09659..976e6122 100644 --- a/Editor/Animation/AnimationUtil.cs +++ b/Editor/Animation/AnimationUtil.cs @@ -51,9 +51,12 @@ namespace nadena.dev.modular_avatar.animation // This helps reduce the risk that we'll accidentally modify the original assets. #if MA_VRCSDK3_AVATARS - context.AvatarDescriptor.baseAnimationLayers = + var avatarDescriptor = context.AvatarDescriptor; + if (!avatarDescriptor) return; + + avatarDescriptor.baseAnimationLayers = CloneLayers(context, context.AvatarDescriptor.baseAnimationLayers); - context.AvatarDescriptor.specialAnimationLayers = + avatarDescriptor.specialAnimationLayers = CloneLayers(context, context.AvatarDescriptor.specialAnimationLayers); #endif }