[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1067] trunk/py/scripts/addons: minor syntax adjustments
Campbell Barton
ideasman42 at gmail.com
Sun Sep 19 16:26:41 CEST 2010
Revision: 1067
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1067
Author: campbellbarton
Date: 2010-09-19 16:26:41 +0200 (Sun, 19 Sep 2010)
Log Message:
-----------
minor syntax adjustments
Modified Paths:
--------------
trunk/py/scripts/addons/add_mesh_3d_function_surface.py
trunk/py/scripts/addons/add_mesh_gears.py
trunk/py/scripts/addons/add_mesh_solid.py
trunk/py/scripts/addons/io_export_directx_x.py
trunk/py/scripts/addons/io_export_unreal_psk_psa.py
trunk/py/scripts/addons/io_import_scene_mhx.py
trunk/py/scripts/addons/io_mesh_raw/import_raw.py
trunk/py/scripts/addons/io_mesh_stl/stl_utils.py
trunk/py/scripts/addons/object_fracture/fracture_ops.py
trunk/py/scripts/addons/render_povray/render.py
trunk/py/scripts/addons/space_view3d_spacebar_menu.py
Modified: trunk/py/scripts/addons/add_mesh_3d_function_surface.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_3d_function_surface.py 2010-09-19 14:15:16 UTC (rev 1066)
+++ trunk/py/scripts/addons/add_mesh_3d_function_surface.py 2010-09-19 14:26:41 UTC (rev 1067)
@@ -111,7 +111,7 @@
'sin', 'sinh', 'sqrt', 'tan', 'tanh']
# Use the list to filter the local namespace
-safe_dict = dict([(k, globals().get(k, None)) for k in safe_list])
+safe_dict = dict((k, globals().get(k, None)) for k in safe_list)
# Stores the values of a list of properties and the
Modified: trunk/py/scripts/addons/add_mesh_gears.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_gears.py 2010-09-19 14:15:16 UTC (rev 1066)
+++ trunk/py/scripts/addons/add_mesh_gears.py 2010-09-19 14:26:41 UTC (rev 1067)
@@ -350,7 +350,7 @@
C = [cos(i) for i in A]
S = [sin(i) for i in A]
- verts.extend([(Rb * I, Rb * J, d) for (I, J) in zip(C, S)])
+ verts.extend((Rb * I, Rb * J, d) for (I, J) in zip(C, S))
edgefaces2.append(len(verts) - 1)
Rb = Rb - s
@@ -552,7 +552,7 @@
radius * c, De * c, base * c,
spbevel, spwidth, splength, 0, spresol)
verts.extend(sv)
- faces.extend([[j + fl for j in i] for i in sf])
+ faces.extend([j + fl for j in i] for i in sf)
fl += len(sv)
d1 = fl - len(sv)
Modified: trunk/py/scripts/addons/add_mesh_solid.py
===================================================================
--- trunk/py/scripts/addons/add_mesh_solid.py 2010-09-19 14:15:16 UTC (rev 1066)
+++ trunk/py/scripts/addons/add_mesh_solid.py 2010-09-19 14:26:41 UTC (rev 1067)
@@ -342,7 +342,7 @@
if vtrunc == 0:
if dual: # dual is as simple as another, but mirrored platonic solid
vInput,fInput = source(dualSource[plato])
- supposed_size = Asum([vInput[i] for i in fInput[0]]).length/len(fInput[0])
+ supposed_size = Asum(vInput[i] for i in fInput[0]).length / len(fInput[0])
vInput = [-i*supposed_size for i in vInput] # mirror it
return vInput,fInput
return source(plato)
@@ -352,7 +352,7 @@
# truncation is now equal to simple truncation of the dual of the source
elif vtrunc > 0.5:
vInput,fInput = source(dualSource[plato])
- supposed_size = Asum([vInput[i] for i in fInput[0]]).length/len(fInput[0])
+ supposed_size = Asum(vInput[i] for i in fInput[0]).length / len(fInput[0])
# account for the source being a dual
vtrunc = 1-vtrunc
if vtrunc == 0: # no truncation
@@ -504,7 +504,7 @@
# calculate supposed vertex length to ensure continuity
if supposed_size:
- supposed_size *= len(vert_faces[0])/Asum([verts[i] for i in vert_faces[0]]).length
+ supposed_size *= len(vert_faces[0])/Asum(verts[i] for i in vert_faces[0]).length
verts = [-i*supposed_size for i in verts]
# generate face-faces by looking up the old verts and replacing them with
@@ -532,14 +532,14 @@
# face. do it in this order to ease the following face creation
nVerts = []
for i in vert_faces:
- nVerts.append(Asum([verts[j] for j in i])/len(i))
+ nVerts.append(Asum(verts[j] for j in i)/len(i))
if etrunc:
eStart = len(nVerts)
for i in edge_faces:
- nVerts.append(Asum([verts[j] for j in i])/len(i))
+ nVerts.append(Asum(verts[j] for j in i)/len(i))
fStart = len(nVerts)
for i in face_faces:
- nVerts.append(Asum([verts[j] for j in i])/len(i))
+ nVerts.append(Asum(verts[j] for j in i)/len(i))
# the special face generation for snub duals, it sucks, even i dont get it
if lSnub or rSnub:
for x in range(len(fInput)):
Modified: trunk/py/scripts/addons/io_export_directx_x.py
===================================================================
--- trunk/py/scripts/addons/io_export_directx_x.py 2010-09-19 14:15:16 UTC (rev 1066)
+++ trunk/py/scripts/addons/io_export_directx_x.py 2010-09-19 14:26:41 UTC (rev 1067)
@@ -101,7 +101,7 @@
if Config.ExportMode == 1:
Config.ExportList = [Object for Object in Config.context.scene.objects
if Object.type in ("ARMATURE", "EMPTY", "MESH")
- and Object.parent == None]
+ and Object.parent is None]
else:
ExportList = [Object for Object in Config.context.selected_objects
if Object.type in ("ARMATURE", "EMPTY", "MESH")]
@@ -230,7 +230,7 @@
if Config.ExportArmatures and Object.type == "ARMATURE":
Armature = Object.data
- ParentList = [Bone for Bone in Armature.bones if Bone.parent == None]
+ ParentList = [Bone for Bone in Armature.bones if Bone.parent is None]
if Config.Verbose:
print(" Writing Armature Bones...")
WriteArmatureBones(Config, Object, ParentList)
Modified: trunk/py/scripts/addons/io_export_unreal_psk_psa.py
===================================================================
--- trunk/py/scripts/addons/io_export_unreal_psk_psa.py 2010-09-19 14:15:16 UTC (rev 1066)
+++ trunk/py/scripts/addons/io_export_unreal_psk_psa.py 2010-09-19 14:26:41 UTC (rev 1067)
@@ -674,7 +674,7 @@
#print(dir(ArmatureData))
for bone in objectbone.bones:
- if(bone.parent == None):
+ if(bone.parent is None):
BoneIndex(bone)
#BBCount += 1
break
@@ -937,7 +937,7 @@
#print '-------------------- Dumping Bone ---------------------- '
#If bone does not have parent that mean it the root bone
- if blender_bone.parent == None:
+ if blender_bone.parent is None:
parent_root = blender_bone
@@ -1033,7 +1033,7 @@
child_count = 0
for current_obj in blender_armature:
current_armature = current_obj.data
- bones = [x for x in current_armature.bones if not x.parent == None]
+ bones = [x for x in current_armature.bones if not x.parent is None]
child_count += len(bones)
for current_obj in blender_armature:
@@ -1044,11 +1044,11 @@
#we dont want children here - only the top level bones of the armature itself
#we will recursively dump the child bones as we dump these bones
"""
- bones = [x for x in current_armature.bones if not x.parent == None]
+ bones = [x for x in current_armature.bones if not x.parent is None]
#will ingore this part of the ocde
"""
for current_bone in current_armature.bones: #list the bone. #note this will list all the bones.
- if(current_bone.parent == None):
+ if(current_bone.parent is None):
parse_bone(current_bone, psk_file, psa_file, 0, 0, current_obj.matrix_local, None)
break
@@ -1174,7 +1174,7 @@
#these must be ordered in the order the bones will show up in the PSA file!
ordered_bones = {}
- ordered_bones = sorted([(psa_file.UseBone(x.name), x) for x in pose_data.bones], key=operator.itemgetter(0))
+ ordered_bones = sorted((psa_file.UseBone(x.name), x) for x in pose_data.bones, key=operator.itemgetter(0))
#############################
# ORDERED FRAME, BONE
Modified: trunk/py/scripts/addons/io_import_scene_mhx.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_mhx.py 2010-09-19 14:15:16 UTC (rev 1066)
+++ trunk/py/scripts/addons/io_import_scene_mhx.py 2010-09-19 14:26:41 UTC (rev 1067)
@@ -473,7 +473,7 @@
bpyType = typ.capitalize()
print(bpyType, name, data)
loadedData[bpyType][name] = data
- if data == None:
+ if data is None:
return None
for (key, val, sub) in tokens:
@@ -514,7 +514,7 @@
act = ob.animation_data.action
loadedData['Action'][name] = act
- if act == None:
+ if act is None:
print("Ignoring action %s" % name)
return act
act.name = name
@@ -632,7 +632,7 @@
def parseAnimationData(rna, tokens):
if 0 and toggle & T_MHX:
return
- if rna.animation_data == None:
+ if rna.animation_data is None:
rna.animation_data_create()
adata = rna.animation_data
for (key, val, sub) in tokens:
@@ -742,7 +742,7 @@
name = args[0]
#print("Parse material "+name)
mat = bpy.data.materials.new(name)
- if mat == None:
+ if mat is None:
return None
loadedData['Material'][name] = mat
#print("Material %s %s %s" % (mat, name, loadedData['Material'][name]))
@@ -899,7 +899,7 @@
for n in range(1,len(val)):
filename += " " + val[n]
img = loadImage(filename)
- if img == None:
+ if img is None:
return None
img.name = imgName
else:
@@ -925,7 +925,7 @@
except:
data = None
- if data == None and typ != 'EMPTY':
+ if data is None and typ != 'EMPTY':
print("Failed to find data: %s %s %s" % (name, typ, datName))
return
@@ -966,7 +966,7 @@
def linkObject(ob, data):
#print("Data", data, ob.data)
- if data and ob.data == None:
+ if data and ob.data is None:
ob.data = data
scn = bpy.context.scene
scn.objects.link(ob)
@@ -1267,7 +1267,7 @@
group = ob.vertex_groups.new(grpName)
group.name = grpName
loadedData['VertexGroup'][grpName] = group
- ob.vertex_groups.assign([int(val[0]) for (key, val, sub) in tokens if key == 'wv'], group, float(val[1]), 'REPLACE')
+ ob.vertex_groups.assign(int(val[0]) for (key, val, sub) in tokens if key == 'wv', group, float(val[1]), 'REPLACE')
return
@@ -1285,7 +1285,7 @@
return (toggle & T_Face)
def parseShapeKeys(ob, me, args, tokens):
- if bpy.context.object == None:
+ if bpy.context.object is None:
return
for (key, val, sub) in tokens:
if key == 'ShapeKey':
@@ -1897,7 +1897,7 @@
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list