From 4c12550fe89a6a14ae246c37a97626c1b55c2b19 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 15 Nov 2011 19:46:56 +0000 Subject: Fix #29208: Text.clear() and Text.write() did not redraw text editor. --- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/makesrna/intern/rna_text_api.c | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index a464948c3ac..6dbf7b9c553 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -2481,7 +2481,7 @@ static RNAProcessItem PROCESS_ITEMS[]= { {"rna_space.c", NULL, RNA_def_space}, {"rna_speaker.c", NULL, RNA_def_speaker}, {"rna_test.c", NULL, RNA_def_test}, - {"rna_text.c", NULL, RNA_def_text}, + {"rna_text.c", "rna_text_api.c", RNA_def_text}, {"rna_timeline.c", NULL, RNA_def_timeline_marker}, {"rna_sound.c", NULL, RNA_def_sound}, {"rna_ui.c", "rna_ui_api.c", RNA_def_ui}, diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c index ec669b28918..acfcad80f19 100644 --- a/source/blender/makesrna/intern/rna_text_api.c +++ b/source/blender/makesrna/intern/rna_text_api.c @@ -28,11 +28,25 @@ #include #include - #include "RNA_define.h" #ifdef RNA_RUNTIME +#include "WM_api.h" +#include "WM_types.h" + +static void rna_Text_clear(Text *text) +{ + clear_text(text); + WM_main_add_notifier(NC_TEXT|NA_EDITED, text); +} + +static void rna_Text_write(Text *text, const char *str) +{ + write_text(text, str); + WM_main_add_notifier(NC_TEXT|NA_EDITED, text); +} + #else void RNA_api_text(StructRNA *srna) @@ -40,10 +54,10 @@ void RNA_api_text(StructRNA *srna) FunctionRNA *func; PropertyRNA *prop; - func= RNA_def_function(srna, "clear", "clear_text"); + func= RNA_def_function(srna, "clear", "rna_Text_clear"); RNA_def_function_ui_description(func, "clear the text block"); - func= RNA_def_function(srna, "write", "write_text"); + func= RNA_def_function(srna, "write", "rna_Text_write"); RNA_def_function_ui_description(func, "write text at the cursor location and advance to the end of the text block"); prop= RNA_def_string(func, "text", "Text", 0, "", "New text for this datablock"); RNA_def_property_flag(prop, PROP_REQUIRED); -- cgit v1.2.3