Page MenuHome

Blender Crashes after calling a pie menu with a specific item.
Open, Needs Triage by DeveloperPublic

Description

System Information
Operating system: Windows-10-10.0.16299 64 Bits
Graphics card: GeForce GTX 660 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 388.13

Blender Version
Broken: version: 2.82 (sub 1), branch: master, commit date: 2019-11-15 16:34, hash: rB17cb32c7bc7c
Worked: (optional)

Short description of error
Blender crashes after you call a pie menu that contains:

pie.prop_enum(context.scene.transform_orientation_slots[1], "type", value="GLOBAL")

It crashes with:

context.scene.transform_orientation_slots[1]
context.scene.transform_orientation_slots[2]
context.scene.transform_orientation_slots[3]

For Move, Rotate and Scale orientations.
It works fine with LOCAL, NORMAL, GIMBAL, CURSOR and DEFAULT, but not with GLOBAL.

Exact steps for others to reproduce the error

  1. Create a pie menu that contains the item mentioned above. For example:
import bpy
from bpy.types import Menu

class CRASH_MT_pie_menu(Menu):
    
    bl_label = "Crash Blender"

    def draw(self, context):    
        layout = self.layout
        obj = context.object
        
        pie = layout.menu_pie()
        
        # This is the reson for the crash. It happens only with "GLOBAL".
        # Works fine with LOCAL,NORMAL etc.
        pie.prop_enum(context.scene.transform_orientation_slots[1], "type", value="GLOBAL")

classes = (
    CRASH_MT_pie_menu,
    )

register, unregister = bpy.utils.register_classes_factory(classes)

if __name__ == "__main__":
    register()
  1. Assign a key to run the pie menu (CRASH_MT_pie_menu).
  2. Run it in the 3D View.

Details

Type
Bug

Event Timeline

I can't reproduce the crash using just transform_orientation_slots[1], and as far as I know there isn't a [2] or [3] to call in the first place.

EDIT: Might need to change my statement; investigating.

So it looks like there's some weirdness going on with what's actually returned by transform_orientation_slots[1].type — it returns both the type enum and the use bool in some (but not all) sub-layouts. This is probably what's causing your crash, but I'm not a 100% on whether this is a bug or a design limitation.

This appears to work, though:

op = pie.operator("wm.context_set_enum", text="")
op.data_path = "scene.transform_orientation_slots[1].type"
op.value = 'GLOBAL'
Oskar (Oskar) added a comment.EditedWed, Nov 20, 11:43 AM

As far as I understand transform_orientation_slots[0] is for the orientation of every tool (top middle), transform_orientation_slots[1] is for Move tool, [2] for Rotate tool and [3] for Scale tool. This way you have different orientation settings for the different tools.

I just tested it again on two different machines, Windows 10 and Windows 7 with fresh copy of Blender 2.82 and it crashes every time.

This works here too:

op = pie.operator("wm.context_set_enum", text="GLOBAL")
op.data_path = "scene.transform_orientation_slots[1].type"
op.value = 'GLOBAL'

EDIT:
Forgot to mention that if I use the one for the main orientation settings - [0] it works fine:

pie.prop_enum(context.scene.transform_orientation_slots[0], "type", value="GLOBAL")