Fix #108722 : Measures not cleared when removing annotation layer #108749

Open
Philipp Oeser wants to merge 2 commits from lichtwerk/blender:108722 into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Member

Removing the layer would leave the ruler gizmos on screen, only way to
update was changing to another tool and back. Now remove all gizmo ruler
items when removing the ruler annotation layer.

Also add a proper notifier that grease pencil was edited (this way we
also get immediate update when a ruler annotation layer was added --
which was also missing).

Could go into 3.3 LTS

Removing the layer would leave the ruler gizmos on screen, only way to update was changing to another tool and back. Now remove all gizmo ruler items when removing the ruler annotation layer. Also add a proper notifier that grease pencil was edited (this way we also get immediate update when a ruler annotation layer was added -- which was also missing). Could go into 3.3 LTS
Philipp Oeser requested review from Campbell Barton 2023-06-08 12:40:07 +02:00
Philipp Oeser added this to the User Interface project 2023-06-08 12:40:13 +02:00
Philipp Oeser requested review from Harley Acheson 2023-06-09 10:48:57 +02:00
Campbell Barton reviewed 2023-06-20 09:28:57 +02:00
@ -332,2 +333,4 @@
}
if (gpl->flag & GP_LAYER_IS_RULER) {
ED_view3d_gizmo_ruler_remove_all(C);

Couldn't the gpl be passed to this function? it's possible there are multiple windows with different scenes active.

Some other ways to ensure rulers are valid could work too, e.g. refresh all rulers based on grease pencil data, but I don't think there is much/any advantage in this.

Couldn't the `gpl` be passed to this function? it's possible there are multiple windows with different scenes active. Some other ways to ensure rulers are valid could work too, e.g. refresh all rulers based on grease pencil data, but I don't think there is much/any advantage in this.
Campbell Barton requested changes 2023-06-20 09:29:58 +02:00
Campbell Barton left a comment
Owner

Request minor change so this doesn't remove all rulers from all windows/scenes.

Request minor change so this doesn't remove all rulers from all windows/scenes.
Member

I load Factory settings, add two ruler measures over the default cube, then View / Annotations select that annotation layer and click the remove button.

This throws an exception for me in ED_view3d_gizmo_ruler_remove_all. A read access violation in the loop with ruler_item pointing at what looks like uninitialized data. The loop runs once and removes the first measure and dies in the second.

My gut feeling, without looking too deeply, is that this might be a case of unsafe list item removal. So you might want to start from the end rather than the front. Or (more likely) you might want to keep removing the first item while there is a first item without moving to the next item.

I load Factory settings, add **two** ruler measures over the default cube, then View / Annotations select that annotation layer and click the remove button. This throws an exception for me in ED_view3d_gizmo_ruler_remove_all. A read access violation in the loop with `ruler_item` pointing at what looks like uninitialized data. The loop runs once and removes the first measure and dies in the second. My gut feeling, without looking too deeply, is that this might be a case of unsafe list item removal. So you might want to start from the end rather than the front. Or (more likely) you might want to keep removing the first item while there is a first item without moving to the next item.
Philipp Oeser changed title from Fix #108722 : Measures not cleared when removing annotation layer to WIP: Fix #108722 : Measures not cleared when removing annotation layer 2023-06-26 12:18:51 +02:00
Philipp Oeser changed title from WIP: Fix #108722 : Measures not cleared when removing annotation layer to WIP: Fix #108722 : Measures not cleared when removing annotation layer 2023-06-26 12:19:28 +02:00
lichtwerk changed target branch from blender-v3.6-release to main 2023-06-26 12:19:35 +02:00
Philipp Oeser force-pushed 108722 from af08a83c05 to 182a8f3854 2023-06-26 12:37:46 +02:00 Compare
Philipp Oeser added 1 commit 2023-06-26 14:05:31 +02:00
Author
Member

I load Factory settings, add two ruler measures over the default cube, then View / Annotations select that annotation layer and click the remove button.

This throws an exception for me in ED_view3d_gizmo_ruler_remove_all. A read access violation in the loop with ruler_item pointing at what looks like uninitialized data. The loop runs once and removes the first measure and dies in the second.

My gut feeling, without looking too deeply, is that this might be a case of unsafe list item removal. So you might want to start from the end rather than the front. Or (more likely) you might want to keep removing the first item while there is a first item without moving to the next item.

That shoul be fixed with the last update, thx noting.

> I load Factory settings, add **two** ruler measures over the default cube, then View / Annotations select that annotation layer and click the remove button. > > This throws an exception for me in ED_view3d_gizmo_ruler_remove_all. A read access violation in the loop with `ruler_item` pointing at what looks like uninitialized data. The loop runs once and removes the first measure and dies in the second. > > My gut feeling, without looking too deeply, is that this might be a case of unsafe list item removal. So you might want to start from the end rather than the front. Or (more likely) you might want to keep removing the first item while there is a first item without moving to the next item. That shoul be fixed with the last update, thx noting.
Author
Member

Request minor change so this doesn't remove all rulers from all windows/scenes.

Sorry, I cant seem to be able to repro this, if I have multiple windows with different scenes (and different rulers), the rulers dont seem to be removed from all windows/scenes?

> Request minor change so this doesn't remove all rulers from all windows/scenes. Sorry, I cant seem to be able to repro this, if I have multiple windows with different scenes (and different rulers), the rulers dont seem to be removed from all windows/scenes?
Philipp Oeser changed title from WIP: Fix #108722 : Measures not cleared when removing annotation layer to Fix #108722 : Measures not cleared when removing annotation layer 2023-06-26 14:08:35 +02:00
Member

@lichtwerk - That should be fixed with the last update

Yes, works great!

Campbell: Couldn't the gpl be passed to this function? it's possible there are multiple windows with different scenes active
Phillip: Sorry, I cant seem to be able to repro this

I think that issue is that ED_view3d_gizmo_ruler_remove_all does not remove all. It is removing the ruler_items in the gizmo_map of the current region only. It might be more clear if a region is passed to it and the function renamed?

> @lichtwerk - That should be fixed with the last update Yes, works great! > Campbell: Couldn't the gpl be passed to this function? it's possible there are multiple windows with different scenes active > Phillip: Sorry, I cant seem to be able to repro this I _think_ that issue is that `ED_view3d_gizmo_ruler_remove_all` does not remove all. It is removing the ruler_items in the gizmo_map of the current region only. It might be more clear if a region is passed to it and the function renamed?
Member

@lichtwerk

Is there anything you need or anything I can do to assist with this? This bug fix is still needed.

I still think that the active region should be passed to ED_view3d_gizmo_ruler_remove_all (and that function renamed), which would both make it more clear that it is only clearing the ruler data from that one region's gizmo_map, not all of them. I think that would address Campbell's comments.

@lichtwerk Is there anything you need or anything I can do to assist with this? This bug fix is still needed. I still think that the active region should be passed to `ED_view3d_gizmo_ruler_remove_all` (and that function renamed), which would both make it more clear that it is only clearing the ruler data from that one region's gizmo_map, not all of them. I think that would address Campbell's comments.
This pull request has changes conflicting with the target branch.
  • source/blender/editors/gpencil_legacy/gpencil_data.c
  • source/blender/editors/include/ED_view3d.h

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 108722:lichtwerk-108722
git checkout lichtwerk-108722
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#108749
No description provided.