Code cleanup: unused python vars & imports

Use frosted rather then pyflakes
This commit is contained in:
Campbell Barton
2014-04-25 05:31:20 +10:00
parent 16443b1ae0
commit a15be34389
31 changed files with 24 additions and 61 deletions

View File

@@ -229,9 +229,9 @@ def check(module_name):
def _addon_ensure(module_name):
addons = _user_preferences.addons
addon = _user_preferences.addons.get(module_name)
addon = addons.get(module_name)
if not addon:
addon = _user_preferences.addons.new()
addon = addons.new()
addon.module = module_name

View File

@@ -73,16 +73,11 @@ def region_2d_to_origin_3d(region, rv3d, coord):
:return: The origin of the viewpoint in 3d space.
:rtype: :class:`mathutils.Vector`
"""
from mathutils import Vector
viewinv = rv3d.view_matrix.inverted()
if rv3d.is_perspective:
from mathutils.geometry import intersect_line_plane
origin_start = viewinv.translation.copy()
else:
from mathutils.geometry import intersect_point_line
persmat = rv3d.perspective_matrix.copy()
dx = (2.0 * coord[0] / region.width) - 1.0
dy = (2.0 * coord[1] / region.height) - 1.0

View File

@@ -18,7 +18,6 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel
class NodeCategory():
@@ -92,7 +91,6 @@ def register_node_categories(identifier, cat_list):
def draw_node_item(self, context):
layout = self.layout
col = layout.column()
default_context = bpy.app.translations.contexts.default
for item in self.category.items(context):
item.draw(item, col, context)

View File

@@ -292,7 +292,6 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
kmi_type_set.add(v)
return kmi_type_set
kmi_type_set_combine = None
for i, kmi_type in enumerate(filter_text_split):
kmi_type_set = kmi_type_set_from_string(kmi_type)

View File

@@ -22,7 +22,6 @@ from bpy.types import Operator
from bpy.props import (FloatProperty,
IntProperty,
BoolProperty,
)
from bpy.app.translations import pgettext_data as data_

View File

@@ -87,7 +87,6 @@ class MeshMirrorUV(Operator):
polys = mesh.polygons
loops = mesh.loops
verts = mesh.vertices
uv_loops = mesh.uv_layers.active.data
nbr_polys = len(polys)

View File

@@ -61,7 +61,6 @@ class NodeAddOperator():
@staticmethod
def store_mouse_cursor(context, event):
space = context.space_data
v2d = context.region.view2d
tree = space.edit_tree
# convert mouse position to the View2D for later node placement

View File

@@ -687,7 +687,6 @@ class TransformsToDeltasAnim(Operator):
DELTA_PATHS = STANDARD_TO_DELTA_PATHS.values()
# try to apply on each selected object
success = False
for obj in context.selected_editable_objects:
adt = obj.animation_data
if (adt is None) or (adt.action is None):
@@ -792,7 +791,6 @@ class LodByName(Operator):
return (context.active_object is not None)
def execute(self, context):
scene = context.scene
ob = context.active_object
prefix = ""
@@ -843,7 +841,6 @@ class LodClearAll(Operator):
return (context.active_object is not None)
def execute(self, context):
scene = context.scene
ob = context.active_object
if ob.lod_levels:

View File

@@ -183,7 +183,6 @@ class VertexPaintDirt(Operator):
def execute(self, context):
import time
from math import radians
obj = context.object
mesh = obj.data

View File

@@ -19,7 +19,6 @@
# <pep8-80 compliant>
import bpy
import mathutils
from bpy.types import Operator
from bpy.props import BoolProperty

View File

@@ -19,7 +19,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Operator
from bpy.types import Operator
from bpy.props import (StringProperty,
BoolProperty,
IntProperty,

View File

@@ -195,7 +195,6 @@ class UI_UL_list(bpy.types.UIList):
return a list mapping org_idx -> new_idx,
or an empty list if no sorting has been done.
"""
neworder = [None] * len(items)
_sort = [(idx, getattr(it, propname, "")) for idx, it in enumerate(items)]
return cls.sort_items_helper(_sort, lambda e: e[1].lower())

View File

@@ -292,7 +292,7 @@ class DATA_PT_motion_paths(MotionPathButtonsPanel, Panel):
return (context.object) and (context.armature)
def draw(self, context):
layout = self.layout
# layout = self.layout
ob = context.object
avs = ob.pose.animation_visualization

View File

@@ -76,7 +76,7 @@ class MESH_UL_shape_keys(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, bpy.types.ShapeKey)
obj = active_data
key = data
# key = data
key_block = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:
split = layout.split(0.66, False)
@@ -323,7 +323,6 @@ class DATA_PT_uv_texture(MeshButtonsPanel, Panel):
layout = self.layout
me = context.mesh
lay = me.uv_textures.active
row = layout.row()
col = row.column()
@@ -343,7 +342,6 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, Panel):
layout = self.layout
me = context.mesh
lay = me.vertex_colors.active
row = layout.row()
col = row.column()

View File

@@ -377,7 +377,6 @@ class MASK_MT_select(Menu):
def draw(self, context):
layout = self.layout
sc = context.space_data
layout.operator("mask.select_border")
layout.operator("mask.select_circle")

View File

@@ -73,7 +73,7 @@ class MATERIAL_MT_specials(Menu):
class MATERIAL_UL_matslots(UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# assert(isinstance(item, bpy.types.MaterialSlot)
ob = data
# ob = data
slot = item
ma = slot.material
if self.layout_type in {'DEFAULT', 'COMPACT'}:

View File

@@ -324,7 +324,7 @@ class OBJECT_PT_motion_paths(MotionPathButtonsPanel, Panel):
return (context.object)
def draw(self, context):
layout = self.layout
# layout = self.layout
ob = context.object
avs = ob.animation_visualization

View File

@@ -18,7 +18,7 @@
# <pep8 compliant>
import bpy
from bpy.types import Menu, Panel, UIList
from bpy.types import Panel, UIList
class RenderLayerButtonsPanel():

View File

@@ -182,7 +182,6 @@ class SCENE_PT_color_management(SceneButtonsPanel, Panel):
layout = self.layout
scene = context.scene
rd = scene.render
col = layout.column()
col.label(text="Display:")

View File

@@ -262,7 +262,6 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
sc = context.space_data
clip = sc.clip
settings = clip.tracking.settings
col = layout.column(align=True)
row = col.row(align=True)
@@ -641,7 +640,6 @@ class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
def draw(self, context):
layout = self.layout
sc = context.space_data
clip = context.space_data.clip
active_track = clip.tracking.plane_tracks.active
@@ -1086,7 +1084,6 @@ class CLIP_PT_footage_info(CLIP_PT_clip_view_panel, Panel):
layout = self.layout
sc = context.space_data
clip = sc.clip
col = layout.column()
col.template_movieclip_information(sc, "clip", sc.clip_user)

View File

@@ -458,7 +458,6 @@ class MASK_MT_editor_menus(Menu):
sima = context.space_data
ima = sima.image
show_render = sima.show_render
show_uvedit = sima.show_uvedit
show_maskedit = sima.show_maskedit
@@ -759,7 +758,6 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
toolsettings = context.tool_settings.image_paint
brush = toolsettings.brush
tex_slot = brush.texture_slot
col = layout.column()
col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
@@ -775,7 +773,6 @@ class IMAGE_PT_tools_mask_texture(BrushButtonsPanel, Panel):
layout = self.layout
brush = context.tool_settings.image_paint.brush
tex_slot_alpha = brush.mask_texture_slot
col = layout.column()

View File

@@ -274,7 +274,6 @@ class NODE_PT_active_node_generic(Panel):
@classmethod
def poll(cls, context):
space = context.space_data
return context.active_node is not None
def draw(self, context):
@@ -293,7 +292,6 @@ class NODE_PT_active_node_color(Panel):
@classmethod
def poll(cls, context):
space = context.space_data
return context.active_node is not None
def draw_header(self, context):
@@ -323,7 +321,6 @@ class NODE_PT_active_node_properties(Panel):
@classmethod
def poll(cls, context):
space = context.space_data
return context.active_node is not None
def draw(self, context):

View File

@@ -486,7 +486,6 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
sequencer = context.scene.sequence_editor
strip = act_strip(context)
if strip.input_count > 0:

View File

@@ -30,8 +30,7 @@ class VIEW3D_HT_header(Header):
layout = self.layout
view = context.space_data
mode_string = context.mode
edit_object = context.edit_object
# mode_string = context.mode
obj = context.active_object
toolsettings = context.tool_settings
@@ -2793,8 +2792,6 @@ class VIEW3D_PT_view3d_display(Panel):
view = context.space_data
scene = context.scene
gs = scene.game_settings
obj = context.object
col = layout.column()
col.prop(view, "show_only_render")

View File

@@ -1100,7 +1100,6 @@ class VIEW3D_PT_tools_brush_texture(Panel, View3DPaintPanel):
settings = self.paint_settings(context)
brush = settings.brush
tex_slot = brush.texture_slot
col = layout.column()
@@ -1124,7 +1123,6 @@ class VIEW3D_PT_tools_mask_texture(View3DPanel, Panel):
layout = self.layout
brush = context.tool_settings.image_paint.brush
tex_slot_alpha = brush.mask_texture_slot
col = layout.column()