[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1737] trunk/py/scripts/addons: pep8 cleanup.

Campbell Barton ideasman42 at gmail.com
Sun Mar 27 07:24:00 CEST 2011


Revision: 1737
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1737
Author:   campbellbarton
Date:     2011-03-27 05:24:00 +0000 (Sun, 27 Mar 2011)
Log Message:
-----------
pep8 cleanup. untag lwo and mhx formats as pep8 compliant.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_import_scene_lwo.py
    trunk/py/scripts/addons/io_import_scene_mhx.py
    trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
    trunk/py/scripts/addons/io_scene_3ds/import_3ds.py

Modified: trunk/py/scripts/addons/io_import_scene_lwo.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_lwo.py	2011-03-26 09:37:44 UTC (rev 1736)
+++ trunk/py/scripts/addons/io_import_scene_lwo.py	2011-03-27 05:24:00 UTC (rev 1737)
@@ -16,8 +16,6 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 
-# <pep8 compliant>
-
 bl_info= {
     "name": "Import LightWave Objects",
     "author": "Ken Nign (Ken9)",

Modified: trunk/py/scripts/addons/io_import_scene_mhx.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_mhx.py	2011-03-26 09:37:44 UTC (rev 1736)
+++ trunk/py/scripts/addons/io_import_scene_mhx.py	2011-03-27 05:24:00 UTC (rev 1737)
@@ -16,8 +16,6 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 
-# <pep8 compliant>
-
 # Project Name:        MakeHuman
 # Product Home Page:   http://www.makehuman.org/
 # Code Home Page:      http://code.google.com/p/makehuman/

Modified: trunk/py/scripts/addons/io_scene_3ds/export_3ds.py
===================================================================
--- trunk/py/scripts/addons/io_scene_3ds/export_3ds.py	2011-03-26 09:37:44 UTC (rev 1736)
+++ trunk/py/scripts/addons/io_scene_3ds/export_3ds.py	2011-03-27 05:24:00 UTC (rev 1737)
@@ -32,58 +32,58 @@
 
 #Some of the chunks that we will export
 #----- Primary Chunk, at the beginning of each file
-PRIMARY= 0x4D4D
+PRIMARY = 0x4D4D
 
 #------ Main Chunks
-OBJECTINFO   =      0x3D3D      #This gives the version of the mesh and is found right before the material and object information
-VERSION      =      0x0002      #This gives the version of the .3ds file
-KFDATA       =      0xB000      #This is the header for all of the key frame info
+OBJECTINFO = 0x3D3D  # This gives the version of the mesh and is found right before the material and object information
+VERSION = 0x0002  # This gives the version of the .3ds file
+KFDATA = 0xB000  # This is the header for all of the key frame info
 
 #------ sub defines of OBJECTINFO
-MATERIAL=45055		#0xAFFF				// This stored the texture info
-OBJECT=16384		#0x4000				// This stores the faces, vertices, etc...
+MATERIAL = 45055  # 0xAFFF				// This stored the texture info
+OBJECT = 16384  # 0x4000				// This stores the faces, vertices, etc...
 
 #>------ sub defines of MATERIAL
-MATNAME    =      0xA000      # This holds the material name
-MATAMBIENT   =      0xA010      # Ambient color of the object/material
-MATDIFFUSE   =      0xA020      # This holds the color of the object/material
-MATSPECULAR   =      0xA030      # SPecular color of the object/material
-MATSHINESS   =      0xA040      # ??
-MATMAP       =      0xA200      # This is a header for a new material
-MATMAPFILE    =      0xA300      # This holds the file name of the texture
+MATNAME = 0xA000  # This holds the material name
+MATAMBIENT = 0xA010  # Ambient color of the object/material
+MATDIFFUSE = 0xA020  # This holds the color of the object/material
+MATSPECULAR = 0xA030  # SPecular color of the object/material
+MATSHINESS = 0xA040  # ??
+MATMAP = 0xA200  # This is a header for a new material
+MATMAPFILE = 0xA300  # This holds the file name of the texture
 
-RGB1=	0x0011
-RGB2=	0x0012
+RGB1 = 0x0011
+RGB2 = 0x0012
 
 #>------ sub defines of OBJECT
-OBJECT_MESH  =      0x4100      # This lets us know that we are reading a new object
-OBJECT_LIGHT =      0x4600      # This lets un know we are reading a light object
-OBJECT_CAMERA=      0x4700      # This lets un know we are reading a camera object
+OBJECT_MESH = 0x4100  # This lets us know that we are reading a new object
+OBJECT_LIGHT = 0x4600  # This lets un know we are reading a light object
+OBJECT_CAMERA = 0x4700  # This lets un know we are reading a camera object
 
 #>------ sub defines of CAMERA
-OBJECT_CAM_RANGES=   0x4720      # The camera range values
+OBJECT_CAM_RANGES = 0x4720      # The camera range values
 
 #>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES =   0x4110      # The objects vertices
-OBJECT_FACES    =   0x4120      # The objects faces
-OBJECT_MATERIAL =   0x4130      # This is found if the object has a material, either texture map or color
-OBJECT_UV       =   0x4140      # The UV texture coordinates
-OBJECT_TRANS_MATRIX  =   0x4160 # The Object Matrix
+OBJECT_VERTICES = 0x4110  # The objects vertices
+OBJECT_FACES = 0x4120  # The objects faces
+OBJECT_MATERIAL = 0x4130  # This is found if the object has a material, either texture map or color
+OBJECT_UV = 0x4140  # The UV texture coordinates
+OBJECT_TRANS_MATRIX = 0x4160  # The Object Matrix
 
 #>------ sub defines of KFDATA
-KFDATA_KFHDR            = 0xB00A
-KFDATA_KFSEG            = 0xB008
-KFDATA_KFCURTIME        = 0xB009
-KFDATA_OBJECT_NODE_TAG  = 0xB002
+KFDATA_KFHDR = 0xB00A
+KFDATA_KFSEG = 0xB008
+KFDATA_KFCURTIME = 0xB009
+KFDATA_OBJECT_NODE_TAG = 0xB002
 
 #>------ sub defines of OBJECT_NODE_TAG
-OBJECT_NODE_ID          = 0xB030
-OBJECT_NODE_HDR         = 0xB010
-OBJECT_PIVOT            = 0xB013
-OBJECT_INSTANCE_NAME    = 0xB011
-POS_TRACK_TAG			= 0xB020
-ROT_TRACK_TAG			= 0xB021
-SCL_TRACK_TAG			= 0xB022
+OBJECT_NODE_ID = 0xB030
+OBJECT_NODE_HDR = 0xB010
+OBJECT_PIVOT = 0xB013
+OBJECT_INSTANCE_NAME = 0xB011
+POS_TRACK_TAG = 0xB020
+ROT_TRACK_TAG = 0xB021
+SCL_TRACK_TAG = 0xB022
 
 import struct
 
@@ -91,6 +91,8 @@
 # this is verry annoying for filenames!
 name_unique = []  # stores str, ascii only
 name_mapping = {}  # stores {orig: byte} mapping
+
+
 def sane_name(name):
     name_fixed = name_mapping.get(name)
     if name_fixed is not None:
@@ -102,62 +104,69 @@
 
     while new_name in name_unique:
         new_name = new_name_clean + ".%.3d" % i
-        i+=1
+        i += 1
 
     # note, appending the 'str' version.
     name_unique.append(new_name)
     name_mapping[name] = new_name = new_name.encode("ASCII", "replace")
     return new_name
 
+
 def uv_key(uv):
     return round(uv[0], 6), round(uv[1], 6)
 
 # size defines:
 SZ_SHORT = 2
-SZ_INT   = 4
+SZ_INT = 4
 SZ_FLOAT = 4
 
+
 class _3ds_short(object):
     '''Class representing a short (2-byte integer) for a 3ds file.
     *** This looks like an unsigned short H is unsigned from the struct docs - Cam***'''
-    __slots__ = ('value', )
+    __slots__ = ("value", )
+
     def __init__(self, val=0):
         self.value = val
 
     def get_size(self):
         return SZ_SHORT
 
-    def write(self,file):
+    def write(self, file):
         file.write(struct.pack("<H", self.value))
 
     def __str__(self):
         return str(self.value)
 
+
 class _3ds_int(object):
     '''Class representing an int (4-byte integer) for a 3ds file.'''
-    __slots__ = ('value', )
+    __slots__ = ("value", )
+
     def __init__(self, val):
         self.value = val
 
     def get_size(self):
         return SZ_INT
 
-    def write(self,file):
+    def write(self, file):
         file.write(struct.pack("<I", self.value))
 
     def __str__(self):
         return str(self.value)
 
+
 class _3ds_float(object):
     '''Class representing a 4-byte IEEE floating point number for a 3ds file.'''
-    __slots__ = ('value', )
+    __slots__ = ("value", )
+
     def __init__(self, val):
-        self.value=val
+        self.value = val
 
     def get_size(self):
         return SZ_FLOAT
 
-    def write(self,file):
+    def write(self, file):
         file.write(struct.pack("<f", self.value))
 
     def __str__(self):
@@ -166,31 +175,34 @@
 
 class _3ds_string(object):
     '''Class representing a zero-terminated string for a 3ds file.'''
-    __slots__ = ('value', )
+    __slots__ = ("value", )
+
     def __init__(self, val):
         assert(type(val) == bytes)
         self.value = val
 
     def get_size(self):
-        return (len(self.value)+1)
+        return (len(self.value) + 1)
 
-    def write(self,file):
-        binary_format = "<%ds" % (len(self.value)+1)
+    def write(self, file):
+        binary_format = "<%ds" % (len(self.value) + 1)
         file.write(struct.pack(binary_format, self.value))
 
     def __str__(self):
         return self.value
 
+
 class _3ds_point_3d(object):
     '''Class representing a three-dimensional point for a 3ds file.'''
-    __slots__ = 'x','y','z'
+    __slots__ = "x", "y", "z"
+
     def __init__(self, point):
         self.x, self.y, self.z = point
 
     def get_size(self):
-        return 3*SZ_FLOAT
+        return 3 * SZ_FLOAT
 
-    def write(self,file):
+    def write(self, file):
         file.write(struct.pack('<3f', self.x, self.y, self.z))
 
     def __str__(self):
@@ -200,7 +212,7 @@
 """
 class _3ds_point_4d(object):
     '''Class representing a four-dimensional point for a 3ds file, for instance a quaternion.'''
-    __slots__ = 'x','y','z','w'
+    __slots__ = "x","y","z","w"
     def __init__(self, point=(0.0,0.0,0.0,0.0)):
         self.x, self.y, self.z, self.w = point
 
@@ -215,76 +227,84 @@
         return '(%f, %f, %f, %f)' % (self.x, self.y, self.z, self.w)
 """
 
+
 class _3ds_point_uv(object):
     '''Class representing a UV-coordinate for a 3ds file.'''
-    __slots__ = ('uv', )
+    __slots__ = ("uv", )
+
     def __init__(self, point):
         self.uv = point
 
     def __cmp__(self, other):
-        return cmp(self.uv,other.uv)
+        return cmp(self.uv, other.uv)
 
     def get_size(self):
-        return 2*SZ_FLOAT
+        return 2 * SZ_FLOAT
 
-    def write(self,file):
-        data=struct.pack('<2f', self.uv[0], self.uv[1])
+    def write(self, file):
+        data = struct.pack('<2f', self.uv[0], self.uv[1])
         file.write(data)
 
     def __str__(self):
         return '(%g, %g)' % self.uv
 
+
 class _3ds_rgb_color(object):
     '''Class representing a (24-bit) rgb color for a 3ds file.'''
-    __slots__ = 'r','g','b'
+    __slots__ = "r", "g", "b"
+
     def __init__(self, col):
         self.r, self.g, self.b = col
 
     def get_size(self):
         return 3
 
-    def write(self,file):
-        file.write( struct.pack('<3B', int(255*self.r), int(255*self.g), int(255*self.b) ) )
-# 		file.write( struct.pack('<3c', chr(int(255*self.r)), chr(int(255*self.g)), chr(int(255*self.b)) ) )
+    def write(self, file):
+        file.write(struct.pack('<3B', int(255 * self.r), int(255 * self.g), int(255 * self.b)))
+# 		file.write(struct.pack('<3c', chr(int(255*self.r)), chr(int(255*self.g)), chr(int(255*self.b)) ) )
 
     def __str__(self):
         return '{%f, %f, %f}' % (self.r, self.g, self.b)
 
+
 class _3ds_face(object):
     '''Class representing a face for a 3ds file.'''

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list