[Bf-blender-cvs] [938631dfd38] asset-browser-poselib: Merge remote-tracking branch 'origin/master' into asset-browser-poselib
Julian Eisel
noreply at git.blender.org
Wed Apr 28 13:10:01 CEST 2021
Commit: 938631dfd384ebc944cf6bbb28814bfc3880e9c7
Author: Julian Eisel
Date: Wed Apr 28 13:09:43 2021 +0200
Branches: asset-browser-poselib
https://developer.blender.org/rB938631dfd384ebc944cf6bbb28814bfc3880e9c7
Merge remote-tracking branch 'origin/master' into asset-browser-poselib
===================================================================
===================================================================
diff --cc source/blender/editors/interface/interface_ops.c
index 757221b5045,1fb7a931c08..8d9fc88c76d
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@@ -74,30 -74,6 +74,32 @@@
#include "ED_screen.h"
#include "ED_text.h"
+/* -------------------------------------------------------------------- */
+/** \name Immediate redraw helper
+ *
+ * Generally handlers shouldn't do any redrawing, that includes the layout/button definitions. That
+ * violates the Model-View-Controller pattern.
+ *
+ * But there are some operators which really need to re-run the layout definitions for various
+ * reasons. For example, "Edit Source" does it to find out which exact Python code added a button.
+ * Other operators may need to access buttons that aren't currently visible. In Blender's UI code
+ * design that typically means just not adding the button in the first place, for a particular
+ * redraw. So the operator needs to change context and re-create the layout, so the button becomes
+ * available to act on.
+ *
+ * \{ */
+
+static void ui_region_redraw_immediately(bContext *C, ARegion *region)
+{
+ ED_region_do_layout(C, region);
++ WM_draw_region_viewport_bind(region);
+ ED_region_do_draw(C, region);
++ WM_draw_region_viewport_unbind(region);
+ region->do_draw = false;
+}
+
+/** \} */
+
/* -------------------------------------------------------------------- */
/** \name Copy Data Path Operator
* \{ */
More information about the Bf-blender-cvs
mailing list