Skip to content

Commit

Permalink
hack: more null check AvatarDescriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikoga committed Mar 3, 2024
1 parent fcbf64c commit 4e7afe3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Editor/FixupPasses/FixupExpressionsMenuPass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ internal class FixupExpressionsMenuPass

internal static void FixupExpressionsMenu(BuildContext context)
{
if (!context.AvatarDescriptor) return;

context.AvatarDescriptor.customExpressions = true;

var expressionsMenu = context.AvatarDescriptor.expressionsMenu;
Expand Down
1 change: 1 addition & 0 deletions Editor/MergeAnimatorProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ internal void OnPreprocessAvatar(GameObject avatarGameObject, BuildContext conte
mergeSessions.Clear();

var descriptor = avatarGameObject.GetComponent<VRCAvatarDescriptor>();
if (!descriptor) return;

if (descriptor.baseAnimationLayers != null) InitSessions(descriptor.baseAnimationLayers);
if (descriptor.specialAnimationLayers != null) InitSessions(descriptor.specialAnimationLayers);
Expand Down
2 changes: 2 additions & 0 deletions Editor/OptimizationPasses/PruneParametersPass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ internal class PruneParametersPass : Pass<PruneParametersPass>
{
protected override void Execute(ndmf.BuildContext context)
{
if (!context.AvatarDescriptor) return;

var expParams = context.AvatarDescriptor.expressionParameters;
if (expParams != null && context.IsTemporaryAsset(expParams))
{
Expand Down
2 changes: 2 additions & 0 deletions Editor/RenameParametersHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ private void SetExpressionParameters(GameObject avatarRoot, ImmutableDictionary<
.ToImmutableDictionary();

var avatar = avatarRoot.GetComponent<VRCAvatarDescriptor>();
if (!avatar) return;

var expParams = avatar.expressionParameters;

if (expParams == null)
Expand Down

0 comments on commit 4e7afe3

Please sign in to comment.