[Bf-blender-cvs] [f526f41] blender-v2.75-release: Fix T45059: Image open /w relative paths & anim

Campbell Barton noreply at git.blender.org
Thu Jun 18 17:37:39 CEST 2015


Commit: f526f410b29202c2994e99dc22266fc0f3fdc0db
Author: Campbell Barton
Date:   Wed Jun 17 15:57:00 2015 +1000
Branches: blender-v2.75-release
https://developer.blender.org/rBf526f410b29202c2994e99dc22266fc0f3fdc0db

Fix T45059: Image open /w relative paths & anim

- would hang on win32 (checking network share?)
- made the path absolute on all systems

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

M	source/blender/editors/space_image/image_ops.c

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

diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 7f0505a..8edfbc9 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1073,15 +1073,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;




More information about the Bf-blender-cvs mailing list