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:
Diffstat (limited to 'source/blender/editors/space_buttons/buttons_ops.c')
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index c1803dde805..b7c9bdde0e8 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -36,9 +36,11 @@
#include "BLI_path_util.h"
#include "BLI_storage.h"
#include "BLI_string.h"
+#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_main.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -53,7 +55,7 @@
/********************** toolbox operator *********************/
-static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
{
bScreen *sc= CTX_wm_screen(C);
SpaceButs *sbuts= CTX_wm_space_buts(C);
@@ -63,7 +65,7 @@ static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_pointer_create(&sc->id, &RNA_SpaceProperties, sbuts, &ptr);
- pup= uiPupMenuBegin(C, "Align", 0);
+ pup= uiPupMenuBegin(C, "Align", ICON_NULL);
layout= uiPupMenuLayout(pup);
uiItemsEnumR(layout, &ptr, "align");
uiPupMenuEnd(C, pup);
@@ -103,16 +105,20 @@ 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];
+
id = fbo->ptr.id.data;
- base = (id && id->lib)? id->lib->filepath: G.sce;
+ base = (id && id->lib)? id->lib->filepath: G.main->name;
BLI_strncpy(path, str, FILE_MAX);
BLI_path_abs(path, base);
-
+
if(BLI_is_dir(path)) {
str = MEM_reallocN(str, strlen(str)+2);
BLI_add_slash(str);
}
+ else
+ BLI_splitdirstring(str, name);
}
RNA_property_string_set(&fbo->ptr, fbo->prop, str);
@@ -123,7 +129,7 @@ static int file_browse_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static int file_browse_cancel(bContext *C, wmOperator *op)
+static int file_browse_cancel(bContext *UNUSED(C), wmOperator *op)
{
MEM_freeN(op->customdata);
op->customdata= NULL;
@@ -174,10 +180,12 @@ static int file_browse_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_string_set(op->ptr, "filepath", str);
MEM_freeN(str);
- if(RNA_struct_find_property(op->ptr, "relative_path"))
- if(!RNA_property_is_set(op->ptr, "relative_path"))
- RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS);
-
+ if(RNA_struct_find_property(op->ptr, "relative_path")) {
+ if(!RNA_property_is_set(op->ptr, "relative_path")) {
+ /* annoying exception!, if were dealign with the user prefs, default relative to be off */
+ RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS && (ptr.data != &U));
+ }
+ }
WM_event_add_fileselect(C, op);
return OPERATOR_RUNNING_MODAL;