From 812f23849422e50b2834434c11072de8eb8bda7e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Feb 2011 04:35:41 +0000 Subject: pep8 cleanup and remove unused vars/imports --- release/datafiles/ctodata.py | 1 - release/scripts/modules/bpy/utils.py | 3 -- release/scripts/modules/sys_info.py | 2 - release/scripts/op/object.py | 1 - release/scripts/ui/properties_data_armature.py | 24 ++++++------ release/scripts/ui/properties_data_mesh.py | 1 - release/scripts/ui/properties_material.py | 52 +++++++++++++------------- release/scripts/ui/properties_object.py | 2 - release/scripts/ui/properties_particle.py | 19 +++++----- release/scripts/ui/properties_render.py | 7 ++-- release/scripts/ui/space_console.py | 2 +- release/scripts/ui/space_info.py | 3 +- release/scripts/ui/space_logic.py | 2 - release/scripts/ui/space_sequencer.py | 1 - release/scripts/ui/space_userpref.py | 7 ---- release/scripts/ui/space_userpref_keymap.py | 3 -- release/scripts/ui/space_view3d.py | 10 ++--- release/scripts/ui/space_view3d_toolbar.py | 8 ++-- 18 files changed, 60 insertions(+), 88 deletions(-) (limited to 'release') diff --git a/release/datafiles/ctodata.py b/release/datafiles/ctodata.py index be33f724deb..2d2daabb661 100644 --- a/release/datafiles/ctodata.py +++ b/release/datafiles/ctodata.py @@ -28,7 +28,6 @@ # import sys -import os if len(sys.argv) < 2: sys.stdout.write("Usage: ctodata \n") diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 56f365db7d8..6baed344f75 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -74,9 +74,6 @@ def modules_from_path(path, loaded_modules): :return: all loaded modules. :rtype: list """ - import traceback - import time - modules = [] for mod_name, mod_path in _bpy.path.module_names(path): diff --git a/release/scripts/modules/sys_info.py b/release/scripts/modules/sys_info.py index 303277a5d75..16dfbf1bb3d 100644 --- a/release/scripts/modules/sys_info.py +++ b/release/scripts/modules/sys_info.py @@ -50,8 +50,6 @@ def textWrap(text, length=70): def write_sysinfo(op): output_filename = "system-info.txt" - warnings = 0 - notices = 0 if output_filename in bpy.data.texts.keys(): output = bpy.data.texts[output_filename] diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 92886689972..81ddd4f7c35 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -476,7 +476,6 @@ class MakeDupliFace(bpy.types.Operator): def _main(self, context): from mathutils import Vector - from math import sqrt SCALE_FAC = 0.01 offset = 0.5 * SCALE_FAC diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index a1680daffe4..5f5b5ad3878 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -157,42 +157,42 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, bpy.types.Panel): class DATA_PT_pose_library(ArmatureButtonsPanel, bpy.types.Panel): bl_label = "Pose Library" bl_options = {'DEFAULT_CLOSED'} - + @classmethod def poll(cls, context): return (context.object and context.object.type == 'ARMATURE' and context.object.pose) - + def draw(self, context): layout = self.layout - + ob = context.object poselib = ob.pose_library - + row = layout.row() row.template_ID(ob, "pose_library", new="poselib.new", unlink="poselib.unlink") - + if poselib: activePoseIndex = poselib.pose_markers.active_index if poselib.pose_markers.active: activePoseName = poselib.pose_markers.active.name else: activePoseName = "" - + row = layout.row() row.template_list(poselib, "pose_markers", poselib.pose_markers, "active_index", rows=5) - + col = row.column(align=True) col.active = (poselib.library is None) - - # invoke should still be used for 'add', as it is needed to allow + + # invoke should still be used for 'add', as it is needed to allow # add/replace options to be used properly col.operator("poselib.pose_add", icon='ZOOMIN', text="") - - col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing + + col.operator_context = 'EXEC_DEFAULT' # exec not invoke, so that menu doesn't need showing col.operator("poselib.pose_remove", icon='ZOOMOUT', text="").pose = activePoseName col.operator("poselib.apply_pose", icon='ZOOM_SELECTED', text="").pose_index = activePoseIndex - + row = layout.row() row.operator("poselib.action_sanitise") diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 342204d0e78..5c160a577e4 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -283,7 +283,6 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel): @classmethod def poll(cls, context): ob = context.active_object - rd = context.scene.render return (context.mode == 'EDIT_MESH') and ob and ob.type == 'MESH' diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py index 17501475e51..a531f1c5453 100644 --- a/release/scripts/ui/properties_material.py +++ b/release/scripts/ui/properties_material.py @@ -126,7 +126,7 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel, bpy.types.Panel): elif mat: split.template_ID(space, "pin_id") split.separator() - + if mat: layout.prop(mat, "type", expand=True) if mat.use_nodes: @@ -150,46 +150,46 @@ class MATERIAL_PT_pipeline(MaterialButtonsPanel, bpy.types.Panel): bl_label = "Render Pipeline Options" bl_options = {'DEFAULT_CLOSED'} COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} - + @classmethod def poll(cls, context): mat = context.material engine = context.scene.render.engine return mat and (mat.type in ('SURFACE', 'WIRE', 'VOLUME')) and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self. layout - + mat = context.material #split = layout.split() - mat_type = mat.type in ('SURFACE', 'WIRE') - + mat_type = mat.type in ('SURFACE', 'WIRE') + row = layout.row() row.active = mat_type row.prop(mat, "use_transparency") sub = row.column() sub.prop(mat, "offset_z") sub.active = mat_type and mat.use_transparency and mat.transparency_method == 'Z_TRANSPARENCY' - + row = layout.row() row.active = mat.use_transparency or not mat_type row.prop(mat, "transparency_method", expand=True) - - layout.separator() - + + layout.separator() + split = layout.split() col = split.column() - - col.prop(mat, "use_raytrace") # - col.prop(mat, "use_full_oversampling") # + + col.prop(mat, "use_raytrace") + col.prop(mat, "use_full_oversampling") sub = col.column() sub.active = mat_type sub.prop(mat, "use_sky") sub.prop(mat, "invert_z") - + col = split.column() col.active = mat_type - + col.prop(mat, "use_cast_shadows_only", text="Cast Only") col.prop(mat, "shadow_cast_alpha", text="Casting Alpha") col.prop(mat, "use_cast_buffer_shadows") @@ -205,7 +205,7 @@ class MATERIAL_PT_diffuse(MaterialButtonsPanel, bpy.types.Panel): mat = context.material engine = context.scene.render.engine return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self.layout @@ -264,7 +264,7 @@ class MATERIAL_PT_specular(MaterialButtonsPanel, bpy.types.Panel): mat = context.material engine = context.scene.render.engine return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self.layout @@ -321,7 +321,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel): mat = context.material engine = context.scene.render.engine return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self.layout @@ -359,17 +359,17 @@ class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - + base_mat = context.material mat = active_node_mat(context.material) rayt = mat.raytrace_transparency - + split = layout.split() col = split.column() col.prop(mat, "alpha") row = col.row() - row.active = base_mat.use_transparency and (not mat.use_shadeless) # + row.active = base_mat.use_transparency and (not mat.use_shadeless) row.prop(mat, "specular_alpha", text="Specular") col = split.column() @@ -413,7 +413,7 @@ class MATERIAL_PT_mirror(MaterialButtonsPanel, bpy.types.Panel): def draw_header(self, context): raym = active_node_mat(context.material).raytrace_mirror - + self.layout.prop(raym, "use", text="") def draw(self, context): @@ -679,7 +679,7 @@ class MATERIAL_PT_options(MaterialButtonsPanel, bpy.types.Panel): mat = context.material engine = context.scene.render.engine return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self.layout @@ -717,7 +717,7 @@ class MATERIAL_PT_shadow(MaterialButtonsPanel, bpy.types.Panel): mat = context.material engine = context.scene.render.engine return check_material(mat) and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self.layout @@ -874,13 +874,13 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel): bl_label = "Options" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} bl_options = {'DEFAULT_CLOSED'} - + @classmethod def poll(cls, context): mat = context.material engine = context.scene.render.engine return check_material(mat) and (mat.type == 'VOLUME') and (engine in cls.COMPAT_ENGINES) - + def draw(self, context): layout = self.layout diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 30380e2d338..46455888e7b 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -329,8 +329,6 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # return (context.object) def draw(self, context): - layout = self.layout - ob = context.object self.draw_settings(context, ob.animation_visualisation) diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index 6b635ce1ce8..f84b052df73 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -40,17 +40,18 @@ def particle_panel_poll(cls, context): psys = context.particle_system engine = context.scene.render.engine settings = 0 - + if psys: settings = psys.settings elif isinstance(context.space_data.pin_id, bpy.types.ParticleSettings): settings = context.space_data.pin_id - + if not settings: return False return settings.is_fluid == False and (engine in cls.COMPAT_ENGINES) - + + def particle_get_settings(context): if context.particle_system: return context.particle_system.settings @@ -97,18 +98,18 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel): if psys == None: part = particle_get_settings(context) - + if part == None: return - + layout.template_ID(context.space_data, "pin_id") - + if part.is_fluid: layout.label(text="Settings used for fluid.") return - + layout.prop(part, "type", text="Type") - + elif not psys.settings: split = layout.split(percentage=0.32) @@ -392,7 +393,7 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel): if particle_panel_poll(PARTICLE_PT_rotation, context): psys = context.particle_system settings = particle_get_settings(context) - + if settings.type == 'HAIR' and not settings.use_advanced_hair: return False return settings.physics_type != 'BOIDS' and (psys == None or not psys.point_cache.use_external) diff --git a/release/scripts/ui/properties_render.py b/release/scripts/ui/properties_render.py index 9c5fbb76166..4916ba226c3 100644 --- a/release/scripts/ui/properties_render.py +++ b/release/scripts/ui/properties_render.py @@ -304,18 +304,17 @@ class RENDER_PT_output(RenderButtonsPanel, bpy.types.Panel): if file_format == 'PNG': layout.prop(rd, "file_quality", slider=True, text="Compression") - + if file_format in ('OPEN_EXR', 'MULTILAYER'): row = layout.row() row.prop(rd, "exr_codec", text="Codec") - + if file_format == 'OPEN_EXR': row = layout.row() row.prop(rd, "use_exr_half") row.prop(rd, "exr_zbuf") row.prop(rd, "exr_preview") - elif file_format == 'JPEG2000': split = layout.split() col = split.column() @@ -418,7 +417,7 @@ class RENDER_PT_encoding(RenderButtonsPanel, bpy.types.Panel): col.label(text="Mux:") col.prop(rd, "ffmpeg_muxrate", text="Rate") col.prop(rd, "ffmpeg_packetsize", text="Packet Size") - + layout.separator() # Audio: diff --git a/release/scripts/ui/space_console.py b/release/scripts/ui/space_console.py index b3bd886d8c5..97720947e37 100644 --- a/release/scripts/ui/space_console.py +++ b/release/scripts/ui/space_console.py @@ -25,7 +25,7 @@ class CONSOLE_HT_header(bpy.types.Header): bl_space_type = 'CONSOLE' def draw(self, context): - sc = context.space_data + # sc = context.space_data # text = sc.text layout = self.layout diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 6c392cb9a3d..c19321a198b 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -26,9 +26,7 @@ class INFO_HT_header(bpy.types.Header): def draw(self, context): layout = self.layout - wm = context.window_manager window = context.window - sinfo = context.space_data scene = context.scene rd = scene.render @@ -70,6 +68,7 @@ class INFO_HT_header(bpy.types.Header): # XXX: BEFORE RELEASE, MOVE FILE MENU OUT OF INFO!!! """ + sinfo = context.space_data row = layout.row(align=True) row.prop(sinfo, "show_report_debug", text="Debug") row.prop(sinfo, "show_report_info", text="Info") diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py index 54dde61e90a..3c55853e2e2 100644 --- a/release/scripts/ui/space_logic.py +++ b/release/scripts/ui/space_logic.py @@ -66,8 +66,6 @@ class LOGIC_HT_header(bpy.types.Header): def draw(self, context): layout = self.layout - st = context.space_data - row = layout.row(align=True) row.template_header() diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index 3ae1e35aaf8..937ccf6a8a3 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -353,7 +353,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel): def draw(self, context): layout = self.layout scene = context.scene - render = context.scene.render frame_current = scene.frame_current strip = act_strip(context) diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index e8d80f79ad8..7ebf47d290a 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -817,7 +817,6 @@ class USERPREF_PT_input(InputKeyMapPanel): #start = time.time() userpref = context.user_preferences - wm = context.window_manager inputs = userpref.inputs @@ -871,9 +870,6 @@ class USERPREF_PT_addons(bpy.types.Panel): import sys import time - modules = [] - loaded_modules = set() - # RELEASE SCRIPTS: official scripts distributed in Blender releases paths = bpy.utils.script_paths("addons") @@ -885,9 +881,6 @@ class USERPREF_PT_addons(bpy.types.Panel): # if folder addons_extern/ exists, scripts in there will be loaded too paths += bpy.utils.script_paths("addons_extern") - if bpy.app.debug: - t_main = time.time() - # fake module importing def fake_module(mod_name, mod_path, speedy=True): if bpy.app.debug: diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py index a78ef1be36f..34d461fbef2 100644 --- a/release/scripts/ui/space_userpref_keymap.py +++ b/release/scripts/ui/space_userpref_keymap.py @@ -676,7 +676,6 @@ class WM_OT_keymap_edit(bpy.types.Operator): bl_label = "Edit Key Map" def execute(self, context): - wm = context.window_manager km = context.keymap km.copy_to_user() return {'FINISHED'} @@ -715,7 +714,6 @@ class WM_OT_keyitem_restore(bpy.types.Operator): return km.is_user_defined def execute(self, context): - wm = context.window_manager km = context.keymap kmi = km.items.from_id(self.item_id) @@ -779,7 +777,6 @@ class WM_OT_keyconfig_remove(bpy.types.Operator): return wm.keyconfigs.active.is_user_defined def execute(self, context): - import sys wm = context.window_manager keyconfig = wm.keyconfigs.active wm.keyconfigs.remove(keyconfig) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index d401b779efb..5b23fd6d5c2 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -647,10 +647,11 @@ class VIEW3D_MT_select_face(bpy.types.Menu): # XXX no matching enum bl_label = "Select" def draw(self, context): - layout = self.layout + # layout = self.layout # TODO # see view3d_select_faceselmenu + pass # ********** Object menu ********** @@ -1151,8 +1152,6 @@ class VIEW3D_MT_pose(bpy.types.Menu): def draw(self, context): layout = self.layout - arm = context.active_object.data - layout.operator("ed.undo") layout.operator("ed.redo") @@ -1447,7 +1446,7 @@ class VIEW3D_OT_edit_mesh_extrude_individual_move(bpy.types.Operator): totface = mesh.total_face_sel totedge = mesh.total_edge_sel - totvert = mesh.total_vert_sel + # totvert = mesh.total_vert_sel if select_mode[2] and totface == 1: bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) @@ -1475,7 +1474,7 @@ class VIEW3D_OT_edit_mesh_extrude_move(bpy.types.Operator): totface = mesh.total_face_sel totedge = mesh.total_edge_sel - totvert = mesh.total_vert_sel + # totvert = mesh.total_vert_sel if totface >= 1: bpy.ops.mesh.extrude_region_move('INVOKE_REGION_WIN', TRANSFORM_OT_translate={"constraint_orientation": 'NORMAL', "constraint_axis": (False, False, True)}) @@ -1958,7 +1957,6 @@ class VIEW3D_PT_view3d_properties(bpy.types.Panel): layout = self.layout view = context.space_data - scene = context.scene col = layout.column() col.active = view.region_3d.view_perspective != 'CAMERA' diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 163e02817a4..563eeb5e893 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -782,8 +782,9 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel): settings = __class__.paint_settings(context) brush = settings.brush - texture_paint = context.texture_paint_object - sculpt = context.sculpt_object + ## Unused + # texture_paint = context.texture_paint_object + # sculpt = context.sculpt_object col = layout.column(align=True) @@ -941,7 +942,6 @@ class VIEW3D_PT_sculpt_options(PaintPanel, bpy.types.Panel): tool_settings = context.tool_settings sculpt = tool_settings.sculpt settings = __class__.paint_settings(context) - brush = settings.brush split = layout.split() @@ -978,7 +978,6 @@ class VIEW3D_PT_sculpt_symmetry(PaintPanel, bpy.types.Panel): sculpt = context.tool_settings.sculpt settings = __class__.paint_settings(context) - brush = settings.brush split = layout.split() @@ -1011,7 +1010,6 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel): def draw(self, context): layout = self.layout - sculpt = context.tool_settings.sculpt settings = __class__.paint_settings(context) brush = settings.brush -- cgit v1.2.3