minor cleanup
authorCampbell Barton <ideasman42@gmail.com>
Wed, 16 Nov 2011 16:38:37 +0000 (16:38 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 16 Nov 2011 16:38:37 +0000 (16:38 +0000)
- remove / comment unused python vars
- replace mul_v3_fl(somevec, -1.0f); with negate_v3(somevec);

13 files changed:
build_files/cmake/Modules/FindPythonLibsUnix.cmake
intern/cycles/blender/addon/ui.py
release/scripts/modules/bpy/path.py
release/scripts/presets/camera/Sony_A55.py
release/scripts/startup/bl_operators/clip.py
release/scripts/startup/bl_operators/image.py
release/scripts/startup/bl_operators/wm.py
release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_view3d.py
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c

index 8c3ff64d3f3b1b915257d96ba89f7d0d958bc002..448e587e2242008e251a32cd897d03edcfd855d6 100644 (file)
@@ -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
+)
index d96efe93cf8d73ba68d4f4d0b24d6393a7870fca..00010bb7463f346b7e73a1c5913cccb159107e77 100644 (file)
@@ -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
index e6d0fbb99a25a0d3aa7467507216a84175af1414..4173d71b39c7dff1b73f7ec19494bfc1f871fa72 100644 (file)
@@ -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())):
index 0de8198972ae0660a0e7756fa7e58a785dd0af4c..b0f172206fa5de861b448d9b549cfa1648e7af56 100644 (file)
@@ -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'
-
index b805178bdc80c346ec384f63f0aff64e2d17a6ba..d5d9684bcf39a42712679953685a1efb9cb19cce 100644 (file)
@@ -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
index 8c12a6442f7d6eac033c8cd506b878e1ca2b72c8..c97f6eae6c78cc8f7352041b5e54becc21f86865 100644 (file)
@@ -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'}
index aa661b765121b27c22a6062ee0311b2d1798946a..14c9a090529ecdc9c55a88cb15164447642fe290 100644 (file)
@@ -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
index 4e6c4063d2ce24f36b33115b36f6f44edf97ce20..68fa0cedaa319d5b116f2679929a5a644abc4d47 100644 (file)
@@ -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':
index aa1ffe4ca36202c0a5e07955cc37479a46c43b0a..237dd7f998db29eb1568f7b0bb5c76ef1059e101 100644 (file)
@@ -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")
 
index 536936105e359ff20d8b7bafae9a2f2dd922d208..6bf8dd82c9bce09e028be4555470b65cff133d47 100644 (file)
@@ -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")
index 532e6f797ddf6da94437a125af7345958107bf59..522aed439aa88b48863cde1679aa5485131ac76f 100644 (file)
@@ -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;
 
index d28fe8b8509f8a35383ec0215146c29ba6c0221c..220068780a7782536e297bb334b4b74e8ff6b850 100644 (file)
@@ -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);
index cb12230615ec70550b638af5355a2da641a923c2..74fd8ff128bc3ab93b9f239330e6701ae421a727 100644 (file)
@@ -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]);