Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/strip_add.c
| Show First 20 Lines • Show All 321 Lines • ▼ Show 20 Lines | Sequence *SEQ_add_image_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data) | ||||
| } | } | ||||
| /* Set initial scale based on load_data->fit_method. */ | /* Set initial scale based on load_data->fit_method. */ | ||||
| char file_path[FILE_MAX]; | char file_path[FILE_MAX]; | ||||
| BLI_join_dirfile(file_path, sizeof(file_path), load_data->path, load_data->name); | BLI_join_dirfile(file_path, sizeof(file_path), load_data->path, load_data->name); | ||||
| BLI_path_abs(file_path, BKE_main_blendfile_path(bmain)); | BLI_path_abs(file_path, BKE_main_blendfile_path(bmain)); | ||||
| ImBuf *ibuf = IMB_loadiffname(file_path, IB_rect, seq->strip->colorspace_settings.name); | ImBuf *ibuf = IMB_loadiffname(file_path, IB_rect, seq->strip->colorspace_settings.name); | ||||
| if (ibuf != NULL) { | if (ibuf != NULL) { | ||||
| strip->stripdata->orig_width = ibuf->x; | |||||
| strip->stripdata->orig_height = ibuf->y; | |||||
| SEQ_set_scale_to_fit( | SEQ_set_scale_to_fit( | ||||
| seq, ibuf->x, ibuf->y, scene->r.xsch, scene->r.ysch, load_data->fit_method); | seq, ibuf->x, ibuf->y, scene->r.xsch, scene->r.ysch, load_data->fit_method); | ||||
| IMB_freeImBuf(ibuf); | IMB_freeImBuf(ibuf); | ||||
| } | } | ||||
| /* Set Last active directory. */ | /* Set Last active directory. */ | ||||
| BLI_strncpy(scene->ed->act_imagedir, seq->strip->dir, sizeof(scene->ed->act_imagedir)); | BLI_strncpy(scene->ed->act_imagedir, seq->strip->dir, sizeof(scene->ed->act_imagedir)); | ||||
| seq_add_set_name(seq, load_data); | seq_add_set_name(seq, load_data); | ||||
| ▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | Sequence *SEQ_add_movie_strip(Main *bmain, Scene *scene, ListBase *seqbase, SeqLoadData *load_data) | ||||
| BLI_strncpy(path, load_data->path, sizeof(path)); | BLI_strncpy(path, load_data->path, sizeof(path)); | ||||
| BLI_path_abs(path, BKE_main_blendfile_path(bmain)); | BLI_path_abs(path, BKE_main_blendfile_path(bmain)); | ||||
| char colorspace[64] = "\0"; /* MAX_COLORSPACE_NAME */ | char colorspace[64] = "\0"; /* MAX_COLORSPACE_NAME */ | ||||
| bool is_multiview_loaded = false; | bool is_multiview_loaded = false; | ||||
| const int totfiles = seq_num_files(scene, load_data->views_format, load_data->use_multiview); | const int totfiles = seq_num_files(scene, load_data->views_format, load_data->use_multiview); | ||||
| struct anim **anim_arr = MEM_callocN(sizeof(struct anim *) * totfiles, "Video files"); | struct anim **anim_arr = MEM_callocN(sizeof(struct anim *) * totfiles, "Video files"); | ||||
| int i; | int i; | ||||
| float width; | |||||
| float height; | |||||
| if (load_data->use_multiview && (load_data->views_format == R_IMF_VIEWS_INDIVIDUAL)) { | if (load_data->use_multiview && (load_data->views_format == R_IMF_VIEWS_INDIVIDUAL)) { | ||||
| char prefix[FILE_MAX]; | char prefix[FILE_MAX]; | ||||
| const char *ext = NULL; | const char *ext = NULL; | ||||
| size_t j = 0; | size_t j = 0; | ||||
| BKE_scene_multiview_view_prefix_get(scene, path, prefix, &ext); | BKE_scene_multiview_view_prefix_get(scene, path, prefix, &ext); | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | if (anim_arr[0] != NULL) { | ||||
| IMB_anim_load_metadata(anim_arr[0]); | IMB_anim_load_metadata(anim_arr[0]); | ||||
| /* Adjust scene's frame rate settings to match. */ | /* Adjust scene's frame rate settings to match. */ | ||||
| if (load_data->flags & SEQ_LOAD_MOVIE_SYNC_FPS) { | if (load_data->flags & SEQ_LOAD_MOVIE_SYNC_FPS) { | ||||
| IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true); | IMB_anim_get_fps(anim_arr[0], &scene->r.frs_sec, &scene->r.frs_sec_base, true); | ||||
| } | } | ||||
| /* Set initial scale based on load_data->fit_method. */ | /* Set initial scale based on load_data->fit_method. */ | ||||
| const float width = IMB_anim_get_image_width(anim_arr[0]); | width = IMB_anim_get_image_width(anim_arr[0]); | ||||
| const float height = IMB_anim_get_image_height(anim_arr[0]); | height = IMB_anim_get_image_height(anim_arr[0]); | ||||
| SEQ_set_scale_to_fit(seq, width, height, scene->r.xsch, scene->r.ysch, load_data->fit_method); | SEQ_set_scale_to_fit(seq, width, height, scene->r.xsch, scene->r.ysch, load_data->fit_method); | ||||
| } | } | ||||
| seq->len = MAX2(1, seq->len); | seq->len = MAX2(1, seq->len); | ||||
| BLI_strncpy(seq->strip->colorspace_settings.name, | BLI_strncpy(seq->strip->colorspace_settings.name, | ||||
| colorspace, | colorspace, | ||||
| sizeof(seq->strip->colorspace_settings.name)); | sizeof(seq->strip->colorspace_settings.name)); | ||||
| Strip *strip = seq->strip; | Strip *strip = seq->strip; | ||||
| /* We only need 1 element for MOVIE strips. */ | /* We only need 1 element for MOVIE strips. */ | ||||
| StripElem *se; | StripElem *se; | ||||
| strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); | strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem"); | ||||
| strip->stripdata->orig_width = width; | |||||
| strip->stripdata->orig_height = height; | |||||
| BLI_split_dirfile(load_data->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); | BLI_split_dirfile(load_data->path, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name)); | ||||
| seq_add_set_name(seq, load_data); | seq_add_set_name(seq, load_data); | ||||
| seq_add_generic_update(scene, seqbase, seq); | seq_add_generic_update(scene, seqbase, seq); | ||||
| MEM_freeN(anim_arr); | MEM_freeN(anim_arr); | ||||
| return seq; | return seq; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 233 Lines • Show Last 20 Lines | |||||