forked from bartvdbraak/blender
py/rna access to setting the header text - can be used in modal operators.
eg: context.area.header_text_set("Some Text") included example in the view3d modal operator template.
This commit is contained in:
parent
3f768cb472
commit
491aebbf67
@ -23,12 +23,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))
|
||||
|
||||
elif event.type == 'LEFTMOUSE':
|
||||
context.area.header_text_set()
|
||||
return {'FINISHED'}
|
||||
|
||||
elif event.type in ('RIGHTMOUSE', 'ESC'):
|
||||
rv3d.view_location = self._initial_location
|
||||
context.area.header_text_set()
|
||||
return {'CANCELLED'}
|
||||
|
||||
return {'RUNNING_MODAL'}
|
||||
|
@ -80,7 +80,7 @@ void ED_area_do_listen(ScrArea *sa, struct wmNotifier *note);
|
||||
void ED_area_tag_redraw(ScrArea *sa);
|
||||
void ED_area_tag_refresh(ScrArea *sa);
|
||||
void ED_area_do_refresh(struct bContext *C, ScrArea *sa);
|
||||
void ED_area_headerprint(ScrArea *sa, const char *str);
|
||||
void ED_area_headerprint(ScrArea *sa, char *str);
|
||||
void ED_area_newspace(struct bContext *C, ScrArea *sa, int type);
|
||||
void ED_area_prevspace(struct bContext *C, ScrArea *sa);
|
||||
void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2);
|
||||
|
@ -414,7 +414,7 @@ void ED_area_tag_refresh(ScrArea *sa)
|
||||
/* *************************************************************** */
|
||||
|
||||
/* use NULL to disable it */
|
||||
void ED_area_headerprint(ScrArea *sa, const char *str)
|
||||
void ED_area_headerprint(ScrArea *sa, char *str)
|
||||
{
|
||||
ARegion *ar;
|
||||
|
||||
|
@ -233,6 +233,7 @@ void RNA_api_keyconfig(struct StructRNA *srna);
|
||||
void RNA_api_keyingset(struct StructRNA *srna);
|
||||
void RNA_api_keymap(struct StructRNA *srna);
|
||||
void RNA_api_keymapitem(struct StructRNA *srna);
|
||||
void RNA_api_area(struct StructRNA *srna);
|
||||
void RNA_api_main(struct StructRNA *srna);
|
||||
void RNA_api_material(StructRNA *srna);
|
||||
void RNA_api_mesh(struct StructRNA *srna);
|
||||
|
@ -106,6 +106,8 @@ static void rna_def_area(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
FunctionRNA *func;
|
||||
PropertyRNA *parm;
|
||||
|
||||
srna= RNA_def_struct(brna, "Area", NULL);
|
||||
RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
|
||||
@ -139,6 +141,10 @@ static void rna_def_area(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, 0, "rna_Area_type_update");
|
||||
|
||||
RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
|
||||
|
||||
func= RNA_def_function(srna, "header_text_set", "ED_area_headerprint");
|
||||
RNA_def_function_ui_description(func, "Set the header text");
|
||||
parm= RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, no argument clears the text.");
|
||||
}
|
||||
|
||||
static void rna_def_region(BlenderRNA *brna)
|
||||
|
Loading…
Reference in New Issue
Block a user