pinned armature bone collection panel grayed out #119402

Closed
opened 2024-03-13 00:02:04 +01:00 by moe-derky · 6 comments

System Information
Operating system: windows 11
Graphics card: RTX 4070

Blender Version
Broken: in 4.1 beta
Worked: in 4.0 and below
Short description of error
when an armature properties tab (object or data) gets pinned. the bone collection panel behaves normally until another object is selected like in the images below.
Exact steps for others to reproduce the error
-create an armature
-pin its properties
-select another object

**System Information** Operating system: windows 11 Graphics card: RTX 4070 **Blender Version** Broken: in 4.1 beta Worked: in 4.0 and below **Short description of error** when an armature properties tab (object or data) gets pinned. the bone collection panel behaves normally until another object is selected like in the images below. **Exact steps for others to reproduce the error** -create an armature -pin its properties -select another object
moe-derky added the
Status
Needs Triage
Type
Report
Priority
Normal
labels 2024-03-13 00:02:05 +01:00
Member

Hi, thanks for the report. Can confirm. This is related to new tree-view structure. GPv3 layers panel also giving same results.
cc @JulianEisel @dr.sybren

Hi, thanks for the report. Can confirm. This is related to new tree-view structure. GPv3 layers panel also giving same results. cc @JulianEisel @dr.sybren
Member

This is not a regression but breaks the use of Pin property so raising the priority for attention.

This is not a regression but breaks the use of `Pin` property so raising the priority for attention.
Member

If active object is not armature then panel and bone collection rows are not drawn. I'm not sure what would be the replacement of CTX_data_active_object. Can we get object data from pinid?

If active object is not `armature` then panel and bone collection rows are not drawn. I'm not sure what would be the replacement of `CTX_data_active_object`. Can we get object data from pinid?
Member

I thought following change might work but it's not:

diff --git a/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc b/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc
index d4acbd2c305..3f7cbe98abd 100644
--- a/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc
+++ b/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc
@@ -16,6 +16,7 @@
 #include "UI_interface.hh"
 #include "UI_tree_view.hh"

+#include "DNA_space_types.h"
 #include "RNA_access.hh"
 #include "RNA_prototypes.h"

@@ -397,9 +398,16 @@ void LayerTreeView::build_tree()
 void uiTemplateGreasePencilLayerTree(uiLayout *layout, bContext *C)
 {
   using namespace blender;
-
+  ScrArea *area = CTX_wm_area(C);
   Object *object = CTX_data_active_object(C);
   if (!object || object->type != OB_GREASE_PENCIL) {
+    if (area->spacetype == SPACE_PROPERTIES) {
+      SpaceProperties *sbuts = static_cast<SpaceProperties *>(area->spacedata.first);
+      object = reinterpret_cast<Object *>(sbuts->pinid);
+    }
+  }
+
+  if (object->type != OB_GREASE_PENCIL) {
     return;
   }
I thought following change might work but it's not: ``` diff --git a/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc b/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc index d4acbd2c305..3f7cbe98abd 100644 --- a/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc +++ b/source/blender/editors/interface/interface_template_grease_pencil_layer_tree.cc @@ -16,6 +16,7 @@ #include "UI_interface.hh" #include "UI_tree_view.hh" +#include "DNA_space_types.h" #include "RNA_access.hh" #include "RNA_prototypes.h" @@ -397,9 +398,16 @@ void LayerTreeView::build_tree() void uiTemplateGreasePencilLayerTree(uiLayout *layout, bContext *C) { using namespace blender; - + ScrArea *area = CTX_wm_area(C); Object *object = CTX_data_active_object(C); if (!object || object->type != OB_GREASE_PENCIL) { + if (area->spacetype == SPACE_PROPERTIES) { + SpaceProperties *sbuts = static_cast<SpaceProperties *>(area->spacedata.first); + object = reinterpret_cast<Object *>(sbuts->pinid); + } + } + + if (object->type != OB_GREASE_PENCIL) { return; } ```

The template should take an object argument, not get it from the context.

In general, API functions should rely on context as little as possible. It makes their behavior unpredictable and leads to these kinds of subtle mismatches.

The template should take an object argument, not get it from the context. In general, API functions should rely on context as little as possible. It makes their behavior unpredictable and leads to these kinds of subtle mismatches.

For 4.1 it's not ideal to change the API at this point though, so it could just use ED_object_active_context instead of CTX_data_active_object. The same is done in for example the modifiers template.

For 4.1 it's not ideal to change the API at this point though, so it could just use `ED_object_active_context` instead of `CTX_data_active_object`. The same is done in for example the modifiers template.
Hans Goudey added
Type
Bug
and removed
Type
Report
labels 2024-03-13 18:09:32 +01:00
Sybren A. Stüvel self-assigned this 2024-03-19 15:07:44 +01:00
Sybren A. Stüvel added this to the 4.1 milestone 2024-03-19 15:07:47 +01:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-03-19 16:27:20 +01:00
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
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#119402
No description provided.