UI: Move render display type to Preferences
authorJulian Eisel <eiseljulian@gmail.com>
Wed, 18 Sep 2019 12:32:21 +0000 (14:32 +0200)
committerJulian Eisel <eiseljulian@gmail.com>
Wed, 18 Sep 2019 12:32:21 +0000 (14:32 +0200)
Moves the render display type (to choose between rendering in a new
window, in a fullscreen area, in an Image Editor, etc) from the scene to
the preferences.

release/scripts/startup/bl_ui/space_topbar.py
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenloader/intern/versioning_userdef.c
source/blender/editors/render/render_view.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_userdef.c

index 0374a56353225555764b5aaebbe9eaff8d494875..fef0e095099d7e090f1b06a3c96c41e0f6588c5f 100644 (file)
@@ -465,7 +465,6 @@ class TOPBAR_MT_render(Menu):
 
         layout.operator("render.view_show", text="View Render")
         layout.operator("render.play_rendered_anim", text="View Animation")
-        layout.prop_menu_enum(rd, "display_mode", text="Display Mode")
 
         layout.separator()
 
index 24586745c4fa64d0455a58ff6a92be9323d68382..89b4819eac76eb2f4ac008b65b0b9c35d02ca52a 100644 (file)
@@ -265,6 +265,25 @@ class USERPREF_PT_interface_editors(PreferencePanel, Panel):
         flow.prop(view, "factor_display_type")
 
 
+class USERPREF_PT_interface_temporary_windows(PreferencePanel, Panel):
+    bl_label = "Temporary Windows"
+    bl_parent_id = "USERPREF_PT_interface_editors"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    @classmethod
+    def poll(cls, context):
+        prefs = context.preferences
+        return (prefs.active_section == 'INTERFACE')
+
+    def draw_props(self, context, layout):
+        prefs = context.preferences
+        view = prefs.view
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False)
+
+        flow.prop(view, "render_display_type", text="Render in")
+
+
 class USERPREF_PT_interface_menus(Panel):
     bl_space_type = 'PREFERENCES'
     bl_region_type = 'WINDOW'
@@ -2119,6 +2138,7 @@ classes = (
 
     USERPREF_PT_interface_display,
     USERPREF_PT_interface_editors,
+    USERPREF_PT_interface_temporary_windows,
     USERPREF_PT_interface_translation,
     USERPREF_PT_interface_text,
     USERPREF_PT_interface_menus,
index 739dc32d1feba82035ae5dfa941cd59cb652d3f6..c1c398c32d030f9d614074649e7262e3a3c8788a 100644 (file)
@@ -620,6 +620,7 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef)
    */
   {
     /* pass */
+    userdef->render_display_type = USER_RENDER_DISPLAY_WINDOW;
   }
 
   if (userdef->pixelsize == 0.0f) {
index d92cd13628b5871ac80954f4f079716ae533eabf..6873495e9622c1c53913e233158dd23aebdfa53b 100644 (file)
@@ -139,11 +139,11 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
   SpaceImage *sima;
   bool area_was_image = false;
 
-  if (scene->r.displaymode == R_OUTPUT_NONE) {
+  if (U.render_display_type == USER_RENDER_DISPLAY_NONE) {
     return NULL;
   }
 
-  if (scene->r.displaymode == R_OUTPUT_WINDOW) {
+  if (U.render_display_type == USER_RENDER_DISPLAY_WINDOW) {
     int sizex = 30 * UI_DPI_FAC + (scene->r.xsch * scene->r.size) / 100;
     int sizey = 60 * UI_DPI_FAC + (scene->r.ysch * scene->r.size) / 100;
 
@@ -164,7 +164,7 @@ ScrArea *render_view_open(bContext *C, int mx, int my, ReportList *reports)
 
     sa = CTX_wm_area(C);
   }
-  else if (scene->r.displaymode == R_OUTPUT_SCREEN) {
+  else if (U.render_display_type == USER_RENDER_DISPLAY_SCREEN) {
     sa = CTX_wm_area(C);
 
     /* if the active screen is already in fullscreen mode, skip this and
index 86c2b2f09a8ef29f8a5d60549c5f531864c576be..22da2a860548ebc7379c2f175b4988a94b661098 100644 (file)
@@ -814,7 +814,8 @@ typedef struct UserDef {
 
   char viewport_aa;
 
-  char _pad5[6];
+  char render_display_type;      /* eUserpref_RenderDisplayType */
+  char _pad5[5];
 
   struct WalkNavigation walk_navigation;
 
@@ -1202,6 +1203,13 @@ typedef enum eUserpref_FactorDisplay {
   USER_FACTOR_AS_PERCENTAGE = 1,
 } eUserpref_FactorDisplay;
 
+typedef enum eUserpref_RenderDisplayType {
+  USER_RENDER_DISPLAY_NONE = 0,
+  USER_RENDER_DISPLAY_SCREEN = 1,
+  USER_RENDER_DISPLAY_AREA = 2,
+  USER_RENDER_DISPLAY_WINDOW = 3
+} eUserpref_RenderDisplayType;
+
 typedef enum eUserpref_TempSpaceDisplayType {
   USER_TEMP_SPACE_DISPLAY_FULLSCREEN,
   USER_TEMP_SPACE_DISPLAY_WINDOW,
index 1cf4a33c5c98e67aeebe4d686a6f396676ec6f8c..d82fd64b19347b6a1c7d9b12b160faf6ee602dc3 100644 (file)
@@ -5509,22 +5509,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
   StructRNA *srna;
   PropertyRNA *prop;
 
-  static const EnumPropertyItem display_mode_items[] = {
-      {R_OUTPUT_SCREEN,
-       "SCREEN",
-       0,
-       "Full Screen",
-       "Images are rendered in a maximized Image Editor"},
-      {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in an Image Editor"},
-      {R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in a new window"},
-      {R_OUTPUT_NONE,
-       "NONE",
-       0,
-       "Keep User Interface",
-       "Images are rendered without changing the user interface"},
-      {0, NULL, 0, NULL, NULL},
-  };
-
   /* Bake */
   static const EnumPropertyItem bake_mode_items[] = {
       //{RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"},
@@ -5921,13 +5905,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
                            "(this solves anti-aliasing issues with compositing)");
   RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
 
-  prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
-  RNA_def_property_enum_bitflag_sdna(prop, NULL, "displaymode");
-  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-  RNA_def_property_enum_items(prop, display_mode_items);
-  RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed");
-  RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
   prop = RNA_def_property(srna, "use_lock_interface", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "use_lock_interface", 1);
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
index 94f800c82a97e6702c4a53be3aa19cde4e1fce96..5b75bca89f34e052510f37ccc46ebdb201d220ee 100644 (file)
@@ -4044,6 +4044,29 @@ static void rna_def_userdef_view(BlenderRNA *brna)
       {0, NULL, 0, NULL, NULL},
   };
 
+  static const EnumPropertyItem render_display_types[] = {
+      {USER_RENDER_DISPLAY_NONE,
+       "NONE",
+       0,
+       "Keep User Interface",
+       "Images are rendered without changing the user interface"},
+      {USER_RENDER_DISPLAY_SCREEN,
+       "SCREEN",
+       0,
+       "Full Screen",
+       "Images are rendered in a maximized Image Editor"},
+      {USER_RENDER_DISPLAY_AREA,
+       "AREA",
+       0,
+       "Image Editor",
+       "Images are rendered in an Image Editor"},
+      {USER_RENDER_DISPLAY_WINDOW,
+       "WINDOW",
+       0,
+       "New Window",
+       "Images are rendered in a new window"},
+      {0, NULL, 0, NULL, NULL},
+  };
   static const EnumPropertyItem temp_space_display_types[] = {
       {USER_TEMP_SPACE_DISPLAY_FULLSCREEN,
        "SCREEN", /* Could be FULLSCREEN, but keeping it consistent with render_display_types */
@@ -4282,6 +4305,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Header Position", "Default header position for new space-types");
   RNA_def_property_update(prop, 0, "rna_userdef_screen_update_header_default");
 
+  prop = RNA_def_property(srna, "render_display_type", PROP_ENUM, PROP_NONE);
+  RNA_def_property_enum_items(prop, render_display_types);
+  RNA_def_property_ui_text(
+      prop, "Render Display Type", "Default location where rendered images will be displayed in");
+
   static const EnumPropertyItem text_hinting_items[] = {
       {0, "AUTO", 0, "Auto", ""},
       {USER_TEXT_HINTING_NONE, "NONE", 0, "None", ""},