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 Dec 30, 2023
1 parent d78e97d commit 37de296
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 @@ -7,6 +7,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 @@ -42,6 +42,8 @@ public void OnPreprocessAvatar(GameObject avatar, BuildContext context)
private void SetExpressionParameters(GameObject avatarRoot)
{
var avatar = avatarRoot.GetComponent<VRCAvatarDescriptor>();
if (!avatar) return;

var expParams = avatar.expressionParameters;

if (expParams == null)
Expand Down

0 comments on commit 37de296

Please sign in to comment.