Whoa, a new feature!
authorTon Roosendaal <ton@blender.org>
Mon, 25 Jun 2007 13:01:46 +0000 (13:01 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 25 Jun 2007 13:01:46 +0000 (13:01 +0000)
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/

source/blender/include/BIF_editseq.h
source/blender/src/editseq.c
source/blender/src/header_seq.c
source/blender/src/space.c
source/blender/src/toolbox.c

index 3999b4311d4389e8abb9f8ef1f58d6f59e44f776..5b7378b3f9c31bb531227ff614dcb9b003d65b2f 100644 (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);
index 1677fe49c59faf2be986c41ad2f4ae0ae4628817..968d1965ef479db6b543e9574870479ea60e0885 100644 (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)
index e3bffc550b5c7dbe1533977c9d47a0a1967097cb..566606c22d38d1ee21beb4af0bafbad72cb829a5 100644 (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) {
index 31e890db01af56847bc0a71c76c08aebe1636b50..b8a1de717e8f911287845ad8d4e63ac79dfe0a26 100644 (file)
@@ -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))
index d888eb22667c24b7950062f7e6174bf9b9aceba3..05296ca70f257d7201b9f97b03592c010197e154 100644 (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)