System Information
Operating system: Windows 8.1 x64
Graphics card: Intel HD Graphics 520
Blender Version
Broken: Blender 2.91.0, Commit date: 2020-11-18 18:54, Hash ad58999b0d46
Worked: 2.90 (and below).
Additional files
blender.crash.txt is attached to this report.
Short description of error
Blender crashes when you click on the cells of an bpy.props.EnumProperty created with the ENUM_FLAG flag.
Exact steps for others to reproduce the error
On a Text Editor view, create a new text datablock, paste the following script and run it.
It will create an EnumProperty and draw it on the 3D View header.
Clicking on any of its cells crashes Blender.
import bpy
from time import time
def myCustomEnumDrawHeader(self, context):
layout = self.layout.row(align=True)
layout.alignment = 'CENTER'
layout.prop(context.scene, 'myCustomEnum', expand=True, icon_only=True)
def myCustomEnumItems(self, context):
items = [
(
str(index), # String identifier.
str(index), # UI label.
'', # UI description.
'LAYER_ACTIVE',
2**index # Integer index (always a power-of-two with the 'ENUM_FLAG' option).
)
for index in range(9)
]
return items
def myCustomEnumGet(self):
return 2 ** 3
def myCustomEnumSet(self, value):
print('myCustomEnumSet()', int(time.time() * 1000))
def register():
bpy.types.Scene.myCustomEnum = bpy.props.EnumProperty(
name = '',
items = myCustomEnumItems,
get = myCustomEnumGet,
set = myCustomEnumSet,
description = 'My Custom Enum',
options = {'ENUM_FLAG', 'SKIP_SAVE', 'HIDDEN'}
)
bpy.types.VIEW3D_HT_header.append(myCustomEnumDrawHeader)
def unregister():
bpy.types.VIEW3D_HT_header.remove(myCustomEnumDrawHeader)
del bpy.types.Scene.myCustomEnum
if __name__ == "__main__":
register(){F9588970}