Cleanup: unused variables

This commit is contained in:
Campbell Barton 2019-03-17 21:13:25 +11:00
parent ad9addbf46
commit 69bf4e5e36
18 changed files with 20 additions and 30 deletions

View File

@ -470,7 +470,7 @@ def reset_all(*, reload_scripts=False):
for path in paths_list:
_bpy.utils._sys_path_ensure(path)
for mod_name, mod_path in _bpy.path.module_names(path):
for mod_name, _mod_path in _bpy.path.module_names(path):
is_enabled, is_loaded = check(mod_name)
# first check if reload is needed before changing state.

View File

@ -156,7 +156,7 @@ def keyconfig_export_as_data(wm, kc, filepath, *, all_keymaps=False):
fw = fh.write
fw("keyconfig_data = \\\n[")
for km, kc_x in export_keymaps:
for km, _kc_x in export_keymaps:
km = km.active()
fw("(")
fw(f"\"{km.name:s}\",\n")

View File

@ -284,7 +284,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
camera = bpy.data.objects[render_context.camera, None]
light = bpy.data.objects[render_context.light, None] if render_context.light is not None else None
cos = objects_bbox_calc(camera, objects, offset_matrix)
loc, ortho_scale = camera.camera_fit_coords(bpy.context.depsgraph, cos)
loc, _ortho_scale = camera.camera_fit_coords(bpy.context.depsgraph, cos)
camera.location = loc
# Set camera clipping accordingly to computed bbox.
min_dist = 1e24
@ -298,7 +298,7 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
camera.data.clip_start = min_dist / 2
camera.data.clip_end = max_dist * 2
if light:
loc, ortho_scale = light.camera_fit_coords(bpy.context.depsgraph, cos)
loc, _ortho_scale = light.camera_fit_coords(bpy.context.depsgraph, cos)
light.location = loc
scene.update()

View File

@ -137,7 +137,7 @@ def modules_from_path(path, loaded_modules):
"""
modules = []
for mod_name, mod_path in _bpy.path.module_names(path):
for mod_name, _mod_path in _bpy.path.module_names(path):
mod = _test_import(mod_name, loaded_modules)
if mod:
modules.append(mod)
@ -868,7 +868,6 @@ def unregister_tool(tool_cls):
del tool_list[-1]
while tool_list and tool_list[0] is None:
del tool_list[0]
is_none_prev = False
# Remove duplicate separators.
for i in range(len(tool_list) - 1, -1, -1):
is_none = tool_list[i] is None

View File

@ -138,7 +138,7 @@ def load_image(imagepath,
def _recursive_search(paths, filename_check):
for path in paths:
for dirpath, dirnames, filenames in os.walk(path):
for dirpath, _dirnames, filenames in os.walk(path):
# skip '.svn'
if dirpath[0] in {".", b'.'}:

View File

@ -131,7 +131,7 @@ class ShaderWrapper():
if self._node_texcoords is None and not self.is_readonly:
tree = self.material.node_tree
nodes = tree.nodes
links = tree.links
# links = tree.links
node_texcoords = nodes.new(type='ShaderNodeTexCoord')
node_texcoords.label = "Texture Coords"
@ -521,8 +521,8 @@ class ShaderImageTextureWrapper():
self._node_mapping = ...
tree = node_dst.id_data
nodes = tree.nodes
links = tree.links
# nodes = tree.nodes
# links = tree.links
if socket_dst.is_linked:
from_node = socket_dst.links[0].from_node

View File

@ -99,10 +99,10 @@ def add_uvs(mesh, minor_seg, major_seg):
u_prev = u_init
u_next = u_prev + u_step
for major_index in range(major_seg):
for _major_index in range(major_seg):
v_prev = v_init
v_next = v_prev + v_step
for minor_index in range(minor_seg):
for _minor_index in range(minor_seg):
loops = polygons[vertex_index].loop_indices
uv_data[loops[0]].uv = u_prev, v_prev
uv_data[loops[1]].uv = u_next, v_prev

View File

@ -68,7 +68,6 @@ class DATA_PT_context_gpencil(DataButtonsPanel, Panel):
layout = self.layout
ob = context.object
gpencil = context.gpencil
space = context.space_data
if ob:

View File

@ -249,7 +249,6 @@ class GreasePencilStrokeSculptPanel:
layout.use_property_decorate = False
settings = context.tool_settings.gpencil_sculpt
tool = settings.sculpt_tool
brush = settings.brush
layout.template_icon_view(settings, "sculpt_tool", show_labels=True)

View File

@ -1000,7 +1000,6 @@ class PARTICLE_PT_physics_fluid_interaction(ParticleButtonsPanel, Panel):
layout.use_property_split = True
psys = context.particle_system
part = particle_get_settings(context)
row = layout.row()
row.template_list("UI_UL_list", "particle_targets", psys, "targets",

View File

@ -491,7 +491,6 @@ class RENDER_PT_eevee_film(RenderButtonsPanel, Panel):
layout.use_property_split = True
scene = context.scene
props = scene.eevee
rd = scene.render
col = layout.column()

View File

@ -383,8 +383,6 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
def draw(self, context):
layout = self.layout
sc = context.space_data
col = layout.column(align=True)
row = col.row(align=True)
row.operator("clip.add_marker_at_click", text="Add")

View File

@ -719,7 +719,6 @@ class IMAGE_PT_view_display(Panel):
ima = sima.image
show_uvedit = sima.show_uvedit
show_maskedit = sima.show_maskedit
uvedit = sima.uv_editor
col = layout.column()

View File

@ -294,10 +294,11 @@ class _draw_left_context_mode:
if tool is None:
return
is_paint = True
# is_paint = True
# FIXME: tools must use their own UI drawing!
if tool.idname in {"builtin.line", "builtin.box", "builtin.circle", "builtin.arc", "builtin.curve"}:
is_paint = False
# is_paint = False
pass
elif tool.idname == "Cutter":
row = layout.row(align=True)
row.prop(context.tool_settings.gpencil_sculpt, "intersection_threshold")

View File

@ -1518,7 +1518,6 @@ class USERPREF_PT_input_tablet(PreferencePanel, Panel):
@classmethod
def poll(cls, context):
prefs = context.preferences
inputs = prefs.inputs
return prefs.active_section == 'INPUT'
def draw_props(self, context, layout):

View File

@ -135,7 +135,6 @@ class VIEW3D_HT_header(Header):
# Orientation
if object_mode in {'OBJECT', 'EDIT', 'EDIT_GPENCIL'} or has_pose_mode:
orient_slot = scene.transform_orientation_slots[0]
custom_orientation = orient_slot.custom_orientation
trans_name, trans_icon = orient_slot.ui_info()
row = layout.row(align=True)
@ -651,7 +650,6 @@ class VIEW3D_MT_view_local(Menu):
def draw(self, context):
layout = self.layout
view = context.space_data
layout.operator("view3d.localview", text="Toggle Local View")
layout.operator("view3d.localview_remove_from")
@ -4333,13 +4331,14 @@ class VIEW3D_PT_collections(Panel):
need_separator = False
icon = 'BLANK1'
has_objects = True
# has_objects = True
if child.has_selected_objects(view_layer):
icon = 'LAYER_ACTIVE'
elif child.has_objects():
icon = 'LAYER_USED'
else:
has_objects = False
# has_objects = False
pass
row = layout.row()
sub = row.split(factor=0.98)
@ -4365,7 +4364,7 @@ class VIEW3D_PT_collections(Panel):
layout.use_property_split = False
layout.label(text="Collections Visibility")
col = layout.column()
layout.column()
view_layer = context.view_layer
# We pass index 0 here beause the index is increased
@ -4891,7 +4890,6 @@ class VIEW3D_PT_overlay_edit_mesh(Panel):
view = context.space_data
overlay = view.overlay
shading = view.shading
display_all = overlay.show_overlays
col = layout.column()

View File

@ -1663,7 +1663,7 @@ class VIEW3D_PT_tools_grease_pencil_brushcurves(View3DPanel, Panel):
return brush is not None and brush.gpencil_tool not in {'ERASE', 'FILL'}
def draw(self, context):
layout = self.layout
pass
class VIEW3D_PT_tools_grease_pencil_brushcurves_sensitivity(View3DPanel, Panel):

View File

@ -45,7 +45,7 @@ FORCE_PEP8_ALL = False
def file_list_py(path):
for dirpath, dirnames, filenames in os.walk(path):
for dirpath, _dirnames, filenames in os.walk(path):
for filename in filenames:
if filename.endswith((".py", ".cfg")):
yield os.path.join(dirpath, filename)