Fix #119402: Bone collections layers fail with pinned object or armature #119434 #119663

Merged
Sybren A. Stüvel merged 7 commits from dr.sybren/blender:pr/bone-collections-pinning-fix into blender-v4.1-release 2024-03-19 16:27:16 +01:00

Don't assume armature of active object is what is displayed in the properties editor, both in C++ and Python code.

Object pointer was left out from some notifiers, as this means only that object was changed. But an armature datablock can be shared by multiple objects.

This is an extension of Brecht's PR #119434 to add Python operator changes as well.


Note that the assign/unassign/select/deselect buttons are still disabled when the armature is pinned. This is because these may need to work on pose bones, which is object data, which may not be available. We could change this, but it requires more elaborate changes that also need to check for compatibility with linked data, library overrides, etc. which I don't feel we should go into for 4.1.

Don't assume armature of active object is what is displayed in the properties editor, both in C++ and Python code. Object pointer was left out from some notifiers, as this means only that object was changed. But an armature datablock can be shared by multiple objects. This is an extension of Brecht's PR #119434 to add Python operator changes as well. ------- Note that the assign/unassign/select/deselect buttons are still disabled when the armature is pinned. This is because these may need to work on pose bones, which is object data, which may not be available. We could change this, but it requires more elaborate changes that also need to check for compatibility with linked data, library overrides, etc. which I don't feel we should go into for 4.1.
Sybren A. Stüvel added 5 commits 2024-03-19 15:32:52 +01:00
Sybren A. Stüvel requested review from Christoph Lendenfeld 2024-03-19 15:33:13 +01:00
Sybren A. Stüvel added the
Module
Animation & Rigging
label 2024-03-19 15:33:19 +01:00
Sybren A. Stüvel added this to the 4.1 milestone 2024-03-19 15:33:20 +01:00
Sybren A. Stüvel added the
Priority
High
label 2024-03-19 15:33:25 +01:00
Christoph Lendenfeld reviewed 2024-03-19 15:40:59 +01:00
@ -559,1 +566,3 @@
if not context.object.data.collections.is_solo_active:
armature = _armature_from_context(context)
if not armature:
return

I assume that None is treated as False
but I still think it would be better to explicitly return a bool from the poll functions

I assume that `None` is treated as `False` but I still think it would be better to explicitly return a bool from the poll functions
Author
Member

absolutely

absolutely
dr.sybren marked this conversation as resolved
Sybren A. Stüvel added 1 commit 2024-03-19 15:49:18 +01:00
Return explicit False from poll function
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
133704e122
Author
Member

@blender-bot build

@blender-bot build
Hans Goudey reviewed 2024-03-19 15:57:38 +01:00
@ -69,0 +68,4 @@
/**
* Get current armature from the context, including properties editor pinning.
**/
Member

Extra newline here

Extra newline here
HooglyBoogly marked this conversation as resolved
Sybren A. Stüvel added 1 commit 2024-03-19 16:02:23 +01:00
Christoph Lendenfeld approved these changes 2024-03-19 16:02:35 +01:00
Christoph Lendenfeld left a comment
Member

lgtm, fixes the bug.
Just wondering why you don't need to check for nullptr anymore in certain cases

lgtm, fixes the bug. Just wondering why you don't need to check for `nullptr` anymore in certain cases
@ -121,3 +107,1 @@
}
bArmature *armature = static_cast<bArmature *>(ob->data);
bArmature *armature = ED_armature_context(C);

No need to check for nullptr here?

No need to check for `nullptr` here?
Author
Member

The poll function would have already prevented the exec from running if that were to return nullptr. A little nicification from Brecht :)

The poll function would have already prevented the exec from running if that were to return `nullptr`. A little nicification from Brecht :)
dr.sybren marked this conversation as resolved
Sybren A. Stüvel merged commit cd476226d8 into blender-v4.1-release 2024-03-19 16:27:15 +01:00
Sybren A. Stüvel deleted branch pr/bone-collections-pinning-fix 2024-03-19 16:27:21 +01:00
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#119663
No description provided.