[Bf-blender-cvs] [325501247d8] master: Fix AttributeError in mesh properties panel when mesh is pinned

Sybren A. Stüvel noreply at git.blender.org
Fri Jul 12 14:19:17 CEST 2019


Commit: 325501247d88647fd2457f9fc02209aadc6a52f1
Author: Sybren A. Stüvel
Date:   Fri Jul 12 14:18:17 2019 +0200
Branches: master
https://developer.blender.org/rB325501247d88647fd2457f9fc02209aadc6a52f1

Fix AttributeError in mesh properties panel when mesh is pinned

When a mesh datablock is pinned in the properties panel,
`context.object` is `None`. This in turn causes `obj.mode` to raise an
`AttributeError` exception as `None.mode` doesn't exist.

Since there is no (fast/simple) way to check whether the owning object
is in edit mode or not, the properties will be disabled. Not ideal, but
better than spewing an exception on every panel draw.

Reviewed By: campbellbarton, brecht

Differential Revision: https://developer.blender.org/D5237

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

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

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

diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py
index e4fd09bb5ff..63e4d44eada 100644
--- a/release/scripts/startup/bl_ui/properties_data_mesh.py
+++ b/release/scripts/startup/bl_ui/properties_data_mesh.py
@@ -483,7 +483,7 @@ class DATA_PT_customdata(MeshButtonsPanel, Panel):
 
         col = layout.column()
 
-        col.enabled = (obj.mode != 'EDIT')
+        col.enabled = obj is not None and obj.mode != 'EDIT'
         col.prop(me, "use_customdata_vertex_bevel")
         col.prop(me, "use_customdata_edge_bevel")
         col.prop(me, "use_customdata_edge_crease")



More information about the Bf-blender-cvs mailing list