Fix T48916: Proxy Custom File is broken
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 9 Aug 2016 12:58:34 +0000 (14:58 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 9 Aug 2016 12:58:34 +0000 (14:58 +0200)
source/blender/blenkernel/intern/sequencer.c

index b2a19c590843ab599cf3fd55e6d00318cca41c7f..c240aa273433bad75f5cf6cee60497a8891115c4 100644 (file)
@@ -1656,6 +1656,9 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render
        else if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE)) {
                BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
        }
        else if ((proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR) && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE)) {
                BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
        }
+       else if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE) {
+               BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
+       }
        else if (sanim && sanim->anim && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR)) {
                char fname[FILE_MAXFILE];
                BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
        else if (sanim && sanim->anim && (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_DIR)) {
                char fname[FILE_MAXFILE];
                BLI_strncpy(dir, seq->strip->proxy->dir, sizeof(dir));
@@ -1675,13 +1678,21 @@ static bool seq_proxy_get_fname(Editing *ed, Sequence *seq, int cfra, int render
        if (view_id > 0)
                BLI_snprintf(suffix, sizeof(suffix), "_%d", view_id);
 
        if (view_id > 0)
                BLI_snprintf(suffix, sizeof(suffix), "_%d", view_id);
 
-       if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE && sanim && sanim->anim &&
+       if (proxy->storage & SEQ_STORAGE_PROXY_CUSTOM_FILE &&
            ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE)
        {
            ed->proxy_storage != SEQ_EDIT_PROXY_DIR_STORAGE)
        {
-               BLI_join_dirfile(name, PROXY_MAXFILE,
-                                dir, proxy->file);
-               BLI_path_abs(name, G.main->name);
-               BLI_snprintf(name, PROXY_MAXFILE, "%s_%s", name, suffix);
+               char fname[FILE_MAXFILE];
+               BLI_join_dirfile(fname, PROXY_MAXFILE, dir, proxy->file);
+               BLI_path_abs(fname, G.main->name);
+               if (suffix[0] != '\0') {
+                       /* TODO(sergey): This will actually append suffix after extension
+                        * which is weird but how was originally coded in multiview branch.
+                        */
+                       BLI_snprintf(name, PROXY_MAXFILE, "%s_%s", fname, suffix);
+               }
+               else {
+                       BLI_strncpy(name, fname, PROXY_MAXFILE);
+               }
 
                return true;
        }
 
                return true;
        }