Deleting bone constraints when the armature layer isn't active crashes Blender #80464

Closed
opened 2020-09-04 11:49:51 +02:00 by Chia · 12 comments

System Information
Operating system: Win 10
Graphics card: RTX2070

Blender Version
Broken: 2.90, 2.91 alpha
Worked: 2.83.5
Caused by 608d9b5aa1: UI: Add shortcuts for constraint panels

Short description of error
Deleting bone constraints when the armature layer isn't active crashes Blender

Exact steps for others to reproduce the error
The attached file has 2 bones in 1 armature. Bone.001 is constrained to Bone, and the two bones are in separate armature layers. With both layers active, deleting the constraint in Bone.001 works normally. But if layer 16 isn't active, doing the same thing will crash Blender.
crashtest_2_90.blend

**System Information** Operating system: Win 10 Graphics card: RTX2070 **Blender Version** Broken: 2.90, 2.91 alpha Worked: 2.83.5 Caused by 608d9b5aa1: UI: Add shortcuts for constraint panels **Short description of error** Deleting bone constraints when the armature layer isn't active crashes Blender **Exact steps for others to reproduce the error** The attached file has 2 bones in 1 armature. Bone.001 is constrained to Bone, and the two bones are in separate armature layers. With both layers active, deleting the constraint in Bone.001 works normally. But if layer 16 isn't active, doing the same thing will crash Blender. [crashtest_2_90.blend](https://archive.blender.org/developer/F8839639/crashtest_2_90.blend)
Author

Added subscriber: @alphis

Added subscriber: @alphis
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Philipp Oeser self-assigned this 2020-09-04 12:06:59 +02:00
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm.

Can confirm.
Member

Caused by 608d9b5aa1

Prior to 608d9b5aa1, the constraint was gotten using context [CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint) -- which is valid for bones on hidden layers].
After 608d9b5aa1, the constraint is found (or isnt) using edit_constraint_property_get [this is not valid for bones on hidden layers because internally BKE_pose_channel_active checks if the bone is on an active layer].

Some observations:

  • Every operator using edit_constraint_property_get doesnt work for bones on inactive layers [delete, moveup, movedown, move to index (drag n drop nowadays)]
    • moveup, movedown, move to index check if they could find a constraint beforehand though (dont crash)
    • delete crashes (doesnt check if a constraint could actually be found)
  • Every operator using edit_constraint_property_get for constraint data doesnt work for bones on inactive layers [stretchto_reset, limitdistance_reset, childof_set_inverse, ...]
    • these all check if they could find a constraint beforehand though (dont crash)

This is because the poll function is using context to get the constraint, the operators themselves use edit_constraint_property_get which leads to inconsistent/unexpected results.

Possible solutions:

    • let the delete operator just work with the context constraint again (like prior to 608d9b5aa1) -- allows for deleting constraints on bones in inactive layers
    • check if we could get a constraint -- prevents the crash, but does not allow for deleting constraints on bones in inactive layers
    • make the poll edit_constraint_poll_generic be as strict as the operators -- dont use context to get the constraint, but something like edit_constraint_property_get
    • make the operators be more graceful and let them act on bones on hidden layers -- let edit_constraint_property_get actually use context

Whatever we decide upon: this might be a candidate for 2.90.1? Will check on all solutions, might go for the quick fix - [x] first, then try [4]?

Note: Adding constraints also doesnt work for bones on inactive layers [that was the case in 2.79 as well -- it is also using BKE_pose_channel_active]
Note: edit_constraint_invoke_properties also uses said context

Caused by 608d9b5aa1 Prior to 608d9b5aa1, the constraint was gotten using **context** [CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint) -- which is valid for bones on hidden layers]. After 608d9b5aa1, the constraint is found (or isnt) using `edit_constraint_property_get` [this is **not** valid for bones on hidden layers because internally `BKE_pose_channel_active` checks if the bone is on an active layer]. Some observations: - Every operator using `edit_constraint_property_get` doesnt work for bones on inactive layers [delete, moveup, movedown, move to index (drag n drop nowadays)] - moveup, movedown, move to index check if they could find a constraint beforehand though (dont crash) - delete crashes (doesnt check if a constraint could actually be found) - Every operator using `edit_constraint_property_get` for constraint data doesnt work for bones on inactive layers [stretchto_reset, limitdistance_reset, childof_set_inverse, ...] - these all check if they could find a constraint beforehand though (dont crash) This is because the poll function is using **context** to get the constraint, the operators themselves use **edit_constraint_property_get** which leads to inconsistent/unexpected results. Possible solutions: - - [x] let the delete operator just work with the context constraint again (like prior to 608d9b5aa1) -- allows for deleting constraints on bones in inactive layers - - [x] check if we could get a constraint -- prevents the crash, but does **not** allow for deleting constraints on bones in inactive layers - - [x] make the poll `edit_constraint_poll_generic` be as strict as the operators -- dont use **context** to get the constraint, but something like **edit_constraint_property_get** - - [x] make the operators be more graceful and let them act on bones on hidden layers -- let **edit_constraint_property_get** actually use **context** Whatever we decide upon: this might be a candidate for 2.90.1? Will check on all solutions, might go for the quick fix - [x] first, then try [4]? Note: Adding constraints also doesnt work for bones on inactive layers [that was the case in 2.79 as well -- it is also using `BKE_pose_channel_active`] Note: `edit_constraint_invoke_properties` also uses said **context**

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

Good find @lichtwerk. I think it's important to have the poll function actually in sync with the rest of the operator; without that, it's rather useless. And first doing - [x] and then trying - [x] sounds good to me.

Good find @lichtwerk. I think it's important to have the poll function actually in sync with the rest of the operator; without that, it's rather useless. And first doing - [x] and then trying - [x] sounds good to me.

This issue was referenced by 8b953fa83d

This issue was referenced by 8b953fa83d64ef0fa140c82e79d1a3101d7496b0

This issue was referenced by 9dcae4eb17

This issue was referenced by 9dcae4eb17d7b5a90fda43d0abab1636acf42851

This issue was referenced by 7447233f76

This issue was referenced by 7447233f76fe85a364002f17232c284f16b7084f

This issue was referenced by 6dc7266cf1

This issue was referenced by 6dc7266cf1f4ee4e6e6eaa7e4949fcff11372479
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
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
4 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#80464
No description provided.