Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/sequencer.c
| Show First 20 Lines • Show All 307 Lines • ▼ Show 20 Lines | |||||
| SequencerToolSettings *SEQ_tool_settings_init(void) | SequencerToolSettings *SEQ_tool_settings_init(void) | ||||
| { | { | ||||
| SequencerToolSettings *tool_settings = MEM_callocN(sizeof(SequencerToolSettings), | SequencerToolSettings *tool_settings = MEM_callocN(sizeof(SequencerToolSettings), | ||||
| "Sequencer tool settings"); | "Sequencer tool settings"); | ||||
| tool_settings->fit_method = SEQ_SCALE_TO_FIT; | tool_settings->fit_method = SEQ_SCALE_TO_FIT; | ||||
| return tool_settings; | return tool_settings; | ||||
| } | } | ||||
| SequencerToolSettings *SEQ_tool_settings_get(Scene *scene) | |||||
campbellbarton: Prefer name `SEQ_tool_settings_ensure` for functions that create new data when it doesn't exist. | |||||
| { | |||||
| SequencerToolSettings *tool_settings = scene->toolsettings->sequencer_tool_settings; | |||||
| if (tool_settings == NULL) { | |||||
| tool_settings = SEQ_tool_settings_init(); | |||||
| } | |||||
| return tool_settings; | |||||
| } | |||||
| void SEQ_tool_settings_free(SequencerToolSettings *tool_settings) | void SEQ_tool_settings_free(SequencerToolSettings *tool_settings) | ||||
| { | { | ||||
| MEM_freeN(tool_settings); | MEM_freeN(tool_settings); | ||||
| } | } | ||||
| eSeqImageFitMethod SEQ_tool_settings_fit_method_get(Scene *scene) | 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_get(scene); | ||||
| return tool_settings->fit_method; | return tool_settings->fit_method; | ||||
| } | } | ||||
| void SEQ_tool_settings_fit_method_set(Scene *scene, eSeqImageFitMethod 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_get(scene); | ||||
| tool_settings->fit_method = fit_method; | tool_settings->fit_method = fit_method; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get seqbase that is being viewed currently. This can be main seqbase or meta strip seqbase | * Get seqbase that is being viewed currently. This can be main seqbase or meta strip seqbase | ||||
| * | * | ||||
| * \param ed: sequence editor data | * \param ed: sequence editor data | ||||
| * \return pointer to active seqbase. returns NULL if ed is NULL | * \return pointer to active seqbase. returns NULL if ed is NULL | ||||
| ▲ Show 20 Lines • Show All 377 Lines • Show Last 20 Lines | |||||
Prefer name SEQ_tool_settings_ensure for functions that create new data when it doesn't exist. Otherwise it's not obvious why using _get is any better than direct pointer access.
Other examples include WM_keymap_ensure, BKE_mesh_runtime_looptri_ensure, BKE_mesh_texspace_ensure.