[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11041] trunk/blender/source/blender: Whoa , a new feature!
Ton Roosendaal
ton at blender.org
Mon Jun 25 15:01:46 CEST 2007
Revision: 11041
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11041
Author: ton
Date: 2007-06-25 15:01:46 +0200 (Mon, 25 Jun 2007)
Log Message:
-----------
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/
Modified Paths:
--------------
trunk/blender/source/blender/include/BIF_editseq.h
trunk/blender/source/blender/src/editseq.c
trunk/blender/source/blender/src/header_seq.c
trunk/blender/source/blender/src/space.c
trunk/blender/source/blender/src/toolbox.c
Modified: trunk/blender/source/blender/include/BIF_editseq.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editseq.h 2007-06-25 11:07:12 UTC (rev 11040)
+++ trunk/blender/source/blender/include/BIF_editseq.h 2007-06-25 13:01:46 UTC (rev 11041)
@@ -58,6 +58,7 @@
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);
Modified: trunk/blender/source/blender/src/editseq.c
===================================================================
--- trunk/blender/source/blender/src/editseq.c 2007-06-25 11:07:12 UTC (rev 11040)
+++ trunk/blender/source/blender/src/editseq.c 2007-06-25 13:01:46 UTC (rev 11041)
@@ -1981,6 +1981,48 @@
}
+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)
Modified: trunk/blender/source/blender/src/header_seq.c
===================================================================
--- trunk/blender/source/blender/src/header_seq.c 2007-06-25 11:07:12 UTC (rev 11040)
+++ trunk/blender/source/blender/src/header_seq.c 2007-06-25 13:01:46 UTC (rev 11041)
@@ -385,6 +385,9 @@
case 14:
reassign_inputs_seq_effect();
break;
+ case 15:
+ seq_remap_paths();
+ break;
}
}
@@ -423,6 +426,10 @@
}
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) {
Modified: trunk/blender/source/blender/src/space.c
===================================================================
--- trunk/blender/source/blender/src/space.c 2007-06-25 11:07:12 UTC (rev 11040)
+++ trunk/blender/source/blender/src/space.c 2007-06-25 13:01:46 UTC (rev 11041)
@@ -4473,7 +4473,10 @@
}
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))
Modified: trunk/blender/source/blender/src/toolbox.c
===================================================================
--- trunk/blender/source/blender/src/toolbox.c 2007-06-25 11:07:12 UTC (rev 11040)
+++ trunk/blender/source/blender/src/toolbox.c 2007-06-25 13:01:46 UTC (rev 11041)
@@ -305,7 +305,7 @@
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 @@
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 @@
if(ret==UI_RETURN_OK) return 1;
return 0;
+
}
short fbutton(float *var, float min, float max, float a1, float a2, char *str)
More information about the Bf-blender-cvs
mailing list