forked from bartvdbraak/blender
PyAPI: Use 'None' arg to clear header text
This commit is contained in:
parent
f711c44b8d
commit
f907eb4268
@ -837,12 +837,12 @@ class WM_OT_context_modal_mouse(Operator):
|
|||||||
elif 'LEFTMOUSE' == event_type:
|
elif 'LEFTMOUSE' == event_type:
|
||||||
item = next(iter(self._values.keys()))
|
item = next(iter(self._values.keys()))
|
||||||
self._values_clear()
|
self._values_clear()
|
||||||
context.area.header_text_set("")
|
context.area.header_text_set(None)
|
||||||
return operator_value_undo_return(item)
|
return operator_value_undo_return(item)
|
||||||
|
|
||||||
elif event_type in {'RIGHTMOUSE', 'ESC'}:
|
elif event_type in {'RIGHTMOUSE', 'ESC'}:
|
||||||
self._values_restore()
|
self._values_restore()
|
||||||
context.area.header_text_set("")
|
context.area.header_text_set(None)
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
@ -96,7 +96,7 @@ class MyCustomShapeWidget(Gizmo):
|
|||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
|
||||||
def exit(self, context, cancel):
|
def exit(self, context, cancel):
|
||||||
context.area.header_text_set("")
|
context.area.header_text_set(None)
|
||||||
if cancel:
|
if cancel:
|
||||||
self.target_set_value("offset", self.init_value)
|
self.target_set_value("offset", self.init_value)
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ class ViewOperator(bpy.types.Operator):
|
|||||||
context.area.header_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
|
context.area.header_text_set("Offset %.4f %.4f %.4f" % tuple(self.offset))
|
||||||
|
|
||||||
elif event.type == 'LEFTMOUSE':
|
elif event.type == 'LEFTMOUSE':
|
||||||
context.area.header_text_set("")
|
context.area.header_text_set(None)
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
elif event.type in {'RIGHTMOUSE', 'ESC'}:
|
elif event.type in {'RIGHTMOUSE', 'ESC'}:
|
||||||
rv3d.view_location = self._initial_location
|
rv3d.view_location = self._initial_location
|
||||||
context.area.header_text_set("")
|
context.area.header_text_set(None)
|
||||||
return {'CANCELLED'}
|
return {'CANCELLED'}
|
||||||
|
|
||||||
return {'RUNNING_MODAL'}
|
return {'RUNNING_MODAL'}
|
||||||
|
@ -332,8 +332,9 @@ static void rna_def_area_api(StructRNA *srna)
|
|||||||
|
|
||||||
func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
|
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_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_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||||
|
RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_def_area(BlenderRNA *brna)
|
static void rna_def_area(BlenderRNA *brna)
|
||||||
|
@ -176,8 +176,9 @@ void RNA_api_workspace(StructRNA *srna)
|
|||||||
func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text");
|
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_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");
|
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_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||||
|
RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RNA_api_workspace_tool(StructRNA *srna)
|
void RNA_api_workspace_tool(StructRNA *srna)
|
||||||
|
Loading…
Reference in New Issue
Block a user