diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-04-26 18:17:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-26 18:35:24 +0300 |
commit | cf366c8b6686bae79aeccbdecdbef2472ff77923 (patch) | |
tree | 4178d6ca1f99a937e8df91bc82f320f9689c51a7 /source/blender/editors/interface/interface_utils.c | |
parent | 5efbd2a4076af7de8d4c9256ff8f6aacbfa6b49f (diff) |
UI: 'View Online Manual' Shortcut
D1031, implement proposal T37478 to give easy access to the online manual.
Use Alt+F1 while hovering over a button/setting.
Diffstat (limited to 'source/blender/editors/interface/interface_utils.c')
-rw-r--r-- | source/blender/editors/interface/interface_utils.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index 28bd637ae59..14d97dd883e 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -52,6 +52,9 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "WM_api.h" +#include "WM_types.h" + #include "interface_intern.h" @@ -309,6 +312,34 @@ int UI_calc_float_precision(int prec, double value) return prec; } +bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength) +{ + if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) { + BLI_snprintf(r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type), + RNA_property_identifier(but->rnaprop)); + return true; + } + else if (but->optype) { + WM_operator_py_idname(r_str, but->optype->idname); + return true; + } + + *r_str = '\0'; + return false; +} + +bool UI_but_online_manual_id_from_active(const struct bContext *C, char *r_str, size_t maxlength) +{ + uiBut *but = UI_context_active_but_get(C); + + if (but) { + return UI_but_online_manual_id(but, r_str, maxlength); + } + + *r_str = '\0'; + return false; +} + /* -------------------------------------------------------------------- */ /* Modal Button Store API */ |