Changeset View
Standalone View
source/blender/editors/space_sequencer/sequencer_edit.c
| Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | for (link = pj->queue.first; link; link = link->next) { | ||||
| BKE_sequencer_proxy_rebuild_finish(link->data, pj->stop); | BKE_sequencer_proxy_rebuild_finish(link->data, pj->stop); | ||||
| } | } | ||||
| BKE_sequencer_free_imbuf(pj->scene, &ed->seqbase, false); | BKE_sequencer_free_imbuf(pj->scene, &ed->seqbase, false); | ||||
| WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene); | WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, pj->scene); | ||||
| } | } | ||||
| static void seq_proxy_build_job(const bContext *C, ReportList *reports) | static void seq_proxy_build_job(const bContext *C, ReportList *reports) | ||||
ISS: parameter `op` is unused, forgot to mention last time. | |||||
| { | { | ||||
| wmJob *wm_job; | wmJob *wm_job; | ||||
| ProxyJob *pj; | ProxyJob *pj; | ||||
| struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | struct Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = BKE_sequencer_editing_get(scene, false); | Editing *ed = BKE_sequencer_editing_get(scene, false); | ||||
| ScrArea *area = CTX_wm_area(C); | ScrArea *area = CTX_wm_area(C); | ||||
| Sequence *seq; | Sequence *seq; | ||||
| GSet *file_list; | GSet *file_list; | ||||
| if (ed == NULL) { | if (ed == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| wm_job = WM_jobs_get(CTX_wm_manager(C), | wm_job = WM_jobs_get(CTX_wm_manager(C), | ||||
| CTX_wm_window(C), | CTX_wm_window(C), | ||||
| scene, | scene, | ||||
| "Building Proxies", | "Building Proxies", | ||||
| WM_JOB_PROGRESS, | WM_JOB_PROGRESS, | ||||
| WM_JOB_TYPE_SEQ_BUILD_PROXY); | WM_JOB_TYPE_SEQ_BUILD_PROXY); | ||||
| pj = WM_jobs_customdata_get(wm_job); | pj = WM_jobs_customdata_get(wm_job); | ||||
| if (!pj) { | if (!pj) { | ||||
| pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job"); | pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job"); | ||||
| pj->depsgraph = depsgraph; | pj->depsgraph = depsgraph; | ||||
| pj->scene = scene; | pj->scene = scene; | ||||
Not Done Inline ActionsThere is already a loop that goes through all strips, so don't iterate twice. ISS: There is already a loop that goes through all strips, so don't iterate twice. | |||||
| pj->main = CTX_data_main(C); | pj->main = CTX_data_main(C); | ||||
| WM_jobs_customdata_set(wm_job, pj, proxy_freejob); | WM_jobs_customdata_set(wm_job, pj, proxy_freejob); | ||||
| WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER); | WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER); | ||||
| WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob); | WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob); | ||||
| } | } | ||||
| file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); | file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); | ||||
| bool selected = false; /* Check for no selected strips */ | |||||
| SEQP_BEGIN (ed, seq) { | SEQP_BEGIN (ed, seq) { | ||||
| if ((seq->flag & SELECT)) { | if (!ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META) || | ||||
| (seq->flag & SELECT) == 0) { | |||||
| continue; | |||||
| } | |||||
| selected = true; | |||||
| if (!(seq->flag & SEQ_USE_PROXY)) { | |||||
| BKE_reportf(reports, RPT_WARNING, "Proxy is not enabled for %s, skipping.", seq->name); | |||||
| } | |||||
| else if (seq->strip->proxy->build_size_flags == 0) { | |||||
| BKE_reportf(reports, RPT_WARNING, "Resolution is not selected for %s, skipping.", seq->name); | |||||
Not Done Inline ActionsI am not sure if this is useful to check. This should definitely not throw error. Personally RPT_INFO would be appropriate with message Proxy is not enabled for %s, skipping. ISS: I am not sure if this is useful to check. This should definitely not throw error. Personally… | |||||
| } | |||||
| bool success = BKE_sequencer_proxy_rebuild_context( | bool success = BKE_sequencer_proxy_rebuild_context( | ||||
| pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue); | pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue); | ||||
| if (!success) { | |||||
| BKE_reportf(reports, RPT_ERROR, "Could not build proxy for strip %s", seq->name); | if (!success && (seq->strip->proxy->build_flags & SEQ_PROXY_SKIP_EXISTING) != 0) { | ||||
| } | BKE_reportf(reports, RPT_WARNING, "Overwrite is not checked for %s, skipping.", seq->name); | ||||
Not Done Inline ActionsYou can only do this check if success is false. bool success = BKE_sequencer_proxy_rebuild_context(
pj->main, pj->depsgraph, pj->scene, seq, file_list, &pj->queue);
if (!success) {
if ((seq->strip->proxy->build_flags & SEQ_PROXY_SKIP_EXISTING) != 0) {
BKE_reportf(reports, RPT_WARNING, "Overwrite is not checked for %s", seq->name);
}
else { /* Unknown error */
BKE_reportf(reports, RPT_ERROR, "Could not build proxy for %s", seq->name);
}
}ISS: You can only do this check if `success` is false.
```
bool success =… | |||||
| } | } | ||||
Not Done Inline ActionsThis check should not be necessary, because it is checked in BKE_sequencer_proxy_rebuild_context and if strip hasn't got this member initialized, it will return success = true Therefore even else {...} branch will never be executed and should be removed. ISS: This check should not be necessary, because it is checked in… | |||||
| } | } | ||||
| SEQ_END; | SEQ_END; | ||||
| if (!selected) { | |||||
| BKE_reportf(reports, RPT_WARNING, "Select movie or image strips."); | |||||
Not Done Inline ActionsThis flag is set in build_flags not build_size_flags ISS: This flag is set in `build_flags` not `build_size_flags` | |||||
| return; | |||||
| } | |||||
| BLI_gset_free(file_list, MEM_freeN); | BLI_gset_free(file_list, MEM_freeN); | ||||
Not Done Inline ActionsThis can generate too much noise if you select all strips and rebuild proxies. What I was suggesting was to only run WM_jobs_start(CTX_wm_manager(C), wm_job); if there is at least 1 valid strip in selection. You could throw this error in case there isn't. ISS: This can generate too much noise if you select all strips and rebuild proxies.
What I was… | |||||
| if (!WM_jobs_is_running(wm_job)) { | if (selected && !WM_jobs_is_running(wm_job)) { | ||||
Not Done Inline ActionsThis condition is incorrect. it should be if (!overwrite) ISS: This condition is incorrect. it should be `if (!overwrite)` | |||||
| G.is_break = false; | G.is_break = false; | ||||
| WM_jobs_start(CTX_wm_manager(C), wm_job); | WM_jobs_start(CTX_wm_manager(C), wm_job); | ||||
| } | } | ||||
| ED_area_tag_redraw(area); | ED_area_tag_redraw(area); | ||||
| } | } | ||||
| /* ********************************************************************** */ | /* ********************************************************************** */ | ||||
| ▲ Show 20 Lines • Show All 3,440 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) | static int sequencer_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| Editing *ed = BKE_sequencer_editing_get(scene, false); | Editing *ed = BKE_sequencer_editing_get(scene, false); | ||||
| Sequence *seq; | Sequence *seq; | ||||
Not Done Inline Actionsparameter op is unused, forgot to mention last time. ISS: parameter `op` is unused, forgot to mention last time. | |||||
| GSet *file_list; | GSet *file_list; | ||||
| if (ed == NULL) { | if (ed == NULL) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); | file_list = BLI_gset_new(BLI_ghashutil_strhash_p, BLI_ghashutil_strcmp, "file list"); | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | static int sequencer_enable_proxies_exec(bContext *C, wmOperator *op) | ||||
| bool turnon = true; | bool turnon = true; | ||||
| if (ed == NULL || !(proxy_25 || proxy_50 || proxy_75 || proxy_100)) { | if (ed == NULL || !(proxy_25 || proxy_50 || proxy_75 || proxy_100)) { | ||||
| turnon = false; | turnon = false; | ||||
| } | } | ||||
| SEQP_BEGIN (ed, seq) { | SEQP_BEGIN (ed, seq) { | ||||
| if ((seq->flag & SELECT)) { | if ((seq->flag & SELECT)) { | ||||
| if (ELEM(seq->type, | if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_META)) { | ||||
| SEQ_TYPE_MOVIE, | |||||
| SEQ_TYPE_IMAGE, | |||||
| SEQ_TYPE_META, | |||||
| SEQ_TYPE_SCENE, | |||||
| SEQ_TYPE_MULTICAM)) { | |||||
| BKE_sequencer_proxy_set(seq, turnon); | BKE_sequencer_proxy_set(seq, turnon); | ||||
| if (seq->strip->proxy == NULL) { | if (seq->strip->proxy == NULL) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (proxy_25) { | if (proxy_25) { | ||||
| seq->strip->proxy->build_size_flags |= SEQ_PROXY_IMAGE_SIZE_25; | seq->strip->proxy->build_size_flags |= SEQ_PROXY_IMAGE_SIZE_25; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 536 Lines • Show Last 20 Lines | |||||
parameter op is unused, forgot to mention last time.