Fix #109460: vertex weight slider not working correctly #109665

Merged
Jacques Lucke merged 6 commits from JacquesLucke/blender:fix-vertex-weight-slider into main 2023-08-01 13:24:31 +02:00
Member

#109460 was caused by the introduction of implicit sharing for custom data layers (7eee378ecc). Due to implicit sharing, the vertex weight layer is now shared between the original and evaluated object in object/weight paint mode, but not in edit mode because of bmesh. For that reason, the original data has to be copied to be able to edit it, which causes its pointer to change. uiDefButF can't deal with the situation when the pointer changes on every redraw.

The solution is to just use a global value to "send" data between the uiBut and the stored vertex group weight.

#109460 was caused by the introduction of implicit sharing for custom data layers (7eee378eccc8f87e1330b9cfea2799928be9d657). Due to implicit sharing, the vertex weight layer is now shared between the original and evaluated object in object/weight paint mode, but not in edit mode because of bmesh. For that reason, the original data has to be copied to be able to edit it, which causes its pointer to change. `uiDefButF` can't deal with the situation when the pointer changes on every redraw. The solution is to just use a global value to "send" data between the `uiBut` and the stored vertex group weight.
Jacques Lucke added 2 commits 2023-07-03 19:13:14 +02:00
Jacques Lucke requested review from Sergey Sharybin 2023-07-03 19:19:24 +02:00

Not sure there is a more clear way of doing it. It seems that some similar cases are constructing RNA property pointer. Not sure it can work here.

@JulianEisel or @brecht are more familiar with what's possible in the UI than me.

Not sure there is a more clear way of doing it. It seems that some similar cases are constructing RNA property pointer. Not sure it can work here. @JulianEisel or @brecht are more familiar with what's possible in the UI than me.

For that reason, the original data has to be copied to be able to edit it, which causes its pointer to change.

Can you say where this copy happens?

> For that reason, the original data has to be copied to be able to edit it, which causes its pointer to change. Can you say where this copy happens?
Author
Member

Didn't check in detail right now, but most likely happens in the call to ED_mesh_active_dvert_get_only(ob) in the same function I changed, which returns a non-const pointer to the vertex weight, so it needs a copy if the data is shared with evaluated data already.

Didn't check in detail right now, but most likely happens in the call to `ED_mesh_active_dvert_get_only(ob)` in the same function I changed, which returns a non-const pointer to the vertex weight, so it needs a copy if the data is shared with evaluated data already.
Brecht Van Lommel requested changes 2023-07-04 15:45:17 +02:00
Brecht Van Lommel left a comment
Owner

This seems like it could bite us in more places, but I also don't have a good general solution for it. We could add some unique identifier to buttons that is used to find a correspondence between buttons across redraws, but that's also quite obscure.

Rather than using a global, this should be stored in TransformProperties along with the various median property values that can be edited here. A global is not strictly correct if there are multiple scenes open at the same time.

If you haven't already, please check if there are more buttons in this file that could have the same problem.

This seems like it could bite us in more places, but I also don't have a good general solution for it. We could add some unique identifier to buttons that is used to find a correspondence between buttons across redraws, but that's also quite obscure. Rather than using a global, this should be stored in `TransformProperties` along with the various median property values that can be edited here. A global is not strictly correct if there are multiple scenes open at the same time. If you haven't already, please check if there are more buttons in this file that could have the same problem.
Jacques Lucke added 4 commits 2023-08-01 11:37:04 +02:00
Author
Member

We could add some unique identifier to buttons that is used to find a correspondence between buttons across redraws, but that's also quite obscure.

Don't need to do that now, but generally I think that would be the right idea. Other UI frameworks also require this in cases when the mapping between redraws can't happen automatically.

If you haven't already, please check if there are more buttons in this file that could have the same problem.

Looks like this was the only remaining one. All other calls to uiDefButF already pass a pointer to something in TransformProperties.

> We could add some unique identifier to buttons that is used to find a correspondence between buttons across redraws, but that's also quite obscure. Don't need to do that now, but generally I think that would be the right idea. Other UI frameworks also require this in cases when the mapping between redraws can't happen automatically. > If you haven't already, please check if there are more buttons in this file that could have the same problem. Looks like this was the only remaining one. All other calls to `uiDefButF` already pass a pointer to something in `TransformProperties`.
Jacques Lucke requested review from Brecht Van Lommel 2023-08-01 11:39:11 +02:00
Brecht Van Lommel approved these changes 2023-08-01 13:19:08 +02:00
Jacques Lucke merged commit cd74ba6413 into main 2023-08-01 13:24:30 +02:00
Jacques Lucke deleted branch fix-vertex-weight-slider 2023-08-01 13:24:32 +02: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#109665
No description provided.