[Bf-blender-cvs] [cafc1e1bb71] blender2.8: Add utility to make it easier to get editors/regions to redraw after changing visibility of regions

Joshua Leung noreply at git.blender.org
Fri Apr 20 19:06:50 CEST 2018


Commit: cafc1e1bb7145acfd7946ecca17ba154fec7e015
Author: Joshua Leung
Date:   Fri Apr 20 12:14:07 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcafc1e1bb7145acfd7946ecca17ba154fec7e015

Add utility to make it easier to get editors/regions to redraw after changing visibility of regions

Previously, there was only an API method to toggle and update, but sometimes you
want to explicitly hide instead of just toggling.

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

M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/screen/area.c

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

diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index 8d7b6c86aa1..cfe4ddd1ddc 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -83,6 +83,7 @@ void    ED_region_header_init(struct ARegion *ar);
 void    ED_region_header(const struct bContext *C, struct ARegion *ar);
 void    ED_region_cursor_set(struct wmWindow *win, struct ScrArea *sa, struct ARegion *ar);
 void    ED_region_toggle_hidden(struct bContext *C, struct ARegion *ar);
+void    ED_region_visibility_change_update(struct bContext *C, struct ARegion *ar);
 void    ED_region_info_draw(struct ARegion *ar, const char *text, float fill_color[4], const bool full_redraw);
 void    ED_region_info_draw_multiline(ARegion *ar, const char *text_array[], float fill_color[4], const bool full_redraw);
 void    ED_region_image_metadata_draw(int x, int y, struct ImBuf *ibuf, const rctf *frame, float zoomx, float zoomy);
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index b6e2d2c57d4..f81d3edc5ba 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -1643,6 +1643,18 @@ void ED_region_cursor_set(wmWindow *win, ScrArea *sa, ARegion *ar)
 	}
 }
 
+/* for use after changing visiblity of regions */
+void ED_region_visibility_change_update(bContext *C, ARegion *ar)
+{
+	ScrArea *sa = CTX_wm_area(C);
+	
+	if (ar->flag & RGN_FLAG_HIDDEN)
+		WM_event_remove_handlers(C, &ar->handlers);
+	
+	ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
+	ED_area_tag_redraw(sa);
+}
+
 /* for quick toggle, can skip fades */
 void region_toggle_hidden(bContext *C, ARegion *ar, const bool do_fade)
 {
@@ -1655,11 +1667,7 @@ void region_toggle_hidden(bContext *C, ARegion *ar, const bool do_fade)
 		region_blend_start(C, sa, ar);
 	}
 	else {
-		if (ar->flag & RGN_FLAG_HIDDEN)
-			WM_event_remove_handlers(C, &ar->handlers);
-		
-		ED_area_initialize(CTX_wm_manager(C), CTX_wm_window(C), sa);
-		ED_area_tag_redraw(sa);
+		ED_region_visibility_change_update(C, ar);
 	}
 }



More information about the Bf-blender-cvs mailing list