Fix #116734: Measure Tool Undo crash. #116751

Merged
Bastien Montagne merged 3 commits from mont29/blender:tmp-116734 into main 2024-01-12 11:13:51 +01:00

From my understanding, existing ruler code would add new (GP) ID and
link it to current scene outside of any depsgraph tagging and/or undo
step writing?

From my understanding, existing ruler code would add new (GP) ID and link it to current scene outside of any depsgraph tagging and/or undo step writing?
Bastien Montagne added 1 commit 2024-01-03 17:25:21 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
303b912960
Fix #116734: Measure Tool Undo crash.
From my understanding, existing ruler code would add new (GP) ID and
link it to current scene outside of any depsgraph tagging and/or undo
step writing?
Author
Owner

@blender-bot build

@blender-bot build

It appears that tweak the ruler ("GIZMOGROUP_OT_gizmo_tweak") is not expected to write Undo step. So just making sure Layer GP was added with "VIEW3D_GT_ruler_item" seems good enough imho.

It appears that tweak the ruler ("GIZMOGROUP_OT_gizmo_tweak") is not expected to write Undo step. So just making sure Layer GP was added with "VIEW3D_GT_ruler_item" seems good enough imho.
Campbell Barton approved these changes 2024-01-11 11:48:17 +01:00
Campbell Barton left a comment
Owner

This works well, previously the new data-block wasn't account for by global-undo.

With the steps from #116734:

Before (also with Blender 3.6x which didn't crash):

Undo 3 Steps (*: active, #=applied, M=memfile-active, S=skip)
[  M ]   0 {0x60f000025ff8} type='Global Undo', name='Original'
[*   ]   1 {0x612000254bf8} type='Edit Mesh', name='Toggle Edit Mode'
[    ]   2 {0x612000447c78} type='Edit Mesh', name='Ruler Add'

With this PR applied:

Undo 4 Steps (*: active, #=applied, M=memfile-active, S=skip)
[*#M ]   0 {0x60f000179b98} type='Global Undo', name='Original'
[    ]   1 {0x6120007dadf8} type='Edit Mesh', name='Toggle Edit Mode'
[   S]   2 {0x60f00009b208} type='Global Undo', name='MemFile Internal (pre)'
[    ]   3 {0x612000647ef8} type='Edit Mesh', name='Ruler Add'

So this fix looks correct to me.

There is still the problem with measure tool undo steps not working in edit-mode but that's a more general issue.

This works well, previously the new data-block wasn't account for by global-undo. With the steps from #116734: Before (also with Blender 3.6x which didn't crash): ``` Undo 3 Steps (*: active, #=applied, M=memfile-active, S=skip) [ M ] 0 {0x60f000025ff8} type='Global Undo', name='Original' [* ] 1 {0x612000254bf8} type='Edit Mesh', name='Toggle Edit Mode' [ ] 2 {0x612000447c78} type='Edit Mesh', name='Ruler Add' ``` With this PR applied: ``` Undo 4 Steps (*: active, #=applied, M=memfile-active, S=skip) [*#M ] 0 {0x60f000179b98} type='Global Undo', name='Original' [ ] 1 {0x6120007dadf8} type='Edit Mesh', name='Toggle Edit Mode' [ S] 2 {0x60f00009b208} type='Global Undo', name='MemFile Internal (pre)' [ ] 3 {0x612000647ef8} type='Edit Mesh', name='Ruler Add' ``` So this fix looks correct to me. There is still the problem with measure tool undo steps not working in edit-mode but that's a more general issue.
@ -517,2 +517,3 @@
#define RULER_ID "RulerData3D"
static bool view3d_ruler_to_gpencil(bContext *C, wmGizmoGroup *gzgroup)
/* GP data creation has to happen before the undo step is stored. */

Worth referencing #116734.

Worth referencing #116734.
mont29 marked this conversation as resolved
@ -522,1 +524,4 @@
Scene *scene = CTX_data_scene(C);
if (scene->gpd == nullptr) {
scene->gpd = BKE_gpencil_data_addnew(bmain, "Annotations");
DEG_id_tag_update_ex(bmain, &scene->id, ID_RECALC_COPY_ON_WRITE);

Note why this is needed.

Note why this is needed.
Author
Owner

Not sure what you mean? We are creating a new ID, and linking it to another ID, so we need to tag the modified ID for update... This is done in thousands of places all over our codebase, I would not expect to have to document this.

Actually, I also forgot to tag for relations update here.

Not sure what you mean? We are creating a new ID, and linking it to another ID, so we need to tag the modified ID for update... This is done in thousands of places all over our codebase, I would not expect to have to document this. Actually, I also forgot to tag for relations update here.

Ah, no need then, I thought this might relate to undo (as tagging wasn't done before).

Ah, no need then, I thought this might relate to undo (as tagging wasn't done before).
ideasman42 marked this conversation as resolved
Bastien Montagne added 2 commits 2024-01-11 12:55:05 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
b3aa273464
Updates from review
Author
Owner

@blender-bot build

@blender-bot build
Campbell Barton approved these changes 2024-01-11 22:47:17 +01:00
Bastien Montagne merged commit da1ed32f76 into main 2024-01-12 11:13:51 +01:00
Bastien Montagne deleted branch tmp-116734 2024-01-12 11:13:53 +01:00
Sign in to join this conversation.
No reviewers
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#116751
No description provided.