protected void DrawFunctionButtons() { using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); GatoGUILayout.Button( LocalizeText.instance.langPair.loadAnimationButtonText, () => { FaceEmotion.LoadAnimationProperties(this, parentWindow); }, editAvatar.Descriptor != null); GatoGUILayout.Button( LocalizeText.instance.langPair.setToDefaultButtonText, () => { if (EditorUtility.DisplayDialog( LocalizeText.instance.langPair.setToDefaultDialogTitleText, LocalizeText.instance.langPair.setToDefaultDialogMessageText, LocalizeText.instance.langPair.ok, LocalizeText.instance.langPair.cancel)) { FaceEmotion.SetToDefaultFaceEmotion(editAvatar, originalAvatar); } }, editAvatar.Descriptor != null); GatoGUILayout.Button( LocalizeText.instance.langPair.resetToDefaultButtonText, () => { FaceEmotion.ResetToDefaultFaceEmotion(editAvatar); ChangeSaveAnimationState(); }, editAvatar.Descriptor != null); } }
protected override void DrawCreateButtonGUI() { GatoGUILayout.Button( LocalizeText.instance.langPair.createAnimFileButtonText, () => { var animController = originalAvatar.StandingAnimController; var createdAnimClip = FaceEmotion.CreateBlendShapeAnimationClip(animName, originalAvatar.AnimSavedFolderPath, editAvatar); if (selectedHandAnim != HandPose.HandPoseType.NoSelection) { HandPose.AddHandPoseAnimationKeysFromOriginClip(createdAnimClip, handPoseAnim); animController[AnimationsGUI.HANDANIMS[(int)selectedHandAnim - 1]] = createdAnimClip; EditorUtility.SetDirty(animController); FaceEmotion.ResetToDefaultFaceEmotion(editAvatar); } originalAvatar.StandingAnimController = animController; editAvatar.StandingAnimController = animController; animationsGUI.ResetPathMissing(AnimationsGUI.HANDANIMS[(int)selectedHandAnim - 1]); }, selectedHandAnim != HandPose.HandPoseType.NoSelection && handPoseAnim != null); }
public void Dispose() { FaceEmotion.ResetToDefaultFaceEmotion(editAvatar); }
protected override void DrawCreateButtonGUI() { GatoGUILayout.Button( LocalizeText.instance.langPair.createAnimFileButtonText, () => { var controller = originalAvatar.FxController; var createdAnimClip = FaceEmotion.CreateBlendShapeAnimationClip( animName, originalAvatar.AnimSavedFolderPath, editAvatar, true); // Stateがない場合は作成のみ if (states.Any()) { states[selectedStateIndex].state.motion = createdAnimClip; EditorUtility.SetDirty(controller); // 可能であればもう一方の手も同じAnimationClipを設定する if (setLeftAndRight) { var layerName = editAvatar.FxController.layers[editAvatar.TargetFxLayerIndex].name; string targetLayerName = string.Empty; if (layerName == "Left Hand") { targetLayerName = "Right Hand"; } else if (layerName == "Right Hand") { targetLayerName = "Left Hand"; } if (!string.IsNullOrEmpty(targetLayerName)) { var targetLayer = editAvatar.FxController.layers .Where(l => l.name == targetLayerName) .SingleOrDefault(); if (targetLayer != null) { var targetStateName = states[selectedStateIndex].state.name; var targetState = targetLayer.stateMachine.states .Where(s => s.state.name == targetStateName) .SingleOrDefault(); if (targetState.state != null) { targetState.state.motion = createdAnimClip; EditorUtility.SetDirty(controller); } } } } } FaceEmotion.ResetToDefaultFaceEmotion(editAvatar); originalAvatar.FxController = controller; editAvatar.FxController = controller; }, originalAvatar.FxController != null); }