public override bool DrawGUI(GUILayoutOption[] layoutOptions) { // 設定済みアニメーション一覧 using (new EditorGUILayout.VerticalScope(GUI.skin.box, layoutOptions)) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); // タブを描画する _tab = (Tab)GUILayout.Toolbar((int)_tab, LocalizeText.instance.animationTabTexts, "LargeButton", GUI.ToolbarButtonSize.Fixed); GUILayout.FlexibleSpace(); } if (_tab == Tab.Standing) { titleText = LocalizeText.instance.langPair.standingTabText; if (originalAvatar != null) { controller = originalAvatar.StandingAnimController; } } else { titleText = LocalizeText.instance.langPair.sittingTabText; if (originalAvatar != null) { controller = originalAvatar.SittingAnimController; } } using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(titleText, EditorStyles.boldLabel); string btnText; if (!showEmoteAnimations) { btnText = LocalizeText.instance.langPair.emoteButtonText; } else { btnText = LocalizeText.instance.langPair.faceAndHandButtonText; } GatoGUILayout.Button( btnText, () => { showEmoteAnimations = !showEmoteAnimations; }); } EditorGUILayout.Space(); if (controller != null) { if (!showEmoteAnimations) { AnimationClip anim; for (int i = 0; i < HANDANIMS.Length; i++) { var handPoseName = HANDANIMS[i]; anim = handPoseName == controller[handPoseName].name ? null : controller[handPoseName]; controller[handPoseName] = EdittableAnimationField( (i + 1) + ":" + handPoseName, anim, pathMissing[i], anim != null, () => { if (vrcAvatarEditorGUI.CurrentTool != VRCAvatarEditorGUI.ToolFunc.FaceEmotion) { vrcAvatarEditorGUI.CurrentTool = VRCAvatarEditorGUI.ToolFunc.FaceEmotion; } FaceEmotion.ApplyAnimationProperties(controller[handPoseName], editAvatar); ((FaceEmotionGUI2)faceEmotionGUI).ChangeSaveAnimationState(controller[handPoseName].name, (HandPose.HandPoseType)Enum.ToObject(typeof(HandPose.HandPoseType), i + 1), controller[handPoseName]); }); } } else { AnimationClip anim; foreach (var emoteAnim in EMOTEANIMS) { anim = emoteAnim == controller[emoteAnim].name ? null : controller[emoteAnim]; controller[emoteAnim] = ValidatableAnimationField($" {emoteAnim}", anim, false); } } } else { if (editAvatar.Descriptor == null) { EditorGUILayout.HelpBox(LocalizeText.instance.langPair.noAvatarMessageText, MessageType.Warning); } else { string notSettingMessage, createMessage; if (_tab == Tab.Standing) { notSettingMessage = LocalizeText.instance.langPair.noCustomStandingAnimsMessageText; createMessage = LocalizeText.instance.langPair.createCustomStandingAnimsButtonText; } else { notSettingMessage = LocalizeText.instance.langPair.noCustomSittingAnimsMessageText; createMessage = LocalizeText.instance.langPair.createCustomSittingAnimsButtonText; } EditorGUILayout.HelpBox(notSettingMessage, MessageType.Warning); GatoGUILayout.Button( createMessage, () => { var fileName = "CO_" + originalAvatar.Animator.gameObject.name + ".overrideController"; saveFolderPath = "Assets/" + originalAvatar.Animator.gameObject.name + "/"; var fullFolderPath = Path.GetFullPath(saveFolderPath); if (!Directory.Exists(fullFolderPath)) { Directory.CreateDirectory(fullFolderPath); AssetDatabase.Refresh(); } var createdCustomOverrideController = InstantiateVrcCustomOverideController(saveFolderPath + fileName); if (_tab == Tab.Standing) { originalAvatar.Descriptor.CustomStandingAnims = createdCustomOverrideController; editAvatar.Descriptor.CustomStandingAnims = createdCustomOverrideController; } else { originalAvatar.Descriptor.CustomSittingAnims = createdCustomOverrideController; editAvatar.Descriptor.CustomSittingAnims = createdCustomOverrideController; } originalAvatar.LoadAvatarInfo(); editAvatar.LoadAvatarInfo(); vrcAvatarEditorGUI.UpdateExclusitionBlendShapes(); }); if (_tab == Tab.Sitting) { GatoGUILayout.Button( LocalizeText.instance.langPair.setToSameAsCustomStandingAnimsButtonText, () => { var customStandingAnimsController = originalAvatar.Descriptor.CustomStandingAnims; originalAvatar.Descriptor.CustomSittingAnims = customStandingAnimsController; editAvatar.Descriptor.CustomSittingAnims = customStandingAnimsController; originalAvatar.LoadAvatarInfo(); editAvatar.LoadAvatarInfo(); vrcAvatarEditorGUI.UpdateExclusitionBlendShapes(); }, editAvatar.StandingAnimController != null); } } } if (pathMissing.Any(x => x)) { var warningMessage = (failedAutoFixMissingPath) ? LocalizeText.instance.langPair.failAutoFixMissingPathMessageText : LocalizeText.instance.langPair.existMissingPathMessageText; EditorGUILayout.HelpBox(warningMessage, MessageType.Warning); GatoGUILayout.Button( LocalizeText.instance.langPair.autoFix, () => { failedAutoFixMissingPath = false; for (int i = 0; i < pathMissing.Length; i++) { if (!pathMissing[i]) { continue; } var result = GatoUtility.TryFixMissingPathInAnimationClip( editAvatar.Animator, editAvatar.StandingAnimController[HANDANIMS[i]]); pathMissing[i] = !result; failedAutoFixMissingPath = !result; } }, !failedAutoFixMissingPath ); } } return(false); }
public virtual void OnLoadedAnimationProperties() { FaceEmotion.ApplyAnimationProperties(ScriptableSingleton <SendData> .instance.loadingProperties, editAvatar); }
public override bool DrawGUI(GUILayoutOption[] layoutOptions) { using (new EditorGUILayout.VerticalScope(GUI.skin.box, layoutOptions)) { if (originalAvatar != null) { fxController = originalAvatar.FxController; } using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("FX Layer", EditorStyles.boldLabel); // TODO: Emote一覧に切り替えるボタン } EditorGUILayout.Space(); // TODO: Emote一覧と切り替えられるように? if (fxController != null) { var layerNames = fxController.layers.Select(l => l.name).ToArray(); editAvatar.TargetFxLayerIndex = EditorGUILayout.Popup("Layer", editAvatar.TargetFxLayerIndex, layerNames); var states = fxController.layers[editAvatar.TargetFxLayerIndex] .stateMachine.states .Where(s => !(s.state.motion is BlendTree)) .OrderBy(s => s.state.name) .ToArray(); GatoGUILayout.ErrorBox(LocalizeText.instance.langPair.haveNoAnimationClipMessageText, states.Any(), MessageType.Info); AnimationClip anim; for (int i = 0; i < states.Length; i++) { var stateName = states[i].state.name; anim = states[i].state.motion as AnimationClip; states[i].state.motion = EdittableAnimationField( $"{i + 1}:{stateName}", anim, false, anim != null && !anim.name.StartsWith("proxy_"), () => { if (vrcAvatarEditorGUI.CurrentTool != VRCAvatarEditorGUI.ToolFunc.FaceEmotion) { vrcAvatarEditorGUI.CurrentTool = VRCAvatarEditorGUI.ToolFunc.FaceEmotion; } FaceEmotion.ApplyAnimationProperties(anim, editAvatar); ((FaceEmotionGUI3)faceEmotionGUI).ChangeSaveAnimationState( anim.name, i, anim); }); } } else { EditorGUILayout.HelpBox(LocalizeText.instance.langPair.missingFxControllerMessageText, MessageType.Warning); if (GUILayout.Button(LocalizeText.instance.langPair.createFxControllerText)) { CreatePlayableLayerController(originalAvatar, editAvatar); vrcAvatarEditorGUI.OnToolChanged(); } } } return(false); }