diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-01 18:08:38 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-01 18:08:38 +0300 |
commit | 051e186d5c61dccfc776b8da9b83c598421be4e7 (patch) | |
tree | 8f00c5a6262ca522fcd11a8540aee637a5aa8245 /source/blender/editors/space_sequencer | |
parent | 7c75c2db4f97e192d76761afe0cdb4391bdc0ec1 (diff) |
Cleanup: some more G.main removal from editor code.
Diffstat (limited to 'source/blender/editors/space_sequencer')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 13 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_edit.c | 5 |
2 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 258cbdfaffd..8315a0eab3d 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -114,9 +114,10 @@ static void sequencer_generic_invoke_path__internal(bContext *C, wmOperator *op, Scene *scene = CTX_data_scene(C); Sequence *last_seq = BKE_sequencer_active_get(scene); if (last_seq && last_seq->strip && SEQ_HAS_PATH(last_seq)) { + Main *bmain = CTX_data_main(C); char path[FILE_MAX]; BLI_strncpy(path, last_seq->strip->dir, sizeof(path)); - BLI_path_abs(path, G.main->name); + BLI_path_abs(path, bmain->name); RNA_string_set(op->ptr, identifier, path); } } @@ -173,8 +174,10 @@ static void sequencer_generic_invoke_xy__internal(bContext *C, wmOperator *op, i } } -static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) +static void seq_load_operator_info(SeqLoadInfo *seq_load, bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); + PropertyRNA *prop; const bool relative = (prop = RNA_struct_find_property(op->ptr, "relative_path")) && RNA_property_boolean_get(op->ptr, prop); int is_file = -1; @@ -196,7 +199,7 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) } if ((is_file != -1) && relative) - BLI_path_rel(seq_load->path, G.main->name); + BLI_path_rel(seq_load->path, bmain->name); if ((prop = RNA_struct_find_property(op->ptr, "frame_end"))) { @@ -545,7 +548,7 @@ static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoad SeqLoadInfo seq_load; int tot_files; - seq_load_operator_info(&seq_load, op); + seq_load_operator_info(&seq_load, C, op); if (seq_load.flag & SEQ_LOAD_REPLACE_SEL) ED_sequencer_deselect_all(scene); @@ -855,7 +858,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) StripElem *se; const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); - seq_load_operator_info(&seq_load, op); + seq_load_operator_info(&seq_load, C, op); /* images are unique in how they handle this - 1 per strip elem */ if (use_placeholders) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 0895d28fba7..a052b76e853 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -3885,13 +3885,14 @@ void SEQUENCER_OT_change_path(struct wmOperatorType *ot) static int sequencer_export_subtitles_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { + Main *bmain = CTX_data_main(C); if (!RNA_struct_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; - if (G.main->name[0] == 0) + if (bmain->name[0] == '\0') BLI_strncpy(filepath, "untitled", sizeof(filepath)); else - BLI_strncpy(filepath, G.main->name, sizeof(filepath)); + BLI_strncpy(filepath, bmain->name, sizeof(filepath)); BLI_replace_extension(filepath, sizeof(filepath), ".srt"); RNA_string_set(op->ptr, "filepath", filepath); |