diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-18 12:44:55 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-01-18 12:44:55 +0400 |
commit | 6a5cdde89992b5872ae617231864768034121533 (patch) | |
tree | a28af64cdeb0bcfacf4db362f41f2e51256a4f70 | |
parent | ee0eb394c9c4cbe9466ac76a35431288e4f80aa9 (diff) |
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.
-rw-r--r-- | source/blender/editors/space_buttons/buttons_ops.c | 12 |
1 files changed, 10 insertions, 2 deletions
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 |