zeffii/mesh_tiny_cad

random menu crash

zeffii opened this issue · 1 comments

This is the 4th or 5th time this has happened. I can only say that it happens after a 20 minute expedition without having left edit mode to go into object mode. perhap I should include a poll to avoid doing anything until blender can prove that it's ready.

This doesn't appear caused by the addition of icons, as it happened before their introductions.

i'm settling for this, though it doesn't guarantee the draw function won't do something scary, despite the the try/except

class VIEW3D_MT_edit_mesh_tinycad(bpy.types.Menu):
    bl_label = "TinyCAD"

    @classmethod
    def poll(cls, context):
        return (context.object is not None)

    def draw(self, context):
        try:
            pcoll = preview_collections["main"]
            for i, text, ico_info in vtx_classes:
                icon_name = ico_info[:-4]
                my_icon = pcoll[icon_name]
                self.layout.operator(i.bl_idname, icon_value=my_icon.icon_id, text=text)
        except:
            print('blender not ready.. try again')