Exemple #1
0
            public override void OnInspectorGUI()
            {
                serializedObject.Update();
                Quilt quilt = (Quilt)target;

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Quilt -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                GUI.enabled = false;
                EditorGUILayout.PropertyField(quiltRT);
                GUI.enabled = true;

                advancedFoldout.boolValue = EditorGUILayout.Foldout(
                    advancedFoldout.boolValue,
                    "Advanced",
                    true
                    );
                if (advancedFoldout.boolValue)
                {
                    EditorGUI.indentLevel++;

                    EditorGUILayout.PropertyField(captures, true);
                    EditorGUILayout.PropertyField(overrideQuilt);
                    // EditorGUILayout.PropertyField(overrideViews, true);
                    EditorGUILayout.PropertyField(renderOverrideBehind);
                    EditorGUILayout.PropertyField(debugPrintoutKey);
                    EditorGUILayout.PropertyField(screenshot2DKey);
                    EditorGUILayout.PropertyField(screenshot3DKey);
                    EditorGUILayout.PropertyField(forceConfigResolution);

                    List <string> tilingPresetNames = new List <string>();
                    foreach (var p in Quilt.tilingPresets)
                    {
                        tilingPresetNames.Add(p.presetName);
                    }
                    tilingPresetNames.Add("Default (determined by quality setting)");
                    tilingPresetNames.Add("Custom");

                    EditorGUI.BeginChangeCheck();
                    tilingPresetIndex.intValue = EditorGUILayout.Popup(
                        "Tiling",
                        tilingPresetIndex.intValue,
                        tilingPresetNames.ToArray()
                        );
                    if (EditorGUI.EndChangeCheck())
                    {
                        serializedObject.ApplyModifiedProperties();
                    }

                    // if it's a custom
                    int custom = Quilt.tilingPresets.Length + 1;
                    if (tilingPresetIndex.intValue == custom)
                    {
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(tilesX);
                        EditorGUILayout.PropertyField(tilesY);
                        EditorGUILayout.PropertyField(quiltW);
                        EditorGUILayout.PropertyField(quiltH);
                        if (EditorGUI.EndChangeCheck())
                        {
                            quilt.ApplyPreset();
                        }
                    }

                    string tilingDisplay = numViews.displayName + ": " + numViews.intValue.ToString() + "\n";
                    tilingDisplay += "Tiles: " + tilesX.intValue + " x " + tilesY.intValue.ToString() + "\n";
                    tilingDisplay += "Quilt Size: " + quiltW.intValue.ToString() + " x " +
                                     quiltH.intValue.ToString() + " px" + "\n";
                    tilingDisplay += "Tile Size: " + tileSizeX.intValue.ToString() + " x " +
                                     tileSizeY.intValue.ToString() + " px";

                    EditorGUILayout.LabelField(tilingDisplay, EditorStyles.helpBox);

                    // on quilt setup event
                    EditorGUILayout.PropertyField(onQuiltSetup);

                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Preview -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(renderIn2D);

                string previewerShortcutKey = "Ctrl + E";
                string settingsShortcutKey  = "Ctrl + Shift + E";

#if UNITY_EDITOR_OSX
                previewerShortcutKey = "⌘E";
                settingsShortcutKey  = "⌘^E";
#endif

                if (GUILayout.Button(new GUIContent(
                                         "Toggle Preview (" + previewerShortcutKey + ")",
                                         "If your LKG device is set up as a second display, " +
                                         "this will generate a game window on it to use as a " +
                                         "realtime preview"),
                                     EditorStyles.miniButton
                                     ))
                {
                    PreviewWindow.ToggleWindow();
                }

                if (GUILayout.Button(new GUIContent(
                                         "Settings (" + settingsShortcutKey + ")",
                                         "Use to set previewer position"),
                                     EditorStyles.miniButton
                                     ))
                {
                    EditorApplication.ExecuteMenuItem("HoloPlay/Preview Settings");
                }

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Config -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

#if CALIBRATOR
                EditorGUILayout.PropertyField(config, true);
#endif

                if (GUILayout.Button(new GUIContent(
                                         "Reload Config",
                                         "Reload the config, only really necessary if " +
                                         "you edited externally and the new config settings won't load"),
                                     EditorStyles.miniButton
                                     ))
                {
                    quilt.LoadConfig();
                }

                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Project Settings -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                if (GUILayout.Button(new GUIContent(
                                         "Optimization Settings",
                                         "Open a window that will let you select project settings " +
                                         "to be optimized for best performance with HoloPlay"),
                                     EditorStyles.miniButton
                                     ))
                {
                    OptimizationSettings window = EditorWindow.GetWindow <OptimizationSettings>();
                    window.Show();
                }

                EditorGUILayout.Space();

                serializedObject.ApplyModifiedProperties();
            }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            Quilt quilt = (Quilt)target;

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Quilt -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            GUI.enabled = false;
            EditorGUILayout.PropertyField(quiltRT);
            GUI.enabled = true;

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Take 2D Screenshot", EditorStyles.miniButton))
            {
                quilt.Screenshot2D();
            }
            if (GUILayout.Button("Take 3D Screenshot", EditorStyles.miniButton))
            {
                quilt.Screenshot3D();
            }
            EditorGUILayout.EndHorizontal();

            advancedFoldout.boolValue = EditorGUILayout.Foldout(
                advancedFoldout.boolValue,
                "Advanced",
                true
                );
            if (advancedFoldout.boolValue)
            {
                EditorGUI.indentLevel++;

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Captures -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(captures, true);
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("Add Capture", EditorStyles.miniButton))
                {
                    AddCapture(quilt);
                    EditorUtility.SetDirty(quilt);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUI.BeginChangeCheck();
                if (GUILayout.Button("Remove Capture", EditorStyles.miniButton))
                {
                    RemoveCapture(quilt);
                    EditorUtility.SetDirty(quilt);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Quilt Settings -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(overrideQuilt);
                // EditorGUILayout.PropertyField(overrideViews, true);
                EditorGUILayout.PropertyField(renderOverrideBehind);
                EditorGUILayout.PropertyField(debugPrintoutKey);
                EditorGUILayout.PropertyField(screenshot2DKey);
                EditorGUILayout.PropertyField(screenshot3DKey);

                EditorGUILayout.PropertyField(forceResolution);

                List <string> tilingPresetNames = new List <string>();
                foreach (var p in System.Enum.GetValues(typeof(Quilt.QuiltPreset)))
                {
                    tilingPresetNames.Add(p.ToString());
                }
                tilingPresetNames.Add("Default (determined by quality setting)");
                tilingPresetNames.Add("Custom");

                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(currentQuiltPreset);
                if (EditorGUI.EndChangeCheck())
                {
                    serializedObject.ApplyModifiedProperties();
                }

                // if it's a custom
                if (currentQuiltPreset.intValue == (int)Quilt.QuiltPreset.Custom)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(viewWidth);
                    EditorGUILayout.PropertyField(viewHeight);
                    EditorGUILayout.PropertyField(numViews);
                    if (EditorGUI.EndChangeCheck())
                    {
                        quilt.ApplyPreset();
                        EditorUtility.SetDirty(quilt);
                    }
                }

                string tilingDisplay = numViews.displayName + ": " + numViews.intValue.ToString() + "\n";

                tilingDisplay += "View Tiling: " + viewsHorizontal.intValue + " x " +
                                 viewsVertical.intValue.ToString() + "\n";

                tilingDisplay += "View Size: " + viewWidth.intValue.ToString() + " x " +
                                 viewHeight.intValue.ToString() + " px" + "\n";

                tilingDisplay += "Quilt Size: " + quiltWidth.intValue.ToString() + " x " +
                                 quiltHeight.intValue.ToString() + " px";

                EditorGUILayout.LabelField(tilingDisplay, EditorStyles.helpBox);
                EditorGUILayout.Space();

                GUI.color = Misc.guiColor;
                EditorGUILayout.LabelField("- Multi Display -", EditorStyles.whiteMiniLabel);
                GUI.color = Color.white;

                EditorGUILayout.PropertyField(calibrationIndex);

                // change display if displayIndex changes
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(displayIndex);
                if (EditorGUI.EndChangeCheck())
                {
                    quilt.QuiltCam.targetDisplay = displayIndex.intValue;
                }

                EditorGUILayout.PropertyField(multiDisplayKey);
                EditorGUILayout.HelpBox(
                    "Display Index 0 = Display 1.\n" +
                    "Unity names it Display 1 but the array is 0 indexed.\n\n" +
                    "Keep in mind that the main display is usually Display 1, and the plugged in Looking Glass is likely Display 2.\n\n" +
                    "In most cases, you will want to leave this at 0 and set the display in the Launch window, but " +
                    "if you're using Multi Display you can set this manually for multiple Looking Glasses.",
                    MessageType.None);

                // on quilt setup event
                EditorGUILayout.PropertyField(onQuiltSetup);

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Preview -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            EditorGUILayout.PropertyField(renderIn2D);

            string previewerShortcutKey = "Ctrl + E";
            string settingsShortcutKey  = "Ctrl + Shift + E";

#if UNITY_EDITOR_OSX
            previewerShortcutKey = "⌘E";
            settingsShortcutKey  = "⌘^E";
#endif

            if (GUILayout.Button(new GUIContent(
                                     "Toggle Preview (" + previewerShortcutKey + ")",
                                     "If your LKG device is set up as a second display, " +
                                     "this will generate a game window on it to use as a " +
                                     "realtime preview"),
                                 EditorStyles.miniButton
                                 ))
            {
                PreviewWindow.ToggleWindow();
            }

            if (GUILayout.Button(new GUIContent(
                                     "Settings (" + settingsShortcutKey + ")",
                                     "Use to set previewer position"),
                                 EditorStyles.miniButton
                                 ))
            {
                EditorApplication.ExecuteMenuItem("HoloPlay/Preview Settings");
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Calibration -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            if (GUILayout.Button(new GUIContent(
                                     "Reload Calibration",
                                     "Reload the calibration, only really necessary if " +
                                     "you edited externally and the new calibration settings won't load"),
                                 EditorStyles.miniButton
                                 ))
            {
                CalibrationManager.LoadCalibrations();
                EditorUtility.SetDirty(quilt);
            }

            EditorGUILayout.Space();

            GUI.color = Misc.guiColor;
            EditorGUILayout.LabelField("- Project Settings -", EditorStyles.whiteMiniLabel);
            GUI.color = Color.white;

            if (GUILayout.Button(new GUIContent(
                                     "Optimization Settings",
                                     "Open a window that will let you select project settings " +
                                     "to be optimized for best performance with HoloPlay"),
                                 EditorStyles.miniButton
                                 ))
            {
                OptimizationSettings window = EditorWindow.GetWindow <OptimizationSettings>();
                window.Show();
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }