Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_sequencer/sequencer_add.c
| Show First 20 Lines • Show All 980 Lines • ▼ Show 20 Lines | static int sequencer_add_image_strip_calculate_length(wmOperator *op, | ||||
| const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); | const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); | ||||
| if (use_placeholders) { | if (use_placeholders) { | ||||
| return sequencer_image_seq_get_minmax_frame(op, start_frame, minframe, numdigits); | return sequencer_image_seq_get_minmax_frame(op, start_frame, minframe, numdigits); | ||||
| } | } | ||||
| return RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); | return RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files")); | ||||
| } | } | ||||
| static void sequencer_add_image_strip_load_files( | static void sequencer_add_image_strip_load_files(wmOperator *op, | ||||
| wmOperator *op, Sequence *seq, SeqLoadData *load_data, const int minframe, const int numdigits) | Scene *scene, | ||||
| Sequence *seq, | |||||
| SeqLoadData *load_data, | |||||
| const int minframe, | |||||
| const int numdigits) | |||||
| { | { | ||||
| const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); | const bool use_placeholders = RNA_boolean_get(op->ptr, "use_placeholders"); | ||||
| SEQ_add_image_set_directory(seq, load_data->path); | SEQ_add_image_set_directory(seq, load_data->path); | ||||
| if (use_placeholders) { | if (use_placeholders) { | ||||
| sequencer_image_seq_reserve_frames( | sequencer_image_seq_reserve_frames( | ||||
| op, seq->strip->stripdata, load_data->image.len, minframe, numdigits); | op, seq->strip->stripdata, load_data->image.len, minframe, numdigits); | ||||
| } | } | ||||
| else { | else { | ||||
| size_t strip_frame = 0; | size_t strip_frame = 0; | ||||
| RNA_BEGIN (op->ptr, itemptr, "files") { | RNA_BEGIN (op->ptr, itemptr, "files") { | ||||
| char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); | char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0); | ||||
| SEQ_add_image_load_file(seq, strip_frame, filename); | SEQ_add_image_load_file(scene, seq, strip_frame, filename); | ||||
| MEM_freeN(filename); | MEM_freeN(filename); | ||||
| strip_frame++; | strip_frame++; | ||||
| } | } | ||||
| RNA_END; | RNA_END; | ||||
| } | } | ||||
| } | } | ||||
| static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) | static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op) | ||||
| Show All 11 Lines | if (load_data.image.len == 0) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (RNA_boolean_get(op->ptr, "replace_sel")) { | if (RNA_boolean_get(op->ptr, "replace_sel")) { | ||||
| ED_sequencer_deselect_all(scene); | ED_sequencer_deselect_all(scene); | ||||
| } | } | ||||
| Sequence *seq = SEQ_add_image_strip(CTX_data_main(C), scene, ed->seqbasep, &load_data); | Sequence *seq = SEQ_add_image_strip(CTX_data_main(C), scene, ed->seqbasep, &load_data); | ||||
| sequencer_add_image_strip_load_files(op, seq, &load_data, minframe, numdigits); | sequencer_add_image_strip_load_files(op, scene, seq, &load_data, minframe, numdigits); | ||||
| SEQ_add_image_init_alpha_mode(seq); | SEQ_add_image_init_alpha_mode(seq); | ||||
| /* Adjust length. */ | /* Adjust length. */ | ||||
| if (load_data.image.len == 1) { | if (load_data.image.len == 1) { | ||||
| SEQ_transform_set_right_handle_frame(seq, load_data.image.end_frame); | SEQ_transform_set_right_handle_frame(scene, seq, load_data.image.end_frame); | ||||
| SEQ_time_update_sequence(scene, seq); | SEQ_time_update_sequence(scene, seq); | ||||
| } | } | ||||
| seq_load_apply_generic_options(C, op, seq); | seq_load_apply_generic_options(C, op, seq); | ||||
| DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); | DEG_id_tag_update(&scene->id, ID_RECALC_SEQUENCER_STRIPS); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); | ||||
| ▲ Show 20 Lines • Show All 182 Lines • Show Last 20 Lines | |||||