[Bf-blender-cvs] [df02675e217] blender2.8: UI: move modal operator text from headers to status bar.

Brecht Van Lommel noreply at git.blender.org
Tue Jun 26 20:25:06 CEST 2018


Commit: df02675e21736bd79acb0e34bb410efe748a86bc
Author: Brecht Van Lommel
Date:   Tue Jun 26 17:19:25 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBdf02675e21736bd79acb0e34bb410efe748a86bc

UI: move modal operator text from headers to status bar.

Python API is context.workspace.status_text_set()

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

M	release/scripts/startup/bl_operators/wm.py
M	release/scripts/startup/bl_ui/space_statusbar.py
M	release/scripts/templates_py/manipulator_custom_geometry.py
M	release/scripts/templates_py/operator_modal_view3d.py
M	source/blender/blenkernel/intern/screen.c
M	source/blender/blenkernel/intern/workspace.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/armature/pose_lib.c
M	source/blender/editors/armature/pose_slide.c
M	source/blender/editors/gpencil/gpencil_brush.c
M	source/blender/editors/gpencil/gpencil_interpolate.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/include/UI_interface.h
M	source/blender/editors/interface/interface_templates.c
M	source/blender/editors/mesh/editmesh_bevel.c
M	source/blender/editors/mesh/editmesh_bisect.c
M	source/blender/editors/mesh/editmesh_inset.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/screen_edit.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/space_clip/tracking_ops.c
M	source/blender/editors/space_node/node_relationships.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_ruler.c
M	source/blender/editors/space_view3d/view3d_walk.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/uvedit/uvedit_smart_stitch.c
M	source/blender/editors/uvedit/uvedit_unwrap_ops.c
M	source/blender/makesdna/DNA_screen_types.h
M	source/blender/makesdna/DNA_workspace_types.h
M	source/blender/makesrna/intern/rna_screen.c
M	source/blender/makesrna/intern/rna_ui_api.c
M	source/blender/makesrna/intern/rna_workspace_api.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index b6f77505410..8a520edb70e 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -828,17 +828,17 @@ class WM_OT_context_modal_mouse(Operator):
                     header_text = header_text % eval("item.%s" % self.data_path_item)
                 else:
                     header_text = (self.header_text % delta) + " (delta)"
-                context.area.header_text_set(header_text)
+                context.workspace.status_text_set(header_text)
 
         elif 'LEFTMOUSE' == event_type:
             item = next(iter(self._values.keys()))
             self._values_clear()
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return operator_value_undo_return(item)
 
         elif event_type in {'RIGHTMOUSE', 'ESC'}:
             self._values_restore()
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
diff --git a/release/scripts/startup/bl_ui/space_statusbar.py b/release/scripts/startup/bl_ui/space_statusbar.py
index a738eb315e7..b0cfe424d3e 100644
--- a/release/scripts/startup/bl_ui/space_statusbar.py
+++ b/release/scripts/startup/bl_ui/space_statusbar.py
@@ -39,7 +39,7 @@ class STATUSBAR_HT_header(Header):
     def draw_left(self, context):
         layout = self.layout
 
-        layout.template_cursor_keymap()
+        layout.template_input_status()
 
     def draw_center(self, context):
         layout = self.layout
diff --git a/release/scripts/templates_py/manipulator_custom_geometry.py b/release/scripts/templates_py/manipulator_custom_geometry.py
index 48bb6956f85..7ebd864e69f 100644
--- a/release/scripts/templates_py/manipulator_custom_geometry.py
+++ b/release/scripts/templates_py/manipulator_custom_geometry.py
@@ -96,7 +96,7 @@ class MyCustomShapeWidget(Manipulator):
         return {'RUNNING_MODAL'}
 
     def exit(self, context, cancel):
-        context.area.header_text_set()
+        context.workspace.status_text_set()
         if cancel:
             self.target_set_value("offset", self.init_value)
 
@@ -108,7 +108,7 @@ class MyCustomShapeWidget(Manipulator):
             delta /= 10.0
         value = self.init_value + delta
         self.target_set_value("offset", value)
-        context.area.header_text_set("My Manipulator: %.4f" % value)
+        context.workspace.status_text_set("My Manipulator: %.4f" % value)
         return {'RUNNING_MODAL'}
 
 
diff --git a/release/scripts/templates_py/operator_modal_view3d.py b/release/scripts/templates_py/operator_modal_view3d.py
index c870bbffdcf..ed8d031285d 100644
--- a/release/scripts/templates_py/operator_modal_view3d.py
+++ b/release/scripts/templates_py/operator_modal_view3d.py
@@ -26,15 +26,15 @@ class ViewOperator(bpy.types.Operator):
         if event.type == 'MOUSEMOVE':
             self.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02
             self.execute(context)
-            context.area.header_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
+            context.workspace.status_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
 
         elif event.type == 'LEFTMOUSE':
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return {'FINISHED'}
 
         elif event.type in {'RIGHTMOUSE', 'ESC'}:
             rv3d.view_location = self._initial_location
-            context.area.header_text_set()
+            context.workspace.status_text_set()
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index 4a840b5ffbe..049c73322c8 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -224,7 +224,6 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
 	newar->visible = 0;
 	newar->manipulator_map = NULL;
 	newar->regiontimer = NULL;
-	newar->headerstr = NULL;
 	newar->draw_buffer = NULL;
 
 	/* use optional regiondata callback */
diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 3a9a392da4a..2e5798cd172 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -173,6 +173,11 @@ void BKE_workspace_free(WorkSpace *workspace)
 		}
 	}
 	BLI_freelistN(&workspace->tools);
+
+	if (workspace->status_text) {
+		MEM_freeN(workspace->status_text);
+		workspace->status_text = NULL;
+	}
 }
 
 /**
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 65692e2d15e..a8fec123477 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -2946,6 +2946,8 @@ static void direct_link_workspace(FileData *fd, WorkSpace *workspace, const Main
 		tref->properties = newdataadr(fd, tref->properties);
 		IDP_DirectLinkGroup_OrFree(&tref->properties, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
 	}
+
+	workspace->status_text = NULL;
 }
 
 static void lib_link_workspace_instance_hook(FileData *fd, WorkSpaceInstanceHook *hook, ID *id)
@@ -6460,7 +6462,6 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
 	BLI_listbase_clear(&ar->panels_category);
 	BLI_listbase_clear(&ar->handlers);
 	BLI_listbase_clear(&ar->uiblocks);
-	ar->headerstr = NULL;
 	ar->visible = 0;
 	ar->type = NULL;
 	ar->do_draw = 0;
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index e957e84857a..c4fbc86a389 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -769,7 +769,7 @@ static void ed_marker_move_update_header(bContext *C, wmOperator *op)
 		BLI_snprintf(str, sizeof(str), IFACE_("Marker offset %s"), str_offs);
 	}
 
-	ED_area_headerprint(CTX_wm_area(C), str);
+	ED_workspace_status_text(C, str);
 }
 
 /* copy selection to temp buffer */
@@ -829,7 +829,7 @@ static void ed_marker_move_exit(bContext *C, wmOperator *op)
 	op->customdata = NULL;
 
 	/* clear custom header prints */
-	ED_area_headerprint(CTX_wm_area(C), NULL);
+	ED_workspace_status_text(C, NULL);
 }
 
 static int ed_marker_move_invoke(bContext *C, wmOperator *op, const wmEvent *event)
diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c
index b9c4584ff15..b5ae950a28a 100644
--- a/source/blender/editors/armature/pose_lib.c
+++ b/source/blender/editors/armature/pose_lib.c
@@ -1118,7 +1118,7 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
 			BLI_strncpy(pld->headerstr,
 			            IFACE_("PoseLib Previewing Pose: [Showing Original Pose] | Use Tab to start previewing poses again"),
 			            sizeof(pld->headerstr));
-			ED_area_headerprint(pld->sa, pld->headerstr);
+			ED_workspace_status_text(C, pld->headerstr);
 		}
 		else if (pld->searchstr[0]) {
 			char tempstr[65];
@@ -1145,14 +1145,14 @@ static void poselib_preview_apply(bContext *C, wmOperator *op)
 			                    "Current Pose - \"%s\"  | "
 			                    "Use ScrollWheel or PageUp/Down to change"),
 			             tempstr, markern);
-			ED_area_headerprint(pld->sa, pld->headerstr);
+			ED_workspace_status_text(C, pld->headerstr);
 		}
 		else {
 			BLI_snprintf(pld->headerstr, sizeof(pld->headerstr),
 			             IFACE_("PoseLib Previewing Pose: \"%s\"  | "
 			                    "Use ScrollWheel or PageUp/Down to change"),
 			             pld->marker->name);
-			ED_area_headerprint(pld->sa, pld->headerstr);
+			ED_workspace_status_text(C, pld->headerstr);
 		}
 	}
 
@@ -1602,7 +1602,7 @@ static void poselib_preview_cleanup(bContext *C, wmOperator *op)
 	TimeMarker *marker = pld->marker;
 
 	/* redraw the header so that it doesn't show any of our stuff anymore */
-	ED_area_headerprint(pld->sa, NULL);
+	ED_workspace_status_text(C, NULL);
 
 	/* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
 	pose->flag |= POSE_DO_UNLOCK;
diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c
index b82535f013b..4f2e2397ef4 100644
--- a/source/blender/editors/armature/pose_slide.c
+++ b/source/blender/editors/armature/pose_slide.c
@@ -627,7 +627,7 @@ static void pose_slide_reset(tPoseSlideOp *pso)
 
 /* draw percentage indicator in header */
 // TODO: Include hints about locks here...
-static void pose_slide_draw_status(tPoseSlideOp *pso)
+static void pose_slide_draw_status(bContext *C, tPoseSlideOp *pso)
 {
 	char status_str[UI_MAX_DRAW_STR];
 	char limits_str[UI_MAX_DRAW_STR];
@@ -705,7 +705,7 @@ static void pose_slide_draw_status(tPoseSlideOp *pso)
 		BLI_snprintf(status_str, sizeof(status_str), "%s: %d %%     |   %s", mode_str, (int)(pso->percentage * 100.0f), limits_str);
 	}
 
-	ED_area_headerprint(pso->sa, status_str);
+	ED_workspace_status_text(C, status_str);
 }
 
 /* common code for invoke() methods */
@@ -781,7 +781,7 @@ static int pose_slide_invoke_common(bContext *C, wmOperator *op, tPoseSlideOp *p
 	WM_cursor_modal_set(win, BC_EW_SCROLLCURSOR);
 
 	/* header print */
-	pose_slide_draw_status(pso);
+	pose_slide_draw_status(C, pso);
 
 	/* add a modal handler for this operator */
 	WM_event_add_modal_handler(C, op);
@@ -857,7 +857,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
 		case PADENTER:
 		{
 			/* return to normal cursor and header status */
-			ED_area_headerprint(pso->sa, NULL);
+			ED_workspace_status_text(C, NULL);
 			WM_cursor_modal_restore(win);
 
 			/* insert keyframes as required... */
@@ -872,7 +872,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
 		case RIGHTMOUSE:
 		{
 			/* return to normal cursor and header status */
-			ED_area_headerprint(pso->sa, NULL);
+			ED_workspace_status_text(C, NULL);
 			WM_cursor_modal_restore(win);
 
 			/* reset transforms back to original state */
@@ -997,7 +997

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list