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
This commit is contained in:
2019-07-12 14:18:17 +02:00
parent 439777f081
commit 325501247d

View File

@@ -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")