Vertex weights menu cannot be operated by mouse dragging #119831

Open
opened 2024-03-23 18:28:26 +01:00 by Bookyakuno · 6 comments

System Information
Operating system: Windows-10-10.0.22631-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 551.76

Blender Version
Broken: version: 4.1.0 Release Candidate, branch: blender-v4.1-release, commit date: 2024-03-22 19:59, hash: 64bfe491645f
Worked: 4.0.2

Caused by b52a071e7a

Short description of error
If you create a menu with weights for specific vertices, you will not be able to manipulate the menu by dragging the mouse.
This is a problem for add-on developers when creating menus of vertex details.

  • Occurs in Blender 4.1.
  • I had a similar problem with Blender 3.6/4.0.
    However, in 3.6/4.0, if you create a "state where no active select vertex exists" using circle selection or box selection, this behavior does not occur.
  • Prior to Blender 3.6, dragging was possible without any problems.
  • It is possible to click on the menu and enter numerical values using the keyboard.
  • There is no problem with the standard Blender menu (vertex paint mode > item > "vertex weight" weight value).
  • This is a very small issue for many people.
    But it was a issue that caused my created weight table add-on to not work properly.

Exact steps for others to reproduce the error

  1. Open the attached Blend file.
  2. Run "mouse_drag_test.py" from the text editor in the project to register the menu.
  3. Drag the menu slider in Properties > Object > Mouse Drag Test.

mouse_drag_test.jpg

**System Information** Operating system: Windows-10-10.0.22631-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3080 Laptop GPU/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 551.76 **Blender Version** Broken: version: 4.1.0 Release Candidate, branch: blender-v4.1-release, commit date: 2024-03-22 19:59, hash: `64bfe491645f` Worked: 4.0.2 Caused by b52a071e7a3a11728821d11efc3f462da991b3e0 **Short description of error** If you create a menu with weights for specific vertices, you will not be able to manipulate the menu by dragging the mouse. This is a problem for add-on developers when creating menus of vertex details. - Occurs in Blender 4.1. - I had a similar problem with Blender 3.6/4.0. <br>However, in 3.6/4.0, if you create a "state where no active select vertex exists" using circle selection or box selection, this behavior does not occur. - Prior to Blender 3.6, dragging was possible without any problems. - It is possible to click on the menu and enter numerical values using the keyboard. - There is no problem with the standard Blender menu (vertex paint mode > item > "vertex weight" weight value). - This is a very small issue for many people. <br>But it was a issue that caused my created weight table add-on to not work properly. **Exact steps for others to reproduce the error** 1. Open the attached Blend file. 2. Run "mouse_drag_test.py" from the text editor in the project to register the menu. 3. Drag the menu slider in Properties > Object > Mouse Drag Test. ![mouse_drag_test.jpg](/attachments/6002117e-5fb8-489b-8d50-7954a387f47f)
Bookyakuno added the
Severity
Normal
Type
Report
Status
Needs Triage
labels 2024-03-23 18:28:27 +01:00
Member

Can confirm, will check

Can confirm, will check
Philipp Oeser added
Status
Confirmed
Module
User Interface
and removed
Status
Needs Triage
labels 2024-03-25 11:37:41 +01:00
Philipp Oeser added this to the 4.1 milestone 2024-03-25 11:42:25 +01:00
Philipp Oeser added
Severity
High
and removed
Severity
Normal
labels 2024-03-25 11:42:32 +01:00
Member

Caused by b52a071e7a

CC @HooglyBoogly

Note: this also reminds me of #112123 / #109460

CC @JacquesLucke

Caused by b52a071e7a3a11728821d11efc3f462da991b3e0 CC @HooglyBoogly Note: this also reminds me of #112123 / #109460 CC @JacquesLucke
Philipp Oeser added
Module
Modeling
Interest
User Interface
and removed
Module
User Interface
labels 2024-03-25 13:15:35 +01:00
Member

Yeah, this is the same issue as #109460. The cleanup commit above exposed the issue by fixing a bug where the data wouldn't be unshared (from implicit sharing). I don't know how to fix this honestly, we can't do anything fancy like referencing static memory here. It feels like sort of a fundamental problem with the UI code that it breaks like this when the data pointer is different between redraws.

Yeah, this is the same issue as #109460. The cleanup commit above exposed the issue by fixing a bug where the data wouldn't be unshared (from implicit sharing). I don't know how to fix this honestly, we can't do anything fancy like referencing static memory here. It feels like sort of a fundamental problem with the UI code that it breaks like this when the data pointer is different between redraws.
Member

Looking at cd74ba6413 it seems like button comparisons over redraws went wrong because a direct pointer was used for the button. But here it looks like a RNA property is used? This should generally be safer, or is the issue here that the PointerRNA.data pointer changes?

I expect we will run into more such issues as we are modernizing memory models, while the UI relies on things like pointer addresses. So we might need designs to decouple button identity from the referenced data more.

One possible solution could be using UI_but_func_identity_compare_set(), it's made for cases where the data-comparisons are not reliable. Not sure how to use this for this specific case though, esp since this is a generic UILayout.prop(). Maybe hardcoded special handling for this property is needed, or we extend RNA to allow for data comparison callbacks.

Looking at cd74ba6413 it seems like button comparisons over redraws went wrong because a direct pointer was used for the button. But here it looks like a RNA property is used? This should generally be safer, or is the issue here that the `PointerRNA.data` pointer changes? I expect we will run into more such issues as we are modernizing memory models, while the UI relies on things like pointer addresses. So we might need designs to decouple button identity from the referenced data more. One possible solution could be using `UI_but_func_identity_compare_set()`, it's made for cases where the data-comparisons are not reliable. Not sure how to use this for this specific case though, esp since this is a generic `UILayout.prop()`. Maybe hardcoded special handling for this property is needed, or we extend RNA to allow for data comparison callbacks.
Member

PointerRNA.data changes with every redraw here. The vertex group data is reallocated on every change because it's shared with undo steps (or maybe the evaluated mesh, not sure).

I agree that this will only be an issue more in the future. A generic solution that doesn't add too much complexity would be very nice. But a proper comparison doesn't seem trivial either. I'm not sure how to handle the active object changing between redraws, for example.

`PointerRNA.data` changes with every redraw here. The vertex group data is reallocated on every change because it's shared with undo steps (or maybe the evaluated mesh, not sure). I agree that this will only be an issue more in the future. A generic solution that doesn't add too much complexity would be very nice. But a proper comparison doesn't seem trivial either. I'm not sure how to handle the active object changing between redraws, for example.
Thomas Dinges removed this from the 4.1 milestone 2024-03-25 15:57:57 +01:00
Member

I think this is more of a known issue for now. The work I mentioned below to make PointerRNA into a proper data path will give us the tools to resolve this, because we can use that to check if UI buttons are the same across redraws instead of using the data pointer.

I think this is more of a known issue for now. The work I mentioned below to make PointerRNA into a proper data path will give us the tools to resolve this, because we can use that to check if UI buttons are the same across redraws instead of using the data pointer.
Hans Goudey added
Type
Known Issue
and removed
Type
Report
labels 2024-06-20 14:23:51 +02:00
Hans Goudey added
Severity
Normal
and removed
Severity
High
labels 2024-06-21 18:02:42 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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 & 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
Viewport & EEVEE
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
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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#119831
No description provided.