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;
                }
            }
        }
예제 #2
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;
        }