Cleanup: line wrapping, remove unused args, variables in UI scripts

This commit is contained in:
2022-04-06 09:40:14 +10:00
parent a776385b26
commit 11b0824d89
5 changed files with 16 additions and 18 deletions

View File

@@ -3041,7 +3041,7 @@ def km_sequencer_channels(params):
# Rename. # Rename.
("sequencer.rename_channel", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None), ("sequencer.rename_channel", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
("sequencer.rename_channel", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None), ("sequencer.rename_channel", {"type": 'LEFTMOUSE', "value": 'DOUBLE_CLICK'}, None),
]) ])
return keymap return keymap

View File

@@ -69,7 +69,7 @@ class MESH_MT_shape_key_context_menu(Menu):
class MESH_MT_attribute_context_menu(Menu): class MESH_MT_attribute_context_menu(Menu):
bl_label = "Attribute Specials" bl_label = "Attribute Specials"
def draw(self, context): def draw(self, _context):
layout = self.layout layout = self.layout
layout.operator("geometry.attribute_convert") layout.operator("geometry.attribute_convert")
@@ -581,15 +581,16 @@ class MESH_UL_color_attributes(UIList):
'CORNER': "Face Corner", 'CORNER': "Face Corner",
} }
def filter_items(self, context, data, property): def filter_items(self, _context, data, property):
attrs = getattr(data, property) attrs = getattr(data, property)
ret = [] ret = []
idxs = [] idxs = []
for idx, item in enumerate(attrs): for idx, item in enumerate(attrs):
skip = item.domain not in {"POINT", "CORNER"} skip = (
skip = skip or item.data_type not in {"FLOAT_COLOR", "BYTE_COLOR"} (item.domain not in {"POINT", "CORNER"}) or
(item.data_type not in {"FLOAT_COLOR", "BYTE_COLOR"})
)
ret.append(self.bitflag_filter_item if not skip else 0) ret.append(self.bitflag_filter_item if not skip else 0)
idxs.append(idx) idxs.append(idx)
@@ -606,9 +607,11 @@ class MESH_UL_color_attributes(UIList):
active_render = _index == data.color_attributes.render_color_index active_render = _index == data.color_attributes.render_color_index
props = split.operator("geometry.color_attribute_render_set", text="", icon = 'RESTRICT_RENDER_OFF'if \ props = split.operator(
active_render else 'RESTRICT_RENDER_ON' "geometry.color_attribute_render_set",
) text="",
icon='RESTRICT_RENDER_OFF' if active_render else 'RESTRICT_RENDER_ON',
)
props.name = attribute.name props.name = attribute.name
@@ -643,7 +646,7 @@ class DATA_PT_vertex_colors(DATA_PT_mesh_attributes, Panel):
col = row.column(align=True) col = row.column(align=True)
col.operator("geometry.color_attribute_add", icon='ADD', text="") col.operator("geometry.color_attribute_add", icon='ADD', text="")
col.operator("geometry.color_attribute_remove", icon='REMOVE', text="") col.operator("geometry.color_attribute_remove", icon='REMOVE', text="")
self.draw_attribute_warnings(context, layout) self.draw_attribute_warnings(context, layout)
classes = ( classes = (

View File

@@ -748,7 +748,7 @@ class ASSETBROWSER_PT_metadata_preview(asset_utils.AssetMetaDataPanel, Panel):
class ASSETBROWSER_MT_metadata_preview_menu(bpy.types.Menu): class ASSETBROWSER_MT_metadata_preview_menu(bpy.types.Menu):
bl_label = "Preview" bl_label = "Preview"
def draw(self, context): def draw(self, _context):
layout = self.layout layout = self.layout
layout.operator("ed.lib_id_generate_preview_from_object", text="Render Active Object") layout.operator("ed.lib_id_generate_preview_from_object", text="Render Active Object")

View File

@@ -135,7 +135,7 @@ class OUTLINER_MT_context_menu_view(Menu):
class OUTLINER_MT_view_pie(Menu): class OUTLINER_MT_view_pie(Menu):
bl_label = "View" bl_label = "View"
def draw(self, context): def draw(self, _context):
layout = self.layout layout = self.layout
pie = layout.menu_pie() pie = layout.menu_pie()
@@ -314,7 +314,7 @@ class OUTLINER_MT_object(Menu):
class OUTLINER_MT_asset(Menu): class OUTLINER_MT_asset(Menu):
bl_label = "Assets" bl_label = "Assets"
def draw(self, context): def draw(self, _context):
layout = self.layout layout = self.layout
layout.operator("asset.mark") layout.operator("asset.mark")

View File

@@ -1307,17 +1307,12 @@ class _defs_sculpt:
@staticmethod @staticmethod
def generate_from_brushes(context): def generate_from_brushes(context):
exclude_filter = {}
# Use 'bpy.context' instead of 'context' since it can be None.
prefs = bpy.context.preferences
return generate_from_enum_ex( return generate_from_enum_ex(
context, context,
idname_prefix="builtin_brush.", idname_prefix="builtin_brush.",
icon_prefix="brush.sculpt.", icon_prefix="brush.sculpt.",
type=bpy.types.Brush, type=bpy.types.Brush,
attr="sculpt_tool", attr="sculpt_tool",
exclude_filter=exclude_filter,
) )
@ToolDef.from_fn @ToolDef.from_fn