Better API design for making text datablocks after loading.

An optional 'internal' argument was added to the bpy.data.texts.load() operator.  
The changes in revision 57153 were reverted, so that the is_in_memory and is_dirty
properties of text datablocks are not editable again.

In the C API layer, BKE_text_load_ex() was introduced to allow for optionally
making text datablocks internal after loading.
This commit is contained in:
2013-06-02 17:52:06 +00:00
parent 5506ab080d
commit d8c2709414
6 changed files with 22 additions and 18 deletions

View File

@@ -238,7 +238,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
text = BKE_text_load(bmain, str, G.main->name);
text = BKE_text_load_ex(bmain, str, G.main->name, internal);
if (!text) {
if (op->customdata) MEM_freeN(op->customdata);
@@ -264,13 +264,6 @@ static int text_open_exec(bContext *C, wmOperator *op)
st->text = text;
st->top = 0;
}
if (internal) {
if (text->name)
MEM_freeN(text->name);
text->name = NULL;
}
text_drawcache_tag_update(st, 1);
WM_event_add_notifier(C, NC_TEXT | NA_ADDED, text);