Custom bone shape disappears if going to editmode on the custom shape object #94886

Closed
opened 2022-01-13 20:15:52 +01:00 by Steven Baar · 14 comments

System Information
Operating system: Windows 10
Graphics card: RTX 2070 GAMING OC

Blender Version
Broken: (example: 2.80, edbf15d3c0, master, 2018-11-28, as found on the splash screen)
3.0+ is broken or altered

Worked: (newest version of Blender that worked as expected)
2.9- old function works

Caused by 594656e7a3

Short description of error
Custom bone shape disappears if going to editmode on the custom shape object

Exact steps for others to reproduce the error
#94886.blend

  • open file
  • go to editmode on the Circle object
  • bone disappears

Original Report

note that the original file may crash on load due to #94726 (Segfault with GPU subdivision on a custom bone shape)

Short description of error

After I add a circle object to a shoulder bone, I'm going into edit mode for the circle object so that I can edit the custom bone shape.

1.png

But the custom bone shape disappears.

2.png

All of the other bones remain it's just when I go into edit mode for the object that the bone uses for its custom shape. Before 3.0 you could see both the bone and the custom shape you were using so that you could easily edit the object to position the bone in real-time. This seems to be broken now or possibly altered? Seems more like a bug since the only solution I've found on blenderartist is to use the navigation panel in the bone tab under the viewport display. This makes positioning and editing custom bones extremely tedious as compared to just moving around the custom object in edit mode to place your custom bone.

3.png

Exact steps for others to reproduce the error
Based on the default startup or an attached .blend file (as simple as possible).

Attach circle as a custom object for the bone, then while in object mode select the circle object. Then enter edit mode for circle object and the custom bone disappears, in my supplied blend file the head, neck, left shoulder, and left arm have these. Under the shapes collection if you go into edit mode for any of the objects the corresponding bone will disappear. (FK bones with edited shapes will be on by default but they live in layer 2 of the skeleton)Rigging LEARNING.blend

**System Information** Operating system: Windows 10 Graphics card: RTX 2070 GAMING OC **Blender Version** Broken: (example: 2.80, edbf15d3c044, master, 2018-11-28, as found on the splash screen) 3.0+ is broken or altered Worked: (newest version of Blender that worked as expected) 2.9- old function works Caused by 594656e7a3 **Short description of error** Custom bone shape disappears if going to editmode on the custom shape object **Exact steps for others to reproduce the error** [#94886.blend](https://archive.blender.org/developer/F12805009/T94886.blend) - open file - go to editmode on the `Circle` object - bone disappears **Original Report** note that the original file may crash on load due to #94726 (Segfault with GPU subdivision on a custom bone shape) **Short description of error** After I add a circle object to a shoulder bone, I'm going into edit mode for the circle object so that I can edit the custom bone shape. ![1.png](https://archive.blender.org/developer/F12804131/1.png) But the custom bone shape disappears. ![2.png](https://archive.blender.org/developer/F12804133/2.png) All of the other bones remain it's just when I go into edit mode for the object that the bone uses for its custom shape. Before 3.0 you could see both the bone and the custom shape you were using so that you could easily edit the object to position the bone in real-time. This seems to be broken now or possibly altered? Seems more like a bug since the only solution I've found on blenderartist is to use the navigation panel in the bone tab under the viewport display. This makes positioning and editing custom bones extremely tedious as compared to just moving around the custom object in edit mode to place your custom bone. ![3.png](https://archive.blender.org/developer/F12804135/3.png) **Exact steps for others to reproduce the error** Based on the default startup or an attached .blend file (as simple as possible). Attach circle as a custom object for the bone, then while in object mode select the circle object. Then enter edit mode for circle object and the custom bone disappears, in my supplied blend file the head, neck, left shoulder, and left arm have these. Under the shapes collection if you go into edit mode for any of the objects the corresponding bone will disappear. (FK bones with edited shapes will be on by default but they live in layer 2 of the skeleton)[Rigging LEARNING.blend](https://archive.blender.org/developer/F12804089/Rigging_LEARNING.blend)
Author

Added subscriber: @Steven-Baar

Added subscriber: @Steven-Baar
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

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

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

Can confirm, will check

Can confirm, will check
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

Caused by 594656e7a3

note that the original file may crash on load due to #94726 (Segfault with GPU subdivision on a custom bone shape), but can be reproduced in a much simpler file:
#94886.blend

CC @HooglyBoogly

Caused by 594656e7a3 note that the original file may crash on load due to #94726 (Segfault with GPU subdivision on a custom bone shape), but can be reproduced in a much simpler file: [#94886.blend](https://archive.blender.org/developer/F12805009/T94886.blend) CC @HooglyBoogly
Philipp Oeser changed title from Custom bone object to Custom bone shape disappears if going to editmode on the custom shape object 2022-01-14 09:51:33 +01:00
Member

Thanks for the report. Unfortunately I don't have a great idea for how to solve this. Like I mentioned in that commit and a07089dcb1, I think the way this bone custom overlay works is quite bad and will necessitate hack after hack to keep things working as expected. Even before that change, the system didn't work with instances, for example.
Converting this to use the existing instancing system should handle all of this complexity automatically. I think the only thing we'd need to add is a "viewport only" flag for instances.
However, I don't foresee myself having the time to do that soon-- I already have plans for more refactoring in other areas.

BKE_object_get_evaluated_mesh just returns null when the object is in edit mode, so the existing code finds no mesh to draw.
The following change makes this work in another hacky way by retrieving the original mesh if there is no evaluated mesh. I don't like the change enough to propose it in a patch, though if someone things this is important enough to add another hack for, I can do that.

diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c
index 6fdf410440d..76576af8edc 100644
--- a/source/blender/draw/engines/overlay/overlay_armature.c
+++ b/source/blender/draw/engines/overlay/overlay_armature.c
@@ -661,6 +661,9 @@ static void drw_shgroup_bone_custom_solid(ArmatureDrawContext *ctx,
    * other data type, but supporting all evaluated geometry components would require a much larger
    * refactor of this area. */
   Mesh *mesh = BKE_object_get_evaluated_mesh(custom);
+  if (mesh == NULL) {
+    mesh = BKE_object_get_original_mesh(custom);
+  }
   if (mesh == NULL) {
     return;
   }
@@ -710,6 +713,9 @@ static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx,
 {
   /* See comments in #drw_shgroup_bone_custom_solid. */
   Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(custom);
+  if (mesh == NULL) {
+    mesh = BKE_object_get_original_mesh(custom);
+  }
   if (mesh == NULL) {
     return;
   }
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 1110658e3b2..ff5832f805e 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -3471,6 +3471,9 @@ void drw_batch_cache_generate_requested_evaluated_mesh(Object *ob)
                           ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob))));
 
   Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(ob);
+  if (mesh == NULL) {
+    mesh = BKE_object_get_original_mesh(ob);
+  }
   DRW_mesh_batch_cache_create_requested(DST.task_graph, ob, mesh, scene, is_paint_mode, use_hide);
 }
Thanks for the report. Unfortunately I don't have a great idea for how to solve this. Like I mentioned in that commit and a07089dcb1, I think the way this bone custom overlay works is quite bad and will necessitate hack after hack to keep things working as expected. Even before that change, the system didn't work with instances, for example. Converting this to use the existing instancing system should handle all of this complexity automatically. I think the only thing we'd need to add is a "viewport only" flag for instances. However, I don't foresee myself having the time to do that soon-- I already have plans for more refactoring in other areas. `BKE_object_get_evaluated_mesh` just returns null when the object is in edit mode, so the existing code finds no mesh to draw. The following change makes this work in another hacky way by retrieving the original mesh if there is no evaluated mesh. I don't like the change enough to propose it in a patch, though if someone things this is important enough to add another hack for, I can do that. ```lines=10 diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index 6fdf410440d..76576af8edc 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -661,6 +661,9 @@ static void drw_shgroup_bone_custom_solid(ArmatureDrawContext *ctx, * other data type, but supporting all evaluated geometry components would require a much larger * refactor of this area. */ Mesh *mesh = BKE_object_get_evaluated_mesh(custom); + if (mesh == NULL) { + mesh = BKE_object_get_original_mesh(custom); + } if (mesh == NULL) { return; } @@ -710,6 +713,9 @@ static void drw_shgroup_bone_custom_wire(ArmatureDrawContext *ctx, { /* See comments in #drw_shgroup_bone_custom_solid. */ Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(custom); + if (mesh == NULL) { + mesh = BKE_object_get_original_mesh(custom); + } if (mesh == NULL) { return; } diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 1110658e3b2..ff5832f805e 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -3471,6 +3471,9 @@ void drw_batch_cache_generate_requested_evaluated_mesh(Object *ob) ((mode == CTX_MODE_EDIT_MESH) && DRW_object_is_in_edit_mode(ob)))); Mesh *mesh = BKE_object_get_evaluated_mesh_no_subsurf(ob); + if (mesh == NULL) { + mesh = BKE_object_get_original_mesh(ob); + } DRW_mesh_batch_cache_create_requested(DST.task_graph, ob, mesh, scene, is_paint_mode, use_hide); } ```
Member

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren
Member

@dr.sybren: thoughts?

@dr.sybren: thoughts?
Member

Once D13824 is committed, this situation might be a bit better / this might work. I still think using the instancing system would be better though.

Once [D13824](https://archive.blender.org/developer/D13824) is committed, this situation might be a bit better / this might work. I still think using the instancing system would be better though.

Before 3.0 you could see both the bone and the custom shape you were using so that you could easily edit the object to position the bone in real-time.

I agree that this is the way to do things, having to go back & forth between different modes just to see what you're doing is quite the regression.

@HooglyBoogly now that D13824 has landed, do you think you could have time to find a nicer-than-the-above-hack solution for this?

> Before 3.0 you could see both the bone and the custom shape you were using so that you could easily edit the object to position the bone in real-time. I agree that this is the way to do things, having to go back & forth between different modes just to see what you're doing is quite the regression. @HooglyBoogly now that [D13824](https://archive.blender.org/developer/D13824) has landed, do you think you could have time to find a nicer-than-the-above-hack solution for this?
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Hans Goudey self-assigned this 2022-02-15 04:36:06 +01:00
Member

Well, testing this now, the situation described in the report works. (I can go into edit mode on the custom bone shape mesh and see the changes on the bone's custom shape).
I wouldn't be surprised if we end up getting other bug reports relating to this situation. But, like I've said before on these tasks and commits, the way it works is just not ideal and misaligned with the way Blender works in other respects.

Well, testing this now, the situation described in the report works. (I can go into edit mode on the custom bone shape mesh and see the changes on the bone's custom shape). I wouldn't be surprised if we end up getting other bug reports relating to this situation. But, like I've said before on these tasks and commits, the way it works is just not ideal and misaligned with the way Blender works in other respects.
Author

Thank you guys for your hard work!!!

Thank you guys for your hard work!!!
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#94886
No description provided.