diff options
author | Ton Roosendaal <ton@blender.org> | 2007-06-25 17:01:46 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2007-06-25 17:01:46 +0400 |
commit | 9dd0c5abe59d69357ac91e52954db5d1db81ec44 (patch) | |
tree | e93532b845c91a4e6330cfa2a2a91bda7c582115 /source/blender | |
parent | b5fb85aede4538dd5d8d3e2473124626b30aa1ef (diff) |
Whoa, a new feature!
Sequence Editor: SHIFT+R, Remap Paths (also in pull down menu)
This allows to remap the root of a path to another directory.
Works on all selected Image strips. That way you can make absolute
paths relative, for example.
Example:
original path: /mnt/orange/finals/06_which_way/06_03b/
to be remapped: /mnt/orange/finals/
remap to: //
new path: //06_which_way/06_03b/
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/include/BIF_editseq.h | 1 | ||||
-rw-r--r-- | source/blender/src/editseq.c | 42 | ||||
-rw-r--r-- | source/blender/src/header_seq.c | 7 | ||||
-rw-r--r-- | source/blender/src/space.c | 5 | ||||
-rw-r--r-- | source/blender/src/toolbox.c | 9 |
5 files changed, 59 insertions, 5 deletions
diff --git a/source/blender/include/BIF_editseq.h b/source/blender/include/BIF_editseq.h index 3999b4311d4..5b7378b3f9c 100644 --- a/source/blender/include/BIF_editseq.h +++ b/source/blender/include/BIF_editseq.h @@ -58,6 +58,7 @@ void seq_snap_menu(void); void set_filter_seq(void); void swap_select_seq(void); void touch_seq_files(void); +void seq_remap_paths(void); void transform_seq(int mode, int context); void un_meta(void); void seq_cut(int cutframe); diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c index 1677fe49c59..968d1965ef4 100644 --- a/source/blender/src/editseq.c +++ b/source/blender/src/editseq.c @@ -1981,6 +1981,48 @@ void set_filter_seq(void) } +void seq_remap_paths(void) +{ + Sequence *seq, *last_seq = get_last_seq(); + Editing *ed; + char from[FILE_MAX], to[FILE_MAX], stripped[FILE_MAX]; + + ed= G.scene->ed; + if(ed==NULL || last_seq==NULL) + return; + + BLI_strncpy(from, last_seq->strip->dir, FILE_MAX); + if (0==sbutton(from, 0, sizeof(from)-1, "From: ")) + return; + + strcpy(to, from); + if (0==sbutton(to, 0, sizeof(to)-1, "To: ")) + return; + + if (strcmp(to, from)==0) + return; + + WHILE_SEQ(ed->seqbasep) { + if(seq->flag & SELECT) { + if(strncmp(seq->strip->dir, from, strlen(from))==0) { + printf("found %s\n", seq->strip->dir); + + /* strip off the beginning */ + stripped[0]= 0; + BLI_strncpy(stripped, seq->strip->dir + strlen(from), FILE_MAX); + + /* new path */ + BLI_strncpy(seq->strip->dir, to, FILE_MAX); + strcat(seq->strip->dir, stripped); + printf("new %s\n", seq->strip->dir); + } + } + } + END_SEQ + + BIF_undo_push("Remap paths in Sequencer"); + allqueue(REDRAWSEQ, 0); +} void no_gaps(void) diff --git a/source/blender/src/header_seq.c b/source/blender/src/header_seq.c index e3bffc550b5..566606c22d3 100644 --- a/source/blender/src/header_seq.c +++ b/source/blender/src/header_seq.c @@ -385,6 +385,9 @@ static void do_seq_editmenu(void *arg, int event) case 14: reassign_inputs_seq_effect(); break; + case 15: + seq_remap_paths(); + break; } } @@ -423,6 +426,10 @@ static uiBlock *seq_editmenu(void *arg_unused) } else if(last_seq->type == SEQ_IMAGE) uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Image...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); else uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Change Scene...|C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, ""); + + if(last_seq->type==SEQ_IMAGE) + uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Remap Paths...|Shift R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 15, ""); + } /* if (last_seq != NULL && last_seq->type == SEQ_MOVIE) { diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 31e890db01a..b8a1de717e8 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -4473,7 +4473,10 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt) } break; case RKEY: - reassign_inputs_seq_effect(); + if((G.qual==LR_SHIFTKEY)) + seq_remap_paths(); + else + reassign_inputs_seq_effect(); break; case SKEY: if((G.qual==LR_SHIFTKEY)) diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c index d888eb22667..05296ca70f2 100644 --- a/source/blender/src/toolbox.c +++ b/source/blender/src/toolbox.c @@ -305,7 +305,7 @@ short sbutton(char *var, float min, float max, char *str) getmouseco_sc(mval); - if(mval[0]<150) mval[0]=150; + if(mval[0]<250) mval[0]=250; if(mval[1]<30) mval[1]=30; if(mval[0]>G.curscreen->sizex) mval[0]= G.curscreen->sizex-10; if(mval[1]>G.curscreen->sizey) mval[1]= G.curscreen->sizey-10; @@ -313,11 +313,11 @@ short sbutton(char *var, float min, float max, char *str) block= uiNewBlock(&listb, "button", UI_EMBOSS, UI_HELV, G.curscreen->mainwin); uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_ENTER_OK); - x1=mval[0]-150; + x1=mval[0]-250; y1=mval[1]-20; - uiDefButC(block, TEX, 32766, str, x1+5,y1+10,125,20, var,(float)min,(float)max, 0, 0, ""); - uiDefBut(block, BUT, 32767, "OK", x1+136,y1+10,25,20, NULL, 0, 0, 0, 0, ""); + uiDefButC(block, TEX, 32766, str, x1+5,y1+10,225,20, var,(float)min,(float)max, 0, 0, ""); + uiDefBut(block, BUT, 32767, "OK", x1+236,y1+10,25,20, NULL, 0, 0, 0, 0, ""); uiBoundsBlock(block, 5); @@ -326,6 +326,7 @@ short sbutton(char *var, float min, float max, char *str) if(ret==UI_RETURN_OK) return 1; return 0; + } short fbutton(float *var, float min, float max, float a1, float a2, char *str) |