Page MenuHome

UI: support jumping to target object/bone from pointer prop or prop_search.

Authored by Alexander Gavrilov (angavrilov) on Nov 18 2018, 11:15 AM.



Complex rigs are built from many bones (often overlapping) that are
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 patch 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.

In order for this to work for bone parent references in Pose mode,
now even disabled fields show their context menu on right click,
but it only contains manual-related options and Jump To Target.

Diff Detail

rB Blender
temp-angavrilov-jump-target (branched from blender2.8)
Build Status
Buildable 2498
Build 2498: arc lint + arc unit

Event Timeline

Generally fine, would move object/pose logic out of the UI.


Would move this to ED_object.h. Avoid adding object/pose logic into UI code.


This is an expensive poll function, maybe note that it's only called in the RMB menu.

Moved the actual selection code to functions in ED_object.h

Campbell Barton (campbellbarton) requested changes to this revision.Nov 20 2018, 4:05 AM

Generally looks close to being finished, notes inline.


Why not return the base instead of the object? Then there is no need for a lookup below BKE_view_layer_base_find.


logic here is a bit odd, if it's selected it uses the first-hit, if it's not selected it uses the last-hit.

Should probably use the first-hit in either case.

Also, it should probably never return a hidden object AFAICS,
or at least, prefer unhidden, the caller can report an error if the users tries to jump to hidden.

This could be done in a single loop, checking for each case, returning the best match.


Why not call BKE_view_layer_base_deselect_all ? or add BKE_view_layer_base_deselect_all_visible if the difference is important.

This revision now requires changes to proceed.Nov 20 2018, 4:05 AM
Alexander Gavrilov (angavrilov) marked an inline comment as done.



Using visible is how all other selection functions in this file work.

Thanks! committed rBd227c58e3ec2020683d9b7e8280f5e48350fd1fd

Made some edits.

  • ED_object_find_by_data_id only works for object data, caller should handle other uses.
  • Pose mode only sets active/selected when the bone is visible/selectable.