From 4d9766aacf274e42b940b04c6a13b2b57043ca64 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 16 Nov 2011 16:38:37 +0000 Subject: minor cleanup - remove / comment unused python vars - replace mul_v3_fl(somevec, -1.0f); with negate_v3(somevec); --- release/scripts/modules/bpy/path.py | 23 ++++++++++------------ release/scripts/presets/camera/Sony_A55.py | 1 - release/scripts/startup/bl_operators/clip.py | 7 +------ release/scripts/startup/bl_operators/image.py | 2 +- release/scripts/startup/bl_operators/wm.py | 2 +- .../bl_ui/properties_physics_dynamicpaint.py | 6 ------ release/scripts/startup/bl_ui/space_clip.py | 7 ------- release/scripts/startup/bl_ui/space_view3d.py | 17 +++++----------- 8 files changed, 18 insertions(+), 47 deletions(-) (limited to 'release') diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index e6d0fbb99a2..4173d71b39c 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -154,25 +154,23 @@ def resolve_ncase(path): returning a string with the path if found else return the original path. """ - import os - def _ncase_path_found(path): - if not path or os.path.exists(path): + if not path or _os.path.exists(path): return path, True # filename may be a directory or a file - filename = os.path.basename(path) - dirpath = os.path.dirname(path) + filename = _os.path.basename(path) + dirpath = _os.path.dirname(path) suffix = path[:0] # "" but ensure byte/str match if not filename: # dir ends with a slash? if len(dirpath) < len(path): suffix = path[:len(path) - len(dirpath)] - filename = os.path.basename(dirpath) - dirpath = os.path.dirname(dirpath) + filename = _os.path.basename(dirpath) + dirpath = _os.path.dirname(dirpath) - if not os.path.exists(dirpath): + if not _os.path.exists(dirpath): if dirpath == path: return path, False @@ -184,8 +182,8 @@ def resolve_ncase(path): # at this point, the directory exists but not the file # we are expecting 'dirpath' to be a directory, but it could be a file - if os.path.isdir(dirpath): - files = os.listdir(dirpath) + if _os.path.isdir(dirpath): + files = _os.listdir(dirpath) else: return path, False @@ -198,7 +196,7 @@ def resolve_ncase(path): break if f_iter_nocase: - return os.path.join(dirpath, f_iter_nocase) + suffix, True + return _os.path.join(dirpath, f_iter_nocase) + suffix, True else: # cant find the right one, just return the path as is. return path, False @@ -216,8 +214,7 @@ def ensure_ext(filepath, ext, case_sensitive=False): :arg case_sensitive: Check for matching case when comparing extensions. :type case_sensitive: bool """ - import os - fn_base, fn_ext = os.path.splitext(filepath) + fn_base, fn_ext = _os.path.splitext(filepath) if fn_base and fn_ext: if ((case_sensitive and ext == fn_ext) or (ext.lower() == fn_ext.lower())): diff --git a/release/scripts/presets/camera/Sony_A55.py b/release/scripts/presets/camera/Sony_A55.py index 0de8198972a..b0f172206fa 100644 --- a/release/scripts/presets/camera/Sony_A55.py +++ b/release/scripts/presets/camera/Sony_A55.py @@ -2,4 +2,3 @@ import bpy bpy.context.object.data.sensor_width = 23.4 bpy.context.object.data.sensor_height = 15.6 bpy.context.object.data.sensor_fit = 'HORIZONTAL' - diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py index b805178bdc8..d5d9684bcf3 100644 --- a/release/scripts/startup/bl_operators/clip.py +++ b/release/scripts/startup/bl_operators/clip.py @@ -86,13 +86,8 @@ class CLIP_OT_tracks_to_mesh(Operator): @classmethod def poll(cls, context): - if context.space_data.type != 'CLIP_EDITOR': - return False - sc = context.space_data - clip = sc.clip - - return clip + return (sc.type == 'CLIP_EDITOR') and sc.clip def execute(self, context): sc = context.space_data diff --git a/release/scripts/startup/bl_operators/image.py b/release/scripts/startup/bl_operators/image.py index 8c12a6442f7..c97f6eae6c7 100644 --- a/release/scripts/startup/bl_operators/image.py +++ b/release/scripts/startup/bl_operators/image.py @@ -147,7 +147,7 @@ class ProjectEdit(Operator): # opengl buffer may fail, we can't help this, but best report it. try: - ret = bpy.ops.paint.image_from_view() + bpy.ops.paint.image_from_view() except RuntimeError as err: self.report({'ERROR'}, str(err)) return {'CANCELLED'} diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index aa661b76512..14c9a090529 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -106,7 +106,7 @@ def operator_path_is_undo(context, data_path): # luckily we don't do this! # # When we cant find the data owner assume no undo is needed. - data_path_head, data_path_sep, data_path_tail = data_path.rpartition(".") + data_path_head = data_path.rpartition(".")[0] if not data_path_head: return False diff --git a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py index 4e6c4063d2c..68fa0cedaa3 100644 --- a/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py +++ b/release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py @@ -46,7 +46,6 @@ class PHYSICS_PT_dynamic_paint(PhysicButtonsPanel, Panel): layout = self.layout md = context.dynamic_paint - ob = context.object layout.prop(md, "ui_type", expand=True) @@ -129,7 +128,6 @@ class PHYSICS_PT_dp_advanced_canvas(PhysicButtonsPanel, Panel): canvas = context.dynamic_paint.canvas_settings surface = canvas.canvas_surfaces.active - ob = context.object surface_type = surface.surface_type @@ -370,8 +368,6 @@ class PHYSICS_PT_dp_cache(PhysicButtonsPanel, Panel): md.canvas_settings.canvas_surfaces.active.is_cache_user) def draw(self, context): - layout = self.layout - surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active cache = surface.point_cache @@ -442,7 +438,6 @@ class PHYSICS_PT_dp_brush_velocity(PhysicButtonsPanel, Panel): layout = self.layout brush = context.dynamic_paint.brush_settings - ob = context.object split = layout.split() @@ -478,7 +473,6 @@ class PHYSICS_PT_dp_brush_wave(PhysicButtonsPanel, Panel): layout = self.layout brush = context.dynamic_paint.brush_settings - ob = context.object layout.prop(brush, "wave_type") if brush.wave_type != 'REFLECT': diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py index aa1ffe4ca36..237dd7f998d 100644 --- a/release/scripts/startup/bl_ui/space_clip.py +++ b/release/scripts/startup/bl_ui/space_clip.py @@ -115,7 +115,6 @@ class CLIP_PT_tools_tracking(Panel): def draw(self, context): layout = self.layout clip = context.space_data.clip - settings = clip.tracking.settings row = layout.row(align=True) @@ -641,7 +640,6 @@ class CLIP_PT_tools_clip(Panel): def draw(self, context): layout = self.layout - clip = context.space_data.clip layout.operator("clip.set_viewport_background") @@ -698,9 +696,6 @@ class CLIP_MT_proxy(Menu): def draw(self, context): layout = self.layout - sc = context.space_data - clip = sc.clip - layout.operator("clip.rebuild_proxy") layout.operator("clip.delete_proxy") @@ -805,8 +800,6 @@ class CLIP_MT_select(Menu): def draw(self, context): layout = self.layout - sc = context.space_data - layout.operator("clip.select_border") layout.operator("clip.select_circle") diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 536936105e3..6bf8dd82c9b 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -2276,12 +2276,6 @@ class VIEW3D_PT_background_image(Panel): bl_label = "Background Images" bl_options = {'DEFAULT_CLOSED'} - @classmethod - def poll(cls, context): - view = context.space_data - #~ bg = context.space_data.background_image - return (view) - def draw_header(self, context): layout = self.layout view = context.space_data @@ -2315,16 +2309,15 @@ class VIEW3D_PT_background_image(Panel): row = box.row() row.prop(bg, "source", expand=True) - hasbg = False + has_bg = False if bg.source == 'IMAGE': row = box.row() row.template_ID(bg, "image", open="image.open") if (bg.image): box.template_image(bg, "image", bg.image_user, compact=True) - hasbg = True + has_bg = True elif bg.source == 'MOVIE': - has_clip = False box.prop(bg, 'use_camera_clip') column = box.column() @@ -2335,14 +2328,14 @@ class VIEW3D_PT_background_image(Panel): column.template_movieclip(bg, "clip", compact=True) if bg.use_camera_clip or bg.clip: - hasbg = True + has_bg = True column = box.column() - column.active = hasbg + column.active = has_bg column.prop(bg.clip_user, "proxy_render_size", text="") column.prop(bg.clip_user, "use_render_undistorted") - if hasbg: + if has_bg: box.prop(bg, "opacity", slider=True) if bg.view_axis != 'CAMERA': box.prop(bg, "size") -- cgit v1.2.3