Crash in sculpt mode at trying to rotate after a cancelled rotate #74205
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#74205
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
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?
System Information
Operating system: Darwin-18.7.0-x86_64-i386-64bit 64 Bits
Graphics card: Intel(R) HD Graphics 6000 Intel Inc. 4.1 INTEL-12.10.12
Blender Version
Broken: version: 2.83 (sub 5), branch: master, commit date: 2020-02-25 17:16, hash:
9cc5af64c6
Exact steps for others to reproduce the error
Added subscriber: @ankitm
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @rjg
This comment was removed by @rjg
Added subscriber: @PabloDobarro
printf("%d", ustack->step_init == NULL);
, it gives1
and0
and then crash.^_^'
?This comment was removed by @rjg
@ankitm Sorry, I misread the assert statement. The assert was triggered because it wasn't
NULL
. The state that you've reported is the one that causes the crash. I removed my previous comments in order to avoid any confusion.Added subscriber: @Asad-ullahKhan
I think I can add some info. For starters, this happens when any transform is applied, not just rotate. The other operations (translate, scale, etc.) on the left toolbar (where all the sculpting tools are) all the way down also cause this problem. You can manually click and drag to eg. translate, then without releasing drag, hit escape, and then drag again (or any other operation) for the assertion to fail. Now, for the diagnosis, I believe the culprit is in this callstack, whose sequence is only called when the rotate/translate/scale commands are cancelled with escape:
recalcData
is called when the sculpting operations are done, but when they are cancelled, only the rotate etc. operations go through the stack above. The other sculpt options go through one like this:The last one uses
sculpt_undo_push_end
, which I think is the key to the issue. Probably need a call toED_sculpt_undo_geometry_end(Object *ob)
somewhere, but I don't know how/where to put it. There is alsoED_sculpt_init_transform(C)
that might be a solution.Ok, it looks like there is a matching call to
ED_sculpt_end_transform(C);
at line 1843 inblender/source/blender/editors/transform/transform.c
(saveTrasform
), but it does not reset thestep_init
becausewm->op_undo_depth == 0
has to be true (line 1143blender/source/blender/editors/sculpt_paint/sculpt_undo.c
insculpt_undo_push_end(void)
) but in this case it is equal to 1. Forcefully setting it to 0 does not work (segfault later in code). Looks like it is set 0 after the call in line 2004 inblender/source/blender/windowmanager/intern/wm_event_system.c
I have a hack that seems to work, maybe someone who knows more can make it better. File
blender/source/blender/editors/transform/transform.c
insaveTransform
lines 1842-1851:The core issue is that
wm->op_undo_depth
is supposed to be 0 here, but it isn't, so I just force it. The reason it is not zero is because of line 1988 ofblender/source/blender/windowmanager/intern/wm_event_system.c
(wm_handler_operator_call
) which is:For whatever reason, canceling while doing a transform has
OPTYPE_UNDO
. This (I think) is the true cause of the issue.you could take some inspiration from the fact that the (hit R, move mouse ,hit escape, hit R again) <- this doesn't cause crash in layout mode. examine the trace maybe ?
also submitting a patch increases chances of "better implementation" comments. (:
Haha, that is true, I just wanted to get at least a slightly less hacky solution before I submitted anything. Also, I'm not familiar with layout mode, but the way I found this solution is by first looking at what happens in Object mode, and then realizing that sculpt mode does undos in a completely different way. Object mode cancels never touch
stack_init
, whereas sculpt does for all operations. There are also many other differences and also comments that say sculpt mode does undos differently. Essentially sculpt mode does all its ops differently (which is fine because it handles it own stuff) but for rotates etc. it borrows the other ones, which all setOPTYPE_UNDO
, which it explicitly doesn't:line 8355
blender/source/blender/editors/sculpt_paint/sculpt.c
SCULPT_OT_brush_stroke
Adding
OPTYPE_UNDO
and removing conditionsculpt_undo_push_end(void)
is another solution, but then you have to hit Ctrl+Z a few times before it actually undoes anything :/Should I bother submitting either of these?
Ahh I'll submit my initial solution, alternative is just too glitchy having to hit Ctrl+z multiple times to undo. Revision here: https://developer.blender.org/D7018
Removed subscriber: @Asad-ullahKhan
Added subscriber: @Asad-ullahKhan
This issue was referenced by
1a69384e76
Changed status from 'Confirmed' to: 'Resolved'