diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2014-02-25 04:06:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-25 04:09:08 +0400 |
commit | b6bb6d1b2c6f16c3c325242d15ef6d65d40f1a74 (patch) | |
tree | 9008ff011684a76663432831ef01eadd196fa896 /source/blender | |
parent | d0ec83c1a24f0cc64588741f7a4758b80af8296c (diff) |
Fix T38808: image opened with 'relative path', gets absolute path
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index bb7a9b9a4ba..de1dfff932e 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1025,6 +1025,7 @@ static int image_sequence_get_len(ListBase *frames, int *ofs) static int image_open_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); SpaceImage *sima = CTX_wm_space_image(C); /* XXX other space types can call */ Scene *scene = CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); @@ -1036,6 +1037,8 @@ static int image_open_exec(bContext *C, wmOperator *op) int frame_seq_len = 0; int frame_ofs = 1; + const bool is_relative_path = RNA_boolean_get(op->ptr, "relative_path"); + if (RNA_struct_property_is_set(op->ptr, "files") && RNA_struct_property_is_set(op->ptr, "directory")) { ListBase frames; @@ -1062,6 +1065,12 @@ static int image_open_exec(bContext *C, wmOperator *op) if (!op->customdata) image_open_init(C, op); + /* only image path after save, never ibuf */ + if (is_relative_path) { + const char *relbase = ID_BLEND_PATH(bmain, &ima->id); + BLI_path_rel(ima->name, relbase); + } + /* hook into UI */ iod = op->customdata; |