Error reporting in modifiers #101091

Open
opened 2022-09-15 16:18:51 +02:00 by Kévin Dietrich · 25 comments

D11591: Alembic: import arbitrary attributes adds some error reporting for attribute reading. It would be nice to formalize this, and extend it to be applicable in other areas, Alembic I/O or otherwise.

One area of improvement would be to stop outputting to the console while telling users to look it: on some platform, or depending on how Blender was started, there may not be a console readily available, and Blender would need to be restarted with a console.

This can fixed by using ReportLists where applicable.

Further, modifiers should have the ability to carry multiple error messages as multiple things can go wrong (e.g. if multiple attributes could not be imported, we should have one error per attribute). This would be the responsability of modifier type. D15492: Modifiers: add a callback to copy the error message introduces some API for modifiers to manage their own errors.


Discussion summary

Rather than D15492, extend ModifierData with an optional ReportList* which would help differentiate between info/warning/error, and have it all displayed in the UI generically.

See P3197 for a quick implementation. Here is an example, based on D11591: Alembic: import arbitrary attributes:

Capture d’écran_2022-09-15_20-07-07.png

[D11591: Alembic: import arbitrary attributes](https://archive.blender.org/developer/D11591) adds some error reporting for attribute reading. It would be nice to formalize this, and extend it to be applicable in other areas, Alembic I/O or otherwise. One area of improvement would be to stop outputting to the console while telling users to look it: on some platform, or depending on how Blender was started, there may not be a console readily available, and Blender would need to be restarted with a console. This can fixed by using `ReportLists` where applicable. Further, modifiers should have the ability to carry multiple error messages as multiple things can go wrong (e.g. if multiple attributes could not be imported, we should have one error per attribute). This would be the responsability of modifier type. [D15492: Modifiers: add a callback to copy the error message](https://archive.blender.org/developer/D15492) introduces some API for modifiers to manage their own errors. ---------------- **Discussion summary** Rather than [D15492](https://archive.blender.org/developer/D15492), extend `ModifierData` with an optional `ReportList*` which would help differentiate between info/warning/error, and have it all displayed in the UI generically. See [P3197](https://archive.blender.org/developer/P3197.txt) for a quick implementation. Here is an example, based on [D11591: Alembic: import arbitrary attributes](https://archive.blender.org/developer/D11591): ![Capture d’écran_2022-09-15_20-07-07.png](https://archive.blender.org/developer/F13496432/Capture_d_écran_2022-09-15_20-07-07.png)
Author
Member

Added subscriber: @kevindietrich

Added subscriber: @kevindietrich

Added subscriber: @brecht

Added subscriber: @brecht

I think modifier could get a optional ReportList* instead of a const char* error, and then the modifier UI can show them with the appropriate icon for info/warning/error (same as the status bar for operators).

Is D15492 mainly intended to display the error message in the attribute remapping panel rather than at the bottom of the modifier? I can see how that would avoid the error being scrolled out of view, but not sure it's worth doing something custom per modifier like that.

I think modifier could get a optional `ReportList*` instead of a `const char* error`, and then the modifier UI can show them with the appropriate icon for info/warning/error (same as the status bar for operators). Is [D15492](https://archive.blender.org/developer/D15492) mainly intended to display the error message in the attribute remapping panel rather than at the bottom of the modifier? I can see how that would avoid the error being scrolled out of view, but not sure it's worth doing something custom per modifier like that.
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

If we were further along in the project of converting modifiers to nodes, I would suggest that we skip these complications, since the node warning system already supports these features.
Because Alembic import isn't a node, we can't rely on that though, so this seems reasonable. I just wanted to mention that because in the future this system should become unnecessary.

If we were further along in the project of converting modifiers to nodes, I would suggest that we skip these complications, since the node warning system already supports these features. Because Alembic import isn't a node, we can't rely on that though, so this seems reasonable. I just wanted to mention that because in the future this system should become unnecessary.
Author
Member

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren
Author
Member

In #101091#1417726, @brecht wrote:
I think modifier could get a optional ReportList* instead of a const char* error, and then the modifier UI can show them with the appropriate icon for info/warning/error (same as the status bar for operators).

Sounds like a good idea.

Is D15492 mainly intended to display the error message in the attribute remapping panel rather than at the bottom of the modifier? I can see how that would avoid the error being scrolled out of view, but not sure it's worth doing something custom per modifier like that.

No, it was because I added some logic specific to the MeshSequenceCache error inside of BKE_object_sync_to_original in D11591 to copy the error message, so @dr.sybren asked to add a callback to modifiers for that, to keep specific things out of generic places, and split the change in a separate patch.

The error message is actually displayed at the top of the modifier for some reason. I put it there because elsewhere was not working, but I don't remember why.

> In #101091#1417726, @brecht wrote: > I think modifier could get a optional ReportList* instead of a const char* error, and then the modifier UI can show them with the appropriate icon for info/warning/error (same as the status bar for operators). Sounds like a good idea. > Is [D15492](https://archive.blender.org/developer/D15492) mainly intended to display the error message in the attribute remapping panel rather than at the bottom of the modifier? I can see how that would avoid the error being scrolled out of view, but not sure it's worth doing something custom per modifier like that. No, it was because I added some logic specific to the `MeshSequenceCache` error inside of `BKE_object_sync_to_original` in [D11591](https://archive.blender.org/developer/D11591) to copy the error message, so @dr.sybren asked to add a callback to modifiers for that, to keep specific things out of generic places, and split the change in a separate patch. The error message is actually displayed at the top of the modifier for some reason. I put it there because elsewhere was not working, but I don't remember why.

In #101091#1417729, @kevindietrich wrote:
No, it was because I added some logic specific to the MeshSequenceCache error inside of BKE_object_sync_to_original in D11591 to copy the error message, so @dr.sybren asked to add a callback to modifiers for that, to keep specific things out of generic places, and split the change in a separate patch.

Why was the error not just put in ModifierData.error then?

> In #101091#1417729, @kevindietrich wrote: > No, it was because I added some logic specific to the `MeshSequenceCache` error inside of `BKE_object_sync_to_original` in [D11591](https://archive.blender.org/developer/D11591) to copy the error message, so @dr.sybren asked to add a callback to modifiers for that, to keep specific things out of generic places, and split the change in a separate patch. Why was the error not just put in `ModifierData.error` then?
Author
Member

In #101091#1417731, @brecht wrote:
Why was the error not just put in ModifierData.error then?

Unit tests were failing (it is mentioned in the patch description). Those errors are recoverable with the remapping system, so they are not really errors that should make unit tests fail (I am talking about added unit tests, not existing ones).

> In #101091#1417731, @brecht wrote: > Why was the error not just put in `ModifierData.error` then? Unit tests were failing (it is mentioned in the patch description). Those errors are recoverable with the remapping system, so they are not really errors that should make unit tests fail (I am talking about added unit tests, not existing ones).

Ah ok, then using ReportList* to distinguish between info/warning/error may be a good fit.

Regarding duplication with geometry nodes, I'm hoping that eventually we can get logs from modifiers, nodes, depsgraph, render all into the info editor. And so for that reason I think moving in the direction of using ReportList more makes sense, and especially here where code is shared with operators that already use it.

Ah ok, then using `ReportList*` to distinguish between info/warning/error may be a good fit. Regarding duplication with geometry nodes, I'm hoping that eventually we can get logs from modifiers, nodes, depsgraph, render all into the info editor. And so for that reason I think moving in the direction of using `ReportList` more makes sense, and especially here where code is shared with operators that already use it.
Author
Member

So we are on the same page, here is what I quickly did (based on my alembic branch): P3197

And the result (2 attributes fail reading out of 13):
Capture d’écran_2022-09-15_20-07-07.png

So we are on the same page, here is what I quickly did (based on my alembic branch): [P3197](https://archive.blender.org/developer/P3197.txt) And the result (2 attributes fail reading out of 13): ![Capture d’écran_2022-09-15_20-07-07.png](https://archive.blender.org/developer/F13496432/Capture_d_écran_2022-09-15_20-07-07.png)

Added subscriber: @Rowan-Ibbeken

Added subscriber: @Rowan-Ibbeken

How would this deal when there are many errors? Is there some way that flooding the UI is prevented? Or can messages be grouped somehow? Was the UI module involved in this change?

How would this deal when there are many errors? Is there some way that flooding the UI is prevented? Or can messages be grouped somehow? Was the UI module involved in this change?
Author
Member

In #101091#1428616, @dr.sybren wrote:
How would this deal when there are many errors? Is there some way that flooding the UI is prevented? Or can messages be grouped somehow? Was the UI module involved in this change?

The UI module was not involved with this change, although a couple core UI member (according to the #user_interface project page) have commented here.

For many errors, I guess we could use a dedicated panel which will only be displayed when there are some errors, and whose header will indicate that are errors. Although, we would need a dedicated error panel for each modifier type, if I understand how subpanels are setup via their parent id. I don't about other grouping mechanism which could be used.

> In #101091#1428616, @dr.sybren wrote: > How would this deal when there are many errors? Is there some way that flooding the UI is prevented? Or can messages be grouped somehow? Was the UI module involved in this change? The UI module was not involved with this change, although a couple core UI member (according to the #user_interface project page) have commented here. For many errors, I guess we could use a dedicated panel which will only be displayed when there are some errors, and whose header will indicate that are errors. Although, we would need a dedicated error panel for each modifier type, if I understand how subpanels are setup via their parent id. I don't about other grouping mechanism which could be used.

In #101091#1417748, @brecht wrote:
Ah ok, then using ReportList* to distinguish between info/warning/error may be a good fit.

I like that option too.

Regarding duplication with geometry nodes, I'm hoping that eventually we can get logs from modifiers, nodes, depsgraph, render all into the info editor.

Messages like these IMO don't belong in the info editor, at least not if it would behave like printing to stdout. Since they're produced on every evaluation of the modifier, that could get spammy really quickly.

In #101091#1438328, @kevindietrich wrote:
For many errors, I guess we could use a dedicated panel which will only be displayed when there are some errors, and whose header will indicate that are errors. Although, we would need a dedicated error panel for each modifier type, if I understand how subpanels are setup via their parent id. I don't about other grouping mechanism which could be used.

That sounds a bit tricky, also in terms of UI/UX. Maybe just showing the first N errors and then collapse the rest under a "show more" button would be enough.

> In #101091#1417748, @brecht wrote: > Ah ok, then using `ReportList*` to distinguish between info/warning/error may be a good fit. I like that option too. > Regarding duplication with geometry nodes, I'm hoping that eventually we can get logs from modifiers, nodes, depsgraph, render all into the info editor. Messages like these IMO don't belong in the info editor, at least not if it would behave like printing to `stdout`. Since they're produced on every evaluation of the modifier, that could get spammy really quickly. > In #101091#1438328, @kevindietrich wrote: > For many errors, I guess we could use a dedicated panel which will only be displayed when there are some errors, and whose header will indicate that are errors. Although, we would need a dedicated error panel for each modifier type, if I understand how subpanels are setup via their parent id. I don't about other grouping mechanism which could be used. That sounds a bit tricky, also in terms of UI/UX. Maybe just showing the first N errors and then collapse the rest under a "show more" button would be enough.

In #101091#1444452, @dr.sybren wrote:
Messages like these IMO don't belong in the info editor, at least not if it would behave like printing to stdout. Since they're produced on every evaluation of the modifier, that could get spammy really quickly.

The main use case is users being able to see all warnings/errors in the current scene and fix them. For that indeed it should not work like stdout, but rather retain and replace the errors somehow per object, per depsgraph for cyclic dependency errors, etc.

I think this would work well as a new mode in the info editor, distinct from the current operator/property logging that works like stdout. And then you can imagine additional modes like render, viewport, memory usage, etc. I don't think we need a distinct editor for each.

> In #101091#1444452, @dr.sybren wrote: > Messages like these IMO don't belong in the info editor, at least not if it would behave like printing to `stdout`. Since they're produced on every evaluation of the modifier, that could get spammy really quickly. The main use case is users being able to see all warnings/errors in the current scene and fix them. For that indeed it should not work like stdout, but rather retain and replace the errors somehow per object, per depsgraph for cyclic dependency errors, etc. I think this would work well as a new mode in the info editor, distinct from the current operator/property logging that works like stdout. And then you can imagine additional modes like render, viewport, memory usage, etc. I don't think we need a distinct editor for each.

👍 I can certainly see that working!

:+1: I can certainly see that working!
Author
Member

Also worth noting, there used to be a GSOC project that could be revived to extend the info editor: #78164 (GSoC 2020 Info Editor Improvements), with similar functionalities as the ones discussed here.

Also worth noting, there used to be a GSOC project that could be revived to extend the info editor: #78164 (GSoC 2020 Info Editor Improvements), with similar functionalities as the ones discussed here.

D15492 mentions this task has no clear conclusion. What I guess is remaining is how to deal with the UI in case of many reports?

I think a panel is the proper solution, I don't think we need a custom "show more" mechanism.

It seems reasonable to register an error subpanel for every modifier type, or all modifiers types that potentially report many errors.

We could support panel types having multiple parents, it's mainly the Python API that is not compatible with this. Panel types have a list of child panel types, and the subpanel type itself only needs to know if it has a parent or not. Not sure it's worth getting into this compared to just registering a panel for the handful of modifiers that need it though.

[D15492](https://archive.blender.org/developer/D15492) mentions this task has no clear conclusion. What I guess is remaining is how to deal with the UI in case of many reports? I think a panel is the proper solution, I don't think we need a custom "show more" mechanism. It seems reasonable to register an error subpanel for every modifier type, or all modifiers types that potentially report many errors. We could support panel types having multiple parents, it's mainly the Python API that is not compatible with this. Panel types have a list of child panel types, and the subpanel type itself only needs to know if it has a parent or not. Not sure it's worth getting into this compared to just registering a panel for the handful of modifiers that need it though.
Member

The problem with adding a subpanel for errors is that it isn't possible to display a sub-panel conditionally based on some modifier data, due to the way modifier panels are created.
If we're okay with the subpanel always displaying, that's okay, but that doesn't seem great to me.

Generally I'm not sure that it's worth putting that much effort into this right now, since modifiers will generally be implemented as nodes in the future, and in cases with many error messages, it would probably make more sense to go there instead anyway.

The problem with adding a subpanel for errors is that it isn't possible to display a sub-panel conditionally based on some modifier data, due to the way modifier panels are created. If we're okay with the subpanel always displaying, that's okay, but that doesn't seem great to me. Generally I'm not sure that it's worth putting that much effort into this right now, since modifiers will generally be implemented as nodes in the future, and in cases with many error messages, it would probably make more sense to go there instead anyway.

Don't panels like that have a poll() function?

My main concern is to get the USD/Alembic improvements landed in time for Blender 3.5, since this is something users requests a lot. Error reporting in the existing modifier is not any better so I would not even consider improving that a blocker personally.

Don't panels like that have a `poll()` function? My main concern is to get the USD/Alembic improvements landed in time for Blender 3.5, since this is something users requests a lot. Error reporting in the existing modifier is not any better so I would not even consider improving that a blocker personally.
Member

I definitely don't consider this blocking the Alembic/USD import patches. They're totally unrelated implementation-wise.
We shouldn't try to bundle these things together arbitrarily, holding important features like that hostage.


Don't panels like that have a poll() function?

They do, but it takes the PanelType instead of the Panel unfortunately, so knowing which modifier it applies to will be very hacky at best.

I definitely don't consider this blocking the Alembic/USD import patches. They're totally unrelated implementation-wise. We shouldn't try to bundle these things together arbitrarily, holding important features like that hostage. --- >Don't panels like that have a poll() function? They do, but it takes the `PanelType` instead of the `Panel` unfortunately, so knowing which modifier it applies to will be very hacky at best.

I assumed there would be a "modifier" entry in the context that it would look at, not the panel.

I assumed there would be a `"modifier"` entry in the context that it would look at, not the panel.
Member

There isn't currently. Maybe that would work, though I'm not exactly sure where that would be set, based on where PanelType::poll is called.
Anyway, I think it's fair to say it's not trivial, whatever that means for planning an implementation.

There isn't currently. Maybe that would work, though I'm not exactly sure where that would be set, based on where `PanelType::poll` is called. Anyway, I think it's fair to say it's not trivial, whatever that means for planning an implementation.
Author
Member

In #101091#1460589, @brecht wrote:
My main concern is to get the USD/Alembic improvements landed in time for Blender 3.5, since this is something users requests a lot. Error reporting in the existing modifier is not any better so I would not even consider improving that a blocker personally.

Only the Alembic attributes import patch depends on this. The Geometry Set patch depends in turn on the attributes one, but it's just about loading attributes for Curves and PointCloud. This little dependency can removed and either added to the other patch, or committed separately.

Then for the attributes patch, I could remove the dependency on this error reporting by revising the unit tests. Besides UI improvement, as noted in the past, there was the need to differentiate between various types of errors so we don't abort the unit tests while testing "recoverable errors" via the attribute remapping system.

In #101091#1460586, @HooglyBoogly wrote:
The problem with adding a subpanel for errors is that it isn't possible to display a sub-panel conditionally based on some modifier data, due to the way modifier panels are created.
If we're okay with the subpanel always displaying, that's okay, but that doesn't seem great to me.

We already show empty (sub)panels at least in the MeshSequenceCache modifier when there is no CacheFile data block set (for the same problem of not being able to show them conditionally). So this is not unprecedented.

In #101091#1460586, @HooglyBoogly wrote:
Generally I'm not sure that it's worth putting that much effort into this right now, since modifiers will generally be implemented as nodes in the future, and in cases with many error messages, it would probably make more sense to go there instead anyway.

I don't know about the timeline, but unless this happens in the next few months and all modifiers are simply gone, I think it does make sense to spend a bit of time improving the UI/UX here.

> In #101091#1460589, @brecht wrote: > My main concern is to get the USD/Alembic improvements landed in time for Blender 3.5, since this is something users requests a lot. Error reporting in the existing modifier is not any better so I would not even consider improving that a blocker personally. Only the Alembic attributes import patch depends on this. The Geometry Set patch depends in turn on the attributes one, but it's just about loading attributes for Curves and PointCloud. This little dependency can removed and either added to the other patch, or committed separately. Then for the attributes patch, I could remove the dependency on this error reporting by revising the unit tests. Besides UI improvement, as noted in the past, there was the need to differentiate between various types of errors so we don't abort the unit tests while testing "recoverable errors" via the attribute remapping system. > In #101091#1460586, @HooglyBoogly wrote: > The problem with adding a subpanel for errors is that it isn't possible to display a sub-panel conditionally based on some modifier data, due to the way modifier panels are created. > If we're okay with the subpanel always displaying, that's okay, but that doesn't seem great to me. We already show empty (sub)panels at least in the `MeshSequenceCache` modifier when there is no `CacheFile` data block set (for the same problem of not being able to show them conditionally). So this is not unprecedented. > In #101091#1460586, @HooglyBoogly wrote: > Generally I'm not sure that it's worth putting that much effort into this right now, since modifiers will generally be implemented as nodes in the future, and in cases with many error messages, it would probably make more sense to go there instead anyway. I don't know about the timeline, but unless this happens in the next few months and all modifiers are simply gone, I think it does make sense to spend a bit of time improving the UI/UX here.
Iliya Katushenock removed the
Status
Needs Triage
label 2023-08-24 17:33:12 +02: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
5 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#101091
No description provided.