From 6a5cdde89992b5872ae617231864768034121533 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 18 Jan 2013 08:44:55 +0000 Subject: Fix #33913: Unable to set sequencer proxy custom directory as relative path Added absolute->relative conversion for directory in file_browse_exec. This is how other places deals with this, but perhaps we'd better change file selection so both filepath and directory are affected by relative option. --- source/blender/editors/space_buttons/buttons_ops.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index d40426a5bc9..54261974993 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -112,14 +112,22 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* add slash for directories, important for some properties */ if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { char name[FILE_MAX]; - + int is_relative = RNA_boolean_get(op->ptr, "relative_path"); id = fbo->ptr.id.data; BLI_strncpy(path, str, FILE_MAX); BLI_path_abs(path, id ? ID_BLEND_PATH(G.main, id) : G.main->name); if (BLI_is_dir(path)) { - str = MEM_reallocN(str, strlen(str) + 2); + if (is_relative) { + BLI_strncpy(path, str, FILE_MAX); + BLI_path_rel(path, G.main->name); + str = MEM_reallocN(str, strlen(path) + 2); + BLI_strncpy(str, path, FILE_MAX); + } + else { + str = MEM_reallocN(str, strlen(str) + 2); + } BLI_add_slash(str); } else -- cgit v1.2.3