PyAPI: Use 'None' arg to clear header text
authorCampbell Barton <ideasman42@gmail.com>
Tue, 30 Oct 2018 05:16:41 +0000 (16:16 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 30 Oct 2018 05:20:38 +0000 (16:20 +1100)
release/scripts/startup/bl_operators/wm.py
release/scripts/templates_py/gizmo_custom_geometry.py
release/scripts/templates_py/operator_modal_view3d.py
source/blender/makesrna/intern/rna_screen.c
source/blender/makesrna/intern/rna_workspace_api.c

index 8a6b472aabf8c448b8eb1b8fec7a3513978f607c..0d8074a8333b731d3d7bdc6b291688fbf59a0fc4 100644 (file)
@@ -837,12 +837,12 @@ class WM_OT_context_modal_mouse(Operator):
         elif 'LEFTMOUSE' == event_type:
             item = next(iter(self._values.keys()))
             self._values_clear()
-            context.area.header_text_set("")
+            context.area.header_text_set(None)
             return operator_value_undo_return(item)
 
         elif event_type in {'RIGHTMOUSE', 'ESC'}:
             self._values_restore()
-            context.area.header_text_set("")
+            context.area.header_text_set(None)
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
index c464ecabe0b4cc965fba45f13e7b3ecd7ddd5af8..fba2b0269c4a060c049e40ec13b4f268b52ac45b 100644 (file)
@@ -96,7 +96,7 @@ class MyCustomShapeWidget(Gizmo):
         return {'RUNNING_MODAL'}
 
     def exit(self, context, cancel):
-        context.area.header_text_set("")
+        context.area.header_text_set(None)
         if cancel:
             self.target_set_value("offset", self.init_value)
 
index 1b94a5fd308c1769e0e0ab5894624c8c0aca4883..93c5ae84e2cf577d3544f35d501b7263e312ef52 100644 (file)
@@ -29,12 +29,12 @@ class ViewOperator(bpy.types.Operator):
             context.area.header_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
 
         elif event.type == 'LEFTMOUSE':
-            context.area.header_text_set("")
+            context.area.header_text_set(None)
             return {'FINISHED'}
 
         elif event.type in {'RIGHTMOUSE', 'ESC'}:
             rv3d.view_location = self._initial_location
-            context.area.header_text_set("")
+            context.area.header_text_set(None)
             return {'CANCELLED'}
 
         return {'RUNNING_MODAL'}
index fdfbdfa4b39d3316e7422f4e842e99b9cbc578a9..f4311f820ce2199ea40ab3013d42b74847940184 100644 (file)
@@ -332,8 +332,9 @@ static void rna_def_area_api(StructRNA *srna)
 
        func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
        RNA_def_function_ui_description(func, "Set the header status text");
-       parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, empty string clears the text");
+       parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, None clears the text");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+       RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
 }
 
 static void rna_def_area(BlenderRNA *brna)
index 398da78d7f9e981bb8a42d289e6d1d307250f1a7..83ee5195fd811a6318aafa3954104d3ab206e81a 100644 (file)
@@ -176,8 +176,9 @@ void RNA_api_workspace(StructRNA *srna)
        func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text");
        RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
        RNA_def_function_ui_description(func, "Set the status bar text, typically key shortcuts for modal operators");
-       parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the status bar, empty string clears the text");
+       parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the status bar, None clears the text");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+       RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
 }
 
 void RNA_api_workspace_tool(StructRNA *srna)