/// <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");
            }
        }
Beispiel #2
0
        public override void DrawDisplayArea(CinemaMocapLayout layout)
        {
            // Eventually we can create session playback viewers.
            // For example: Timeline scrubber with curve editing.

            GUIStyle style = new GUIStyle("helpBox");

            style.fontSize  = 20;
            style.alignment = TextAnchor.MiddleCenter;
            GUI.Box(layout.Area, "<Timeline Reviewer coming soon.>", style);
        }
Beispiel #3
0
        private void syncViewers(CinemaMocapLayout layout)
        {
            if (viewers.Count == layout.ViewerCount)
            {
                return;
            }

            // Cache possible types of viewers and existing types of viewers.
            List <Type> viewerTypes         = new List <Type>();
            List <Type> existingViewerTypes = new List <Type>();

            foreach (TypeLabelContextData viewerType in availableViewerTypes)
            {
                viewerTypes.Add(viewerType.Type);
            }
            foreach (Kinect2EditorViewer viewer in viewers)
            {
                existingViewerTypes.Add(viewer.GetType());
            }

            // Add or remove viewers as necessary.
            while (viewers.Count != layout.ViewerCount)
            {
                if (viewers.Count < layout.ViewerCount)
                {
                    // Add a new instance of a viewer. Try to add an appropriate one.
                    Type appropriateType = viewerTypes[0];
                    foreach (Type t in viewerTypes)
                    {
                        if (!existingViewerTypes.Contains(t))
                        {
                            appropriateType = t;
                            break;
                        }
                    }

                    Kinect2EditorViewer newViewer = Activator.CreateInstance(appropriateType) as Kinect2EditorViewer;
                    newViewer.Initialize(kinectSensor);
                    viewers.Add(newViewer);

                    existingViewerTypes.Add(appropriateType);
                }
                else if (viewers.Count > layout.ViewerCount)
                {
                    int index = viewers.Count - 1;
                    viewers.RemoveAt(index);
                }
            }
        }
Beispiel #4
0
        public override void DrawDisplayArea(CinemaMocapLayout layout)
        {
            // Check that the viewers match the layout.
            syncViewers(layout);

            // Get each viewer's individual area.
            List <Rect> areas = layout.GetViewerRects();

            // Draw each viewer.
            for (int i = 0; i < layout.ViewerCount; i++)
            {
                viewers[i].Area = areas[i];
                viewers[i].DrawBackground();

                // Display the Viewer Type dropdown.
                GUIContent[] content          = new GUIContent[availableViewerTypes.Count];
                int          currentSelection = 0;
                for (int j = 0; j < availableViewerTypes.Count; j++)
                {
                    content[j] = new GUIContent(availableViewerTypes[j].Label);
                    if (viewers[i].GetType() == availableViewerTypes[j].Type)
                    {
                        currentSelection = j;
                    }
                }
                int tempSelection = EditorGUI.Popup(viewers[i].SelectorArea, currentSelection, content, EditorStyles.toolbarDropDown);
                if (tempSelection != currentSelection)
                {
                    viewers[i] = Activator.CreateInstance(availableViewerTypes[tempSelection].Type) as Kinect2EditorViewer;
                    viewers[i].Initialize(kinectSensor);
                }

                // Draw the rest of the toolbar.
                viewers[i].UpdateToolbar();

                // Draw the contents
                if (IsDeviceOn)
                {
                    viewers[i].DrawContent();
                }
                else
                {
                    viewers[i].DrawPlaceHolder();
                }
            }
        }
        //#region Developer Mode
        //private bool isDeveloperModeEnabled = false;
        //#endregion

        /// <summary>
        /// Called when the window is opened.
        /// Initializes all variables and sets up the system.
        /// </summary>
        public void Awake()
        {
            // Setup window
#if UNITY_5 && !UNITY_5_0 || UNITY_2017_1_OR_NEWER
            base.titleContent = new GUIContent(TITLE);
#else
            base.title = TITLE;
#endif
            string res_dir = "Cinema Suite/Cinema Mocap/";
            skin         = EditorGUIUtility.Load(res_dir + "CinemaMocap_ProSkin.guiskin") as GUISkin;
            this.minSize = new Vector2(680, 400f);

            // Load UI Images
            string settingsIconName = EditorGUIUtility.isProSkin ? "CinemaMocap_SettingsIcon" : "CinemaMocap_SettingsIcon_Personal";
            settingsIcon = (Texture2D)EditorGUIUtility.Load(res_dir + settingsIconName + ".png");
            if (settingsIcon == null)
            {
                UnityEngine.Debug.LogWarning(string.Format("{0} is missing from Resources folder.", settingsIconName));
            }

            layoutProfiles = CinemaMocapLayout.LoadMetaData();
            if (layoutProfiles.Count < 1)
            {
                Debug.LogError(NO_LAYOUT_PROFILES_FOUND_MSG);
                return;
            }

            // Load Preferences
            if (EditorPrefs.HasKey(CinemaMocapSettingsWindow.LayoutKey))
            {
                string label  = EditorPrefs.GetString(CinemaMocapSettingsWindow.LayoutKey);
                int    result = layoutProfiles.FindIndex(item => item.Label == label);
                layoutProfileSelection = result;
            }
            //if (EditorPrefs.HasKey(CinemaMocapSettingsWindow.DeveloperModeKey))
            //{
            //    isDeveloperModeEnabled = EditorPrefs.GetBool(CinemaMocapSettingsWindow.DeveloperModeKey);
            //}
        }
Beispiel #6
0
 public abstract void DrawDisplayArea(CinemaMocapLayout layout);