public void _Destruction() { if (_merger != null) { var validatedBlendShapeAvatarClips = blendShapeAvatar.Clips.Where(t => t != null); // ここで NULL を排除しなとエラーが発生する。VRM.BlendShapeMerger のバグ? _merger.RestoreMaterialInitialValues(validatedBlendShapeAvatarClips); _merger = null; } }
void _Construction() { if (blendShapeAvatar == null) { blendShapeAvatar = GetComponent <VRM.VRMBlendShapeProxy> ().BlendShapeAvatar; } if (blendShapeAvatar != null) { var validatedBlendShapeAvatarClips = blendShapeAvatar.Clips.Where(t => t != null); // ここで NULL を排除しなとエラーが発生する。VRM.BlendShapeMerger のバグ? _merger = new BlendShapeMerger(validatedBlendShapeAvatarClips, this.transform); } List <BlendShapeKeyBinder> entities = new List <BlendShapeKeyBinder> (); foreach (var info in GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic)) { Attribute[] attributes = Attribute.GetCustomAttributes( info, typeof(BlendShapeKeyAttribute)); foreach (Attribute attr in attributes) { var blendShapeEntityAttr = attr as BlendShapeKeyAttribute; if (blendShapeEntityAttr == null) { continue; } entities.Add( new BlendShapeKeyBinder( blendShapeEntityAttr.name, GetType().CreateGetDelegate(info.Name), GetType().CreateSetDelegate(info.Name) ) ); } } _binders = entities.ToArray(); }
void _Construction() { if (blendShapeAvatar != null) { var validatedBlendShapeAvatarClips = blendShapeAvatar.Clips.Where(t => t != null); // ここで NULL を排除しなとエラーが発生する。VRM.BlendShapeMerger のバグ? _merger = new BlendShapeMerger(validatedBlendShapeAvatarClips, this.transform); Array.Resize(ref bindings, Mathf.Max(bindings.Count(), validatedBlendShapeAvatarClips.Count())); int index = 0; foreach (var clip in validatedBlendShapeAvatarClips) { var key = clip.Preset != BlendShapePreset.Unknown ? new BlendShapeKey(clip.BlendShapeName, clip.Preset) : new BlendShapeKey(clip.BlendShapeName); bindings[index].key = key; if (kPresetLayer.ContainsKey(clip.Preset)) { bindings[index].layer = kPresetLayer[clip.Preset]; } index++; } } }