Anim: Eyedropper for bone properties #121523

Open
Christoph Lendenfeld wants to merge 32 commits from ChrisLend/blender:bone_eyedropper into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

This PR is abandoned from my end since I cannot overcome certain technical challenges

As discussed in the Animation & Rigging module meeting, I am picking this up again to land with limited functionality.

Test Build
https://builder.blender.org/download/patch/PR121523/

The Goal

Add an eyedropper to properties where you can choose a bone.

image

What works

The picker operator is implemented, and the eyedropper icon shows on the property.
Clicking it activates the modal operation and you can pick:

  • Pose bones from the Outliner
  • Bones from the Outliner
  • Pose bones from the 3D Viewport if the Armature is in Pose Mode

What doesn't work

Picking edit bones from the Outliner

I didn't find a way to get the Bone from an EditBone but I am sure there is a way.

Picking from the 3D viewport while in Object Mode

Solution: Explicit message when picking in the 3D viewport fails
Picking in the 3D viewport works via the selection buffer. The buffer is only filled with pose bones if the armature is in pose mode.
Using the picker while in object mode gives you the Armature object, not its bones.
I am not even sure pose bones are accessible unless the armature is in pose mode.

So you cannot use the bone picker to constrain an object to a bone.
UNLESS you pin the panel with the object, go to pose mode and then pick.
This indicates to me that the issue is purely on the 3D viewport side, the picker doesn't really care.


For the review

  • I had to include RNA headers to outliner_utils.cc. This might not be the correct thing to do or the function might need to move.
  • ED_outliner_give_rna_under_cursor is limited to Bone RNA structs for now. It can be extended in the future if needed.
~~This PR is abandoned from my end since I cannot overcome certain technical challenges~~ As discussed in the [Animation & Rigging](https://devtalk.blender.org/t/2024-06-14-animation-rigging-module-meeting/35135) module meeting, I am picking this up again to land with limited functionality. **Test Build** https://builder.blender.org/download/patch/PR121523/ ## The Goal Add an eyedropper to properties where you can choose a bone. ![image](/attachments/24898739-98da-4401-bb19-84714117a04f) ## What works The picker operator is implemented, and the eyedropper icon shows on the property. Clicking it activates the modal operation and you can pick: * Pose bones from the Outliner * Bones from the Outliner * Pose bones from the 3D Viewport if the Armature is in Pose Mode ## What doesn't work ### Picking edit bones from the Outliner I didn't find a way to get the `Bone` from an `EditBone` but I am sure there is a way. ### Picking from the 3D viewport while in Object Mode **Solution: Explicit message when picking in the 3D viewport fails** Picking in the 3D viewport works via the selection buffer. The buffer is only filled with pose bones if the armature is in pose mode. Using the picker while in object mode gives you the Armature object, not its bones. I am not even sure pose bones are accessible unless the armature is in pose mode. So you cannot use the bone picker to constrain an object to a bone. UNLESS you pin the panel with the object, go to pose mode and then pick. This indicates to me that the issue is purely on the 3D viewport side, the picker doesn't really care. ------ # For the review * I had to include RNA headers to `outliner_utils.cc`. This might not be the correct thing to do or the function might need to move. * `ED_outliner_give_rna_under_cursor` is limited to Bone RNA structs for now. It can be extended in the future if needed.
6.2 KiB
Christoph Lendenfeld added the
Module
Animation & Rigging
label 2024-05-07 15:21:14 +02:00
Christoph Lendenfeld added 3 commits 2024-05-07 15:21:27 +02:00
Christoph Lendenfeld added 1 commit 2024-05-09 15:44:09 +02:00
Christoph Lendenfeld added 1 commit 2024-05-09 16:50:54 +02:00
Christoph Lendenfeld added 2 commits 2024-05-09 17:03:44 +02:00
Christoph Lendenfeld added 1 commit 2024-05-10 12:35:40 +02:00
Christoph Lendenfeld added 1 commit 2024-05-10 14:34:46 +02:00
Christoph Lendenfeld added 1 commit 2024-05-10 15:31:19 +02:00
Christoph Lendenfeld added 1 commit 2024-05-10 17:55:49 +02:00
Christoph Lendenfeld added 3 commits 2024-05-14 14:28:15 +02:00
Christoph Lendenfeld added 1 commit 2024-05-14 14:54:51 +02:00
Christoph Lendenfeld added 2 commits 2024-05-14 15:37:31 +02:00
Christoph Lendenfeld added 1 commit 2024-05-14 16:16:10 +02:00
Member

My 2 cents is that even partial functionality here would be welcome! :) Constraining pose bones to pose bones in the same armature covers like 90% of my use cases, so if you're saying that part already works, I'd definitely vote for documenting the limitation and landing the partial functionality, rather than letting this work go to waste. ❤️

My 2 cents is that even partial functionality here would be welcome! :) Constraining pose bones to pose bones in the same armature covers like 90% of my use cases, so if you're saying that part already works, I'd definitely vote for documenting the limitation and landing the partial functionality, rather than letting this work go to waste. ❤️
Christoph Lendenfeld added 1 commit 2024-06-21 09:55:41 +02:00
Christoph Lendenfeld added 1 commit 2024-06-21 11:06:23 +02:00
explicit message that picking doesn't work in object mode
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
5082f9e1d9
Christoph Lendenfeld changed title from WIP: Anim: Eyedropper for bone properties to Anim: Eyedropper for bone properties 2024-06-21 11:12:54 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121523) when ready.
Christoph Lendenfeld added 1 commit 2024-07-16 13:15:15 +02:00
Member

Tested, and yeah, it's a shame that it doesn't work in the 3d view while the armature is in object mode, but the fact that it works in pose mode is still amazing. (it also does work with outliner bones in all modes btw!)

Here's an edge case that's hopefully an easy fix:

  • Two identical armatures, offset from each other in space
  • In pose mode on both
  • Create a constraint that targets armature A
  • Pick a bone from armature B
  • Current behaviour: Successfully selects the bone of the same name from armature A, but this is not the bone you clicked on! You clicked on armature B!
  • Expected behaviour: Throw an error, I think. Alternatively, you could set the target object to be armature B as well, but I think throwing an error is maybe a bit less confusing? But I'm not against setting the target object either.

Also a question/feature creep:
Should bendy bone start/end handle selectors be supported? They seem to be a bit different from bone constraint subtargets, because at least on the Py side, they take actual Bone/EditBone refs instead of bonename strings.

Other than that, works as you described! Even tested it in edit mode, even though the only constraint UI accessible in armature edit mode is ofc the armature object's constraints. But it still works! :D (tested both 3d viewport and outliner)

I think none of these are big problems, so for me this is good enough to land as is, but ofc if these things can be added that's a nice bonus.

Tested, and yeah, it's a shame that it doesn't work in the 3d view while the armature is in object mode, but the fact that it works in pose mode is still amazing. (it also does work with outliner bones in all modes btw!) Here's an edge case that's hopefully an easy fix: - Two identical armatures, offset from each other in space - In pose mode on both - Create a constraint that targets armature `A` - Pick a bone from armature `B` - Current behaviour: Successfully selects the bone of the same name from armature `A`, but this is not the bone you clicked on! You clicked on armature `B`! - Expected behaviour: Throw an error, I think. Alternatively, you could set the target object to be armature `B` as well, but I think throwing an error is maybe a bit less confusing? But I'm not against setting the target object either. Also a question/feature creep: Should bendy bone start/end handle selectors be supported? They seem to be a bit different from bone constraint subtargets, because at least on the Py side, they take actual Bone/EditBone refs instead of bonename strings. Other than that, works as you described! Even tested it in edit mode, even though the only constraint UI accessible in armature edit mode is ofc the armature object's constraints. But it still works! :D (tested both 3d viewport and outliner) I think none of these are big problems, so for me this is good enough to land as is, but ofc if these things can be added that's a nice bonus.
Christoph Lendenfeld added 1 commit 2024-07-18 10:51:15 +02:00
Christoph Lendenfeld added 1 commit 2024-07-18 13:31:05 +02:00
Christoph Lendenfeld added 2 commits 2024-07-18 14:12:55 +02:00
Christoph Lendenfeld added 1 commit 2024-07-18 17:10:35 +02:00
Christoph Lendenfeld added 1 commit 2024-07-18 17:31:39 +02:00
Author
Member

I made your edge case even more edgy.

My solution was to not allow the picking of bones that are not part of the armature you are searching for.

The edgy case:
Picking a pose bone from a different rig in the outliner. I have no way of knowing which armature the pose bone is from. This is especially problematic for bendy bones, which can then point to another bone which you wouldn't be able to set otherwise.

I made your edge case even more edgy. My solution was to not allow the picking of bones that are not part of the armature you are searching for. The edgy case: Picking a pose bone from a different rig in the outliner. I have no way of knowing which armature the pose bone is from. This is especially problematic for bendy bones, which can then point to another bone which you wouldn't be able to set otherwise.
Christoph Lendenfeld added 1 commit 2024-07-18 17:43:38 +02:00
ensure redraw on exit
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
53bc6b840d
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121523) when ready.
Christoph Lendenfeld added 1 commit 2024-07-23 12:11:44 +02:00
Christoph Lendenfeld added 1 commit 2024-07-23 12:21:10 +02:00
use RNA_prototypes.hh
Some checks failed
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
c67633ad23
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121523) when ready.
Christoph Lendenfeld added 2 commits 2024-07-25 12:37:31 +02:00
use RNA_prototypes.hh
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
7306c065b6
Author
Member

@blender-bot package
forgot a usage of RNA_prototypes.h

@blender-bot package forgot a usage of RNA_prototypes.h
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR121523) when ready.
All checks were successful
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u bone_eyedropper:ChrisLend-bone_eyedropper
git checkout ChrisLend-bone_eyedropper
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#121523
No description provided.