Bones in Envelope Display break apart after selecting bone at id 0. #65669

Closed
opened 2019-06-09 22:13:04 +02:00 by Demeter Dzadik · 8 comments
Member

Blender Version
Broken: 2.80, 81b68f7279

UnfortunateCarelessEmperorshrimp.webm

This happens both in pose mode and edit mode, only in Envelope armature display mode. It seems to be related to which bone was created first.

Reproduction

  • In envelope display mode, have a bunch of bones, but know which one is on id 0. Pose mode or edit mode, doesn't matter.
  • Select and move them around, avoiding the id 0 bone, and everything should be working fine.
  • When you select id 0 bone for the first time, everything is still fine.
  • Now when you select another bone, you will see the envelope of the bone that was selected before id 0 bone, even if that is not the bone you just selected. Uh oh.
  • Selecting any other bone will not update the displayed envelope. You can only see that same envelope. Even if you move the bone the envelope belongs to, it stays in place, not following that bone.
  • That is, until you select id 0 bone again. Now if you try to move it, everything falls apart!
  • Switching between Pose/Edit mode will clean the mess up until you switch back to the other mode. Switching to Object mode will clean the mess up permanently until you do the ritual again.
**Blender Version** Broken: 2.80, 81b68f7279cd [UnfortunateCarelessEmperorshrimp.webm](https://archive.blender.org/developer/F7096665/UnfortunateCarelessEmperorshrimp.webm) This happens both in pose mode and edit mode, only in Envelope armature display mode. It seems to be related to which bone was created first. **Reproduction** - In envelope display mode, have a bunch of bones, but know which one is on id 0. Pose mode or edit mode, doesn't matter. - Select and move them around, avoiding the id 0 bone, and everything should be working fine. - When you select id 0 bone for the first time, everything is still fine. - Now when you select another bone, you will see the envelope of the bone that was selected before id 0 bone, even if that is not the bone you just selected. Uh oh. - Selecting any other bone will not update the displayed envelope. You can only see that same envelope. Even if you move the bone the envelope belongs to, it stays in place, not following that bone. - That is, until you select id 0 bone again. Now if you try to move it, everything falls apart! - Switching between Pose/Edit mode will clean the mess up until you switch back to the other mode. Switching to Object mode will clean the mess up permanently until you do the ritual again.
Author
Member

Added subscriber: @Mets

Added subscriber: @Mets
Member

Added subscribers: @fclem, @lichtwerk

Added subscribers: @fclem, @lichtwerk
Clément Foucault was assigned by Philipp Oeser 2019-06-11 10:24:07 +02:00
Member

I assume this is drawing code [not sure though], @fclem: dose this ring a bell?

I assume this is drawing code [not sure though], @fclem: dose this ring a bell?

This issue was referenced by c49f91a3b6

This issue was referenced by c49f91a3b604da2b26b6c8bc2d3736c84870fe1b

Added subscriber: @mano-wii

Added subscriber: @mano-wii

The problem is that DRW_temp_buffer_request deletes the vbo_id of the instance, which invalidates the batch/vao even though it has the same pointers.

A solution I have found is not to delete the vbo_id:

diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c
index e7a41ee3e43..bcc5a58e58e 100644
--- a/source/blender/draw/intern/draw_instance_data.c
+++ b/source/blender/draw/intern/draw_instance_data.c
@@ -124,8 +124,11 @@ GPUVertBuf *DRW_temp_buffer_request(DRWInstanceDataList *idatalist,
   if (handle->format != format) {
     handle->format = format;
     /* TODO/PERF: Save the allocated data from freeing to avoid reallocation. */
-    GPU_vertbuf_clear(vert);
-    GPU_vertbuf_init_with_format_ex(vert, format, GPU_USAGE_DYNAMIC);
+    GPU_vertformat_copy(&vert->format, format);
+    vert->usage = GPU_USAGE_DYNAMIC;
+    /* Skip assert. */
+    vert->vertex_alloc = -1;
+
     GPU_vertbuf_data_alloc(vert, DRW_BUFFER_VERTS_CHUNK);
   }
   return vert;

Or we can indicate the batch not is_compatible if buf->vbo_id is 0:

diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c
index e7a41ee3e43..b1eefc6f8a6 100644
--- a/source/blender/draw/intern/draw_instance_data.c
+++ b/source/blender/draw/intern/draw_instance_data.c
@@ -140,8 +140,8 @@ GPUBatch *DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist,
   BLI_assert(geom->inst == NULL);
 
   GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_instancing);
-  bool is_compatible = (batch->gl_prim_type == geom->gl_prim_type) && (batch->inst == buf) &&
-                       (batch->phase == GPU_BATCH_READY_TO_DRAW);
+  bool is_compatible = (buf->vbo_id != 0 && batch->gl_prim_type == geom->gl_prim_type) &&
+                       (batch->inst == buf) && (batch->phase == GPU_BATCH_READY_TO_DRAW);
   for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN && is_compatible; i++) {
     if (batch->verts[i] != geom->verts[i]) {
       is_compatible = false;
The problem is that `DRW_temp_buffer_request` deletes the `vbo_id` of the instance, which invalidates the `batch/vao` even though it has the same pointers. A solution I have found is not to delete the `vbo_id`: ``` diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index e7a41ee3e43..bcc5a58e58e 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -124,8 +124,11 @@ GPUVertBuf *DRW_temp_buffer_request(DRWInstanceDataList *idatalist, if (handle->format != format) { handle->format = format; /* TODO/PERF: Save the allocated data from freeing to avoid reallocation. */ - GPU_vertbuf_clear(vert); - GPU_vertbuf_init_with_format_ex(vert, format, GPU_USAGE_DYNAMIC); + GPU_vertformat_copy(&vert->format, format); + vert->usage = GPU_USAGE_DYNAMIC; + /* Skip assert. */ + vert->vertex_alloc = -1; + GPU_vertbuf_data_alloc(vert, DRW_BUFFER_VERTS_CHUNK); } return vert; ``` Or we can indicate the `batch` not `is_compatible` if `buf->vbo_id` is `0`: ``` diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index e7a41ee3e43..b1eefc6f8a6 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -140,8 +140,8 @@ GPUBatch *DRW_temp_batch_instance_request(DRWInstanceDataList *idatalist, BLI_assert(geom->inst == NULL); GPUBatch *batch = BLI_memblock_alloc(idatalist->pool_instancing); - bool is_compatible = (batch->gl_prim_type == geom->gl_prim_type) && (batch->inst == buf) && - (batch->phase == GPU_BATCH_READY_TO_DRAW); + bool is_compatible = (buf->vbo_id != 0 && batch->gl_prim_type == geom->gl_prim_type) && + (batch->inst == buf) && (batch->phase == GPU_BATCH_READY_TO_DRAW); for (int i = 0; i < GPU_BATCH_VBO_MAX_LEN && is_compatible; i++) { if (batch->verts[i] != geom->verts[i]) { is_compatible = false; ```

I have already fixed this issue locally i just didn't pushed it yet. :)

I have already fixed this issue locally i just didn't pushed it yet. :)

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' 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
5 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#65669
No description provided.