diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-17 08:57:00 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-17 09:05:35 +0300 |
commit | 364d934951e3a46864d6478309345a3b10e67818 (patch) | |
tree | 6c14913aa482415a71926529ce3384b794cce8dc | |
parent | a1c6b73de7c93a5320b274f58e3e1a73e03e7389 (diff) |
Fix T45059: Image open /w relative paths & anim
- would hang on win32 (checking network share?)
- made the path absolute on all systems
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index b76cf4e61f4..72e3f21b1be 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1081,15 +1081,27 @@ static int image_open_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", path); - if (!IMB_isanim(path) && RNA_struct_property_is_set(op->ptr, "files") && - RNA_struct_property_is_set(op->ptr, "directory")) + if (RNA_struct_property_is_set(op->ptr, "directory") && + RNA_struct_property_is_set(op->ptr, "files")) { - ListBase frames; - - BLI_listbase_clear(&frames); - image_sequence_get_frames(op->ptr, &frames, path, sizeof(path)); - frame_seq_len = image_sequence_get_len(&frames, &frame_ofs); - BLI_freelistN(&frames); + /* only to pass to imbuf */ + char path_full[FILE_MAX]; + BLI_strncpy(path_full, path, sizeof(path_full)); + BLI_path_abs(path_full, G.main->name); + + if (!IMB_isanim(path_full)) { + bool was_relative = BLI_path_is_rel(path); + ListBase frames; + + BLI_listbase_clear(&frames); + image_sequence_get_frames(op->ptr, &frames, path, sizeof(path)); + frame_seq_len = image_sequence_get_len(&frames, &frame_ofs); + BLI_freelistN(&frames); + + if (was_relative) { + BLI_path_rel(path, G.main->name); + } + } } errno = 0; |