Revision: 20380
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20380
Author:   schlaile
Date:     2009-05-24 15:41:37 +0200 (Sun, 24 May 2009)

Log Message:
-----------
== Sequencer ==

This adds custom proxy file storage to the sequencer.
Reasoning: sometimes low resolution versions are already available as a
seperate file built by the capture application.
So there is no real reason to make blender build it's own seperate proxy.

This also somewhat fixes (aehm works around :) )
[#13632] Creating Proxy Takes Over Process, Should be Background

Since now you can just fire up ffmpeg to build your proxies in the background.
(You could have done before and build a directory of jpeg files, but then you
would have to rename all the files since otherwise things are off by one...)

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/include/butspace.h
    trunk/blender/source/blender/makesdna/DNA_sequence_types.h
    trunk/blender/source/blender/src/buttons_scene.c
    trunk/blender/source/blender/src/sequence.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c   2009-05-24 
13:29:29 UTC (rev 20379)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c   2009-05-24 
13:41:37 UTC (rev 20380)
@@ -3689,6 +3689,7 @@
                                if (seq->flag & SEQ_USE_PROXY) {
                                        seq->strip->proxy = newdataadr(
                                                fd, seq->strip->proxy);
+                                       seq->strip->proxy->anim = 0;
                                } else {
                                        seq->strip->proxy = 0;
                                }

Modified: trunk/blender/source/blender/include/butspace.h
===================================================================
--- trunk/blender/source/blender/include/butspace.h     2009-05-24 13:29:29 UTC 
(rev 20379)
+++ trunk/blender/source/blender/include/butspace.h     2009-05-24 13:41:37 UTC 
(rev 20380)
@@ -318,7 +318,7 @@
 
 /* *********************** */
 #define B_RENDERBUTS   1690
-#define B_SEQUENCERBUTS 1699
+#define B_SEQUENCERBUTS 1700
 
 #define B_FS_PIC               1601
 #define B_FS_BACKBUF   1602
@@ -377,6 +377,7 @@
 #define B_SEQ_BUT_RELOAD_FILE   1696
 #define B_SEQ_BUT_REBUILD_PROXY 1697
 #define B_SEQ_SEL_PROXY_DIR     1698
+#define B_SEQ_SEL_PROXY_FILE    1699
 /* *********************** */
 #define B_ARMATUREBUTS         1800
 #define        B_POSE                  1701

Modified: trunk/blender/source/blender/makesdna/DNA_sequence_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_sequence_types.h  2009-05-24 
13:29:29 UTC (rev 20379)
+++ trunk/blender/source/blender/makesdna/DNA_sequence_types.h  2009-05-24 
13:41:37 UTC (rev 20380)
@@ -78,6 +78,8 @@
 
 typedef struct StripProxy {
        char dir[160];
+       char file[80];
+       struct anim *anim;
 } StripProxy;
 
 typedef struct Strip {
@@ -258,6 +260,7 @@
 #define SEQ_USE_COLOR_BALANCE                  262144
 #define SEQ_USE_PROXY_CUSTOM_DIR               524288
 #define SEQ_ACTIVE                            1048576
+#define SEQ_USE_PROXY_CUSTOM_FILE             2097152
 
 #define SEQ_COLOR_BALANCE_INVERSE_GAIN 1
 #define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2

Modified: trunk/blender/source/blender/src/buttons_scene.c
===================================================================
--- trunk/blender/source/blender/src/buttons_scene.c    2009-05-24 13:29:29 UTC 
(rev 20379)
+++ trunk/blender/source/blender/src/buttons_scene.c    2009-05-24 13:41:37 UTC 
(rev 20380)
@@ -1174,7 +1174,7 @@
 
        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 @@
 
                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 @@
                                 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,9 +1311,21 @@
 
        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)
 {
        Sequence *last_seq = get_last_seq();
@@ -1324,6 +1353,13 @@
                                    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);

Modified: trunk/blender/source/blender/src/sequence.c
===================================================================
--- trunk/blender/source/blender/src/sequence.c 2009-05-24 13:29:29 UTC (rev 
20379)
+++ trunk/blender/source/blender/src/sequence.c 2009-05-24 13:41:37 UTC (rev 
20380)
@@ -106,6 +106,14 @@
 
 }
 
+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 @@
        }
 
        if (strip->proxy) {
+               if (strip->proxy->anim) {
+                       IMB_free_anim(strip->proxy->anim);
+               }
+
                MEM_freeN(strip->proxy);
        }
        if (strip->crop) {
@@ -517,6 +529,8 @@
                seq->strip->len = seq->len;
        }
 
+       free_proxy_seq(seq);
+
        calc_sequence(seq);
 }
 
@@ -1053,6 +1067,12 @@
                }
        }
 
+       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 @@
                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 @@
                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 @@
                        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 @@
                        if(seq->type==SEQ_SPEED) {
                                sequence_effect_speed_rebuild_map(seq, 1);
                        }
+                       free_proxy_seq(seq);
                }
        }
        END_SEQ
@@ -2974,6 +3015,7 @@
                        if(seq->type == SEQ_SPEED) {
                                sequence_effect_speed_rebuild_map(seq, 1);
                        }
+                       free_proxy_seq(seq);
                }
 
                if(len_change)


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to