indentation edits
authorCampbell Barton <ideasman42@gmail.com>
Sat, 19 Nov 2011 16:19:27 +0000 (16:19 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 19 Nov 2011 16:19:27 +0000 (16:19 +0000)
12 files changed:
add_mesh_walls/Blocks.py
cursor_control/data.py
io_import_lipSync_Importer.py
io_import_pdb_atomic_blender.py
io_import_voodoo_camera.py
io_points_pcd/pcdparser.py
mesh_edge_intersection_tools.py
mesh_select_vertex_groups.py
object_drop_to_ground.py
space_view3d_enhanced_3d_cursor.py
space_view3d_game_props_visualiser.py
wetted_mesh.py

index 24e4b74cf008123365b1a978169f6faa881e9ee4..f7a3ae537a2db811759f43fea568a44ceae9dda5 100644 (file)
@@ -742,9 +742,8 @@ def arch(ra,rt,x,z, archStart, archEnd, bevel, bevAngle, vll):
         if side == 1: pointsToAffect = right
         else: pointsToAffect = left
         for num in pointsToAffect:
-                    offsets[num] = offsets[num][:]
-                    offsets[num][0] += -bevel * side
-        
+            offsets[num] = offsets[num][:]
+            offsets[num][0] += -bevel * side
 
     ArchInner = ra-rt/2
     ArchOuter = ra+rt/2-SetGrt + rndc()*SetGrtVar
@@ -884,8 +883,8 @@ def bevelBlockOffsets(offsets, bevel, side):
     if side == 1: pointsToAffect = (0,2) # right
     else: pointsToAffect = (4,6) # left
     for num in pointsToAffect:
-                offsets[num] = offsets[num][:]
-                offsets[num][0] += bevel * side
+        offsets[num] = offsets[num][:]
+        offsets[num][0] += bevel * side
 
 def rowProcessing(row, Thesketch, WallBoundaries):
     __doc__ = """\
index d5631a05ec4fcc9777e7a34b64ce11d5fe54688a..fcd82d129a35f630d5b6e10fb6989d1ef9bba7d6 100644 (file)
@@ -104,17 +104,17 @@ class CursorControlData(bpy.types.PropertyGroup):
         return (tvs, tes, tfs, edit_mode)
 
     def invertDeltaVector(self):
-      self.deltaVector = Vector([0,0,0])-Vector(self.deltaVector)
+        self.deltaVector = Vector([0,0,0])-Vector(self.deltaVector)
 
     def normalizeDeltaVector(self):
-      q = Vector(self.deltaVector)
-      q.normalize()
-      self.deltaVector = q
+        q = Vector(self.deltaVector)
+        q.normalize()
+        self.deltaVector = q
 
     def addDeltaVectorToCursor(self):
-      c = CursorAccess.getCursor()
-      CursorAccess.setCursor(Vector(c)+Vector(self.deltaVector))
+        c = CursorAccess.getCursor()
+        CursorAccess.setCursor(Vector(c)+Vector(self.deltaVector))
 
     def subDeltaVectorToCursor(self):
-      c = CursorAccess.getCursor()
-      CursorAccess.setCursor(Vector(c)-Vector(self.deltaVector))
+        c = CursorAccess.getCursor()
+        CursorAccess.setCursor(Vector(c)-Vector(self.deltaVector))
index e7e5f666b55c561255d3b5c07fecf7c8ca5609f2..33b93b63024926be31f470adb8e9b75b00d9b855 100644 (file)
@@ -40,7 +40,7 @@ phnmlst="nothing"
 
 # truning off relative path - it causes an error if it was true
 if bpy.context.user_preferences.filepaths.use_relative_paths == True:
-   bpy.context.user_preferences.filepaths.use_relative_paths = False
+    bpy.context.user_preferences.filepaths.use_relative_paths = False
 
 # add blinking
 def blinker():
index 18e46578097e6139204e60e84289782297bacf0f..99f9b6ce2ec69ea8e5026837cc17f0e7ca6b4ec0 100644 (file)
@@ -248,12 +248,12 @@ class CLASS_Distance_Button(bpy.types.Operator):
         dist   = Measure_distance_in_scene()
 
         if dist != "-1.0":
-           # The string length is cut, 3 digits after the first 3 digits 
-           # after the '.'. Append also "Angstrom". 
-           # Remember: 1 Angstrom = 10^(-10) m 
-           pos    = str.find(dist, ".")
-           dist   = dist[:pos+4] 
-           dist   = dist + " Angstrom"
+            # The string length is cut, 3 digits after the first 3 digits 
+            # after the '.'. Append also "Angstrom". 
+            # Remember: 1 Angstrom = 10^(-10) m 
+            pos    = str.find(dist, ".")
+            dist   = dist[:pos+4] 
+            dist   = dist + " Angstrom"
 
         # Put the distance into the string of the output field.
         scn                = bpy.context.scene
@@ -709,31 +709,31 @@ def Draw_scene(FLAG_group_atoms,group_atoms_dn,mesh_yn,Ball_azimuth,Ball_zenith,
     i = 0
     for line in DATAFILEPATH_p:
 
-      if "Atom" in line:
+        if "Atom" in line:
 
-          line              = DATAFILEPATH_p.readline() 
-          line              = DATAFILEPATH_p.readline()
-          pos               = str.find(line, ":")
-          Data_Number.append(line[pos+2:-1])
+            line              = DATAFILEPATH_p.readline() 
+            line              = DATAFILEPATH_p.readline()
+            pos               = str.find(line, ":")
+            Data_Number.append(line[pos+2:-1])
 
-          line              = DATAFILEPATH_p.readline()
-          pos               = str.find(line, ":")
-          Data_Atomname.append(line[pos+2:-1])
+            line              = DATAFILEPATH_p.readline()
+            pos               = str.find(line, ":")
+            Data_Atomname.append(line[pos+2:-1])
 
-          line              = DATAFILEPATH_p.readline()
-          pos               = str.find(line, ":")
-          Data_Shortname.append(line[pos+2:-1])
+            line              = DATAFILEPATH_p.readline()
+            pos               = str.find(line, ":")
+            Data_Shortname.append(line[pos+2:-1])
 
-          line              = DATAFILEPATH_p.readline()
-          pos               = str.find(line, ":")
-          color_value       = line[pos+2:-1].split(',')
-          Data_Color.append([float(color_value[0]),float(color_value[1]),float(color_value[2])]) 
+            line              = DATAFILEPATH_p.readline()
+            pos               = str.find(line, ":")
+            color_value       = line[pos+2:-1].split(',')
+            Data_Color.append([float(color_value[0]),float(color_value[1]),float(color_value[2])]) 
 
-          line              = DATAFILEPATH_p.readline()
-          pos               = str.find(line, ":")
-          Data_Radius.append(line[pos+2:-1])
+            line              = DATAFILEPATH_p.readline()
+            pos               = str.find(line, ":")
+            Data_Radius.append(line[pos+2:-1])
 
-          i += 1
+            i += 1
 
     DATAFILEPATH_p.close()
     
index 90dfbf811e2b08388e42b9fdb0bf4bf5b3b46437..44a4df99d017be771b17458c0cf3b728718f7a24 100644 (file)
@@ -199,7 +199,7 @@ def voodoo_import(infile,ld_cam,ld_points):
     for line in file.readlines():
 
         if (b24 and (line.find('import') != -1) and (line.find('bpy') != -1)):
-                b24= False
+            b24= False
 
         process_line(line)
 
index d430be0b1ba447da2db846b8fd0c7bfb1a75a7c3..8c543c4c10b37cc44ac2df0ac5a5534a95d62f86 100644 (file)
@@ -82,7 +82,7 @@ class PCDParser:
                     break
       
         if version == ".7" or version == "0.7": 
-             return PCDParser_v0_7(filepath, PointClass)
+            return PCDParser_v0_7(filepath, PointClass)
         else:
             return None
 
@@ -101,7 +101,7 @@ class PCDParser:
     
 
     def rmComment(self, line):
-       return line[:line.find('#')] 
+        return line[:line.find('#')] 
 
 
     def parseFile(self):
index 5e6461befe79c8529fad0398cc2340988953f477..d999bff05be5612dc5dda7f053d48197bb35be32 100644 (file)
@@ -187,7 +187,7 @@ def ProjectGeometry(vX, opoint):
 def getMeshMatrix(obj):
     is_editmode = (obj.mode == 'EDIT')
     if is_editmode:
-       bpy.ops.object.mode_set(mode='OBJECT')
+        bpy.ops.object.mode_set(mode='OBJECT')
 
     (edges, meshMatrix) = ([],[])
     mesh = obj.data
index aab42b442a7ad38b82bf930d4b887136127cdd08..c12952b73cecc6ee9d102a34c8a87539756c381b 100644 (file)
@@ -120,66 +120,66 @@ class DeselectFound(bpy.types.Operator):
         return {'FINISHED'}
 
 def set_used():
-        global use_selected_only, used_vertexes, the_mesh, vertex_usage
-        obj = bpy.context.active_object
-        used_vertexes = set()
-        if use_selected_only:
-                for v in obj.data.vertices:
-                        if v.select: used_vertexes.add(v.index)
-        else:
-                for v in obj.data.vertices: used_vertexes.add(v.index)
-        the_mesh = obj
-        vertex_usage = '%d vertexes used' % (len(used_vertexes))
+    global use_selected_only, used_vertexes, the_mesh, vertex_usage
+    obj = bpy.context.active_object
+    used_vertexes = set()
+    if use_selected_only:
+        for v in obj.data.vertices:
+            if v.select: used_vertexes.add(v.index)
+    else:
+        for v in obj.data.vertices: used_vertexes.add(v.index)
+    the_mesh = obj
+    vertex_usage = '%d vertexes used' % (len(used_vertexes))
 
 
 def make_groups(limit):
-        global used_vertexes
-        vgp = []
-        vgdict = {}
-        vgused = {}
-        obj = bpy.context.active_object
-        all_in_group = True
-        for vg in obj.vertex_groups:
-                vgdict[vg.index] = vg.name
-        for v in obj.data.vertices:
-                in_group = False
-                if v.index in used_vertexes:
-                        for g in v.groups:
-                                gr = g.group
-                                w = g.weight
-                                if w > limit:
-                                        if not gr in vgused: vgused[gr] = 0
-                                        vgused[gr] += 1
-                                        in_group = True
-                if not in_group: all_in_group = False
-        if not all_in_group:
-                vgp.append(("no group", "(No group)"))
-        for gn in vgused.keys():
-                name = vgdict[gn]
-                vgp.append((name, '%s has %d vertexes' % (name, vgused[gn]) ))
-        print("%d groups found\n" % len(vgp))
-        return vgp
+    global used_vertexes
+    vgp = []
+    vgdict = {}
+    vgused = {}
+    obj = bpy.context.active_object
+    all_in_group = True
+    for vg in obj.vertex_groups:
+        vgdict[vg.index] = vg.name
+    for v in obj.data.vertices:
+        in_group = False
+        if v.index in used_vertexes:
+            for g in v.groups:
+                gr = g.group
+                w = g.weight
+                if w > limit:
+                    if not gr in vgused: vgused[gr] = 0
+                    vgused[gr] += 1
+                    in_group = True
+        if not in_group: all_in_group = False
+    if not all_in_group:
+        vgp.append(("no group", "(No group)"))
+    for gn in vgused.keys():
+        name = vgdict[gn]
+        vgp.append((name, '%s has %d vertexes' % (name, vgused[gn]) ))
+    print("%d groups found\n" % len(vgp))
+    return vgp
 
 def found_verts(vertex_group):
-        global used_vertexes
-        vgfound = []
-        obj = bpy.context.active_object
-        if vertex_group == 'no group':
-                for v in obj.data.vertices:
-                        if v.index in used_vertexes and len(v.groups) == 0:
-                                vgfound.append(v)
-        else:
-                vgnum = -1
-                for vg in obj.vertex_groups:
-                        if vg.name == vertex_group: vgnum = vg.index
-                for v in obj.data.vertices:
-                        if v.index in used_vertexes:
-                                found = False
-                                for g in v.groups:
-                                        if g.group == vgnum: found = True
-                                if found: vgfound.append(v)
-        print('%d vertexes found for %s' % (len(vgfound), vertex_group))
-        return vgfound
+    global used_vertexes
+    vgfound = []
+    obj = bpy.context.active_object
+    if vertex_group == 'no group':
+        for v in obj.data.vertices:
+            if v.index in used_vertexes and len(v.groups) == 0:
+                gfound.append(v)
+    else:
+        vgnum = -1
+        for vg in obj.vertex_groups:
+            if vg.name == vertex_group: vgnum = vg.index
+        for v in obj.data.vertices:
+            if v.index in used_vertexes:
+                found = False
+                for g in v.groups:
+                        if g.group == vgnum: found = True
+                if found: vgfound.append(v)
+    print('%d vertexes found for %s' % (len(vgfound), vertex_group))
+    return vgfound
 
 
 class VIEW3D_PT_FixVertexGroups(bpy.types.Panel):
@@ -190,16 +190,16 @@ class VIEW3D_PT_FixVertexGroups(bpy.types.Panel):
     @classmethod
     def poll(self, context):
         if bpy.context.active_object:
-           obj = bpy.context.active_object
-           if obj.type == 'MESH' and obj.mode == 'EDIT': return True
+            obj = bpy.context.active_object
+            if obj.type == 'MESH' and obj.mode == 'EDIT': return True
         return False
 
     def draw(self, context):
         global use_selected_only, used_vertexes, the_mesh, vertex_usage
 
         if bpy.context.active_object:
-           obj = bpy.context.active_object
-           if obj.type == 'MESH' and obj.mode == 'EDIT':
+            obj = bpy.context.active_object
+            if obj.type == 'MESH' and obj.mode == 'EDIT':
                 layout = self.layout
                 use_all = layout.operator("mesh.primitive_fvg_useall", "Use all vertexes")
                 layout.operator("mesh.primitive_fvg_useselected", "Use selected vertexes")
@@ -213,12 +213,12 @@ class VIEW3D_PT_FixVertexGroups(bpy.types.Panel):
                 #groups = make_groups(use_all.limitval)
                 groups = make_groups(0.01)
                 for gp in groups:
-                        layout.label(text = gp[1])
-                        row = layout.row()
-                        sel_op = row.operator("mesh.primitive_fvg_selfound", "Select")
-                        sel_op.vertexgroup = gp[0]
-                        desel_op = row.operator("mesh.primitive_fvg_deselfound", "Deselect")
-                        desel_op.vertexgroup = gp[0]
+                    layout.label(text = gp[1])
+                    row = layout.row()
+                    sel_op = row.operator("mesh.primitive_fvg_selfound", "Select")
+                    sel_op.vertexgroup = gp[0]
+                    desel_op = row.operator("mesh.primitive_fvg_deselfound", "Deselect")
+                    desel_op.vertexgroup = gp[0]
 
 classes = [UseAll, UseSelected, SelectFound, DeselectFound]
 
index 783756cb0f96ef8b7ac225df8642aae722921008..d3d312bf3092ec587962af8859d5d2370c32d6d5 100644 (file)
@@ -87,20 +87,20 @@ def do_drop(context,tmpObj, ob):
 # compute randomisation based on the general or specific percentage chosen
 # if the specific percentage is zero then the general percentage is used
 def compute_percentage(min,max,value,percentage):
-        range = max-min
-        general_percentage = 100
-        
-        if percentage == 0:
-            percentage_random = ( value -((range*(general_percentage/100))/2) )+ (range * (general_percentage / 100) * random.random())
-        else:
-            percentage_random = ( value - ((range*(percentage/100))/2)) + (range * (percentage / 100) * random.random())
-             
-        if percentage_random > max:
-            percentage_random = max
-        if percentage_random < min:
-            percentage_random = min
-        
-        return percentage_random 
+    range = max-min
+    general_percentage = 100
+    
+    if percentage == 0:
+        percentage_random = ( value -((range*(general_percentage/100))/2) )+ (range * (general_percentage / 100) * random.random())
+    else:
+        percentage_random = ( value - ((range*(percentage/100))/2)) + (range * (percentage / 100) * random.random())
+         
+    if percentage_random > max:
+        percentage_random = max
+    if percentage_random < min:
+        percentage_random = min
+    
+    return percentage_random 
 
 def main(self, context):
 
@@ -192,27 +192,27 @@ class OBJECT_OT_drop_to_ground(bpy.types.Operator):
 #### REGISTER ####
 
 def register():
-     bpy.utils.register_module(__name__)
-     bpy.types.Scene.align_object = BoolProperty(
+    bpy.utils.register_module(__name__)
+    bpy.types.Scene.align_object = BoolProperty(
         name="Align object to ground",
         description="Aligns the object to the ground",
         default=True)
-     bpy.types.Scene.use_center = BoolProperty(
+    bpy.types.Scene.use_center = BoolProperty(
         name="Use the center to drop",
         description="When dropping the object will be relocated on the basis of its senter",
         default=False)
-     
-     #random location props
-     bpy.types.Scene.random_loc = BoolProperty(
+    
+    #random location props
+    bpy.types.Scene.random_loc = BoolProperty(
         name="Random Location",
         description="When dropping the object will be relocated randomly ",
         default=False)
-     bpy.types.Scene.rl_min_x =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the x axis", default = 0)
-     bpy.types.Scene.rl_max_x =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the x axis", default = 0)
-     bpy.types.Scene.rl_min_y =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the y axis", default = 0)
-     bpy.types.Scene.rl_max_y =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the y axis", default = 0)
-     bpy.types.Scene.rl_min_z =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the z axis", default = 0)
-     bpy.types.Scene.rl_max_z =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the z axis", default = 0)
+    bpy.types.Scene.rl_min_x =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the x axis", default = 0)
+    bpy.types.Scene.rl_max_x =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the x axis", default = 0)
+    bpy.types.Scene.rl_min_y =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the y axis", default = 0)
+    bpy.types.Scene.rl_max_y =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the y axis", default = 0)
+    bpy.types.Scene.rl_min_z =  IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the z axis", default = 0)
+    bpy.types.Scene.rl_max_z =  IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the z axis", default = 0)
      
 def unregister():
     bpy.utils.unregister_module(__name__)
index ce070581d551e1c3153a16ea7ce28f5c058b768e..33c95bdf0fdad43a2c1e51dda0c98aa4bd5b684f 100644 (file)
@@ -1193,7 +1193,7 @@ class EnhancedSetCursor(bpy.types.Operator):
             xyz_width = 0
             for i in range(3):
                 if i == self.current_axis:
-                   curr_axis_x_start = xyz_width
+                    curr_axis_x_start = xyz_width
                 
                 xyz_width += axis_cells[i].w
                 
@@ -1207,7 +1207,7 @@ class EnhancedSetCursor(bpy.types.Operator):
                 xyz_width += coord_cells[i].w
                 
                 if i == self.current_axis:
-                   curr_axis_x_end = xyz_width
+                    curr_axis_x_end = xyz_width
                 
                 xyz_width += xyz_margin
             
@@ -4178,11 +4178,11 @@ def round_step(x, s=1.0):
 
 twoPi = 2.0 * math.pi
 def clamp_angle(ang):
-       # Attention! In Python the behaviour is:
-       # -359.0 % 180.0 == 1.0
-       # -359.0 % -180.0 == -179.0
-       ang = (ang % twoPi)
-       return ((ang - twoPi) if (ang > math.pi) else ang)
+    # Attention! In Python the behaviour is:
+    # -359.0 % 180.0 == 1.0
+    # -359.0 % -180.0 == -179.0
+    ang = (ang % twoPi)
+    return ((ang - twoPi) if (ang > math.pi) else ang)
 
 def prepare_grid_mesh(nx=1, ny=1, sx=1.0, sy=1.0, z=0.0, xyz_indices=(0,1,2)):
     vertices = []
index 6f4d090c8536f7368bdf1890644db7f04837d24a..f4e7bc52ae209978e9584cd2ee3cac6b1d007a6a 100644 (file)
@@ -74,9 +74,9 @@ def calc_callback(self, context):
         total_mat = view_mat*ob_mat
  
         for p in ob.game.properties:
-          d=0.0#{'data':p.name+':'+str(p.value)}
-         #print (d)
-          locs.append([ mathutils.Vector([0,0,0]).resize_4d()])
+            d=0.0#{'data':p.name+':'+str(p.value)}
+            # print (d)
+            locs.append([ mathutils.Vector([0,0,0]).resize_4d()])
     
     
         for loc in locs:
index bda459c85ba6686dbb81d2458acf9d7dc59d1aee..996bcb87696c8113ad9285a38a2d3be1623643a6 100644 (file)
@@ -49,15 +49,15 @@ class VIEW3D_PT_tools_WettedMesh(bpy.types.Panel):
         slcnt = len(context.selected_objects)
 
         if slcnt != 2:
-           col.label(text = 'Select two mesh objects')
-           col.label(text = 'to generate separated')
-           col.label(text = 'fluid, dry and wetted')
-           col.label(text = 'meshes.')
+            col.label(text = 'Select two mesh objects')
+            col.label(text = 'to generate separated')
+            col.label(text = 'fluid, dry and wetted')
+            col.label(text = 'meshes.')
         else:
-           (solid, fluid) = getSelectedPair(context)
-           col.label(text = 'solid = '+solid.name)
-           col.label(text = 'fluid = '+fluid.name)
-           col.operator('mesh.primitive_wetted_mesh_add', text='Generate Meshes')
+            (solid, fluid) = getSelectedPair(context)
+            col.label(text = 'solid = '+solid.name)
+            col.label(text = 'fluid = '+fluid.name)
+            col.operator('mesh.primitive_wetted_mesh_add', text='Generate Meshes')
 
 ### Operator ###
 class AddWettedMesh(bpy.types.Operator):
@@ -144,7 +144,7 @@ class AddWettedMesh(bpy.types.Operator):
         i = 0
         for f in fluidMinusSolid.data.faces:
             if i % 500 == 0:
-               print("      ", i, " / ", numFaces)
+                print("      ", i, " / ", numFaces)
             i += 1
             fuid = unifiedFaceId(kdtrees, f, fluidMinusSolid.data.vertices, \
                                  faceDict, vertDict, cacheDict)
@@ -157,7 +157,7 @@ class AddWettedMesh(bpy.types.Operator):
         i = 0
         for f in fluidUnionSolid.data.faces:
             if i % 500 == 0:
-               print("      ", i, " / ", numFaces)
+                print("      ", i, " / ", numFaces)
             i += 1
             fuid = unifiedFaceId(kdtrees, f, fluidUnionSolid.data.vertices, \
                                  faceDict, vertDict, cacheDict)
@@ -305,7 +305,7 @@ def getSelectedPair(context):
     objA = context.object
     objB = context.selected_objects[0]
     if objA == objB:
-       objB = context.selected_objects[1]
+        objB = context.selected_objects[1]
     return (objA, objB)
 
 # get a unified vertex id for given coordinates