cleanup for python scripts - unused vars and imports

This commit is contained in:
Campbell Barton
2011-07-10 12:51:37 +00:00
parent 7370ba1839
commit b62a956cc8
11 changed files with 9 additions and 20 deletions

View File

@@ -48,8 +48,6 @@ def paths():
def modules(module_cache): def modules(module_cache):
import os import os
import sys
import time
path_list = paths() path_list = paths()
@@ -173,11 +171,9 @@ def enable(module_name, default_set=True):
:return: the loaded module or None on failier. :return: the loaded module or None on failier.
:rtype: module :rtype: module
""" """
# note, this still gets added to _bpy_types.TypeMap
import os import os
import sys import sys
import bpy_types as _bpy_types
import imp import imp
def handle_error(): def handle_error():
@@ -246,8 +242,6 @@ def disable(module_name, default_set=True):
:type module_name: string :type module_name: string
""" """
import sys import sys
import bpy_types as _bpy_types
mod = sys.modules.get(module_name) mod = sys.modules.get(module_name)
# possible this addon is from a previous session and didnt load a module this time. # possible this addon is from a previous session and didnt load a module this time.

View File

@@ -22,7 +22,6 @@ __all__ = (
"region_2d_to_vector_3d", "region_2d_to_vector_3d",
"region_2d_to_location_3d", "region_2d_to_location_3d",
"location_3d_to_region_2d", "location_3d_to_region_2d",
"location_3d_to_region_2d",
) )

View File

@@ -241,7 +241,7 @@ class _GenericBone:
chain.append(child) chain.append(child)
else: else:
if len(children_basename): if len(children_basename):
print("multiple basenames found, this is probably not what you want!", bone.name, children_basename) print("multiple basenames found, this is probably not what you want!", self.name, children_basename)
break break

View File

@@ -22,7 +22,6 @@
import bpy as _bpy import bpy as _bpy
import bpyml import bpyml
from bpyml import TAG, ARGS, CHILDREN from bpyml import TAG, ARGS, CHILDREN
from types import ModuleType
_uilayout_rna = _bpy.types.UILayout.bl_rna _uilayout_rna = _bpy.types.UILayout.bl_rna

View File

@@ -114,7 +114,7 @@ def draw(layout, context, context_member, property_type, use_edit=True):
to_dict = getattr(val, "to_dict", None) to_dict = getattr(val, "to_dict", None)
to_list = getattr(val, "to_list", None) to_list = getattr(val, "to_list", None)
val_orig = val # val_orig = val # UNUSED
if to_dict: if to_dict:
val = to_dict() val = to_dict()
val_draw = str(val) val_draw = str(val)

View File

@@ -121,7 +121,6 @@ class ProjectEdit(bpy.types.Operator):
def execute(self, context): def execute(self, context):
import os import os
import subprocess
EXT = "png" # could be made an option but for now ok EXT = "png" # could be made an option but for now ok

View File

@@ -87,8 +87,6 @@ class MeshMirrorUV(bpy.types.Operator):
def execute(self, context): def execute(self, context):
DIR = (self.direction == 'NEGATIVE') DIR = (self.direction == 'NEGATIVE')
from mathutils import Vector
ob = context.active_object ob = context.active_object
is_editmode = (ob.mode == 'EDIT') is_editmode = (ob.mode == 'EDIT')
if is_editmode: if is_editmode:

View File

@@ -98,8 +98,6 @@ def align_objects(align_x, align_y, align_z, align_mode, relative_to):
# Main Loop # Main Loop
for obj, bb_world in objs: for obj, bb_world in objs:
loc_world = obj.location
bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box] bb_world = [Vector(v[:]) * obj.matrix_world for v in obj.bound_box]
Left_Up_Front = bb_world[1] Left_Up_Front = bb_world[1]

View File

@@ -78,7 +78,7 @@ class PlayRenderedAnim(bpy.types.Operator):
preset = prefs.filepaths.animation_player_preset preset = prefs.filepaths.animation_player_preset
player_path = prefs.filepaths.animation_player player_path = prefs.filepaths.animation_player
file_path = bpy.path.abspath(rd.filepath) # file_path = bpy.path.abspath(rd.filepath) # UNUSED
is_movie = rd.is_movie_format is_movie = rd.is_movie_format
# try and guess a command line if it doesn't exist # try and guess a command line if it doesn't exist

View File

@@ -42,7 +42,6 @@ def extend(obj, operator, EXTEND_MODE):
edge_average_lengths = {} edge_average_lengths = {}
OTHER_INDEX = 2, 3, 0, 1 OTHER_INDEX = 2, 3, 0, 1
FAST_INDICIES = 0, 2, 1, 3 # order is faster
def extend_uvs(face_source, face_target, edge_key): def extend_uvs(face_source, face_target, edge_key):
''' '''

View File

@@ -444,7 +444,7 @@ def lightmap_uvpack(meshes,
del even_dict del even_dict
del odd_dict del odd_dict
orig = len(pretty_faces) # orig = len(pretty_faces)
pretty_faces = [pf for pf in pretty_faces if not pf.has_parent] pretty_faces = [pf for pf in pretty_faces if not pf.has_parent]
@@ -489,7 +489,10 @@ def lightmap_uvpack(meshes,
if PREF_APPLY_IMAGE: if PREF_APPLY_IMAGE:
if not PREF_PACK_IN_ONE: if not PREF_PACK_IN_ONE:
image = Image.New("lightmap", PREF_IMG_PX_SIZE, PREF_IMG_PX_SIZE, 24) image = bpy.data.images.new(name="lightmap",
width=PREF_IMG_PX_SIZE,
height=PREF_IMG_PX_SIZE,
)
for f in face_sel: for f in face_sel:
# f.image = image # f.image = image
@@ -530,7 +533,7 @@ def unwrap(operator, context, **kwargs):
return {'FINISHED'} return {'FINISHED'}
from bpy.props import BoolProperty, FloatProperty, IntProperty, EnumProperty from bpy.props import BoolProperty, FloatProperty, IntProperty
class LightMapPack(bpy.types.Operator): class LightMapPack(bpy.types.Operator):