Curve with bevel radius appears black after using Redo Panel (undo issue). #85807

Open
opened 2021-02-20 01:15:43 +01:00 by Juan Hernandez · 9 comments

System Information
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.40

Blender Version
Broken: version: 2.91.2, branch: master, commit date: 2021-01-19 16:15, hash: 5be9ef4177
(also broken in 2.83, 2.90 and unreleased 2.92)
Worked: 2.82 (pre-undo improvements I believe)

Short description of error
Curve with bevel radius turns black if modifying the property through an operator's redo panel (posibly related to Undo algorithm).

swPM4.gif

Exact steps for others to reproduce the error

  • Run the attached script from Blender's Text Editor.
  • Make sure Undo Legacy is OFF.
  • From the search menu run the "black curve test" operator TWICE (this will create two curves).
  • Expand the redo panel(F9) and tweak the bevel radius.

Result: one of the curves turns black in the viewport.

Known Fixes:

  • Enabling Undo Legacy in the Preferences fixes and prevents the issue from happening.
  • Adding bpy.ops.ed.undo_push() in the script's Invoke method.
  • Toggling IN and OUT of Edit Mode.
  • Using bpy.ops to create the bezier curve instead of the manual approach seen in the attatched script.
  • Run the operator once, then click on the viewport to select the curve before running the operator the second time. Not fully tested but having some extra step in between operator runs seems to prevent this bug.

black_curve_script.txt

**System Information** Operating system: Windows-10-10.0.18362-SP0 64 Bits Graphics card: GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 461.40 **Blender Version** Broken: version: 2.91.2, branch: master, commit date: 2021-01-19 16:15, hash: `5be9ef4177` (also broken in 2.83, 2.90 and unreleased 2.92) Worked: 2.82 (pre-undo improvements I believe) **Short description of error** Curve with bevel radius turns black if modifying the property through an operator's redo panel (posibly related to Undo algorithm). ![swPM4.gif](https://archive.blender.org/developer/F9819554/swPM4.gif) **Exact steps for others to reproduce the error** - Run the attached script from Blender's Text Editor. - Make sure Undo Legacy is OFF. - From the search menu run the "black curve test" operator TWICE (this will create two curves). - Expand the redo panel(F9) and tweak the bevel radius. Result: one of the curves turns black in the viewport. **Known Fixes:** - Enabling Undo Legacy in the Preferences fixes and prevents the issue from happening. - Adding **bpy.ops.ed.undo_push()** in the script's Invoke method. - Toggling IN and OUT of Edit Mode. - Using bpy.ops to create the bezier curve instead of the manual approach seen in the attatched script. - Run the operator once, then click on the viewport to select the curve before running the operator the second time. Not fully tested but having some extra step in between operator runs seems to prevent this bug. [black_curve_script.txt](https://archive.blender.org/developer/F9819570/black_curve_script.txt)
Author

Added subscriber: @ArmoredWolf

Added subscriber: @ArmoredWolf

Added subscriber: @mano-wii

Added subscriber: @mano-wii

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'

In my case the curve turns flat gray:
image.png

The python code is simple and I haven't found anything that explains that behavior.
I'm not sure if the problem is really in the Undo system, but I'm confirming and tagging the #core project for now.

In my case the curve turns flat gray: ![image.png](https://archive.blender.org/developer/F9827859/image.png) The python code is simple and I haven't found anything that explains that behavior. I'm not sure if the problem is really in the Undo system, but I'm confirming and tagging the #core project for now.
Added subscribers: @fclem, @Sergey, @Jeroen-Bakker, @dr.sybren, @mont29

Think this is an update flag issue... But am still trying to figure out what exactly is going on here, this is fairly weird. Could also be a missing bit in depsgraph update?

Basically, the first curve object (the one turning black) gets ID_RECALC_GEOMETRY | ID_RECALC_SHADING | ID_RECALC_COPY_ON_WRITE recalc flags in DEG eval just after the undo, and shading is not updated. If we add ID_RECALC_TRANSFORM to it, shading does get updated and there is no more black object.

Not sure what exactly is the issue here, to me it makes little sense that you'd have to use TRANSFORM update flag to get shading updated? Would like to get @Jeroen-Bakker and @fclem input here, and maybe also @Sergey or @dr.sybren for the depsgraph side of things, before diving deeper in the problem.

Think this is an update flag issue... But am still trying to figure out what exactly is going on here, this is fairly weird. Could also be a missing bit in depsgraph update? Basically, the first curve object (the one turning black) gets `ID_RECALC_GEOMETRY | ID_RECALC_SHADING | ID_RECALC_COPY_ON_WRITE` `recalc` flags in DEG eval just after the undo, and shading is not updated. If we add `ID_RECALC_TRANSFORM` to it, shading does get updated and there is no more black object. Not sure what exactly is the issue here, to me it makes little sense that you'd have to use `TRANSFORM` update flag to get shading updated? Would like to get @Jeroen-Bakker and @fclem input here, and maybe also @Sergey or @dr.sybren for the depsgraph side of things, before diving deeper in the problem.

Note that BKE_object_add_only_object (which is called from RNA object creation) does not set any recalc flag, while higher-level functions like BKE_object_add_for_data (which gets called from Editor code, including operators, when creating a new object) does flag new object with ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION...

From what I can tell, rna_Main_objects_new is not doing any recalc tagging at all actually? Looks suspicious...

Note that `BKE_object_add_only_object` (which is called from RNA object creation) does not set any `recalc` flag, while higher-level functions like `BKE_object_add_for_data` (which gets called from Editor code, including operators, when creating a new object) does flag new object with `ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION`... From what I can tell, `rna_Main_objects_new` is not doing any `recalc` tagging at all actually? Looks suspicious...

Can confirm that adding a DEG_id_tag_update_ex(bmain, &ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); to rna_Main_objects_new also fixes the issue, think all those RNA new ID functions should do some recalc tagging in fact?

Can confirm that adding a `DEG_id_tag_update_ex(bmain, &ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);` to `rna_Main_objects_new` also fixes the issue, think all those RNA `new` ID functions should do some `recalc` tagging in fact?

New objects in depsgraph are supposed to be fully evaluated. As in, in theory, you don't need to tag individual flags after adding new object to depsgraph, depsgraph will decide it for you.

One possible thing thought, is that depsgraph doesn't really handle shading itself: shading is done by the draw manager.

So as a quick fix for annoying issue doing tags is acceptable (although, a bit weird and maybe need ID_RECALC_SHADING in this case?). But it feels that the issue might be a bit deeper in the way how the draw manager is listening to changes and reacts to them.

But it depends on whether it is draw manager is not doing something, or whether there is no data ready for the draw manager. This is not very clear from the explanations here.

New objects in depsgraph are supposed to be fully evaluated. As in, in theory, you don't need to tag individual flags after adding new object to depsgraph, depsgraph will decide it for you. One possible thing thought, is that depsgraph doesn't really handle shading itself: shading is done by the draw manager. So as a quick fix for annoying issue doing tags is acceptable (although, a bit weird and maybe need `ID_RECALC_SHADING` in this case?). But it feels that the issue might be a bit deeper in the way how the draw manager is listening to changes and reacts to them. But it depends on whether it is draw manager is not doing something, or whether there is no data ready for the draw manager. This is not very clear from the explanations here.
Philipp Oeser removed the
Interest
Core
label 2023-02-09 14:43:13 +01: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
4 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#85807
No description provided.