From 86fe67d6ed6ecd5a7fb006b8deddb56cedb1f77f Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Wed, 3 Nov 2021 16:41:50 -0700 Subject: [PATCH] Fix python error --- .../startup/bl_ui/properties_data_mesh.py | 44 +++++++------------ 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_mesh.py b/release/scripts/startup/bl_ui/properties_data_mesh.py index 27921a5766a..fbff93dadd4 100644 --- a/release/scripts/startup/bl_ui/properties_data_mesh.py +++ b/release/scripts/startup/bl_ui/properties_data_mesh.py @@ -29,16 +29,12 @@ class MESH_MT_vertex_group_context_menu(Menu): def draw(self, _context): layout = self.layout - layout.operator( - "object.vertex_group_sort", + layout.operator("object.vertex_group_sort", icon='SORTALPHA', - text="Sort by Name", - ).sort_type = 'NAME' - layout.operator( - "object.vertex_group_sort", + text="Sort by Name",).sort_type = 'NAME' + layout.operator("object.vertex_group_sort", icon='BONE_DATA', - text="Sort by Bone Hierarchy", - ).sort_type = 'BONE_HIERARCHY' + text="Sort by Bone Hierarchy",).sort_type = 'BONE_HIERARCHY' layout.separator() layout.operator("object.vertex_group_copy", icon='DUPLICATE') layout.operator("object.vertex_group_copy_to_selected") @@ -46,11 +42,9 @@ class MESH_MT_vertex_group_context_menu(Menu): layout.operator("object.vertex_group_mirror", icon='ARROW_LEFTRIGHT').use_topology = False layout.operator("object.vertex_group_mirror", text="Mirror Vertex Group (Topology)").use_topology = True layout.separator() - layout.operator( - "object.vertex_group_remove_from", + layout.operator("object.vertex_group_remove_from", icon='X', - text="Remove from All Groups", - ).use_all_groups = True + text="Remove from All Groups",).use_all_groups = True layout.operator("object.vertex_group_remove_from", text="Clear Active Group").use_all_verts = True layout.operator("object.vertex_group_remove", text="Delete All Unlocked Groups").all_unlocked = True layout.operator("object.vertex_group_remove", text="Delete All Groups").all = True @@ -134,7 +128,8 @@ class MESH_UL_shape_keys(UIList): class MESH_UL_uvmaps(UIList): def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): - # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))) + # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, + # bpy.types.MeshLoopColorLayer))) if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(item, "name", text="", emboss=False, icon='GROUP_UVS') icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON' @@ -146,7 +141,8 @@ class MESH_UL_uvmaps(UIList): class MESH_UL_vcols(UIList): def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index): - # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, bpy.types.MeshLoopColorLayer))) + # assert(isinstance(item, (bpy.types.MeshTexturePolyLayer, + # bpy.types.MeshLoopColorLayer))) if self.layout_type in {'DEFAULT', 'COMPACT'}: layout.prop(item, "name", text="", emboss=False, icon='GROUP_VCOL') icon = 'RESTRICT_RENDER_OFF' if item.active_render else 'RESTRICT_RENDER_ON' @@ -266,11 +262,7 @@ class DATA_PT_vertex_groups(MeshButtonsPanel, Panel): col.operator("object.vertex_group_move", icon='TRIA_UP', text="").direction = 'UP' col.operator("object.vertex_group_move", icon='TRIA_DOWN', text="").direction = 'DOWN' - if ( - ob.vertex_groups and - (ob.mode == 'EDIT' or - (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex)) - ): + if (ob.vertex_groups and (ob.mode == 'EDIT' or (ob.mode == 'WEIGHT_PAINT' and ob.type == 'MESH' and ob.data.use_paint_mask_vertex))): row = layout.row() sub = row.row(align=True) @@ -561,15 +553,13 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel): row = layout.row() col = row.column() - col.template_list( - "MESH_UL_attributes", + col.template_list("MESH_UL_attributes", "attributes", mesh, "attributes", mesh.attributes, "active_index", - rows=3, - ) + rows=3,) col = row.column(align=True) col.operator("geometry.attribute_add", icon='ADD', text="") @@ -577,7 +567,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel): active = mesh.attributes.active - if active.domain == "POINT" and active.data_type == "FLOAT_COLOR": + if active and (active.domain == "POINT" and active.data_type == "FLOAT_COLOR"): layout.operator("sculpt.vertex_to_loop_colors", text="Save To Corners") layout.operator("sculpt.loop_to_vertex_colors", text="Load From Corners") @@ -615,8 +605,7 @@ class DATA_PT_mesh_attributes(MeshButtonsPanel, Panel): layout.label(text="Name collisions: {}".format(", ".join(colliding_names)), icon='ERROR') -classes = ( - MESH_MT_vertex_group_context_menu, +classes = (MESH_MT_vertex_group_context_menu, MESH_MT_shape_key_context_menu, MESH_UL_vgroups, MESH_UL_fmaps, @@ -635,8 +624,7 @@ classes = ( DATA_PT_texture_space, DATA_PT_remesh, DATA_PT_customdata, - DATA_PT_custom_props_mesh, -) + DATA_PT_custom_props_mesh,) if __name__ == "__main__": # only for live edit. from bpy.utils import register_class