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:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-11-20 09:34:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-20 09:38:35 +0300
commitd227c58e3ec2020683d9b7e8280f5e48350fd1fd (patch)
tree8531da3080fce08e69fe4a492a85420c305c2fe2 /source/blender/editors/interface/interface_context_menu.c
parent93f82698e759bb7b4aa999173433d2053cf99606 (diff)
UI: support jumping to target object/bone
Complex rigs are built from many bones (often overlapping) connected by constraints. When investigating or debugging such rigs one often wants to switch to the target of a constraint, or a parent bone, but it is difficult to do manually due to overlap confusion. This adds a right click menu option that automatically selects and makes the target object or bone active for UI fields where a suitable reference is readily available.
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
-rw-r--r--source/blender/editors/interface/interface_context_menu.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c
index 03d941c2387..0ffc97444e1 100644
--- a/source/blender/editors/interface/interface_context_menu.c
+++ b/source/blender/editors/interface/interface_context_menu.c
@@ -361,7 +361,12 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT);
}
- if (but->type == UI_BTYPE_TAB) {
+ const bool is_disabled = but->flag & UI_BUT_DISABLED;
+
+ if (is_disabled) {
+ /* Suppress editing commands. */
+ }
+ else if (but->type == UI_BTYPE_TAB) {
uiButTab *tab = (uiButTab *)but;
if (tab->menu) {
UI_menutype_draw(C, tab->menu, layout);
@@ -639,6 +644,17 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but)
}
}
+ /* Pointer properties and string properties with prop_search support jumping to target object/bone. */
+ if (but->rnapoin.data && but->rnaprop) {
+ const PropertyType type = RNA_property_type(but->rnaprop);
+
+ if ((type == PROP_POINTER) || (type == PROP_STRING && but->type == UI_BTYPE_SEARCH_MENU && but->search_func == ui_rna_collection_search_cb)) {
+ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Jump To Target"),
+ ICON_NONE, "UI_OT_jump_to_target_button");
+ uiItemS(layout);
+ }
+ }
+
/* Favorites Menu */
if (ui_but_is_user_menu_compatible(C, but)) {
uiBlock *block = uiLayoutGetBlock(layout);