diff --git a/source/blender/editors/space_image/image_sequence.cc b/source/blender/editors/space_image/image_sequence.cc index 5ab31fa9e3d..19cc4588870 100644 --- a/source/blender/editors/space_image/image_sequence.cc +++ b/source/blender/editors/space_image/image_sequence.cc @@ -29,7 +29,7 @@ * * The output is a list of frame ranges, each containing a list of frames with matching names. */ -static void image_sequence_get_frame_ranges(wmOperator *op, ListBase *ranges) +static void image_sequence_get_frame_ranges(wmOperator *op, ListBase *ranges, bool *r_was_relative) { char dir[FILE_MAXDIR]; const bool do_frame_range = RNA_boolean_get(op->ptr, "use_sequence_detection"); @@ -75,6 +75,8 @@ static void image_sequence_get_frame_ranges(wmOperator *op, ListBase *ranges) MEM_freeN(filename); } RNA_END; + + *r_was_relative = BLI_path_is_rel(dir); } static int image_cmp_frame(const void *a, const void *b) @@ -143,16 +145,12 @@ ListBase ED_image_filesel_detect_sequences(blender::StringRefNull root_path, ListBase ranges; BLI_listbase_clear(&ranges); - char filepath[FILE_MAX]; - RNA_string_get(op->ptr, "filepath", filepath); - /* File browser. */ if (RNA_struct_property_is_set(op->ptr, "directory") && RNA_struct_property_is_set(op->ptr, "files")) { - const bool was_relative = BLI_path_is_rel(filepath); - - image_sequence_get_frame_ranges(op, &ranges); + bool was_relative = false; + image_sequence_get_frame_ranges(op, &ranges, &was_relative); LISTBASE_FOREACH (ImageFrameRange *, range, &ranges) { image_detect_frame_range(range, detect_udim); @@ -163,6 +161,9 @@ ListBase ED_image_filesel_detect_sequences(blender::StringRefNull root_path, } /* Filepath property for drag & drop etc. */ else { + char filepath[FILE_MAX]; + RNA_string_get(op->ptr, "filepath", filepath); + ImageFrameRange *range = MEM_callocN(__func__); BLI_addtail(&ranges, range);