Commit: f16fcb5bd5ecfc6ef80b537b77b9a7dd99d9ecf8
Author: Brecht Van Lommel
Date:   Sun Apr 12 02:37:31 2020 +0200
Branches: master
https://developer.blender.org/rBf16fcb5bd5ecfc6ef80b537b77b9a7dd99d9ecf8

Fix volume object not loading frame sequences correct in some cases

Ensure we use the first frame as filepath so we can compute the number of
leading zeros. For file validation, always test the first frame rather than
the current scene frame.

===================================================================

M       source/blender/editors/object/object_volume.c
M       source/blender/editors/space_image/image_sequence.c

===================================================================

diff --git a/source/blender/editors/object/object_volume.c 
b/source/blender/editors/object/object_volume.c
index bb619972e80..b7da91b70ba 100644
--- a/source/blender/editors/object/object_volume.c
+++ b/source/blender/editors/object/object_volume.c
@@ -109,11 +109,6 @@ static int volume_import_exec(bContext *C, wmOperator *op)
       BLI_path_rel(volume->filepath, BKE_main_blendfile_path(bmain));
     }
 
-    volume->is_sequence = (range->length > 1);
-    volume->frame_duration = (volume->is_sequence) ? range->length : 0;
-    volume->frame_start = 1;
-    volume->frame_offset = (volume->is_sequence) ? range->offset - 1 : 0;
-
     if (!BKE_volume_load(volume, bmain)) {
       BKE_reportf(op->reports,
                   RPT_WARNING,
@@ -134,6 +129,13 @@ static int volume_import_exec(bContext *C, wmOperator *op)
       continue;
     }
 
+    /* Set sequence parameters after trying to load the first frame, for file 
validation we want
+     * to use a consistent frame rather than whatever corresponds to the 
current scene frame. */
+    volume->is_sequence = (range->length > 1);
+    volume->frame_duration = (volume->is_sequence) ? range->length : 0;
+    volume->frame_start = 1;
+    volume->frame_offset = (volume->is_sequence) ? range->offset - 1 : 0;
+
     if (BKE_volume_is_y_up(volume)) {
       object->rot[0] += M_PI_2;
     }
diff --git a/source/blender/editors/space_image/image_sequence.c 
b/source/blender/editors/space_image/image_sequence.c
index e65924d0eb9..0817bdda88d 100644
--- a/source/blender/editors/space_image/image_sequence.c
+++ b/source/blender/editors/space_image/image_sequence.c
@@ -64,6 +64,7 @@ static void image_sequence_get_frame_ranges(wmOperator *op, 
ListBase *ranges)
   char dir[FILE_MAXDIR];
   const bool do_frame_range = RNA_boolean_get(op->ptr, 
"use_sequence_detection");
   ImageFrameRange *range = NULL;
+  int range_first_frame = 0;
 
   RNA_string_get(op->ptr, "directory", dir);
   RNA_BEGIN (op->ptr, itemptr, "files") {
@@ -79,7 +80,11 @@ static void image_sequence_get_frame_ranges(wmOperator *op, 
ListBase *ranges)
     /* still in the same sequence */
     if (do_frame_range && (range != NULL) && (STREQLEN(base_head, head, 
FILE_MAX)) &&
         (STREQLEN(base_tail, tail, FILE_MAX))) {
-      /* pass */
+      /* Set filepath to first frame in the range. */
+      if (frame->framenr < range_first_frame) {
+        BLI_join_dirfile(range->filepath, sizeof(range->filepath), dir, 
filename);
+        range_first_frame = frame->framenr;
+      }
     }
     else {
       /* start a new frame range */
@@ -89,6 +94,8 @@ static void image_sequence_get_frame_ranges(wmOperator *op, 
ListBase *ranges)
 
       BLI_strncpy(base_head, head, sizeof(base_head));
       BLI_strncpy(base_tail, tail, sizeof(base_tail));
+
+      range_first_frame = frame->framenr;
     }
 
     BLI_addtail(&range->frames, frame);

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

Reply via email to