void DrawAutomapTools(IEnumerable <JointType> activeJoints) { bool disableClearbutton = activeJoints.Count() == 0; using (new VerticalGroup(EditorStyles.helpBox)) { string text = disableClearbutton ? "Click \"Automap\" to quickly configure the avatar" : "To make the avatar exactly repeat your movements, put the avatar in the T-pose"; GUIContent gUIContent = new GUIContent(text, NuitrackSDKGUI.GetMessageIcon(LogType.Log)); EditorGUILayout.LabelField(gUIContent, EditorStyles.wordWrappedLabel); using (new HorizontalGroup()) { using (new GUIColor(disableClearbutton ? firstAutomapColor : GUI.color)) if (GUILayout.Button(autoMapping)) { AutoMapping(); } EditorGUI.BeginDisabledGroup(disableClearbutton); if (GUILayout.Button(enforceTPose)) { SetToTPose(); } if (GUILayout.Button(clearMapping)) { if (EditorUtility.DisplayDialog("Skeleton map", "Do you really want to clear the skeleton map?", "Yes", "No")) { Clear(); } } EditorGUI.EndDisabledGroup(); } } }
void DrawRuntimeWizard() { GUIContent wizardLabel = new GUIContent("Save runtime pose wizard", EditorGUIUtility.IconContent("AvatarSelector").image); ShowRuntimePoseWizard = EditorGUILayout.BeginFoldoutHeaderGroup(ShowRuntimePoseWizard, wizardLabel); if (ShowRuntimePoseWizard) { if (NuitrackManager == null) { UnityAction fixNuitrack = delegate { NuitrackMenu.AddNuitrackToScene(); }; NuitrackSDKGUI.DrawMessage("The wizard requires NuitrackScripts on the scene.", LogType.Error, fixNuitrack, "Fix"); Selection.activeObject = target; } else { if (!EditorApplication.isPlaying) { using (new VerticalGroup(EditorStyles.helpBox)) EditorGUILayout.LabelField("1) Play \n2) Stand in a pose \n3) Save pose", EditorStyles.wordWrappedLabel); EditorGUILayout.Space(); SaveFolder = NuitrackSDKGUI.OpenFolderField(SaveFolder, "Save pose folder", true, DefaultPath); GUIContent playScene = new GUIContent("Play", EditorGUIUtility.IconContent("PlayButton").image); EditorGUILayout.Space(); if (GUILayout.Button(playScene)) { EditorApplication.isPlaying = true; } } else { UserData user = NuitrackManager.Users.Current; bool disable = user == null || user.Skeleton == null; Texture icon = disable ? NuitrackSDKGUI.GetMessageIcon(LogType.Warning) : null; Color backgroundColor = disable ? Color.yellow : Color.green; string message = "After saving a pose, playback will stop and the saved pose will open"; if (disable) { message = string.Format("{0}\n{1}", "The user was not found. Stand in front of the sensor to save a pose.", message); } GUIContent messageGUI = new GUIContent(message, icon); UnityAction savePose = delegate { SaveRuntimePose(user.Skeleton); }; GUIContent iconAvatar = new GUIContent("Save runtime pose", EditorGUIUtility.IconContent("SaveAs").image); EditorGUI.BeginDisabledGroup(disable); NuitrackSDKGUI.DrawMessage(messageGUI, backgroundColor, savePose, iconAvatar); EditorGUI.EndDisabledGroup(); Repaint(); if (rgbCache == null) { rgbCache = new TextureCache(); } rgbTexture = NuitrackManager.ColorFrame.ToRenderTexture(rgbCache); NuitrackSDKGUI.DrawFrame(rgbTexture, "RGB Preview"); } } } EditorGUILayout.EndFoldoutHeaderGroup(); }