[Bf-blender-cvs] [23fdac86729] blender2.8: Cleanup: unused variables

Campbell Barton noreply at git.blender.org
Thu Oct 25 03:05:04 CEST 2018


Commit: 23fdac8672965aaa7c08bc8e2db416ceff875ee6
Author: Campbell Barton
Date:   Thu Oct 25 12:03:34 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB23fdac8672965aaa7c08bc8e2db416ceff875ee6

Cleanup: unused variables

===================================================================

M	release/scripts/startup/bl_operators/clip.py
M	release/scripts/startup/bl_operators/object.py
M	release/scripts/startup/bl_operators/wm.py
M	release/scripts/startup/bl_ui/properties_data_camera.py
M	release/scripts/startup/bl_ui/properties_physics_cloth.py
M	release/scripts/startup/bl_ui/space_clip.py
M	release/scripts/startup/bl_ui/space_image.py
M	release/scripts/startup/bl_ui/space_toolsystem_common.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	release/scripts/startup/bl_ui/space_view3d.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index d1bc8030d1e..dfdfa845114 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -624,7 +624,7 @@ class CLIP_OT_setup_tracking_scene(Operator):
             fg.use_sky = True
 
         if not view_layers.get("Background"):
-            bg = view_layers.new("Background")
+            _bg = view_layers.new("Background")
 
     @staticmethod
     def createCollection(context, collection_name):
@@ -969,8 +969,6 @@ class CLIP_OT_setup_tracking_scene(Operator):
             setup_shadow_catcher_objects(bg_coll)
 
     def execute(self, context):
-        scene = context.scene
-
         self._setupScene(context)
         self._setupWorld(context)
         self._setupCamera(context)
diff --git a/release/scripts/startup/bl_operators/object.py b/release/scripts/startup/bl_operators/object.py
index ae12db225cf..a24f6a742c1 100644
--- a/release/scripts/startup/bl_operators/object.py
+++ b/release/scripts/startup/bl_operators/object.py
@@ -254,7 +254,7 @@ class SubdivisionSet(Operator):
                     if not relative:
                         if level > mod.total_levels:
                             sub = level - mod.total_levels
-                            for i in range(sub):
+                            for _ in range(sub):
                                 bpy.ops.object.multires_subdivide(modifier="Multires")
 
                         if obj.mode == 'SCULPT':
@@ -287,7 +287,7 @@ class SubdivisionSet(Operator):
                 if obj.mode == 'SCULPT':
                     mod = obj.modifiers.new("Multires", 'MULTIRES')
                     if level > 0:
-                        for i in range(0, level):
+                        for _ in range(level):
                             bpy.ops.object.multires_subdivide(modifier="Multires")
                 else:
                     mod = obj.modifiers.new("Subsurf", 'SUBSURF')
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py
index 5ba430ab9f5..9e7f8028f75 100644
--- a/release/scripts/startup/bl_operators/wm.py
+++ b/release/scripts/startup/bl_operators/wm.py
@@ -1521,7 +1521,6 @@ class WM_OT_copy_prev_settings(Operator):
         return os.path.isfile(old_userpref) and not os.path.isfile(new_userpref)
 
     def execute(self, context):
-        import os
         import shutil
 
         shutil.copytree(self._old_path(), self._new_path(), symlinks=True)
@@ -2204,7 +2203,7 @@ class WM_OT_addon_remove(Operator):
     # lame confirmation check
     def draw(self, context):
         self.layout.label(text="Remove Add-on: %r?" % self.module)
-        path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
+        path, _isdir = WM_OT_addon_remove.path_from_addon(self.module)
         self.layout.label(text="Path: %r" % path)
 
     def invoke(self, context, event):
diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py
index 0e3ee0e3044..ffeab50f02c 100644
--- a/release/scripts/startup/bl_ui/properties_data_camera.py
+++ b/release/scripts/startup/bl_ui/properties_data_camera.py
@@ -18,7 +18,7 @@
 
 # <pep8 compliant>
 import bpy
-from bpy.types import Panel, Menu
+from bpy.types import Panel
 from rna_prop_ui import PropertyPanel
 from bl_operators.presets import PresetMenu
 
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index ee2415b26d3..ab281ef64d6 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -64,7 +64,6 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
         layout.use_property_split = True
 
         md = context.cloth
-        ob = context.object
         cloth = md.settings
 
         layout.active = cloth_panel_enabled(md)
@@ -236,7 +235,6 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
 
         cloth = context.cloth.collision_settings
         md = context.cloth
-        ob = context.object
 
         layout.active = (cloth.use_collision or cloth.use_self_collision) and cloth_panel_enabled(md)
 
diff --git a/release/scripts/startup/bl_ui/space_clip.py b/release/scripts/startup/bl_ui/space_clip.py
index 88d556ae808..a9e5443fcbe 100644
--- a/release/scripts/startup/bl_ui/space_clip.py
+++ b/release/scripts/startup/bl_ui/space_clip.py
@@ -390,7 +390,6 @@ class CLIP_PT_tools_marker(CLIP_PT_tracking_panel, Panel):
         layout = self.layout
 
         sc = context.space_data
-        clip = sc.clip
 
         col = layout.column(align=True)
         row = col.row(align=True)
@@ -812,7 +811,6 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
         layout.use_property_decorate = False
 
         clip = context.space_data.clip
-        settings = clip.tracking.settings
 
         col = layout.column()
 
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index f5310645bfa..411e931cb0e 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -515,7 +515,6 @@ class IMAGE_HT_header(Header):
         ima = sima.image
         iuser = sima.image_user
         toolsettings = context.tool_settings
-        mode = sima.mode
 
         show_render = sima.show_render
         show_uvedit = sima.show_uvedit
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py
index 55fe0a3c4a5..11601334913 100644
--- a/release/scripts/startup/bl_ui/space_toolsystem_common.py
+++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py
@@ -584,7 +584,7 @@ class WM_MT_toolsystem_submenu(Menu):
         layout = self.layout
         layout.scale_y = 2.0
 
-        cls, item_group = self._tool_group_from_button(context)
+        _cls, item_group = self._tool_group_from_button(context)
         if item_group is None:
             # Should never happen, just in case
             layout.label(text="Unable to find toolbar group")
@@ -616,7 +616,7 @@ def _activate_by_item(context, space_type, item, index):
 
 
 def activate_by_name(context, space_type, text):
-    cls, item, index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
+    _cls, item, index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
     if item is None:
         return False
     _activate_by_item(context, space_type, item, index)
@@ -626,7 +626,7 @@ def activate_by_name(context, space_type, text):
 def activate_by_name_or_cycle(context, space_type, text, offset=1):
 
     # Only cycle when the active tool is activated again.
-    cls, item, index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
+    cls, item, _index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
     if item is None:
         return False
 
@@ -637,7 +637,7 @@ def activate_by_name_or_cycle(context, space_type, text, offset=1):
     for item_group in cls.tools_from_context(context):
         if type(item_group) is tuple:
             index_current = cls._tool_group_active.get(item_group[0].text, 0)
-            for i, sub_item in enumerate(item_group):
+            for sub_item in item_group:
                 if sub_item.text == text:
                     text_current = item_group[index_current].text
                     break
@@ -660,7 +660,7 @@ def activate_by_name_or_cycle(context, space_type, text, offset=1):
 
 def description_from_name(context, space_type, text, *, use_operator=True):
     # Used directly for tooltips.
-    cls, item, index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
+    _cls, item, _index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
     if item is None:
         return False
 
@@ -685,7 +685,7 @@ def description_from_name(context, space_type, text, *, use_operator=True):
 
 def keymap_from_name(context, space_type, text):
     # Used directly for tooltips.
-    cls, item, index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
+    _cls, item, _index = ToolSelectPanelHelper._tool_get_by_name(context, space_type, text)
     if item is None:
         return False
 
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 420fa656b85..d78f13bf9e1 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1441,7 +1441,7 @@ class USERPREF_PT_addons(Panel):
                                 "wm.addon_remove", text="Remove", icon='CANCEL',
                             ).module = mod.__name__
 
-                        for i in range(4 - tot_row):
+                        for _ in range(4 - tot_row):
                             split.separator()
 
                     # Show addon user preferences
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index cdf908df87d..750c8fcd6a9 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3847,7 +3847,6 @@ class VIEW3D_MT_orientations_pie(Menu):
         layout = self.layout
         pie = layout.menu_pie()
         scene = context.scene
-        orientation = scene.current_orientation
 
         pie.prop(scene, "transform_orientation", expand=True)



More information about the Bf-blender-cvs mailing list