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>2020-06-11 10:24:00 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-11 10:24:00 +0300
commit3f648f5b423347fa31e60cf52701a10862a157f1 (patch)
tree1fae9fc722d34bc43b6d1756ae91c9157c86d4c5 /source/blender
parente43a948a2ca7aef365ac0e6808341215e35ee4ff (diff)
Fix T77171: File selector doesn't tag preferences to be saved
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/include/UI_interface.h4
-rw-r--r--source/blender/editors/interface/interface_handlers.c14
-rw-r--r--source/blender/editors/interface/interface_layout.c5
-rw-r--r--source/blender/editors/space_buttons/buttons_ops.c10
4 files changed, 28 insertions, 5 deletions
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 11dbb105072..59dcc9a8ace 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -764,6 +764,7 @@ bool UI_but_online_manual_id(const uiBut *but,
bool UI_but_online_manual_id_from_active(const struct bContext *C,
char *r_str,
size_t maxlength) ATTR_WARN_UNUSED_RESULT;
+bool UI_but_is_userdef(const uiBut *but);
/* Buttons
*
@@ -2445,7 +2446,8 @@ void UI_context_update_anim_flag(const struct bContext *C);
void UI_context_active_but_prop_get_filebrowser(const struct bContext *C,
struct PointerRNA *r_ptr,
struct PropertyRNA **r_prop,
- bool *r_is_undo);
+ bool *r_is_undo,
+ bool *r_is_userdef);
void UI_context_active_but_prop_get_templateID(struct bContext *C,
struct PointerRNA *r_ptr,
struct PropertyRNA **r_prop);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index b37b2f2cd4b..336f942ad8c 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -585,7 +585,7 @@ static bool ui_but_dragedit_update_mval(uiHandleButtonData *data, int mx)
return true;
}
-static void ui_rna_update_preferences_dirty(PointerRNA *ptr, PropertyRNA *prop)
+static bool ui_rna_is_userdef(PointerRNA *ptr, PropertyRNA *prop)
{
/* Not very elegant, but ensures preference changes force re-save. */
bool tag = false;
@@ -598,8 +598,18 @@ static void ui_rna_update_preferences_dirty(PointerRNA *ptr, PropertyRNA *prop)
tag = true;
}
}
+ return tag;
+}
- if (tag) {
+bool UI_but_is_userdef(const uiBut *but)
+{
+ /* This is read-only, RNA API isn't using const when it could. */
+ return ui_rna_is_userdef((PointerRNA *)&but->rnapoin, but->rnaprop);
+}
+
+static void ui_rna_update_preferences_dirty(PointerRNA *ptr, PropertyRNA *prop)
+{
+ if (ui_rna_is_userdef(ptr, prop)) {
U.runtime.is_dirty = true;
WM_main_add_notifier(NC_WINDOW, NULL);
}
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 196fdf47bd3..6aefef197df 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1069,7 +1069,8 @@ static uiBut *ui_item_with_label(uiLayout *layout,
void UI_context_active_but_prop_get_filebrowser(const bContext *C,
PointerRNA *r_ptr,
PropertyRNA **r_prop,
- bool *r_is_undo)
+ bool *r_is_undo,
+ bool *r_is_userdef)
{
ARegion *region = CTX_wm_menu(C) ? CTX_wm_menu(C) : CTX_wm_region(C);
uiBlock *block;
@@ -1078,6 +1079,7 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C,
memset(r_ptr, 0, sizeof(*r_ptr));
*r_prop = NULL;
*r_is_undo = false;
+ *r_is_userdef = false;
if (!region) {
return;
@@ -1096,6 +1098,7 @@ void UI_context_active_but_prop_get_filebrowser(const bContext *C,
*r_ptr = prevbut->rnapoin;
*r_prop = prevbut->rnaprop;
*r_is_undo = (prevbut->flag & UI_BUT_UNDO) != 0;
+ *r_is_userdef = UI_but_is_userdef(prevbut);
return;
}
}
diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c
index 9af623d8065..53a904438eb 100644
--- a/source/blender/editors/space_buttons/buttons_ops.c
+++ b/source/blender/editors/space_buttons/buttons_ops.c
@@ -83,6 +83,7 @@ typedef struct FileBrowseOp {
PointerRNA ptr;
PropertyRNA *prop;
bool is_undo;
+ bool is_userdef;
} FileBrowseOp;
static int file_browse_exec(bContext *C, wmOperator *op)
@@ -148,6 +149,11 @@ static int file_browse_exec(bContext *C, wmOperator *op)
}
}
+ /* Tag user preferences as dirty. */
+ if (fbo->is_userdef) {
+ U.runtime.is_dirty = true;
+ }
+
MEM_freeN(op->customdata);
return OPERATOR_FINISHED;
@@ -164,6 +170,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
PointerRNA ptr;
PropertyRNA *prop;
bool is_undo;
+ bool is_userdef;
FileBrowseOp *fbo;
char *str;
@@ -172,7 +179,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
}
- UI_context_active_but_prop_get_filebrowser(C, &ptr, &prop, &is_undo);
+ UI_context_active_but_prop_get_filebrowser(C, &ptr, &prop, &is_undo, &is_userdef);
if (!prop) {
return OPERATOR_CANCELLED;
@@ -209,6 +216,7 @@ static int file_browse_invoke(bContext *C, wmOperator *op, const wmEvent *event)
fbo->ptr = ptr;
fbo->prop = prop;
fbo->is_undo = is_undo;
+ fbo->is_userdef = is_userdef;
op->customdata = fbo;
/* normally ED_fileselect_get_params would handle this but we need to because of stupid