[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2841] trunk/py/scripts/addons: various style edits, no functional changes

Campbell Barton ideasman42 at gmail.com
Sat Dec 31 11:57:44 CET 2011


Revision: 2841
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2841
Author:   campbellbarton
Date:     2011-12-31 10:57:35 +0000 (Sat, 31 Dec 2011)
Log Message:
-----------
various style edits, no functional changes

Modified Paths:
--------------
    trunk/py/scripts/addons/io_import_gimp_image_to_scene.py
    trunk/py/scripts/addons/io_import_images_as_planes.py
    trunk/py/scripts/addons/io_mesh_ply/__init__.py
    trunk/py/scripts/addons/io_mesh_ply/export_ply.py
    trunk/py/scripts/addons/io_mesh_raw/__init__.py
    trunk/py/scripts/addons/io_mesh_raw/export_raw.py
    trunk/py/scripts/addons/io_mesh_raw/import_raw.py

Modified: trunk/py/scripts/addons/io_import_gimp_image_to_scene.py
===================================================================
--- trunk/py/scripts/addons/io_import_gimp_image_to_scene.py	2011-12-31 10:27:24 UTC (rev 2840)
+++ trunk/py/scripts/addons/io_import_gimp_image_to_scene.py	2011-12-31 10:57:35 UTC (rev 2841)
@@ -25,19 +25,19 @@
     "location": "File > Import > GIMP Image to Scene(.xcf/.xjt)",
     "description": "Imports GIMP multilayer image files as a series of multiple planes",
     "warning": "XCF import requires xcftools installed",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
-        "Scripts/Import-Export/GIMPImageToScene",
-    "tracker_url": "http://projects.blender.org/tracker/index.php?"\
-        "func=detail&aid=25136",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+                "Scripts/Import-Export/GIMPImageToScene",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?"
+                   "func=detail&aid=25136",
     "category": "Import-Export"}
 
 """
 This script imports GIMP layered image files into 3D Scenes (.xcf, .xjt)
 """
 
-def main(File, Path, LayerViewers, MixerViewers, LayerOffset,\
-    LayerScale, OpacityMode, PremulAlpha, ShadelessMats,\
-    SetCamera, SetupCompo, GroupUntagged, Ext):
+def main(File, Path, LayerViewers, MixerViewers, LayerOffset,
+         LayerScale, OpacityMode, PremulAlpha, ShadelessMats,
+         SetCamera, SetupCompo, GroupUntagged, Ext):
     
     #-------------------------------------------------
     
@@ -147,8 +147,8 @@
                         os.rename(PathSaveRaw+imageFile, PathSaveRaw+NameShort+'.jpg')
                         if HasAlpha: os.rename(PathSaveRaw+imageFileAlpha, PathSaveRaw+NameShort+'_A'+'.jpg')
                         
-                IMGs.append({'LayerMode':md, 'LayerOpacity':op,\
-                            'LayerName':n, 'LayerNameShort':NameShort,\
+                IMGs.append({'LayerMode':md, 'LayerOpacity':op,
+                            'LayerName':n, 'LayerNameShort':NameShort,
                             'RenderLayer':RenderLayer, 'LayerCoords':[ow, oh, ox, oy], 'HasAlpha':HasAlpha})
     
     else: # Ext == '.xcf':
@@ -194,14 +194,14 @@
                     Mode = LineThree[:Slash]
                     Opacity = float(LineThree[Slash+1:LineThree.find('%')])*.01
                 
-                IMGs.append ({\
-                    'LayerMode':Mode,\
-                    'LayerOpacity':Opacity,\
-                    'LayerName':Line[4].rstrip(),\
-                    'LayerNameShort':NameShort,\
-                    'LayerCoords':list(map(int, Line[1].replace('x', ' ').replace('+', ' +').replace('-', ' -').split())),\
-                    'RenderLayer':RenderLayer,\
-                    'HasAlpha':True,\
+                IMGs.append ({
+                    'LayerMode': Mode,
+                    'LayerOpacity': Opacity,
+                    'LayerName': Line[4].rstrip(),
+                    'LayerNameShort': NameShort,
+                    'LayerCoords': list(map(int, Line[1].replace('x', ' ').replace('+', ' +').replace('-', ' -').split())),
+                    'RenderLayer': RenderLayer,
+                    'HasAlpha': True,
                     })
             elif Line.startswith('Version'):
                 ResX, ResY = map (int, Line.split()[2].split('x'))
@@ -213,8 +213,8 @@
         else:
             Opacity = ' --percent 100'
         for Layer in IMGs:
-            CMD = '%s -C %s%s -o %s%s.png "%s"%s' %\
-            (XCF2PNG, Path, File, PathSave, Layer['LayerName'].replace(' ', '_'), Layer['LayerName'], Opacity)
+            CMD = ('%s -C %s%s -o %s%s.png "%s"%s' %
+            (XCF2PNG, Path, File, PathSave, Layer['LayerName'].replace(' ', '_'), Layer['LayerName'], Opacity))
             os.system(CMD)
     
     #-------------------------------------------------
@@ -286,13 +286,12 @@
                 LayerList.append([RenderLayer, LayerMode, LayerOpacity])
                 
                 LayerNum += 1
-        
+
         # Object
-        bpy.ops.mesh.primitive_plane_add(\
-        view_align=False,\
-        enter_editmode=False,\
-        rotation=(0, 0, pi))
-        
+        bpy.ops.mesh.primitive_plane_add(view_align=False,
+                                         enter_editmode=False,
+                                         rotation=(0, 0, pi))
+
         bpy.ops.object.transform_apply(location=False, rotation=True, scale=False)
 
         
@@ -301,8 +300,8 @@
         if SetupCompo:
             Active.layers = LayerFlags[RenderLayer]
         
-        Active.location = (\
-            (float(Coords[2])-(ResX*0.5))*LayerScale,\
+        Active.location = (
+            (float(Coords[2])-(ResX*0.5))*LayerScale,
             (-float(Coords[3])+(ResY*0.5))*LayerScale, Z)
         
         for Vert in Active.data.vertices:
@@ -420,16 +419,15 @@
     LayerList = []
     
     for Layer in IMGs:
-        Make3DLayer(\
-        Layer['LayerName'].replace(' ', '_'),\
-        Layer['LayerNameShort'].replace(' ', '_'),\
-        Z,\
-        Layer['LayerCoords'],\
-        Layer['RenderLayer'],\
-        Layer['LayerMode'],\
-        Layer['LayerOpacity'],\
-        Layer['HasAlpha'],\
-        )
+        Make3DLayer(Layer['LayerName'].replace(' ', '_'),
+                    Layer['LayerNameShort'].replace(' ', '_'),
+                    Z,
+                    Layer['LayerCoords'],
+                    Layer['RenderLayer'],
+                    Layer['LayerMode'],
+                    Layer['LayerOpacity'],
+                    Layer['HasAlpha'],
+                    )
         
         Z -= LayerOffset
     
@@ -647,9 +645,9 @@
         
         # Call Main Function
         if Ext:
-            main(filename, directory, LayerViewers, MixerViewers, LayerOffset,\
-                LayerScale, OpacityMode, PremulAlpha, ShadelessMats,\
-                SetCamera, SetupCompo, GroupUntagged, Ext)
+            main(filename, directory, LayerViewers, MixerViewers, LayerOffset,
+                 LayerScale, OpacityMode, PremulAlpha, ShadelessMats,
+                 SetCamera, SetupCompo, GroupUntagged, Ext)
         else:
             self.report({'ERROR'},"Selected file wasn't valid, try .xcf or .xjt")
         

Modified: trunk/py/scripts/addons/io_import_images_as_planes.py
===================================================================
--- trunk/py/scripts/addons/io_import_images_as_planes.py	2011-12-31 10:27:24 UTC (rev 2840)
+++ trunk/py/scripts/addons/io_import_images_as_planes.py	2011-12-31 10:57:35 UTC (rev 2841)
@@ -23,17 +23,25 @@
     "blender": (2, 5, 7),
     "api": 35622,
     "location": "File > Import > Images as Planes",
-    "description": "Imports images and creates planes with the appropriate aspect ratio. "\
-        "The images are mapped to the planes.",
+    "description": "Imports images and creates planes with the appropriate "
+                   "aspect ratio. The images are mapped to the planes.",
     "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
-        "Scripts/Add_Mesh/Planes_from_Images",
-    "tracker_url": "https://projects.blender.org/tracker/index.php?"\
-        "func=detail&aid=21751",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+                "Scripts/Add_Mesh/Planes_from_Images",
+    "tracker_url": "https://projects.blender.org/tracker/index.php?"
+                   "func=detail&aid=21751",
     "category": "Import-Export"}
 
-import bpy, os, mathutils
-from bpy.props import *
+import bpy
+import mathutils
+import os
+
+from bpy.props import (BoolProperty,
+                       EnumProperty,
+                       IntProperty,
+                       FloatProperty,
+                       )
+
 from add_utils import *
 from bpy_extras.io_utils import ImportHelper
 from bpy_extras.image_utils import load_image
@@ -54,7 +62,7 @@
     'cin': ['cin'],
     'dpx': ['dpx'],
     'psd': ['psd']}
-EXT_VALS = [val for val in EXT_LIST.values()]
+EXT_VALS = list(EXT_LIST.values())
 EXTENSIONS = []
 for i in EXT_VALS:
     EXTENSIONS.extend(i)
@@ -189,12 +197,12 @@
     gap = self.align_offset
     offset = 0
     for i, plane in enumerate(planes):
-        offset += (plane.dimensions.x / 2) + gap
+        offset += (plane.dimensions.x / 2.0) + gap
         if i == 0: continue
         move_local = mathutils.Vector((offset, 0, 0))
         move_world = plane.location + move_local * plane.matrix_world.inverted()
         plane.location += move_world
-        offset += (plane.dimensions.x / 2)
+        offset += (plane.dimensions.x / 2.0)
         
 ##### MAIN #####
 def import_images(self, context):
@@ -363,7 +371,9 @@
 ##### REGISTER #####
 
 def import_images_button(self, context):
-    self.layout.operator(IMPORT_OT_image_to_plane.bl_idname, text="Images as Planes", icon='PLUGIN')
+    self.layout.operator(IMPORT_OT_image_to_plane.bl_idname,
+                         text="Images as Planes",
+                         icon='PLUGIN')
 
 def register():
     bpy.utils.register_module(__name__)

Modified: trunk/py/scripts/addons/io_mesh_ply/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/__init__.py	2011-12-31 10:27:24 UTC (rev 2840)
+++ trunk/py/scripts/addons/io_mesh_ply/__init__.py	2011-12-31 10:57:35 UTC (rev 2841)
@@ -26,12 +26,15 @@
     "location": "File > Import-Export",
     "description": "Import-Export PLY mesh data withs UV's and vertex colors",
     "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"\
-        "Scripts/Import-Export/Stanford_PLY",
+    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
+                "Scripts/Import-Export/Stanford_PLY",
     "tracker_url": "",
     "support": 'OFFICIAL',
     "category": "Import-Export"}
 
+# Copyright (C) 2004, 2005: Bruce Merry, bmerry at cs.uct.ac.za
+# Contributors: Bruce Merry, Campbell Barton
+
 # To support reload properly, try to access a package var,
 # if it's there, reload everything
 if "bpy" in locals():

Modified: trunk/py/scripts/addons/io_mesh_ply/export_ply.py
===================================================================
--- trunk/py/scripts/addons/io_mesh_ply/export_ply.py	2011-12-31 10:27:24 UTC (rev 2840)

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list