/// <summary>
        /// Called when the window is Enabled.
        /// </summary>
        public void OnEnable()
        {
            layoutProfiles = CinemaMocapLayout.LoadMetaData();
            if (layoutProfiles.Count < 1)
            {
                Debug.LogError(NO_LAYOUT_PROFILES_FOUND_MSG);
                return;
            }

            mocapWorkflowPhase = GetUserDefaultWorkflow();


            if (mocapWorkflowPhase == MocapWorkflow.Record)
            {
                mocapPipeline = new RecordPipeline(true);
            }
            else
            {
                mocapPipeline = new ReviewPipeline(true);
            }

            showInputSettings     = new AnimBool(true, Repaint);
            showMappingSettings   = new AnimBool(true, Repaint);
            showOutputSettings    = new AnimBool(true, Repaint);
            showRecordingSettings = new AnimBool(true, Repaint);

            foldoutStyle = skin.FindStyle("SettingsFoldout");
            if (foldoutStyle == null)
            {
                foldoutStyle = skin.FindStyle("box");
            }
        }
Ejemplo n.º 2
0
        protected void loadProfiles(bool loadFromEditorPrefs, MocapWorkflow mocapWorkflow)
        {
            // Look up user prefs if asked.
            if (loadFromEditorPrefs)
            {
                // Load all the profile meta data.
                loadInputMetaData(MocapWorkflow.Record, MocapWorkflow.Review);

                // Try to load the user's preferred input method.
                if (EditorPrefs.HasKey(CinemaMocapSettingsWindow.InputProfileKey))
                {
                    string label  = EditorPrefs.GetString(CinemaMocapSettingsWindow.InputProfileKey);
                    int    result = inputProfiles.FindIndex(item => item.Attribute.ProfileName == label);

                    // Set the correct workflow phase
                    mocapWorkflow = inputProfiles[result].Attribute.MocapPhase;
                }
            }

            // Load the appropriate profiles for the current mocap workflow.
            loadInputMetaData(mocapWorkflow);
            mocapProfileSelection = 0;

            if (loadFromEditorPrefs)
            {
                if (EditorPrefs.HasKey(CinemaMocapSettingsWindow.InputProfileKey))
                {
                    string label  = EditorPrefs.GetString(CinemaMocapSettingsWindow.InputProfileKey);
                    int    result = inputProfiles.FindIndex(item => item.Attribute.ProfileName == label);
                    mocapProfileSelection = result;
                }
            }

            // Instantiate Input Profile
            InputProfile = BaseSystem.Activator.CreateInstance(inputProfiles[mocapProfileSelection].Type) as InputProfile;
            //InputProfile.SkeletonFrameCaptured += MocapProfile_SkeletonFrameCaptured;
            ////InputProfile.InputSkeletonTypeChanged += InputProfile_InputSkeletonTypeChanged;
            spoolUpInputEvents();

            inputProfileChanged();
        }
Ejemplo n.º 3
0
 public InputProfileAttribute(string profileName, MocapWorkflow mocapPhase, int sensorCount)
 {
     this.profileName = profileName;
     this.mocapPhase  = mocapPhase;
     this.sensorCount = sensorCount;
 }
        /// <summary>
        /// Draw the window's toolbar.
        /// </summary>
        /// <param name="toolbar">The toolbar's area.</param>
        private void DrawToolbar(Rect toolbar)
        {
            EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Width(toolbar.width));

            //if (isDeveloperModeEnabled)
            {
                MocapWorkflow tempWorkflow = (MocapWorkflow)EditorGUILayout.EnumPopup(mocapWorkflowPhase, EditorStyles.toolbarDropDown);
                if (tempWorkflow != mocapWorkflowPhase)
                {
                    mocapWorkflowPhase = tempWorkflow;

                    if (mocapWorkflowPhase == MocapWorkflow.Record)
                    {
                        mocapPipeline.OnDestroy();
                        mocapPipeline = new RecordPipeline(GetUserDefaultWorkflow() == MocapWorkflow.Record);
                    }
                    else
                    {
                        mocapPipeline.OnDestroy();
                        mocapPipeline = new ReviewPipeline(GetUserDefaultWorkflow() == MocapWorkflow.Review);
                    }
                }
            }

            GUIContent[] content = new GUIContent[layoutProfiles.Count];
            for (int i = 0; i < layoutProfiles.Count; i++)
            {
                content[i] = new GUIContent(layoutProfiles[i].Label);
            }
            GUILayout.FlexibleSpace();

            int tempSelection = EditorGUILayout.Popup(new GUIContent(string.Empty, "Layout"), layoutProfileSelection, content, EditorStyles.toolbarDropDown, GUILayout.Width(120));

            if (layoutProfileSelection != tempSelection || mocapPipeline.LayoutProfile == null)
            {
                mocapPipeline.LayoutProfile = Activator.CreateInstance(layoutProfiles[tempSelection].Type) as CinemaMocapLayout;
                if (mocapPipeline.InputProfile != null)
                {
                    mocapPipeline.LayoutProfile.AspectRatio = mocapPipeline.InputProfile.AspectRatio;
                }
                layoutProfileSelection = tempSelection;
            }

            if (GUILayout.Button(new GUIContent(settingsIcon, "Settings"), EditorStyles.toolbarButton))
            {
                EditorWindow.GetWindow(typeof(CinemaMocapSettingsWindow));
            }

            // Check if the Welcome Window exists and if so, show an icon for it.
            var helpWindowType = Type.GetType("CinemaSuite.CinemaSuiteWelcome");

            if (helpWindowType != null)
            {
                if (GUILayout.Button(new GUIContent("?", "Help"), EditorStyles.toolbarButton))
                {
                    EditorWindow.GetWindow(helpWindowType);
                }
            }

            EditorGUILayout.EndHorizontal();
        }