[Bf-blender-cvs] [cac756a92aa] master: UI: Move render display type to Preferences

Julian Eisel noreply at git.blender.org
Wed Sep 18 14:43:44 CEST 2019


Commit: cac756a92aaec5ccc8ddb95c021dcf79d12cc588
Author: Julian Eisel
Date:   Wed Sep 18 14:32:21 2019 +0200
Branches: master
https://developer.blender.org/rBcac756a92aaec5ccc8ddb95c021dcf79d12cc588

UI: Move render display type to Preferences

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.

===================================================================

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

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 0374a563532..fef0e095099 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -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()
 
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 24586745c4f..89b4819eac7 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -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,
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 739dc32d1fe..c1c398c32d0 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -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) {
diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c
index d92cd13628b..6873495e962 100644
--- a/source/blender/editors/render/render_view.c
+++ b/source/blender/editors/render/render_view.c
@@ -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
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 86c2b2f09a8..22da2a86054 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -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,
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 1cf4a33c5c9..d82fd64b193 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -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);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 94f800c82a9..5b75bca89f3 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -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", ""},



More information about the Bf-blender-cvs mailing list