[Bf-blender-cvs] [e9d940ca2f1] blender2.8: Fix topbar UI w/ no active object

Campbell Barton noreply at git.blender.org
Fri Apr 20 23:09:06 CEST 2018


Commit: e9d940ca2f1b062842b08ba297baa7859cc99750
Author: Campbell Barton
Date:   Fri Apr 20 23:08:08 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBe9d940ca2f1b062842b08ba297baa7859cc99750

Fix topbar UI w/ no active object

===================================================================

M	release/scripts/startup/bl_ui/space_topbar.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 7ce512ebb2a..708be478301 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -95,11 +95,11 @@ class TOPBAR_HT_lower_bar(Header):
     def draw_left(self, context):
         layout = self.layout
         layer = context.view_layer
-
-        act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[layer.objects.active.mode]
+        object = layer.objects.active
+        object_mode = 'OBJECT' if object is None else object.mode
+        act_mode_item = bpy.types.Object.bl_rna.properties['mode'].enum_items[object_mode]
         layout.operator_menu_enum("object.mode_set", "mode", text=act_mode_item.name, icon=act_mode_item.icon)
 
-
     def draw_right(self, context):
         layout = self.layout



More information about the Bf-blender-cvs mailing list