Page MenuHome

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

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

Details

Summary

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

Repository
rB Blender
Branch
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.

source/blender/editors/interface/interface_ops.c
807–949

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

952

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.Tue, Nov 20, 4:05 AM

Generally looks close to being finished, notes inline.

source/blender/editors/interface/interface_ops.c
832–834

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

source/blender/editors/object/object_select.c
181–191

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.

210–220

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.Tue, Nov 20, 4:05 AM
Alexander Gavrilov (angavrilov) marked an inline comment as done.

tweak

source/blender/editors/object/object_select.c
210–220

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.