Cleanup: unused arguments

This commit is contained in:
2021-03-06 18:21:17 +11:00
parent bd79691599
commit 9dc0c44aa1
19 changed files with 43 additions and 42 deletions

View File

@@ -19,7 +19,7 @@
import bpy
def geometry_node_group_empty_new(context):
def geometry_node_group_empty_new():
group = bpy.data.node_groups.new("Geometry Nodes", 'GeometryNodeTree')
group.inputs.new('NodeSocketGeometry', "Geometry")
group.outputs.new('NodeSocketGeometry', "Geometry")
@@ -85,7 +85,7 @@ class NewGeometryNodeTreeAssign(bpy.types.Operator):
if not modifier:
return {'CANCELLED'}
group = geometry_node_group_empty_new(context)
group = geometry_node_group_empty_new()
modifier.node_group = group
return {'FINISHED'}

View File

@@ -169,7 +169,7 @@ class VIEW3D_OT_edit_mesh_extrude_manifold_normal(Operator):
obj = context.active_object
return (obj is not None and obj.mode == 'EDIT')
def execute(self, context):
def execute(self, _context):
bpy.ops.mesh.extrude_manifold(
'INVOKE_REGION_WIN',
MESH_OT_extrude_region={

View File

@@ -42,7 +42,7 @@ class OBJECT_PT_constraints(ObjectConstraintPanel, Panel):
bl_label = "Object Constraints"
bl_options = {'HIDE_HEADER'}
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator_menu_enum("object.constraint_add", "type", text="Add Object Constraint")
@@ -56,7 +56,7 @@ class BONE_PT_constraints(BoneConstraintPanel, Panel):
bl_label = "Bone Constraints"
bl_options = {'HIDE_HEADER'}
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator_menu_enum("pose.constraint_add", "type", text="Add Bone Constraint")
@@ -122,7 +122,7 @@ class ConstraintButtonsPanel:
elif con.target.type in {'MESH', 'LATTICE'}:
col.prop_search(con, "subtarget", con.target, "vertex_groups", text="Vertex Group")
def get_constraint(self, context):
def get_constraint(self, _context):
con = self.custom_data
self.layout.context_pointer_set("constraint", con)
return con
@@ -844,7 +844,7 @@ class ConstraintButtonsPanel:
self.draw_influence(layout, con)
def draw_python_constraint(self, context):
def draw_python_constraint(self, _context):
layout = self.layout
layout.label(text="Blender 2.6 doesn't support python constraints yet")
@@ -976,7 +976,7 @@ class ConstraintButtonsSubPanel:
bl_label = ""
bl_options = {'DRAW_BOX'}
def get_constraint(self, context):
def get_constraint(self, _context):
con = self.custom_data
self.layout.context_pointer_set("constraint", con)
return con

View File

@@ -81,7 +81,7 @@ class HAIR_MT_add_attribute(Menu):
class HAIR_UL_attributes(UIList):
def draw_item(self, context, layout, data, attribute, icon, active_data, active_propname, index):
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
domain = attribute.bl_rna.properties['domain'].enum_items[attribute.domain]

View File

@@ -37,7 +37,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
ob = context.object
return ob and ob.type != 'GPENCIL'
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator_menu_enum("object.modifier_add", "type")
layout.template_modifiers()
@@ -51,7 +51,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
ob = context.object
return ob and ob.type == 'GPENCIL'
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator_menu_enum("object.gpencil_modifier_add", "type")
layout.template_grease_pencil_modifiers()

View File

@@ -83,7 +83,7 @@ class POINTCLOUD_MT_add_attribute(Menu):
class POINTCLOUD_UL_attributes(UIList):
def draw_item(self, context, layout, data, attribute, icon, active_data, active_propname, index):
def draw_item(self, _context, layout, _data, attribute, _icon, _active_data, _active_propname, _index):
data_type = attribute.bl_rna.properties['data_type'].enum_items[attribute.data_type]
split = layout.split(factor=0.75)

View File

@@ -37,7 +37,7 @@ class DATA_PT_shader_fx(ShaderFxButtonsPanel, Panel):
# ob = context.object
# return ob and ob.type == 'GPENCIL'
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator_menu_enum("object.shaderfx_add", "type")
layout.template_shaderfx()

View File

@@ -84,7 +84,7 @@ class DATA_PT_volume_file(DataButtonsPanel, Panel):
class VOLUME_UL_grids(UIList):
def draw_item(self, context, layout, data, grid, icon, active_data, active_propname, index):
def draw_item(self, _context, layout, _data, grid, _icon, _active_data, _active_propname, _index):
name = grid.name
data_type = grid.bl_rna.properties['data_type'].enum_items[grid.data_type]

View File

@@ -26,7 +26,7 @@ from bpy.app.translations import contexts as i18n_contexts
# Use by both image & clip context menus.
def draw_mask_context_menu(layout, context):
def draw_mask_context_menu(layout, _context):
layout.operator_menu_enum("mask.handle_type_set", "type")
layout.operator("mask.switch_direction")
layout.operator("mask.cyclic_toggle")

View File

@@ -1282,7 +1282,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=False)
layout.template_curve_mapping(settings, "thickness_primitive_curve", brush=True)
def brush_basic_gpencil_sculpt_settings(layout, context, brush, *, compact=False):
def brush_basic_gpencil_sculpt_settings(layout, _context, brush, *, compact=False):
gp_settings = brush.gpencil_settings
tool = brush.gpencil_sculpt_tool

View File

@@ -21,7 +21,7 @@ from bpy.types import Panel, UIList
class VIEWLAYER_UL_aov(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname):
row = layout.row()
split = row.split(factor=0.65)
icon = 'NONE' if item.is_valid else 'ERROR'

View File

@@ -375,7 +375,7 @@ class IMAGE_MT_uvs_split(Menu):
class IMAGE_MT_uvs_unwrap(Menu):
bl_label = "Unwrap"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator("uv.unwrap")

View File

@@ -257,7 +257,7 @@ class OUTLINER_MT_collection_new(Menu):
bl_label = "Collection"
@staticmethod
def draw_without_context_menu(context, layout):
def draw_without_context_menu(_context, layout):
layout.operator("outliner.collection_new", text="New Collection").nested = True
layout.operator("outliner.id_paste", text="Paste Data-Blocks", icon='PASTEDOWN')

View File

@@ -1022,7 +1022,7 @@ def activate_by_id(context, space_type, idname, *, as_fallback=False):
return True
def activate_by_id_or_cycle(context, space_type, idname, *, offset=1, as_fallback=False):
def activate_by_id_or_cycle(context, space_type, idname, *, offset=1, _as_fallback=False):
# Only cycle when the active tool is activated again.
cls = ToolSelectPanelHelper._tool_class_from_space_type(space_type)

View File

@@ -1096,7 +1096,7 @@ class _defs_edit_curve:
@ToolDef.from_fn
def draw():
def draw_settings(context, layout, tool, *, extra=False):
def draw_settings(context, layout, _tool, *, extra=False):
# Tool settings initialize operator options.
tool_settings = context.tool_settings
cps = tool_settings.curve_paint_settings
@@ -1589,7 +1589,7 @@ class _defs_weight_paint:
@ToolDef.from_fn
def sample_weight():
def draw_settings(context, layout, tool):
def draw_settings(context, layout, _tool):
if context.tool_settings.unified_paint_settings.use_unified_weight:
weight = context.tool_settings.unified_paint_settings.weight
elif context.tool_settings.weight_paint.brush:
@@ -1869,7 +1869,7 @@ class _defs_image_uv_sculpt:
class _defs_gpencil_paint:
@staticmethod
def gpencil_primitive_toolbar(context, layout, tool, props):
def gpencil_primitive_toolbar(context, layout, _tool, props):
paint = context.tool_settings.gpencil_paint
brush = paint.brush
@@ -1907,7 +1907,7 @@ class _defs_gpencil_paint:
@ToolDef.from_fn
def cutter():
def draw_settings(context, layout, tool):
def draw_settings(_context, layout, tool):
props = tool.operator_properties("gpencil.stroke_cutter")
row = layout.row()
row.use_property_split = False
@@ -2020,7 +2020,7 @@ class _defs_gpencil_paint:
@ToolDef.from_fn
def eyedropper():
def draw_settings(context, layout, tool):
def draw_settings(_context, layout, tool):
props = tool.operator_properties("ui.eyedropper_gpencil_color")
row = layout.row()
row.use_property_split = False
@@ -2037,7 +2037,7 @@ class _defs_gpencil_paint:
@ToolDef.from_fn
def interpolate():
def draw_settings(context, layout, tool):
def draw_settings(_context, layout, tool):
props = tool.operator_properties("gpencil.interpolate")
layout.prop(props, "layers")
layout.prop(props, "flip")
@@ -2201,7 +2201,7 @@ class _defs_gpencil_edit:
@ToolDef.from_fn
def transform_fill():
def draw_settings(context, layout, tool):
def draw_settings(_context, layout, tool):
props = tool.operator_properties("gpencil.transform_fill")
row = layout.row()
row.use_property_split = False
@@ -2219,7 +2219,7 @@ class _defs_gpencil_edit:
@ToolDef.from_fn
def interpolate():
def draw_settings(context, layout, tool):
def draw_settings(_context, layout, tool):
props = tool.operator_properties("gpencil.interpolate")
layout.prop(props, "layers")
layout.prop(props, "interpolate_selected_only")
@@ -2412,7 +2412,7 @@ class _defs_sequencer_generic:
@ToolDef.from_fn
def sample():
def draw_settings(_context, layout, tool):
tool.operator_properties("sequencer.sample")
props = tool.operator_properties("sequencer.sample")
return dict(
idname="builtin.sample",
label="Sample",

View File

@@ -244,7 +244,7 @@ class TOPBAR_MT_app(Menu):
class TOPBAR_MT_file_cleanup(Menu):
bl_label = "Clean Up"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.separator()
@@ -475,7 +475,7 @@ class TOPBAR_MT_file_export(Menu):
bl_label = "Export"
bl_owner_use_filter = False
def draw(self, context):
def draw(self, _context):
if bpy.app.build_options.collada:
self.layout.operator("wm.collada_export",
text="Collada (Default) (.dae)")

View File

@@ -96,7 +96,7 @@ class USERPREF_MT_editor_menus(Menu):
class USERPREF_MT_view(Menu):
bl_label = "View"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.menu("INFO_MT_area")
@@ -241,7 +241,7 @@ class USERPREF_PT_interface_translation(InterfacePanel, CenterAlignMixIn, Panel)
bl_translation_context = i18n_contexts.id_windowmanager
@classmethod
def poll(cls, context):
def poll(cls, _context):
return bpy.app.build_options.international
def draw_centered(self, context, layout):
@@ -581,7 +581,7 @@ class USERPREF_PT_system_cycles_devices(SystemPanel, CenterAlignMixIn, Panel):
bl_label = "Cycles Render Devices"
@classmethod
def poll(cls, context):
def poll(cls, _context):
# No GPU rendering on macOS currently.
import sys
return bpy.app.build_options.cycles and sys.platform != "darwin"
@@ -2185,7 +2185,7 @@ class ExperimentalPanel:
url_prefix = "https://developer.blender.org/"
@classmethod
def poll(cls, context):
def poll(cls, _context):
return bpy.app.version_cycle == 'alpha'
def _draw_items(self, context, items):
@@ -2260,7 +2260,7 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel):
bl_label = "Debugging"
@classmethod
def poll(cls, context):
def poll(cls, _context):
# Unlike the other experimental panels, the debugging one is always visible
# even in beta or release.
return True

View File

@@ -1068,7 +1068,7 @@ class VIEW3D_MT_snap(Menu):
class VIEW3D_MT_uv_map(Menu):
bl_label = "UV Mapping"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator("uv.unwrap")
@@ -1822,7 +1822,7 @@ class VIEW3D_MT_select_edit_armature(Menu):
class VIEW3D_MT_paint_gpencil(Menu):
bl_label = "Paint"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator("gpencil.vertex_color_set", text="Set Vertex Colors")
@@ -2238,7 +2238,7 @@ class VIEW3D_MT_object(Menu):
bl_context = "objectmode"
bl_label = "Object"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.menu("VIEW3D_MT_transform_object")
@@ -2717,7 +2717,7 @@ class VIEW3D_MT_object_constraints(Menu):
class VIEW3D_MT_object_quick_effects(Menu):
bl_label = "Quick Effects"
def draw(self, context):
def draw(self, _context):
layout = self.layout
layout.operator("object.quick_fur")

View File

@@ -1488,7 +1488,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_stroke(Panel, View3DPanel):
brush = context.tool_settings.gpencil_paint.brush
return brush is not None and brush.gpencil_tool == 'DRAW'
def draw(self, context):
def draw(self, _context):
# layout = self.layout
pass
@@ -1847,7 +1847,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_weight_falloff(GreasePencilBrushFallof
ts = context.tool_settings
settings = ts.gpencil_weight_paint
brush = settings.brush
return (brush and brush.curve)
return (settings and settings.brush and settings.brush.curve)
# Grease Pencil vertex painting tools
@@ -1939,6 +1939,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_vertex_color(View3DPanel, Panel):
ts = context.tool_settings
settings = ts.gpencil_vertex_paint
brush = settings.brush
gp_settings = brush.gpencil_settings
col = layout.column()