[Bf-extensions-cvs] [4ae173a] master: Cleanup: pep8

Campbell Barton noreply at git.blender.org
Wed Jul 27 10:28:25 CEST 2016


Commit: 4ae173a2b03eb1381d12d1048b296a4c777d33ae
Author: Campbell Barton
Date:   Wed Jul 27 18:25:23 2016 +1000
Branches: master
https://developer.blender.org/rBAC4ae173a2b03eb1381d12d1048b296a4c777d33ae

Cleanup: pep8

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

M	object_boolean_tools.py

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

diff --git a/object_boolean_tools.py b/object_boolean_tools.py
index 6ad4a60..63337d7 100644
--- a/object_boolean_tools.py
+++ b/object_boolean_tools.py
@@ -31,8 +31,6 @@ bl_info = {
     }
 
 import bpy
-import bmesh
-import time
 from bpy.app.handlers import persistent
 from bpy.types import (
         Operator,
@@ -53,6 +51,8 @@ def update_BoolHide(self, context):
         o.hide = hide_state
 
 # Object is a Canvas
+
+
 def isCanvas(_obj):
     try:
         if _obj["BoolToolRoot"]:
@@ -96,8 +96,8 @@ def FindCanvas(obj):
 
 
 def isFTransf():
-    addons = bpy.context.user_preferences.addons
     user_preferences = bpy.context.user_preferences
+    addons = user_preferences.addons
     addon_prefs = addons[__name__].preferences
     if addon_prefs.fast_transform:
         return True
@@ -155,22 +155,23 @@ def Operation(context, _operation):
             else:
                 selObj.draw_type = "BOUNDS"
 
-            cyclesVis.camera = False;
-            cyclesVis.diffuse = False;
-            cyclesVis.glossy = False;
-            cyclesVis.shadow = False;
-            cyclesVis.transmission = False;
-            if _operation=="SLICE":
-                clone=context.active_object.copy() #copies dupli_group property(empty), but group property is empty (users_group = None)
+            cyclesVis.camera = False
+            cyclesVis.diffuse = False
+            cyclesVis.glossy = False
+            cyclesVis.shadow = False
+            cyclesVis.transmission = False
+            if _operation == "SLICE":
+                # copies dupli_group property(empty), but group property is empty (users_group = None)
+                clone = context.active_object.copy()
                 # clone.select=True
                 context.scene.objects.link(clone)
-                sliceMod = clone.modifiers.new("BTool_" + selObj.name, "BOOLEAN") #add mod to clone obj
+                sliceMod = clone.modifiers.new("BTool_" + selObj.name, "BOOLEAN")  # add mod to clone obj
                 sliceMod.object = selObj
                 sliceMod.operation = "DIFFERENCE"
                 clone["BoolToolRoot"] = True
             newMod = actObj.modifiers.new("BTool_" + selObj.name, "BOOLEAN")
             newMod.object = selObj
-            if _operation=="SLICE":
+            if _operation == "SLICE":
                 newMod.operation = "INTERSECT"
             else:
                 newMod.operation = _operation
@@ -194,19 +195,20 @@ def Operation_Direct(context, _operation):
                 selObj.draw_type = "WIRE"
             else:
                 selObj.draw_type = "BOUNDS"
-            if _operation=="SLICE":
-                clone=context.active_object.copy() #copies dupli_group property(empty), but group property is empty (users_group = None)
+            if _operation == "SLICE":
+                # copies dupli_group property(empty), but group property is empty (users_group = None)
+                clone = context.active_object.copy()
                 # clone.select=True
-                clone.data=context.active_object.data.copy()
+                clone.data = context.active_object.data.copy()
                 context.scene.objects.link(clone)
-                sliceMod = clone.modifiers.new("BTool_" + selObj.name, "BOOLEAN") #add mod to clone obj
+                sliceMod = clone.modifiers.new("BTool_" + selObj.name, "BOOLEAN")  # add mod to clone obj
                 sliceMod.object = selObj
                 sliceMod.operation = "DIFFERENCE"
 
                 bpy.ops.object.modifier_apply(modifier=sliceMod.name)
 
             newMod = actObj.modifiers.new("BTool_" + selObj.name, "BOOLEAN")
-            if _operation=="SLICE":
+            if _operation == "SLICE":
                 newMod.operation = "INTERSECT"
             else:
                 newMod.operation = _operation
@@ -231,11 +233,11 @@ def Remove(context, thisObj_name, Prop):
                 obj.draw_type = "TEXTURED"
                 del obj["BoolToolBrush"]
                 del obj["BoolTool_FTransform"]
-                cyclesVis.camera = True;
-                cyclesVis.diffuse = True;
-                cyclesVis.glossy = True;
-                cyclesVis.shadow = True;
-                cyclesVis.transmission = True;
+                cyclesVis.camera = True
+                cyclesVis.diffuse = True
+                cyclesVis.glossy = True
+                cyclesVis.shadow = True
+                cyclesVis.transmission = True
 
                 # Remove it from the Canvas
                 for mod in actObj.modifiers:
@@ -259,11 +261,11 @@ def Remove(context, thisObj_name, Prop):
                         actObj.draw_type = "TEXTURED"
                         del actObj["BoolToolBrush"]
                         del actObj["BoolTool_FTransform"]
-                        cyclesVis.camera = True;
-                        cyclesVis.diffuse = True;
-                        cyclesVis.glossy = True;
-                        cyclesVis.shadow = True;
-                        cyclesVis.transmission = True;
+                        cyclesVis.camera = True
+                        cyclesVis.diffuse = True
+                        cyclesVis.glossy = True
+                        cyclesVis.shadow = True
+                        cyclesVis.transmission = True
 
         if Prop == "CANVAS":
             for mod in actObj.modifiers:
@@ -335,8 +337,8 @@ def ApplyAll(context, list):
                     objDeleteList.append(mod.object)
                 try:
                     bpy.ops.object.modifier_apply(modifier=mod.name)
-                except: #if fails the means it is multiuser data
-                    context.active_object.data=context.active_object.data.copy() #so just make data unique
+                except:  # if fails the means it is multiuser data
+                    context.active_object.data = context.active_object.data.copy()  # so just make data unique
                     bpy.ops.object.modifier_apply(modifier=mod.name)
 
             # bpy.ops.object.select_all(action='TOGGLE')
@@ -348,7 +350,7 @@ def ApplyAll(context, list):
         if isCanvas(obj):
             for mod in obj.modifiers:
                 if mod.type == 'BOOLEAN':
-                    if mod.object in objDeleteList: # do not delete brush that is used by another canvas
+                    if mod.object in objDeleteList:  # do not delete brush that is used by another canvas
                         objDeleteList.remove(mod.object)  # remove it from deletion
     bpy.ops.object.select_all(action='DESELECT')
     # for obj in objDeleteList:
@@ -382,8 +384,8 @@ def ApplyThisBrush(context, brush):
                     context.scene.objects.active = obj
                     try:
                         bpy.ops.object.modifier_apply(modifier=mod.name)
-                    except: #if fails the means it is multiuser data
-                        context.active_object.data=context.active_object.data.copy() #so just make data unique
+                    except:  # if fails the means it is multiuser data
+                        context.active_object.data = context.active_object.data.copy()  # so just make data unique
                         bpy.ops.object.modifier_apply(modifier=mod.name)
                     bpy.ops.object.select_all(action='TOGGLE')
                     bpy.ops.object.select_all(action='DESELECT')
@@ -411,7 +413,7 @@ def GCollector(_obj):
         for mod in _obj.modifiers:
             if ("BTool_" in mod.name):
                 BTRoot = True
-                if (mod.object == None):
+                if mod.object is None:
                     _obj.modifiers.remove(mod)
         if not BTRoot:
             del _obj["BoolToolRoot"]
@@ -504,6 +506,7 @@ class BTool_FastTransform(Operator):
     operator = bpy.props.StringProperty("")
 
     count = 0
+
     def modal(self, context, event):
         self.count += 1
         actObj = bpy.context.active_object
@@ -596,6 +599,8 @@ class BTool_Diff(Operator):
         return {'FINISHED'}
 
 # Boolean Slices Operator
+
+
 class BTool_Slice(Operator):
     """This operator add a intersect brush to a canvas"""
     bl_idname = "btool.boolean_slice"
@@ -611,6 +616,7 @@ class BTool_Slice(Operator):
 
 # Booltron Direct FUNCTIONS ---------------------------------------------------
 
+
 def mesh_selection(ob, select_action):
     context = bpy.context
     scene = context.scene
@@ -667,6 +673,7 @@ def objects_get():
 
 # Booltron Direct Operators ---------------------------------------------------
 
+
 class Direct_Union(Operator):
     """Combine selected objects"""
     bl_idname = "btool.direct_union"
@@ -677,6 +684,7 @@ class Direct_Union(Operator):
         boolean_each('UNION')
         return {'FINISHED'}
 
+
 class Direct_Difference(Operator):
     """Subtract selected objects from active object"""
     bl_idname = "btool.direct_difference"
@@ -687,6 +695,7 @@ class Direct_Difference(Operator):
         boolean_each('DIFFERENCE')
         return {'FINISHED'}
 
+
 class Direct_Intersect(Operator):
     """Keep only intersecting geometry"""
     bl_idname = "btool.direct_intersect"
@@ -697,6 +706,7 @@ class Direct_Intersect(Operator):
         boolean_each('INTERSECT')
         return {'FINISHED'}
 
+
 class Direct_Slice(Operator):
     """Slice active object along the selected object (can handle only two objects at a time)"""
     bl_idname = "btool.direct_slice"
@@ -725,8 +735,10 @@ class Direct_Slice(Operator):
         modifier_boolean(obj_copy, ob, 'INTERSECT')
         return {'FINISHED'}
 
+
 class Direct_Subtract(Operator):
-    """Subtract selected object from active object, subtracted object not removed (can handle only two objects at a time))"""
+    """Subtract selected object from active object, """ \
+    """subtracted object not removed (can handle only two objects at a time))"""
     bl_idname = "btool.direct_subtract"
     bl_label = "Subtract"
     bl_options = {'REGISTER', 'UNDO'}
@@ -743,6 +755,8 @@ class Direct_Subtract(Operator):
 # Utils Class ---------------------------------------------------------------
 
 # Find the Brush Selected in Three View
+
+
 class BTool_FindBrush(Operator):
     """Find the this brush"""
     bl_idname = "btoo

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list