diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_add.c | 3 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_sequencer.h | 1 | ||||
-rw-r--r-- | source/blender/sequencer/intern/sequencer.c | 15 |
3 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 7e76da0400c..ac31e0e7c37 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -1081,8 +1081,7 @@ static int sequencer_add_image_strip_invoke(bContext *C, sequencer_disable_one_time_properties(C, op); - const SequencerToolSettings *tool_settings = scene->toolsettings->sequencer_tool_settings; - RNA_enum_set(op->ptr, "fit_method", tool_settings->fit_method); + RNA_enum_set(op->ptr, "fit_method", SEQ_tool_settings_fit_method_get(scene)); /* Name set already by drag and drop. */ if (RNA_struct_property_is_set(op->ptr, "files") && RNA_collection_length(op->ptr, "files")) { diff --git a/source/blender/sequencer/SEQ_sequencer.h b/source/blender/sequencer/SEQ_sequencer.h index 4f49b8cb58f..63df886d31f 100644 --- a/source/blender/sequencer/SEQ_sequencer.h +++ b/source/blender/sequencer/SEQ_sequencer.h @@ -52,6 +52,7 @@ enum { #define SEQ_DUPE_IS_RECURSIVE_CALL (1 << 4) struct SequencerToolSettings *SEQ_tool_settings_init(void); +struct SequencerToolSettings *SEQ_tool_settings_ensure(struct Scene *scene); void SEQ_tool_settings_free(struct SequencerToolSettings *tool_settings); eSeqImageFitMethod SEQ_tool_settings_fit_method_get(struct Scene *scene); void SEQ_tool_settings_fit_method_set(struct Scene *scene, eSeqImageFitMethod fit_method); diff --git a/source/blender/sequencer/intern/sequencer.c b/source/blender/sequencer/intern/sequencer.c index 55c14944a23..4acb6a206be 100644 --- a/source/blender/sequencer/intern/sequencer.c +++ b/source/blender/sequencer/intern/sequencer.c @@ -313,6 +313,17 @@ SequencerToolSettings *SEQ_tool_settings_init(void) return tool_settings; } +SequencerToolSettings *SEQ_tool_settings_ensure(Scene *scene) +{ + SequencerToolSettings *tool_settings = scene->toolsettings->sequencer_tool_settings; + if (tool_settings == NULL) { + scene->toolsettings->sequencer_tool_settings = SEQ_tool_settings_init(); + tool_settings = scene->toolsettings->sequencer_tool_settings; + } + + return tool_settings; +} + void SEQ_tool_settings_free(SequencerToolSettings *tool_settings) { MEM_freeN(tool_settings); @@ -320,13 +331,13 @@ void SEQ_tool_settings_free(SequencerToolSettings *tool_settings) eSeqImageFitMethod SEQ_tool_settings_fit_method_get(Scene *scene) { - const SequencerToolSettings *tool_settings = scene->toolsettings->sequencer_tool_settings; + const SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene); return tool_settings->fit_method; } void SEQ_tool_settings_fit_method_set(Scene *scene, eSeqImageFitMethod fit_method) { - SequencerToolSettings *tool_settings = scene->toolsettings->sequencer_tool_settings; + SequencerToolSettings *tool_settings = SEQ_tool_settings_ensure(scene); tool_settings->fit_method = fit_method; } |