Example #1
0
    public override void OnInspectorGUI()
    {
        NoesisView view = target as NoesisView;

        // Register changes in the component so scene can be saved, and Undo is also enabled
        Undo.RecordObject(view, "Noesis View");

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel(new GUIContent("Render Mode",
                                                   "When attached to a camera the interface is rendered as a camera overlay. " +
                                                   "When attached to a Renderer or UI.RawImage the interface is rendered to texture"));
        if (view.IsRenderToTexture())
        {
            GUILayout.Label("Render Texture", "AssetLabel");
        }
        else
        {
            GUILayout.Label("Camera Overlay", "AssetLabel");
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        view._xaml = (NoesisXaml)EditorGUILayout.ObjectField(
            new GUIContent("XAML", "Drop here a xaml file that defines the user interface"),
            view._xaml, typeof(NoesisXaml), false);

        EditorGUILayout.Space();

        view._antiAliasingMode = (Noesis.View.AntialiasingMode)EditorGUILayout.EnumPopup(
            new GUIContent("Antialiasing Mode",
                           "Antialiasing Mode: MSAA=Uses hardware multisample, PPA=Propietary GPU accelerated antialiasing algorithm"),
            view._antiAliasingMode);

        view._tessellationQuality = (Noesis.View.TessellationQuality)EditorGUILayout.EnumPopup(
            new GUIContent("Tessellation Quality",
                           "Specifies tessellation quality"), view._tessellationQuality);

        EditorGUILayout.Space();

        RenderMode renderMode = ToRenderMode(view._renderFlags);

        renderMode        = (RenderMode)EditorGUILayout.EnumPopup(new GUIContent("Render Flags", ""), renderMode);
        view._renderFlags = ToRenderFlags(renderMode);

        EditorGUILayout.Space();

        view._enableKeyboard = EditorGUILayout.Toggle(new GUIContent("Enable Keyboard",
                                                                     "When enabled, Keyboard input events are processed by NoesisGUI view"),
                                                      view._enableKeyboard);

        view._enableMouse = EditorGUILayout.Toggle(new GUIContent("Enable Mouse",
                                                                  "When enabled, Mouse input events are processed by NoesisGUI view"),
                                                   view._enableMouse);

        view._enableTouch = EditorGUILayout.Toggle(new GUIContent("Enable Touch",
                                                                  "When enabled, Touch input events are processed by NoesisGUI view"),
                                                   view._enableTouch);

        view._emulateTouch = EditorGUILayout.Toggle(new GUIContent("Emulate Touch",
                                                                   "When enabled, Touch input events are emulated by using the Mouse"),
                                                    view._emulateTouch);

        view._useRealTimeClock = EditorGUILayout.Toggle(new GUIContent("Real Time Clock",
                                                                       "When enabled, Time.realtimeSinceStartup is used instead of Time.time for animations"),
                                                        view._useRealTimeClock);
    }
Example #2
0
    public override void OnInspectorGUI()
    {
        NoesisView view = target as NoesisView;

        // Register changes in the component so scene can be saved, and Undo is also enabled
        Undo.RecordObject(view, "Noesis View");

        EditorGUILayout.LabelField(new GUIContent("Render Mode", "Views attached to camera objects work in 'Camera Overlay' mode. 'Render Texture' mode is enabled in all other cases"),
                                   new GUIContent(view.IsRenderToTexture() ? "Render Texture" : "Camera Overlay"), EditorStyles.popup);

        if (view.IsRenderToTexture())
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(new GUIContent("Target Texture", "The texture to render this View into"));
            view._texture = (RenderTexture)EditorGUILayout.ObjectField(view._texture, typeof(RenderTexture), false);
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.Space();
        view._xaml = (NoesisXaml)EditorGUILayout.ObjectField(new GUIContent("XAML", "User interface definition XAML"), view._xaml, typeof(NoesisXaml), false);

        EditorGUILayout.BeginHorizontal();
        GUIContent[] options = { new GUIContent("Low Quality"), new GUIContent("Medium Quality"), new GUIContent("High Quality"), new GUIContent("Custom Quality") };
        int[]        values  = { 0, 1, 2, 3 };
        int          value   = view._tessellationMaxPixelError == 0.7f ? 0 : view._tessellationMaxPixelError == 0.4f ? 1 : view._tessellationMaxPixelError == 0.2f ? 2 : 3;

        value = EditorGUILayout.IntPopup(new GUIContent("Tessellation Pixel Error", "Tessellation curve tolerance in screen space. " +
                                                        "'Medium Quality' is usually fine for PPAA (non-multisampled) while 'High Quality' is the recommended pixel error if you are rendering to a 8x multisampled surface"),
                                         value, options, values);
        float maxError = value == 0 ? 0.7f : value == 1 ? 0.4f : value == 2 ? 0.2f: view._tessellationMaxPixelError;

        view._tessellationMaxPixelError = Math.Max(0.01f, EditorGUILayout.FloatField(maxError, GUILayout.Width(64)));
        EditorGUILayout.EndHorizontal();

        RenderMode renderMode = ToRenderMode(view._renderFlags);

        renderMode = (RenderMode)EditorGUILayout.EnumPopup(new GUIContent("Debug Render Flags",
                                                                          "Enables debugging render flags. No debug flags are active by default"), renderMode);
        view._renderFlags = ToRenderFlags(renderMode);

        view._isPPAAEnabled       = EditorGUILayout.Toggle(new GUIContent("Enable PPAA", "PPAA is a 'cheap' antialiasing algorithm useful when GPU MSAA is not enabled"), view._isPPAAEnabled);
        view._continuousRendering = EditorGUILayout.Toggle(new GUIContent("Continuous Rendering", "When continuous rendering is disabled rendering only happens when needed." +
                                                                          " For performance purposes and to save battery this is the default mode when rendering to texture.\n\nThis flag is ignored in 'Camera Overlay' mode and instead the property " +
                                                                          "NoesisView.NeedsRendering must be used with a manually repainted camera."), view._continuousRendering);
        EditorGUILayout.Space();

        view._enableKeyboard = EditorGUILayout.Toggle(new GUIContent("Enable Keyboard",
                                                                     "If Keyboard input events are processed by this view"),
                                                      view._enableKeyboard);

        view._enableMouse = EditorGUILayout.Toggle(new GUIContent("Enable Mouse",
                                                                  "If Mouse input events are processed by this view"),
                                                   view._enableMouse);

        view._enableTouch = EditorGUILayout.Toggle(new GUIContent("Enable Touch",
                                                                  "If Touch input events are processed by this view"),
                                                   view._enableTouch);

        view._emulateTouch = EditorGUILayout.Toggle(new GUIContent("Emulate Touch",
                                                                   "If Touch input events are emulated by the Mouse"),
                                                    view._emulateTouch);

        view._useRealTimeClock = EditorGUILayout.Toggle(new GUIContent("Real Time Clock",
                                                                       "If Time.realtimeSinceStartup is used instead of Time.time for animations"),
                                                        view._useRealTimeClock);
    }
Example #3
0
    public override void OnInspectorGUI()
    {
        NoesisView view = target as NoesisView;

        // Register changes in the component so scene can be saved, and Undo is also enabled
        Undo.RecordObject(view, "Noesis View");

        EditorGUILayout.LabelField(new GUIContent("Render Mode", "Views attached to camera objects work in 'Camera Overlay' mode. 'Render Texture' mode is enabled in all other cases"),
                                   new GUIContent(view.IsRenderToTexture() ? "Render Texture" : "Camera Overlay"), EditorStyles.popup);

        if (view.IsRenderToTexture())
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel(new GUIContent("Target Texture", "The texture to render this View into"));
            view.Texture = (RenderTexture)EditorGUILayout.ObjectField(view.Texture, typeof(RenderTexture), false);
            EditorGUILayout.EndHorizontal();
            view.ContinuousRendering = EditorGUILayout.Toggle(new GUIContent("Continuous Rendering", "When continuous rendering is disabled, rendering only happens when UI changes." +
                                                                             " For performance purposes and to save battery this is the default mode when rendering to texture.\n\nThis flag is not available in 'Camera Overlay' mode and instead the property " +
                                                                             "NoesisView.NeedsRendering must be used with a manually repainted camera."), view.ContinuousRendering);
        }

        EditorGUILayout.Space();
        view.Xaml = (NoesisXaml)EditorGUILayout.ObjectField(new GUIContent("XAML", "User interface definition XAML"), view.Xaml, typeof(NoesisXaml), false);

        EditorGUILayout.BeginHorizontal();
        GUIContent[] options    = { new GUIContent("Low Quality"), new GUIContent("Medium Quality"), new GUIContent("High Quality"), new GUIContent("Custom Quality") };
        int[]        values     = { 0, 1, 2, 3 };
        float        inMaxError = view.TessellationMaxPixelError;
        int          value      = inMaxError == 0.7f ? 0 : inMaxError == 0.4f ? 1 : inMaxError == 0.2f ? 2 : 3;

        value = EditorGUILayout.IntPopup(new GUIContent("Tessellation Pixel Error", "Tessellation curve tolerance in screen space. " +
                                                        "'Medium Quality' is usually fine for PPAA (non-multisampled) while 'High Quality' is the recommended pixel error if you are rendering to a 8x multisampled surface"),
                                         value, options, values);
        float outMaxError = value == 0 ? 0.7f : value == 1 ? 0.4f : value == 2 ? 0.2f: inMaxError;

        view.TessellationMaxPixelError = Math.Max(0.01f, EditorGUILayout.FloatField(outMaxError, GUILayout.Width(64)));
        EditorGUILayout.EndHorizontal();

        Noesis.RenderFlags renderFlags = view.RenderFlags;

        RenderMode renderMode = (RenderMode)EditorGUILayout.EnumPopup(new GUIContent("Debug Render Flags",
                                                                                     "Enables debugging render flags." +
                                                                                     "\n\n- Wireframe: toggles wireframe mode when rendering triangles" +
                                                                                     "\n\n- ColorBatches: each batch submitted to the GPU is given a unique solid color" +
                                                                                     "\n\n- Overdraw: displays pixel overdraw using blending layers. Different colors are used for each type of triangles." +
                                                                                     "'Green' for normal ones, 'Red' for opacities and 'Blue' for clipping masks"
                                                                                     ), ToRenderMode(renderFlags));

        renderFlags = (renderFlags & ~(Noesis.RenderFlags.Wireframe | Noesis.RenderFlags.ColorBatches | Noesis.RenderFlags.Overdraw))
                      | ToRenderFlags(renderMode);

        bool ppaa = EditorGUILayout.Toggle(new GUIContent("Enable PPAA",
                                                          "Per-Primitive Antialiasing extrudes the contours of the geometry and smooths them. " +
                                                          "It is a 'cheap' antialiasing algorithm useful when GPU MSAA is not enabled"),
                                           (renderFlags & Noesis.RenderFlags.PPAA) > 0);

        renderFlags = (renderFlags & ~Noesis.RenderFlags.PPAA) | (ppaa ? Noesis.RenderFlags.PPAA : 0);

        bool lcd = EditorGUILayout.Toggle(new GUIContent("Subpixel Rendering",
                                                         "Enables subpixel rendering compatible with LCD displays"),
                                          (renderFlags & Noesis.RenderFlags.LCD) > 0);

        renderFlags = (renderFlags & ~Noesis.RenderFlags.LCD) | (lcd ? Noesis.RenderFlags.LCD : 0);

        view.RenderFlags = renderFlags;

        EditorGUILayout.Space();

        view.EnableExternalUpdate = EditorGUILayout.Toggle(new GUIContent("External Update",
                                                                          "When enabled, the view must be explicitly updated by calling 'ExternalUpdate()'. " +
                                                                          "By default, the view is automatically updated during LateUpdate"
                                                                          ), view.EnableExternalUpdate);

        view.EnableKeyboard = EditorGUILayout.Toggle(new GUIContent("Enable Keyboard",
                                                                    "Indicates if keyboard input events are processed by this view"), view.EnableKeyboard);

        view.EnableMouse = EditorGUILayout.Toggle(new GUIContent("Enable Mouse",
                                                                 "Indicates if mouse input events are processed by this view"), view.EnableMouse);

        view.EnableTouch = EditorGUILayout.Toggle(new GUIContent("Enable Touch",
                                                                 "Indicates if touch input events are processed by this view"), view.EnableTouch);

        view.EnableGamepad = EditorGUILayout.Toggle(new GUIContent("Enable Gamepad",
                                                                   "Indicates if gamepad input events are processed by this view"), view.EnableGamepad);

        view.EmulateTouch = EditorGUILayout.Toggle(new GUIContent("Emulate Touch",
                                                                  "Indicates if touch input events are emulated by the Mouse"), view.EmulateTouch);

        view.UseRealTimeClock = EditorGUILayout.Toggle(new GUIContent("Real Time Clock",
                                                                      "Indicates if 'Time.realtimeSinceStartup' is used instead of 'Time.time' for animations"), view.UseRealTimeClock);
    }