Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-05-31 19:35:14 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-05-31 19:35:14 +0300
commitf71efafe8fc43083dcf573d258a1a5511d522702 (patch)
tree5d8f5e32c6a6a8aa43cb8679230b756328d5d8ad /source/blender/editors/space_text
parentdf22cd9ce160457bda1a976da4dd6e7079f36865 (diff)
parentcfea9c261c2349e03c5ce38a04659479901ce815 (diff)
Merge branch 'master' into blender2.8
Conflicts: source/blender/editors/sculpt_paint/paint_image.c source/blender/editors/space_image/image_edit.c source/blender/editors/space_image/image_ops.c source/blender/makesrna/intern/rna_material.c source/blender/makesrna/intern/rna_sculpt_paint.c source/blender/makesrna/intern/rna_space.c source/blenderplayer/bad_level_call_stubs/stubs.c
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_ops.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 2ce699aa6e2..01b404e321a 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -234,7 +234,7 @@ static int text_open_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", str);
- text = BKE_text_load_ex(bmain, str, G.main->name, internal);
+ text = BKE_text_load_ex(bmain, str, bmain->name, internal);
if (!text) {
if (op->customdata) MEM_freeN(op->customdata);
@@ -272,8 +272,9 @@ static int text_open_exec(bContext *C, wmOperator *op)
static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
+ Main *bmain = CTX_data_main(C);
Text *text = CTX_data_edit_text(C);
- const char *path = (text && text->name) ? text->name : G.main->name;
+ const char *path = (text && text->name) ? text->name : bmain->name;
if (RNA_struct_property_is_set(op->ptr, "filepath"))
return text_open_exec(C, op);
@@ -456,7 +457,7 @@ static int text_save_poll(bContext *C)
return (text->name != NULL && !(text->flags & TXT_ISMEM));
}
-static void txt_write_file(Text *text, ReportList *reports)
+static void txt_write_file(Main *bmain, Text *text, ReportList *reports)
{
FILE *fp;
TextLine *tmp;
@@ -464,7 +465,7 @@ static void txt_write_file(Text *text, ReportList *reports)
char filepath[FILE_MAX];
BLI_strncpy(filepath, text->name, FILE_MAX);
- BLI_path_abs(filepath, G.main->name);
+ BLI_path_abs(filepath, bmain->name);
fp = BLI_fopen(filepath, "w");
if (fp == NULL) {
@@ -499,9 +500,10 @@ static void txt_write_file(Text *text, ReportList *reports)
static int text_save_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Text *text = CTX_data_edit_text(C);
- txt_write_file(text, op->reports);
+ txt_write_file(bmain, text, op->reports);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
@@ -525,6 +527,7 @@ void TEXT_OT_save(wmOperatorType *ot)
static int text_save_as_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Text *text = CTX_data_edit_text(C);
char str[FILE_MAX];
@@ -537,7 +540,7 @@ static int text_save_as_exec(bContext *C, wmOperator *op)
text->name = BLI_strdup(str);
text->flags &= ~TXT_ISMEM;
- txt_write_file(text, op->reports);
+ txt_write_file(bmain, text, op->reports);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
@@ -547,6 +550,7 @@ static int text_save_as_exec(bContext *C, wmOperator *op)
static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
{
+ Main *bmain = CTX_data_main(C);
Text *text = CTX_data_edit_text(C);
const char *str;
@@ -558,7 +562,7 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
else if (text->flags & TXT_ISMEM)
str = text->id.name + 2;
else
- str = G.main->name;
+ str = bmain->name;
RNA_string_set(op->ptr, "filepath", str);
WM_event_add_fileselect(C, op);