private void Update() { if (BlendShapeAvatar != null) { if (m_merger == null) { m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform); } } }
public void Initialize() { if (BlendShapeAvatar == null) { return; } if (m_merger == null) { m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform); } }
private void Start() { if (m_destroyed) { return; } if (BlendShapeAvatar == null) { return; } // m_merger の null check は必用か? m_merger = new BlendShapeMerger(BlendShapeAvatar.Clips, transform); }
void OnBlendShapeGUI(VRMBlendShapeProxy proxy) { if (!State.ExportRoot.scene.IsValid()) { EditorGUILayout.HelpBox(BlendShapeTabMessages.CANNOT_MANIPULATE_PREFAB.Msg(), MessageType.Warning); return; } if (!proxy) { EditorGUILayout.HelpBox("no BlendShapeProxy", MessageType.Warning); return; } var avatar = proxy.BlendShapeAvatar; if (!avatar) { return; } m_merger = new BlendShapeMerger(avatar.Clips, proxy.transform); GUILayout.Space(20); EditorGUILayout.HelpBox(BlendShapeTabMessages.SCENE_MESSAGE.Msg(), MessageType.Info); var options = avatar.Clips.Select(x => x.ToString()).ToArray(); m_selected = EditorGUILayout.Popup("select blendshape", m_selected, options); if (GUILayout.Button(BlendShapeTabMessages.APPLY_BLENDSHAPECLIP_BUTTON.Msg())) { m_merger.SetValues(avatar.Clips.Select((x, i) => new KeyValuePair <BlendShapeKey, float>(x.Key, i == m_selected ? 1 : 0))); m_merger.Apply(); m_settings.PoseFreeze = true; } if (GUILayout.Button(BlendShapeTabMessages.CLEAR_BLENDSHAPE_BUTTON.Msg())) { m_merger.SetValues(avatar.Clips.Select(x => new KeyValuePair <BlendShapeKey, float>(x.Key, 0))); m_merger.Apply(); } }
void OnBlendShapeGUI(VRMBlendShapeProxy proxy) { if (!m_state.ExportRoot.scene.IsValid()) { EditorGUILayout.HelpBox("prefab は操作できません", MessageType.Warning); return; } if (!proxy) { return; } var avatar = proxy.BlendShapeAvatar; if (!avatar) { return; } m_merger = new BlendShapeMerger(avatar.Clips, proxy.transform); GUILayout.Space(20); EditorGUILayout.HelpBox("シーン上のExportRootにBlendShapeを適用します。Exportすると適用された状態がBakeされます。", MessageType.Info); var options = avatar.Clips.Select(x => x.ToString()).ToArray(); m_selected = EditorGUILayout.Popup("select blendshape", m_selected, options); if (GUILayout.Button("選択されたBlendShapeを適用する")) { m_merger.SetValues(avatar.Clips.Select((x, i) => new KeyValuePair <BlendShapeKey, float>(x.Key, i == m_selected ? 1 : 0))); m_merger.Apply(); m_settings.PoseFreeze = true; } if (GUILayout.Button("BlendShapeをClearする")) { m_merger.SetValues(avatar.Clips.Select(x => new KeyValuePair <BlendShapeKey, float>(x.Key, 0))); m_merger.Apply(); } }