[Bf-blender-cvs] [f907eb4268c] blender2.8: PyAPI: Use 'None' arg to clear header text
Campbell Barton
noreply at git.blender.org
Tue Oct 30 06:21:07 CET 2018
Commit: f907eb4268ccea96869fc36c8aa1045507c066e8
Author: Campbell Barton
Date: Tue Oct 30 16:16:41 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBf907eb4268ccea96869fc36c8aa1045507c066e8
PyAPI: Use 'None' arg to clear header text
===================================================================
M release/scripts/startup/bl_operators/wm.py
M release/scripts/templates_py/gizmo_custom_geometry.py
M release/scripts/templates_py/operator_modal_view3d.py
M source/blender/makesrna/intern/rna_screen.c
M source/blender/makesrna/intern/rna_workspace_api.c
===================================================================
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 8a6b472aabf..0d8074a8333 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -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'}
diff --git a/release/scripts/templates_py/gizmo_custom_geometry.py b/release/scripts/templates_py/gizmo_custom_geometry.py
index c464ecabe0b..fba2b0269c4 100644
--- a/release/scripts/templates_py/gizmo_custom_geometry.py
+++ b/release/scripts/templates_py/gizmo_custom_geometry.py
@@ -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)
diff --git a/release/scripts/templates_py/operator_modal_view3d.py b/release/scripts/templates_py/operator_modal_view3d.py
index 1b94a5fd308..93c5ae84e2c 100644
--- a/release/scripts/templates_py/operator_modal_view3d.py
+++ b/release/scripts/templates_py/operator_modal_view3d.py
@@ -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'}
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index fdfbdfa4b39..f4311f820ce 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -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)
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index 398da78d7f9..83ee5195fd8 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -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)
More information about the Bf-blender-cvs
mailing list