From 7d67113a8ae9af1d8711bca9f2eb125d76495354 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 Oct 2025 15:23:53 +1000 Subject: [PATCH] Fix: failure to set relative paths when adding an image strip Calling SEQUENCER_OT_image_strip_add from Python attempted to read a non-existent property "filepath" to check if the path was relative. Use the "directory" for this instead. The error occurred with the test file from #146433. Ref !147100 --- .../blender/editors/space_image/image_sequence.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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);