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/
This commit is contained in:
2007-06-25 13:01:46 +00:00
parent b5fb85aede
commit 9dd0c5abe5
5 changed files with 59 additions and 5 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -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) {

View File

@@ -4473,6 +4473,9 @@ static void winqreadseqspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
break;
case RKEY:
if((G.qual==LR_SHIFTKEY))
seq_remap_paths();
else
reassign_inputs_seq_effect();
break;
case SKEY:

View File

@@ -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)