Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-02-22 22:37:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-22 22:39:34 +0300
commitadab35ba02476c9b3f77f31b2ac77ebd4c4fdbcf (patch)
tree938ebe52416d0bc67934d59f7322862f10989b49 /source/blender/editors/space_buttons
parent2a3bd4621b04c6ddb3883f72909ffcec8f788c35 (diff)
Fix T47529: Selecting paths makes them relative
When selecting file-paths from the interface, initialize the 'Relative' setting from existing paths.
Diffstat (limited to 'source/blender/editors/space_buttons')
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index c665a2e6cbe..fc1b6877f5e 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -219,17 +219,30 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
fbo->is_undo = is_undo;
op->customdata = fbo;
- RNA_string_set(op->ptr, path_prop, str);
- MEM_freeN(str);
-
/* normally ED_fileselect_get_params would handle this but we need to because of stupid
* user-prefs exception - campbell */
if ((prop_relpath = RNA_struct_find_property(op->ptr, "relative_path"))) {
if (!RNA_property_is_set(op->ptr, prop_relpath)) {
+ bool is_relative = (U.flag & USER_RELPATHS) != 0;
+
+ /* while we want to follow the defaults,
+ * we better not switch existing paths relative/absolute state. */
+ if (str[0]) {
+ is_relative = BLI_path_is_rel(str);
+ }
+
+ if (UNLIKELY(ptr.data == &U)) {
+ is_relative = false;
+ }
+
/* annoying exception!, if were dealing with the user prefs, default relative to be off */
- RNA_property_boolean_set(op->ptr, prop_relpath, U.flag & USER_RELPATHS && (ptr.data != &U));
+ RNA_property_boolean_set(op->ptr, prop_relpath, is_relative);
}
}
+
+ RNA_string_set(op->ptr, path_prop, str);
+ MEM_freeN(str);
+
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;