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); --- build_files/cmake/Modules/FindPythonLibsUnix.cmake | 10 +++++----- intern/cycles/blender/addon/ui.py | 14 ++++++------- 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 +++++----------- source/blender/blenkernel/intern/dynamicpaint.c | 2 +- source/blender/blenkernel/intern/particle.c | 4 ++-- source/blender/blenkernel/intern/particle_system.c | 4 ++-- 13 files changed, 35 insertions(+), 64 deletions(-) diff --git a/build_files/cmake/Modules/FindPythonLibsUnix.cmake b/build_files/cmake/Modules/FindPythonLibsUnix.cmake index 8c3ff64d3f3..448e587e224 100644 --- a/build_files/cmake/Modules/FindPythonLibsUnix.cmake +++ b/build_files/cmake/Modules/FindPythonLibsUnix.cmake @@ -139,9 +139,9 @@ IF(PYTHONLIBSUNIX_FOUND) # not used # SET(PYTHON_BINARY ${PYTHON_EXECUTABLE} CACHE STRING "") - - MARK_AS_ADVANCED( - PYTHON_INCLUDE_DIR - PYTHON_LIBRARY - ) ENDIF() + +MARK_AS_ADVANCED( + PYTHON_INCLUDE_DIR + PYTHON_LIBRARY +) diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index d96efe93cf8..00010bb7463 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -459,7 +459,7 @@ class CyclesWorld_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - world = context.world + # world = context.world return False # world and world.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): @@ -493,7 +493,7 @@ class CyclesMaterial_PT_volume(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - mat = context.material + # mat = context.material return False # mat and mat.node_tree and CyclesButtonsPanel.poll(context) def draw(self, context): @@ -562,7 +562,7 @@ class CyclesTexture_PT_context(CyclesButtonsPanel, Panel): pin_id = space.pin_id use_pin_id = space.use_pin_id user = context.texture_user - node = context.texture_node + # node = context.texture_node if not use_pin_id or not isinstance(pin_id, bpy.types.Texture): pin_id = None @@ -638,7 +638,7 @@ class CyclesTexture_PT_mapping(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout - tex = context.texture + # tex = context.texture node = context.texture_node mapping = node.texture_mapping @@ -664,15 +664,15 @@ class CyclesTexture_PT_colors(CyclesButtonsPanel, Panel): @classmethod def poll(cls, context): - tex = context.texture - node = context.texture_node + # tex = context.texture + # node = context.texture_node return False #return (node or (tex and tex.use_nodes)) and CyclesButtonsPanel.poll(context) def draw(self, context): layout = self.layout - tex = context.texture + # tex = context.texture node = context.texture_node mapping = node.color_mapping 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") diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 532e6f797dd..522aed439aa 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3235,7 +3235,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, /* Also cast a ray in opposite direction to make sure * point is at least surrounded by two brush faces */ - mul_v3_fl(ray_dir, -1.0f); + negate_v3(ray_dir); hit.index = -1; hit.dist = 9999; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d28fe8b8509..220068780a7 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1911,7 +1911,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float switch(type) { case PART_KINK_CURL: { - mul_v3_fl(par_vec, -1.f); + negate_v3(par_vec); if(flat > 0.f) { float proj[3]; @@ -1977,7 +1977,7 @@ static void do_kink(ParticleKey *state, ParticleKey *par, float *par_rot, float mul_qt_v3(par_rot, z_vec); } - mul_v3_fl(par_vec, -1.f); + negate_v3(par_vec); normalize_v3_v3(vec_one, par_vec); inp_y=dot_v3v3(y_vec, vec_one); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index cb12230615e..74fd8ff128b 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2679,7 +2679,7 @@ static float nr_signed_distance_to_plane(float *p, float radius, ParticleCollisi } if(pce->inv_nor == 1) { - mul_v3_fl(nor, -1.f); + negate_v3(nor); d = -d; } @@ -2799,7 +2799,7 @@ static void collision_point_on_surface(float p[3], ParticleCollisionElement *pce normalize_v3(nor); if(pce->inv_nor == 1) - mul_v3_fl(nor, -1.f); + negate_v3(nor); madd_v3_v3v3fl(co, pce->x0, nor, col->radius); madd_v3_v3fl(co, e1, pce->uv[0]); -- cgit v1.2.3