WIP: UI: dont run update functions if button values did not change #115831
No reviewers
Labels
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#115831
Loading…
Reference in New Issue
No description provided.
Delete Branch "lichtwerk/blender:40009_b"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptoms were recalculation in cases were these are not needed (e.g.
putting the same value as before on a heavy modifier property would give
a delay, same as selecting e.g. the same vertexgroup that was previously
selected). As shown in #40009, this delay could also end up swallowing
doublick-events, so on a heavy mesh e.g. a vertexgroup could not be
renamed by doublicking on it.
The doubleclick issue can be solved with event timestamps (see
efef709ec7
for this being done for linux), however the - unneccessaryThis PR skip RNA property set/update functions in case a button value
did not change, thus eliminating the delay.
It is basically the second try at this (see
eb06ccc324
which gotreverted), but this time leaving the button handling code untouched.
Fixes #87448
Fixes #40009
Testing this patch, it seems to work well for the most part, however it breaks
PROP_ENUM_FLAG
properties.To reproduce the bug:
In
main
the last step will toggle the button.This problem occurs because the value of
PROP_ENUM_FLAG
buttons is the bit to toggle, not the final value.Other potential issues:
UI_BUT_POIN_FLOAT
buttons foundvalue <= std::abs(0.00001)
to zero, while it's odd to do this - it means this PR is making an unintended functional change.but->editval
is not set when it otherwise would be, while I couldn't make this result in any bugs, it seems error prone & could cause problems in the future.UI_BUT_VALUE_UNSET
could previously be set for unhandled types (not sure if this is important right now, but it's a funcitonal change).Attached a patch which applies to this PR and resolves these issues, although I'm not all that keen on it (adds checks inline & tracks changed state).
A more general issue is this workaround is only for numbers, not colors, vectors, strings, anyone reading the code might ask why numbers are special cases - and why every other button doesn't attempt skipping unnecessary work. If we want to make number an exception, OK, then an explanation should be added to the code-comment explaining why this is a pain-point for numbers and why strings and other button types don't do this check.
This update-if-changed check also isn't applied for multi-button editing, Python API and other areas... so while skipping updates seems reasonable at first, I think this is more of a "special case" than it might first seem.
I'd suggest to investigate a solution that deals with clicking on already active UI-list item, but if that's not practical, a solution similar to the attached patch could work however it's hard to predict how skipping updates might cause problems.
While in principle it's logical to avoid unnecessary work, in practice users rarely set a button to it's exact same value (with the exception of
UIList
's) and the drawback for failing to run update-callbacks is significant.The UIList code could be changed so clicking on the current active item doesn't send through the index assignment (although this isn't very elegant either as it's a UI-specific logic that's applied in one place).
Thx @ideasman42 for checking in such depth!
I agree the most pressing issue (UIList doubleclick) has been solved already by the timestamps commits, so the urgency decreased considerably. I'll still have it on the list, will check on the issues mentioned (but with a lower prio for now, so might take a bit to post an update...)
UI: dont run update functions if button values did not changeto WIP: UI: dont run update functions if button values did not changeCheckout
From your project repository, check out a new branch and test the changes.