Fix T102045: Properties Editor Attribute panels errors when pinning mesh

When pinning a Mesh, we cannot rely on the context object.
Instead, use the context mesh now.
For vertexgroups names [which are still on the object API wise], this
means name collisions cannot be checked when pinning a Mesh (so print
this as a warning in that case)

Maniphest Tasks: T102045

Differential Revision: https://developer.blender.org/D16333
This commit is contained in:
Philipp Oeser 2022-10-25 11:51:04 +02:00
parent 49cd04044a
commit 2186d58d1c
Notes: blender-bot 2023-02-14 06:17:14 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #102045, Properties Editor Attribute panels errors when pinning mesh
1 changed files with 5 additions and 2 deletions

View File

@ -586,7 +586,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
def draw_attribute_warnings(self, context, layout):
ob = context.object
mesh = ob.data
mesh = context.mesh
unique_names = set()
colliding_names = []
@ -595,8 +595,11 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel):
{"position": None, "shade_smooth": None, "normal": None, "crease": None},
mesh.attributes,
mesh.uv_layers,
ob.vertex_groups,
None if ob is None else ob.vertex_groups,
):
if collection is None:
colliding_names.append("Cannot check for object vertex groups when pinning mesh")
continue
for name in collection.keys():
unique_names_len = len(unique_names)
unique_names.add(name)