diff options
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/buttons_scene.c | 56 | ||||
-rw-r--r-- | source/blender/src/sequence.c | 42 |
2 files changed, 88 insertions, 10 deletions
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 3036bb78da8..f99ac47b2c5 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -1174,7 +1174,7 @@ static void seq_panel_proxy() uiDefButBitI(block, TOG, SEQ_USE_PROXY, B_SEQ_BUT_RELOAD, "Use Proxy", - 10,140,120,19, &last_seq->flag, + 10,140,80,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Use a preview proxy for this strip"); @@ -1187,10 +1187,16 @@ static void seq_panel_proxy() uiDefButBitI(block, TOG, SEQ_USE_PROXY_CUSTOM_DIR, B_SEQ_BUT_RELOAD, "Custom Dir", - 130,140,120,19, &last_seq->flag, + 90,140,80,19, &last_seq->flag, 0.0, 21.0, 100, 0, "Use a custom directory to store data"); + uiDefButBitI(block, TOG, SEQ_USE_PROXY_CUSTOM_FILE, + B_SEQ_BUT_RELOAD, "Custom File", + 170,140,80,19, &last_seq->flag, + 0.0, 21.0, 100, 0, + "Use a custom file to load data from"); + if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR) { uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_DIR, ICON_FILESEL, 10, 120, 20, 20, 0, 0, 0, 0, 0, @@ -1202,30 +1208,41 @@ static void seq_panel_proxy() 30,120,220,20, last_seq->strip->proxy->dir, 0.0, 160.0, 100, 0, ""); } + if (last_seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + uiDefIconBut(block, BUT, B_SEQ_SEL_PROXY_FILE, + ICON_FILESEL, 10, 100, 20, 20, 0, 0, 0, + 0, 0, + "Select the custom proxy file " + "(used for all preview resolutions!)"); + + uiDefBut(block, TEX, + B_SEQ_BUT_RELOAD, "File: ", + 30,100,220,20, last_seq->strip->proxy->file, + 0.0, 160.0, 100, 0, ""); + } } if (last_seq->flag & SEQ_USE_PROXY) { if (G.scene->r.size == 100) { uiDefBut(block, LABEL, 0, "Full render size selected, ", - 10,100,240,19, 0, 0, 0, 0, 0, ""); + 10,60,240,19, 0, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, "so no proxy enabled!", - 10,80,240,19, 0, 0, 0, 0, 0, ""); + 10,40,240,19, 0, 0, 0, 0, 0, ""); } else if (last_seq->type != SEQ_MOVIE && last_seq->type != SEQ_IMAGE && !(last_seq->flag & SEQ_USE_PROXY_CUSTOM_DIR)) { uiDefBut(block, LABEL, 0, "Cannot proxy this strip without ", - 10,100,240,19, 0, 0, 0, 0, 0, ""); + 10,60,240,19, 0, 0, 0, 0, 0, ""); uiDefBut(block, LABEL, 0, "custom directory selection!", - 10,80,240,19, 0, 0, 0, 0, 0, ""); - - } else { + 10,40,240,19, 0, 0, 0, 0, 0, ""); + } else if (!(last_seq->flag & SEQ_USE_PROXY_CUSTOM_FILE)) { uiDefBut(block, BUT, B_SEQ_BUT_REBUILD_PROXY, "Rebuild proxy", - 10,100,240,19, 0, 0, 0, 0, 0, + 10,60,240,19, 0, 0, 0, 0, 0, "Rebuild proxy for the " "currently selected strip."); } @@ -1294,7 +1311,19 @@ static void sel_proxy_dir(char *name) allqueue(REDRAWBUTSSCENE, 0); - BIF_undo_push("Change proxy directory"); + BIF_undo_push("Change custom proxy directory"); +} + +static void sel_proxy_file(char *name) +{ + Sequence *last_seq = get_last_seq(); + + BLI_split_dirfile_basic(name, last_seq->strip->proxy->dir, + last_seq->strip->proxy->file); + + allqueue(REDRAWBUTSSCENE, 0); + + BIF_undo_push("Change custom proxy file"); } void do_sequencer_panels(unsigned short event) @@ -1324,6 +1353,13 @@ void do_sequencer_panels(unsigned short event) last_seq->strip->proxy->dir, sel_proxy_dir); break; + case B_SEQ_SEL_PROXY_FILE: + sa= closest_bigger_area(); + areawinset(sa->win); + activate_fileselect(FILE_SPECIAL, "SELECT PROXY FILE", + last_seq->strip->proxy->dir, + sel_proxy_file); + break; case B_SEQ_BUT_RELOAD: case B_SEQ_BUT_RELOAD_ALL: update_seq_ipo_rect(last_seq); diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index edc68d016a1..d94f30a2bdb 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -106,6 +106,14 @@ void free_tstripdata(int len, TStripElem *se) } +static void free_proxy_seq(Sequence *seq) +{ + if (seq->strip && seq->strip->proxy && seq->strip->proxy->anim) { + IMB_free_anim(seq->strip->proxy->anim); + seq->strip->proxy->anim = 0; + } +} + void free_strip(Strip *strip) { strip->us--; @@ -120,6 +128,10 @@ void free_strip(Strip *strip) } if (strip->proxy) { + if (strip->proxy->anim) { + IMB_free_anim(strip->proxy->anim); + } + MEM_freeN(strip->proxy); } if (strip->crop) { @@ -517,6 +529,8 @@ void reload_sequence_new_file(Sequence * seq) seq->strip->len = seq->len; } + free_proxy_seq(seq); + calc_sequence(seq); } @@ -1053,6 +1067,12 @@ static int seq_proxy_get_fname(Sequence * seq, int cfra, char * name) } } + if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + snprintf(name, PROXY_MAXFILE, "%s/%s", + dir, seq->strip->proxy->file); + return TRUE; + } + /* generate a seperate proxy directory for each preview size */ if (seq->type == SEQ_IMAGE) { @@ -1099,6 +1119,20 @@ static struct ImBuf * seq_proxy_fetch(Sequence * seq, int cfra) return 0; } + if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + if (!seq->strip->proxy->anim) { + if (!seq_proxy_get_fname(seq, cfra, name)) { + return 0; + } + + seq->strip->proxy->anim = openanim(name, IB_rect); + } + if (!seq->strip->proxy->anim) { + return 0; + } + return IMB_anim_absolute(seq->strip->proxy->anim, cfra); + } + if (!seq_proxy_get_fname(seq, cfra, name)) { return 0; } @@ -1131,6 +1165,11 @@ static void seq_proxy_build_frame(Sequence * seq, int cfra) return; } + /* that's why it is called custom... */ + if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) { + return; + } + if (!seq_proxy_get_fname(seq, cfra, name)) { return; } @@ -2866,6 +2905,7 @@ void free_imbuf_seq_except(int cfra) if(seq->type==SEQ_MOVIE) if(seq->startdisp > cfra || seq->enddisp < cfra) free_anim_seq(seq); + free_proxy_seq(seq); } } END_SEQ @@ -2909,6 +2949,7 @@ void free_imbuf_seq() if(seq->type==SEQ_SPEED) { sequence_effect_speed_rebuild_map(seq, 1); } + free_proxy_seq(seq); } } END_SEQ @@ -2974,6 +3015,7 @@ static int update_changed_seq_recurs(Sequence *seq, Sequence *changed_seq, int l if(seq->type == SEQ_SPEED) { sequence_effect_speed_rebuild_map(seq, 1); } + free_proxy_seq(seq); } if(len_change) |