public void OnToolChanged() { selectedToolGUI = toolGUIs[CurrentTool]; if (CurrentTool == ToolFunc.FaceEmotion) { faceEmotionGUI.Initialize(edittingAvatar, originalAvatar, saveFolder, this, animationsGUI); UpdateExclusitionBlendShapes(); avatarMonitorGUI.MoveAvatarCam(true, false); } else { avatarMonitorGUI.MoveAvatarCam(false, false); } if (CurrentTool == ToolFunc.Shader) { shaderGUI.Initialize(edittingAvatar, originalAvatar); } avatarMonitorGUI.showEyePosition = false; }
public bool DrawGUI(GUILayoutOption[] layoutOptions) { EditorGUILayout.LabelField(LocalizeText.instance.langPair.avatarInfoTitle, EditorStyles.boldLabel); if (originalAvatar != null && originalAvatar.Descriptor != null) { using (new EditorGUILayout.VerticalScope(GUI.skin.box)) { // 性別 using (var check = new EditorGUI.ChangeCheckScope()) { originalAvatar.Sex = (AnimationSet)EditorGUILayout.EnumPopup(LocalizeText.instance.langPair.genderLabel, originalAvatar.Sex); if (check.changed) { originalAvatar.Descriptor.Animations = originalAvatar.Sex; EditorUtility.SetDirty(originalAvatar.Descriptor); } } // アップロード状態 EditorGUILayout.LabelField(LocalizeText.instance.langPair.uploadStatusLabel, (string.IsNullOrEmpty(originalAvatar.AvatarId)) ? LocalizeText.instance.langPair.newAvatarText : LocalizeText.instance.langPair.uploadedAvatarText); // AnimatorOverrideController using (var check = new EditorGUI.ChangeCheckScope()) { #if VRC_SDK_VRCSDK2 originalAvatar.StandingAnimController = GatoGUILayout.ObjectField( LocalizeText.instance.langPair.customStandingAnimsLabel, originalAvatar.StandingAnimController); originalAvatar.SittingAnimController = GatoGUILayout.ObjectField( LocalizeText.instance.langPair.customSittingAnimsLabel, originalAvatar.SittingAnimController); #elif VRC_SDK_VRCSDK3 originalAvatar.GestureController = GatoGUILayout.ObjectField( "Gesture Layer", originalAvatar.GestureController); originalAvatar.FxController = GatoGUILayout.ObjectField( "FX Layer", originalAvatar.FxController); #endif if (check.changed) { #if VRC_SDK_VRCSDK2 originalAvatar.Descriptor.CustomStandingAnims = originalAvatar.StandingAnimController; originalAvatar.Descriptor.CustomSittingAnims = originalAvatar.SittingAnimController; #elif VRC_SDK_VRCSDK3 originalAvatar.Descriptor.baseAnimationLayers[2].animatorController = originalAvatar.GestureController; originalAvatar.Descriptor.baseAnimationLayers[4].animatorController = originalAvatar.FxController; #endif EditorUtility.SetDirty(originalAvatar.Descriptor); originalAvatar.SetAnimSavedFolderPath(); } } // ポリゴン数 EditorGUILayout.LabelField(LocalizeText.instance.langPair.triangleCountLabel, originalAvatar.TriangleCount + "(" + (originalAvatar.TriangleCount + originalAvatar.TriangleCountInactive) + ")"); // 身長 EditorGUILayout.LabelField(LocalizeText.instance.langPair.heightLabel, $"{originalAvatar.Height:F2} m"); // View Position using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField(LocalizeText.instance.langPair.viewPositionLabel, GUILayout.Width(145f)); using (var check = new EditorGUI.ChangeCheckScope()) { originalAvatar.EyePos = EditorGUILayout.Vector3Field(string.Empty, originalAvatar.EyePos); if (check.changed) { originalAvatar.Descriptor.ViewPosition = originalAvatar.EyePos; editAvatar.Descriptor.ViewPosition = originalAvatar.EyePos; editAvatar.EyePos = originalAvatar.EyePos; EditorUtility.SetDirty(originalAvatar.Descriptor); monitorGUI.showEyePosition = true; monitorGUI.MoveAvatarCam(false, true); } } monitorGUI.showEyePosition = GatoGUILayout.ToggleImage( monitorGUI.showEyePosition, showIconTexture, hideIconTexture); } // faceMesh using (var check = new EditorGUI.ChangeCheckScope()) { originalAvatar.FaceMesh = GatoGUILayout.ObjectField( LocalizeText.instance.langPair.faceMeshLabel, originalAvatar.FaceMesh); if (check.changed) { originalAvatar.Descriptor.VisemeSkinnedMesh = originalAvatar.FaceMesh; EditorUtility.SetDirty(originalAvatar.Descriptor); } } /* * using (new EditorGUILayout.HorizontalScope()) * using (new EditorGUI.DisabledGroupScope(avatar.faceMesh == null)) * { * GUILayout.FlexibleSpace(); * if (GUILayout.Button("Auto Setting")) * { * avatar.eyePos = CalcAvatarViewPosition(avatar); * avatar.descriptor.ViewPosition = avatar.eyePos; * } * * if (GUILayout.Button("Revert to Prefab")) * { * avatar.eyePos = RevertEyePosToPrefab(avatar.descriptor); * } * } * if (avatar.faceMesh == null) * { * EditorGUILayout.HelpBox("ViewPositionを自動設定するためにはFaceMeshを設定する必要があります", MessageType.Warning); * } */ EditorGUILayout.Space(); // リップシンク using (var check = new EditorGUI.ChangeCheckScope()) { originalAvatar.LipSyncStyle = (LipSyncStyle)EditorGUILayout.EnumPopup(LocalizeText.instance.langPair.lipSyncTypeLabel, originalAvatar.LipSyncStyle); if (check.changed) { originalAvatar.Descriptor.lipSync = originalAvatar.LipSyncStyle; } } if (originalAvatar.LipSyncStyle == LipSyncStyle.VisemeBlendShape) { if (originalAvatar.FaceMesh != null) { isOpeningLipSync = EditorGUILayout.Foldout(isOpeningLipSync, LocalizeText.instance.langPair.lipSyncBlendShapesLabel); if (isOpeningLipSync) { using (new EditorGUI.IndentLevelScope()) using (var scrollView = new EditorGUILayout.ScrollViewScope(lipSyncScrollPos)) { lipSyncScrollPos = scrollView.scrollPosition; for (int visemeIndex = 0; visemeIndex < LIPSYNC_SHYPEKEY_NUM; visemeIndex++) { EditorGUILayout.LabelField("Viseme:" + Enum.GetName(typeof(Viseme), visemeIndex), originalAvatar.Descriptor.VisemeBlendShapes[visemeIndex]); } } } } } if (originalAvatar.LipSyncStyle != LipSyncStyle.VisemeBlendShape || originalAvatar.FaceMesh == null) { EditorGUILayout.HelpBox(LocalizeText.instance.langPair.lipSyncWarningMessageText, MessageType.Warning); GatoGUILayout.Button( LocalizeText.instance.langPair.lipSyncBlendShapesAutoDetectButtonText, () => { originalAvatar.SetLipSyncToViseme(); EditorUtility.SetDirty(originalAvatar.Descriptor); }); } } EditorGUILayout.Space(); } return(false); }