diff options
author | Julian Eisel <julian@blender.org> | 2021-10-26 22:55:46 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-10-26 22:57:38 +0300 |
commit | ca2ae350ecb5eb154609fd673e3049b77d426774 (patch) | |
tree | 415f8d5fca727555380fbe4b05831e63d49575ee /source/blender/editors/screen | |
parent | d040493cd48d3afce2d4b380c7ed5e518c3c5e6b (diff) |
Asset Browser: Improve hint for asset library that isn't found
We already show a message when showing an asset library whose path can't be
found on disk. The red text was making it look like some fatal error happened.
And the message could be a bit more useful generally.
So this removes the red color of the text, (arguably) improves the text and
adds a button as shortcut to open the Preferences with the asset library
settings.
Differential Revision: https://developer.blender.org/D12894
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index e516c3ba2c3..66140cba9c6 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -5072,6 +5072,18 @@ static int userpref_show_exec(bContext *C, wmOperator *op) int sizex = (500 + UI_NAVIGATION_REGION_WIDTH) * UI_DPI_FAC; int sizey = 520 * UI_DPI_FAC; + PropertyRNA *prop = RNA_struct_find_property(op->ptr, "section"); + if (prop && RNA_property_is_set(op->ptr, prop)) { + /* Set active section via RNA, so it can fail properly. */ + + PointerRNA pref_ptr; + RNA_pointer_create(NULL, &RNA_Preferences, &U, &pref_ptr); + PropertyRNA *active_section_prop = RNA_struct_find_property(&pref_ptr, "active_section"); + + RNA_property_enum_set(&pref_ptr, active_section_prop, RNA_property_enum_get(op->ptr, prop)); + RNA_property_update(C, &pref_ptr, active_section_prop); + } + /* changes context! */ if (WM_window_open(C, IFACE_("Blender Preferences"), @@ -5105,6 +5117,8 @@ static int userpref_show_exec(bContext *C, wmOperator *op) static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Open Preferences..."; ot->description = "Edit user preferences and system settings"; @@ -5113,6 +5127,14 @@ static void SCREEN_OT_userpref_show(struct wmOperatorType *ot) /* api callbacks */ ot->exec = userpref_show_exec; ot->poll = ED_operator_screenactive_nobackground; /* Not in background as this opens a window. */ + + prop = RNA_def_enum(ot->srna, + "section", + rna_enum_preference_section_items, + 0, + "", + "Section to activate in the Preferences"); + RNA_def_property_flag(prop, PROP_HIDDEN); } /** \} */ |