chore: improve null checks in FixupAnimatorDebugData

This commit is contained in:
bd_ 2023-08-20 13:02:36 +09:00
parent 8471a3134d
commit 5a5142bf62

View File

@ -1,18 +1,18 @@
/*
* MIT License
*
*
* Copyright (c) 2022 bd_
*
*
* 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:
*
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
*
* 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
@ -341,14 +341,27 @@ namespace nadena.dev.modular_avatar.core.editor
"VRC.SDKBase.Validation.Performance.Stats.AvatarPerformanceStats"
);
var ty_VRCSdkControlPanel = Util.FindType("VRCSdkControlPanel");
tempControlPanel = ScriptableObject.CreateInstance(ty_VRCSdkControlPanel) as Object;
if (ty_VRCSdkControlPanelAvatarBuilder3A == null || ty_AvatarPerformanceStats == null ||
ty_VRCSdkControlPanel == null)
{
return;
}
var avatar = avatarGameObject.GetComponent<VRCAvatarDescriptor>();
var animator = avatarGameObject.GetComponent<Animator>();
var builder = ty_VRCSdkControlPanelAvatarBuilder3A.GetConstructor(Type.EmptyTypes)
.Invoke(Array.Empty<object>());
?.Invoke(Array.Empty<object>());
var perfStats = ty_AvatarPerformanceStats.GetConstructor(new[] {typeof(bool)})
.Invoke(new object[] {false});
?.Invoke(new object[] {false});
if (builder == null || perfStats == null)
{
return;
}
tempControlPanel = ScriptableObject.CreateInstance(ty_VRCSdkControlPanel) as Object;
ty_VRCSdkControlPanelAvatarBuilder3A
.GetMethod("RegisterBuilder", BindingFlags.Public | BindingFlags.Instance)
.Invoke(builder, new object[] {tempControlPanel});