Assert when using prop_tabs_enum #78575

Closed
opened 2020-07-03 16:21:46 +02:00 by Martijn Versteegh · 18 comments

System Information
Operating system: Linux-5.4.0-40-generic-x86_64-with-debian-bullseye-sid 64 Bits
Graphics card: GeForce GTX 760/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21

Blender Version
Broken: version: 2.90.0 Alpha, branch: master, commit date: 2020-07-03 10:56, hash: aab41401f9

Short description of error
Using [prop_tabs_enum ]] in an add-on results in an assert being triggered in ui_block_align_but_to_region ( https:*developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_align.c ). This happens because ui_but_align_opposite_to_area_align_get returns zero when called in template_ID_tabs ([ https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_templates.c | interface_templates.c ) for this UI element.

ce148716c8 introduced the prop_tabs_enum function with the described behavior.

Exact steps for others to reproduce the error

  1. Open the text editor
  2. Run the following script
  3. Open the scene properties
bl_info = {
    "name": "MWE T78575",
    "author": "Robert Guetzkow",
    "version": (1, 0),
    "blender": (2, 80, 0),
    "location": "Scene properties > Example tab",
    "description": "Minimum working example for T78575",
    "warning": "",
    "wiki_url": "https://developer.blender.org/T78575",
    "category": "3D View"}

import bpy


class ExampleProperties(bpy.types.PropertyGroup):
    enum: bpy.props.EnumProperty(items=[("id_0", "First", "Description of first entry", 0),
                                        ("id_1", "Second", "Description of second entry", 1),
                                        ("id_2", "Third", "Description of third entry", 2)],
                                 name="Mode",
                                 default="id_0")


class EXAMPLE_PT_panel(bpy.types.Panel):
    bl_label = "Example Panel"
    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout
        layout.prop_tabs_enum(context.scene.mwe_t78575, "enum")


classes = (ExampleProperties, EXAMPLE_PT_panel)


def register():
    for cls in classes:
        bpy.utils.register_class(cls)
    bpy.types.Scene.mwe_t78575 = bpy.props.PointerProperty(type=ExampleProperties)


def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)
    del bpy.types.Scene.mwe_t78575
**System Information** Operating system: Linux-5.4.0-40-generic-x86_64-with-debian-bullseye-sid 64 Bits Graphics card: GeForce GTX 760/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 435.21 **Blender Version** Broken: version: 2.90.0 Alpha, branch: master, commit date: 2020-07-03 10:56, hash: `aab41401f9` **Short description of error** Using [prop_tabs_enum ]] in an add-on results in an assert being triggered in `ui_block_align_but_to_region` ([[ https:*developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_align.c | interface_align.c ]]). This happens because `ui_but_align_opposite_to_area_align_get` returns zero when called in `template_ID_tabs` ([[ https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_templates.c | interface_templates.c ](https:*docs.blender.org/api/current/bpy.types.UILayout.html#bpy.types.UILayout.prop_tabs_enum)) for this UI element. ce148716c8 introduced the `prop_tabs_enum` function with the described behavior. **Exact steps for others to reproduce the error** 1. Open the text editor 2. Run the following script 3. Open the scene properties ``` bl_info = { "name": "MWE T78575", "author": "Robert Guetzkow", "version": (1, 0), "blender": (2, 80, 0), "location": "Scene properties > Example tab", "description": "Minimum working example for T78575", "warning": "", "wiki_url": "https://developer.blender.org/T78575", "category": "3D View"} import bpy class ExampleProperties(bpy.types.PropertyGroup): enum: bpy.props.EnumProperty(items=[("id_0", "First", "Description of first entry", 0), ("id_1", "Second", "Description of second entry", 1), ("id_2", "Third", "Description of third entry", 2)], name="Mode", default="id_0") class EXAMPLE_PT_panel(bpy.types.Panel): bl_label = "Example Panel" bl_space_type = "PROPERTIES" bl_region_type = "WINDOW" bl_context = "scene" def draw(self, context): layout = self.layout layout.prop_tabs_enum(context.scene.mwe_t78575, "enum") classes = (ExampleProperties, EXAMPLE_PT_panel) def register(): for cls in classes: bpy.utils.register_class(cls) bpy.types.Scene.mwe_t78575 = bpy.props.PointerProperty(type=ExampleProperties) def unregister(): for cls in classes: bpy.utils.unregister_class(cls) del bpy.types.Scene.mwe_t78575 ```
Author
Member

Added subscriber: @Baardaap

Added subscriber: @Baardaap

Added subscriber: @Foaly

Added subscriber: @Foaly

I cannot reproduce.
blender-2.90.0- 5a13f682ee -linux64

I cannot reproduce. blender-2.90.0- 5a13f682ee5f -linux64

Added subscriber: @rjg

Added subscriber: @rjg

I can't reproduce this with the same commit nor with the current master. For this error to occur, you would have to have an uiBut that doesn't fit in any of the alignment categories that are listed in ui_block_align_but_to_region .

I can't reproduce this with the same commit nor with the current master. For this error to occur, you would have to have an `uiBut` that doesn't fit in any of the alignment categories that are listed in [ui_block_align_but_to_region ](https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_align.c$367).
Author
Member

Strange. It's a straight debug build of master without any patches. I'll check if there's an addon causing this, I though I disabled them all, but maybe I overlooked one.

Strange. It's a straight debug build of master without any patches. I'll check if there's an addon causing this, I though I disabled them all, but maybe I overlooked one.
Author
Member

An add-on should't cause asserts I think? So then it would still be a bug?

An add-on should't cause asserts I think? So then it would still be a bug?
Author
Member

That's it. The assert is caused by this add-on

https://github.com/mrossini-ethz/camera-calibration-pvr.git

Which I forgot to disable.

Does this still count as a bug or is this considered a bug in the add-on?

That's it. The assert is caused by this add-on https://github.com/mrossini-ethz/camera-calibration-pvr.git Which I forgot to disable. Does this still count as a bug or is this considered a bug in the add-on?

@Baardaap I'll take a look. It depends on whether the Python API is used correctly.

@Baardaap I'll take a look. It depends on whether the Python API is used correctly.

@Baardaap Which version of the add-on are you using? There are two branches for 2.8 and a devel branch.

@Baardaap Which version of the add-on are you using? There are two branches for 2.8 and a devel branch.
Author
Member

I have 30d2682 from the blender-2.80 branch

I have 30d2682 from the blender-2.80 branch

This appear to be a bug in the add-on. Parts of the unfinished UI code has been disabled in commit ab9dfff41f7cb333c707f41052fc0c2c15ead9f5.

This appear to be a bug in the add-on. Parts of the unfinished UI code has been disabled in commit [ab9dfff41f7cb333c707f41052fc0c2c15ead9f5](https://github.com/mrossini-ethz/camera-calibration-pvr/commit/ab9dfff41f7cb333c707f41052fc0c2c15ead9f5).

The source of the issue appears to be layout.prop_tabs_enum(props, "perspective"). This appears to be a bug.

The API change was introduced in ce148716c8 which also added ui_but_align_opposite_to_area_align_get and modified template_ID_tabs (interface_templates.c ). Previously the alignment was assigned as:

const int but_align = (region->alignment == RGN_ALIGN_TOP) ? UI_BUT_ALIGN_DOWN : UI_BUT_ALIGN_TOP;

After the change it is:

const int but_align = ui_but_align_opposite_to_area_align_get(region);

ui_but_align_opposite_to_area_align_get may return zero, which happens in this case and results in the assert being triggered in ui_block_align_but_to_region (interface_align.c )

The source of the issue appears to be `layout.prop_tabs_enum(props, "perspective")`. This appears to be a bug. The API change was introduced in ce148716c8 which also added `ui_but_align_opposite_to_area_align_get` and modified `template_ID_tabs` ([interface_templates.c ](https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_templates.c)). Previously the alignment was assigned as: ``` const int but_align = (region->alignment == RGN_ALIGN_TOP) ? UI_BUT_ALIGN_DOWN : UI_BUT_ALIGN_TOP; ``` After the change it is: ``` const int but_align = ui_but_align_opposite_to_area_align_get(region); ``` `ui_but_align_opposite_to_area_align_get` may return zero, which happens in this case and results in the assert being triggered in `ui_block_align_but_to_region` ([interface_align.c ](https://developer.blender.org/diffusion/B/browse/master/source/blender/editors/interface/interface_align.c))

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

Changed status from 'Needs Triage' to: 'Confirmed'
Robert Guetzkow changed title from BLI_Assert(0) when deleting anything from the outliner. to Assert when using prop_tabs_enum 2020-07-04 14:04:20 +02:00

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel

@JulianEisel This might be for you, since you've originally implemented this feature.

@JulianEisel This might be for you, since you've originally implemented this feature.

This issue was referenced by 057f3f2f3d

This issue was referenced by 057f3f2f3d26bbabf004f59b6350f289e5e7dd5a
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Julian Eisel self-assigned this 2020-08-03 12:13:55 +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#78575
No description provided.