Cleanup: unused Python variables & imports

This commit is contained in:
Campbell Barton 2022-03-04 11:03:36 +11:00
parent 6bca614fd8
commit 0a4fdcbb5f
Notes: blender-bot 2023-02-14 06:05:22 +01:00
Referenced by issue #96520, Regression: Node editor: Tweak is broken and requires click, then click again to drag
Referenced by issue #96255, Node socket click detection is broken in some cases
Referenced by issue #96151, Slow Blender Startup (Not responding + grey screen)
13 changed files with 16 additions and 37 deletions

View File

@ -16,7 +16,6 @@ and <output-filename> is where to write the generated man page.
import argparse
import os
import subprocess
import sys
import time
from typing import (

View File

@ -216,7 +216,6 @@ enum_direct_light_sampling_type = (
)
def update_render_passes(self, context):
scene = context.scene
view_layer = context.view_layer
view_layer.update_render_passes()
@ -1353,7 +1352,7 @@ class CyclesPreferences(bpy.types.AddonPreferences):
items=CyclesPreferences.get_device_types,
)
devices: bpy.props.CollectionProperty(type=CyclesDeviceSettings)
devices: CollectionProperty(type=CyclesDeviceSettings)
peer_memory: BoolProperty(
name="Distribute memory across devices",

View File

@ -5,7 +5,6 @@
from __future__ import annotations
import bpy
import math
from bpy.app.handlers import persistent

View File

@ -344,7 +344,6 @@ def create_derived_objects(depsgraph, objects):
:rtype: dict
"""
result = {}
has_instancer = False
for ob in objects:
ob_parent = ob.parent
if ob_parent and ob_parent.instance_type in {'VERTS', 'FACES'}:

View File

@ -250,19 +250,19 @@ def xml2rna(
value_xml = xml_node.attributes[attr].value
subvalue_type = type(subvalue)
tp_name = 'UNKNOWN'
# tp_name = 'UNKNOWN'
if subvalue_type == float:
value_xml_coerce = float(value_xml)
tp_name = 'FLOAT'
# tp_name = 'FLOAT'
elif subvalue_type == int:
value_xml_coerce = int(value_xml)
tp_name = 'INT'
# tp_name = 'INT'
elif subvalue_type == bool:
value_xml_coerce = {'TRUE': True, 'FALSE': False}[value_xml]
tp_name = 'BOOL'
# tp_name = 'BOOL'
elif subvalue_type == str:
value_xml_coerce = value_xml
tp_name = 'STR'
# tp_name = 'STR'
elif hasattr(subvalue, "__len__"):
if value_xml.startswith("#"):
# read hexadecimal value as float array
@ -280,7 +280,7 @@ def xml2rna(
except ValueError: # bool vector property
value_xml_coerce = [{'TRUE': True, 'FALSE': False}[v] for v in value_xml_split]
del value_xml_split
tp_name = 'ARRAY'
# tp_name = 'ARRAY'
# print(" %s.%s (%s) --- %s" % (type(value).__name__, attr, tp_name, subvalue_type))
try:

View File

@ -4173,7 +4173,7 @@ def keymap_transform_tool_mmb(keymap):
r".*\bSelect Lasso$|"
r".*\bTweak$)",
)
for km_name, km_args, km_content in keymap:
for km_name, _km_args, km_content in keymap:
if re_fallback_tool.match(km_name):
km_items = km_content["items"]
km_items_new = []

View File

@ -694,9 +694,6 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel):
layout.label(text="No active asset", icon='INFO')
return
asset_library_ref = context.asset_library_ref
asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref)
prefs = context.preferences
show_asset_debug_info = prefs.view.show_developer_ui and prefs.experimental.show_asset_debug_info

View File

@ -759,7 +759,6 @@ class IMAGE_HT_header(Header):
ima = sima.image
iuser = sima.image_user
tool_settings = context.tool_settings
show_region_tool_header = sima.show_region_tool_header
show_render = sima.show_render
show_uvedit = sima.show_uvedit
@ -772,8 +771,6 @@ class IMAGE_HT_header(Header):
# UV editing.
if show_uvedit:
uvedit = sima.uv_editor
layout.prop(tool_settings, "use_uv_select_sync", text="")
if tool_settings.use_uv_select_sync:
@ -781,15 +778,15 @@ class IMAGE_HT_header(Header):
else:
row = layout.row(align=True)
uv_select_mode = tool_settings.uv_select_mode[:]
row.operator("uv.select_mode", text="", icon='UV_VERTEXSEL',
row.operator("uv.select_mode", text="", icon='UV_VERTEXSEL',
depress=(uv_select_mode == 'VERTEX')).type = 'VERTEX'
row.operator("uv.select_mode", text="", icon='UV_EDGESEL',
row.operator("uv.select_mode", text="", icon='UV_EDGESEL',
depress=(uv_select_mode == 'EDGE')).type = 'EDGE'
row.operator("uv.select_mode", text="", icon='UV_FACESEL',
row.operator("uv.select_mode", text="", icon='UV_FACESEL',
depress=(uv_select_mode == 'FACE')).type = 'FACE'
row.operator("uv.select_mode", text="", icon='UV_ISLANDSEL',
row.operator("uv.select_mode", text="", icon='UV_ISLANDSEL',
depress=(uv_select_mode == 'ISLAND')).type = 'ISLAND'
layout.prop(tool_settings, "uv_sticky_select_mode", icon_only=True)
IMAGE_MT_editor_menus.draw_collapsible(context, layout)
@ -817,8 +814,6 @@ class IMAGE_HT_header(Header):
sub.popover(panel="IMAGE_PT_overlay", text="")
if show_uvedit:
uvedit = sima.uv_editor
mesh = context.edit_object.data
layout.prop_search(mesh.uv_layers, "active", mesh, "uv_layers", text="")

View File

@ -311,8 +311,6 @@ class OUTLINER_MT_asset(Menu):
def draw(self, context):
layout = self.layout
space = context.space_data
layout.operator("asset.mark")
layout.operator("asset.clear", text="Clear Asset").set_fake_user = False
layout.operator("asset.clear", text="Clear Asset (Set Fake User)").set_fake_user = True

View File

@ -130,7 +130,7 @@ class SEQUENCER_HT_tool_header(Header):
bl_region_type = 'TOOL_HEADER'
def draw(self, context):
layout = self.layout
# layout = self.layout
self.draw_tool_settings(context)
@ -241,7 +241,6 @@ class SEQUENCER_PT_gizmo_display(Panel):
def draw(self, context):
layout = self.layout
scene = context.scene
st = context.space_data
col = layout.column()
@ -555,7 +554,7 @@ class SEQUENCER_MT_select(Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
has_sequencer, has_preview = _space_view_types(st)
has_sequencer, _has_preview = _space_view_types(st)
layout.operator("sequencer.select_all", text="All").action = 'SELECT'
layout.operator("sequencer.select_all", text="None").action = 'DESELECT'
@ -891,7 +890,7 @@ class SEQUENCER_MT_strip(Menu):
def draw(self, context):
layout = self.layout
st = context.space_data
has_sequencer, has_preview = _space_view_types(st)
has_sequencer, _has_preview = _space_view_types(st)
layout.menu("SEQUENCER_MT_strip_transform")
layout.separator()
@ -1134,7 +1133,6 @@ class SEQUENCER_MT_pivot_pie(Menu):
layout = self.layout
pie = layout.menu_pie()
tool_settings = context.tool_settings
sequencer_tool_settings = context.tool_settings.sequencer_tool_settings
pie.prop_enum(sequencer_tool_settings, "pivot_point", value='CENTER')

View File

@ -1065,11 +1065,8 @@ class _defs_edit_mesh:
show_extra = False
props = tool.operator_properties("mesh.knife_tool")
if not extra:
row = layout.row()
layout.prop(props, "use_occlude_geometry")
row = layout.row()
layout.prop(props, "only_selected")
row = layout.row()
layout.prop(props, "xray")
region_is_header = bpy.context.region.type == 'TOOL_HEADER'
if region_is_header:

View File

@ -796,7 +796,6 @@ class TOPBAR_PT_name(Panel):
return row
mode = context.mode
scene = context.scene
space = context.space_data
space_type = None if (space is None) else space.type
found = False

View File

@ -7,7 +7,6 @@
import bpy
import sys
import random