RNA: Area.header_text_set text is now required

This commit is contained in:
2018-09-08 06:23:25 +10:00
parent 9c7195789d
commit f23319d095
4 changed files with 9 additions and 7 deletions

View File

@@ -831,17 +831,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(text=header_text)
context.area.header_text_set(header_text)
elif 'LEFTMOUSE' == event_type:
item = next(iter(self._values.keys()))
self._values_clear()
context.area.header_text_set()
context.area.header_text_set("")
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("")
return {'CANCELLED'}
return {'RUNNING_MODAL'}

View 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("")
if cancel:
self.target_set_value("offset", self.init_value)

View 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("")
return {'FINISHED'}
elif event.type in {'RIGHTMOUSE', 'ESC'}:
rv3d.view_location = self._initial_location
context.area.header_text_set()
context.area.header_text_set("")
return {'CANCELLED'}
return {'RUNNING_MODAL'}

View File

@@ -325,12 +325,14 @@ static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
static void rna_def_area_api(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *parm;
RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
RNA_def_function_ui_description(func, "Set the header status text");
RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_area(BlenderRNA *brna)