fix: ScaleAdjuster causes console errors when a mesh is missing (#706)

* fix: ScaleAdjuster causes console errors when a mesh is missing

* chore: hide ScaleAdjusterRenderer component
This commit is contained in:
bd_ 2024-02-27 00:09:01 -08:00 committed by GitHub
parent e7b09fd787
commit e0c8061a8d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,7 +11,7 @@ using VRC.SDKBase;
namespace nadena.dev.modular_avatar.core
{
[ExecuteInEditMode]
//[AddComponentMenu("")]
[AddComponentMenu("")]
[RequireComponent(typeof(SkinnedMeshRenderer))]
internal class ScaleAdjusterRenderer : MonoBehaviour, IEditorOnly
{
@ -120,11 +120,14 @@ namespace nadena.dev.modular_avatar.core
myRenderer.motionVectorGenerationMode = parentRenderer.motionVectorGenerationMode;
myRenderer.allowOcclusionWhenDynamic = parentRenderer.allowOcclusionWhenDynamic;
var blendShapeCount = myRenderer.sharedMesh.blendShapeCount;
for (int i = 0; i < blendShapeCount; i++)
if (myRenderer.sharedMesh != null)
{
myRenderer.SetBlendShapeWeight(i, parentRenderer.GetBlendShapeWeight(i));
var blendShapeCount = myRenderer.sharedMesh.blendShapeCount;
for (int i = 0; i < blendShapeCount; i++)
{
myRenderer.SetBlendShapeWeight(i, parentRenderer.GetBlendShapeWeight(i));
}
}
ClearAllOverrides();