public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            DrawPoseGUI();

            EditorGUILayout.Space();

            using (new HorizontalGroup())
            {
                GUIContent createNewGUIContent = new GUIContent("Create new pose", EditorGUIUtility.IconContent("Toolbar Plus").image);

                if (GUILayout.Button(createNewGUIContent))
                {
                    NuitrackPose newPose = NuitrackEditorHelper.CreateAsset <NuitrackPose>("Pose", SavePosePath);
                    Selection.activeObject = newPose;
                }

                GUIContent copyNewGUIContent = new GUIContent("Duplicate pose", EditorGUIUtility.IconContent("TreeEditor.Duplicate").image);

                if (GUILayout.Button(copyNewGUIContent))
                {
                    string       newName  = string.Format("{0} (clone)", target.name);
                    NuitrackPose copyPose = NuitrackEditorHelper.CreateAsset <NuitrackPose>(newName, SavePosePath);

                    NuitrackPoseWrapper copyPoseWrapper = new NuitrackPoseWrapper(new SerializedObject(copyPose));
                    copyPoseWrapper.CopyFrom(poseWrapper);

                    Selection.activeObject = copyPose;
                }
            }
        }
        void CreateNewPose(SerializedProperty poseProperty)
        {
            poseProperty.objectReferenceValue = NuitrackEditorHelper.CreateAsset <NuitrackPose>("Pose ", NuitrackPoseEditor.SavePosePath);
            poseProperty.serializedObject.ApplyModifiedProperties();

            GUIUtility.ExitGUI();
        }
Пример #3
0
        void AddNewPose()
        {
            string       newPoseName = string.Format("Pose {0}", PosesProperty.arraySize + 1);
            NuitrackPose newPose     = NuitrackEditorHelper.CreateAsset <NuitrackPose>(newPoseName, NuitrackPoseEditor.SavePosePath);

            PosesProperty.arraySize += 1;
            SerializedProperty poseProperty = GetPose(PosesProperty.arraySize - 1);

            poseProperty.FindPropertyRelative("pose").objectReferenceValue = newPose;
            poseProperty.FindPropertyRelative("poseProcessEvent").FindPropertyRelative("m_PersistentCalls.m_Calls").ClearArray();

            serializedObject.ApplyModifiedProperties();

            listView.index = PosesProperty.arraySize - 1;
        }
Пример #4
0
        void SaveRuntimePose(UserData.SkeletonData skeleton)
        {
            string       name    = "Runtime pose";
            NuitrackPose newPose = new NuitrackPose(name, skeleton);

            string saveFolder = SaveFolder.Replace(Application.dataPath, "");

            string[] separatePath = saveFolder.Split(new char[] { '\\', '/' }, System.StringSplitOptions.RemoveEmptyEntries);

            NuitrackPose        poseAsset           = NuitrackEditorHelper.CreateAsset <NuitrackPose>(name, separatePath);
            NuitrackPoseWrapper nuitrackPoseWrapper = new NuitrackPoseWrapper(new SerializedObject(poseAsset));

            nuitrackPoseWrapper.CopyFrom(newPose);

            Destroy(newPose);

            EditorApplication.isPlaying = false;
            Selection.activeObject      = poseAsset;
        }