[Bf-blender-cvs] [8587679a253] master: UI: option to toggle 'Adjust Last Operation'

Campbell Barton noreply at git.blender.org
Thu Apr 18 14:03:22 CEST 2019


Commit: 8587679a25361b7d23fe72900bbcb307e244c169
Author: Campbell Barton
Date:   Thu Apr 18 13:49:21 2019 +0200
Branches: master
https://developer.blender.org/rB8587679a25361b7d23fe72900bbcb307e244c169

UI: option to toggle 'Adjust Last Operation'

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

M	release/scripts/startup/bl_ui/space_clip.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/editors/interface/interface_region_hud.c
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 32c8d9af0bc..28a6a61ab07 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -1233,6 +1233,7 @@ class CLIP_MT_view(Menu):
         if sc.view == 'CLIP':
             layout.prop(sc, "show_region_ui")
             layout.prop(sc, "show_region_toolbar")
+            layout.prop(sc, "show_region_hud")
 
             layout.separator()
 
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 163e75165da..a233295c2c5 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -71,6 +71,7 @@ class IMAGE_MT_view(Menu):
 
         layout.prop(sima, "show_region_toolbar")
         layout.prop(sima, "show_region_ui")
+        layout.prop(sima, "show_region_hud")
 
         layout.separator()
 
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 47db6f3ab7b..e987ef9b6db 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -582,6 +582,7 @@ class VIEW3D_MT_view(Menu):
 
         layout.prop(view, "show_region_toolbar")
         layout.prop(view, "show_region_ui")
+        layout.prop(view, "show_region_hud")
 
         layout.separator()
 
diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c
index a69f3d89c41..362a1c8a22c 100644
--- a/source/blender/editors/interface/interface_region_hud.c
+++ b/source/blender/editors/interface/interface_region_hud.c
@@ -286,6 +286,13 @@ void ED_area_type_hud_ensure(bContext *C, ScrArea *sa)
   }
 
   ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_HUD);
+
+  if (ar && (ar->flag & RGN_FLAG_HIDDEN_BY_USER)) {
+    /* The region is intentionally hidden by the user, don't show it. */
+    hud_region_hide(ar);
+    return;
+  }
+
   bool init = false;
   bool was_hidden = ar == NULL || ar->visible == false;
   if (!last_redo_poll(C)) {
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 48418ee5035..5f35f7c9d6a 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -625,6 +625,9 @@ enum {
   /** Size has been clamped (floating regions only). */
   RGN_FLAG_SIZE_CLAMP_X = (1 << 5),
   RGN_FLAG_SIZE_CLAMP_Y = (1 << 6),
+  /** When the user sets the region is hidden,
+   * needed for floating regions that may be hidden for other reasons. */
+  RGN_FLAG_HIDDEN_BY_USER = (1 << 7),
 };
 
 /** #ARegion.do_draw */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f6ce958752d..ffbea29a301 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -596,6 +596,15 @@ static void rna_Space_bool_from_region_flag_update_by_type(bContext *C,
         ED_region_visibility_change_update(C, sa, ar);
       }
     }
+    else if (region_flag == RGN_FLAG_HIDDEN_BY_USER) {
+      if (!(ar->flag & RGN_FLAG_HIDDEN_BY_USER) != !(ar->flag & RGN_FLAG_HIDDEN)) {
+        ED_region_toggle_hidden(C, ar);
+
+        if ((ar->flag & RGN_FLAG_HIDDEN_BY_USER) == 0) {
+          ED_area_type_hud_ensure(C, sa);
+        }
+      }
+    }
   }
 }
 
@@ -633,6 +642,20 @@ static void rna_Space_show_region_ui_update(bContext *C, PointerRNA *ptr)
   rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_UI, RGN_FLAG_HIDDEN);
 }
 
+/* Redo (HUD) Region */
+static bool rna_Space_show_region_hud_get(PointerRNA *ptr)
+{
+  return !rna_Space_bool_from_region_flag_get_by_type(ptr, RGN_TYPE_HUD, RGN_FLAG_HIDDEN_BY_USER);
+}
+static void rna_Space_show_region_hud_set(PointerRNA *ptr, bool value)
+{
+  rna_Space_bool_from_region_flag_set_by_type(ptr, RGN_TYPE_HUD, RGN_FLAG_HIDDEN_BY_USER, !value);
+}
+static void rna_Space_show_region_hud_update(bContext *C, PointerRNA *ptr)
+{
+  rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_HUD, RGN_FLAG_HIDDEN_BY_USER);
+}
+
 /** \} */
 
 static bool rna_Space_view2d_sync_get(PointerRNA *ptr)
@@ -2417,6 +2440,10 @@ static void rna_def_space_generic_show_region_toggles(StructRNA *srna, int regio
     region_type_mask &= ~(1 << RGN_TYPE_UI);
     DEF_SHOW_REGION_PROPERTY(show_region_ui, "Sidebar", "");
   }
+  if (region_type_mask & (1 << RGN_TYPE_HUD)) {
+    region_type_mask &= ~(1 << RGN_TYPE_HUD);
+    DEF_SHOW_REGION_PROPERTY(show_region_hud, "Adjust Last Operation", "");
+  }
   BLI_assert(region_type_mask == 0);
 }
 
@@ -3499,7 +3526,8 @@ static void rna_def_space_view3d(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "View3D");
   RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
 
-  rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI));
+  rna_def_space_generic_show_region_toggles(
+      srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD));
 
   prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
   RNA_def_property_flag(prop, PROP_EDITABLE);
@@ -4005,7 +4033,8 @@ static void rna_def_space_image(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "SpaceImage");
   RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
 
-  rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI));
+  rna_def_space_generic_show_region_toggles(
+      srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD));
 
   /* image */
   prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
@@ -5807,7 +5836,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
   RNA_def_struct_sdna(srna, "SpaceClip");
   RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
 
-  rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI));
+  rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD));
 
   /* movieclip */
   prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);



More information about the Bf-blender-cvs mailing list