[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2180] trunk/py/scripts/addons: switch vector multiplication order & some style changes.

Campbell Barton ideasman42 at gmail.com
Mon Jul 25 11:09:46 CEST 2011


Revision: 2180
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2180
Author:   campbellbarton
Date:     2011-07-25 09:09:46 +0000 (Mon, 25 Jul 2011)
Log Message:
-----------
switch vector multiplication order & some style changes.

Modified Paths:
--------------
    trunk/py/scripts/addons/io_import_scene_dxf.py
    trunk/py/scripts/addons/io_import_scene_unreal_psk.py
    trunk/py/scripts/addons/io_mesh_ply/__init__.py

Modified: trunk/py/scripts/addons/io_import_scene_dxf.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_dxf.py	2011-07-25 08:48:58 UTC (rev 2179)
+++ trunk/py/scripts/addons/io_import_scene_dxf.py	2011-07-25 09:09:46 UTC (rev 2180)
@@ -311,7 +311,7 @@
             ma = getOCS(self.normal)
             if ma:
                 #ma.invert()
-                points = [v * ma for v in points]
+                points = [ma * v for v in points]
         #print ('arc vn=', vn)
         #print ('faces=', len(faces))
         return ((points, edges, faces, vn))
@@ -520,7 +520,7 @@
             ma = getOCS(self.normal)
             if ma:
                 #ma.invert()
-                points = [v * ma for v in points]
+                points = [ma * v for v in points]
         #print ('cir vn=', vn)
         #print ('faces=',len(faces))
         return( (points, edges, faces, vn) )
@@ -626,7 +626,7 @@
             ma = getOCS(self.normal)
             if ma:
                 #ma.invert()
-                points = [v * ma for v in points]
+                points = [ma * v for v in points]
         return ((points, edges, faces, vn))
 
 #
@@ -810,7 +810,7 @@
             ma = getOCS(self.normal)
             if ma:
                 #ma.invert()
-                verts = [v * ma for v in verts]
+                verts = [ma * v for v in verts]
         return (verts, edges, [], vn-1)
         
 #
@@ -1018,7 +1018,7 @@
         if self.normal!=Vector((0,0,1)):
             ma = getOCS(self.normal)
             if ma:
-                verts = [v * ma for v in verts]
+                verts = [ma * v for v in verts]
         return((verts, lines, [], vn-1))
 
 #
@@ -1182,7 +1182,7 @@
         if self.normal!=Vector((0,0,1)):
             ma = getOCS(self.normal)
             if ma:
-                points = [v * ma for v in points]
+                points = [ma * v for v in points]
         return((points, edges, faces, vn))
         
 #
@@ -1315,7 +1315,7 @@
         if self.normal!=Vector((0,0,1)):
             ma = getOCS(self.normal)
             if ma:
-                points = [v * ma for v in points]
+                points = [ma * v for v in points]
         return ((points, edges, faces, vn))
 
 #
@@ -1425,7 +1425,7 @@
     if ma_new:
         ma = ma_new
         ma.resize_4x4()
-        o = o * ma
+        o = ma * o
 
     if rotation != 0:
         g = radians(-rotation)
@@ -2425,25 +2425,77 @@
     bl_space_type = "PROPERTIES"
     bl_region_type = "WINDOW"
 
-    filepath = StringProperty(name="File Path", description="Filepath used for importing the DXF file", maxlen= 1024, default= "", subtype='FILE_PATH')
-
-    new_scene = BoolProperty(name="Replace scene", description="Replace scene", default=toggle&T_NewScene)
-    #new_scene = BoolProperty(name="New scene", description="Create new scene", default=toggle&T_NewScene)
-    curves = BoolProperty(name="Draw curves", description="Draw entities as curves", default=toggle&T_Curves)
-    thic_on = BoolProperty(name="Thic ON", description="Support THICKNESS", default=toggle&T_ThicON)
-
-    merge = BoolProperty(name="Remove doubles", description="Merge coincident vertices", default=toggle&T_Merge)
-    mergeLimit = FloatProperty(name="Limit", description="Merge limit", default = theMergeLimit*1e4,min=1.0, soft_min=1.0, max=100.0, soft_max=100.0)
-
-    draw_one = BoolProperty(name="Merge all", description="Draw all into one mesh-object", default=toggle&T_DrawOne)
-    circleResolution = IntProperty(name="Circle resolution", description="Circle/Arc are aproximated will this factor", default = theCircleRes,
-                min=4, soft_min=4, max=360, soft_max=360)
+    filepath = StringProperty(
+            name="File Path",
+            description="Filepath used for importing the DXF file",
+            maxlen=1024,
+            subtype='FILE_PATH',
+            )
+    new_scene = BoolProperty(
+            name="Replace scene",
+            description="Replace scene",
+            default=toggle & T_NewScene,
+            )
+    #~ new_scene = BoolProperty(
+            #~ name="New scene",
+            #~ description="Create new scene",
+            #~ default=toggle & T_NewScene,
+            #~ )
+    curves = BoolProperty(
+            name="Draw curves",
+            description="Draw entities as curves",
+            default=toggle & T_Curves,
+            )
+    thic_on = BoolProperty(
+            name="Thic ON",
+            description="Support THICKNESS",
+            default=toggle & T_ThicON,
+            )
+    merge = BoolProperty(
+            name="Remove doubles",
+            description="Merge coincident vertices",
+            default=toggle & T_Merge,
+            )
+    mergeLimit = FloatProperty(
+            name="Limit",
+            description="Merge limit",
+            default=theMergeLimit * 1e4,
+            min=1.0,
+            soft_min=1.0,
+            max=100.0,
+            soft_max=100.0,
+            )
+    draw_one = BoolProperty(
+            name="Merge all",
+            description="Draw all into one mesh-object",
+            default=toggle & T_DrawOne,
+            )
+    circleResolution = IntProperty(
+            name="Circle resolution",
+            description="Circle/Arc are aproximated will this factor",
+            default=theCircleRes,
+            min=4,
+            soft_min=4,
+            max=360,
+            soft_max=360,
+            )
     codecs = tripleList(['iso-8859-15', 'utf-8', 'ascii'])
-    codec = EnumProperty(name="Codec", description="Codec",  items=codecs, default = 'ascii')
+    codec = EnumProperty(name="Codec",
+            description="Codec",
+            items=codecs,
+            default='ascii',
+            )
+    debug = BoolProperty(
+            name="Debug",
+            description="Unknown DXF-codes generate errors",
+            default=toggle & T_Debug,
+            )
+    verbose = BoolProperty(
+            name="Verbose",
+            description="Print debug info",
+            default=toggle & T_Verbose,
+            )
 
-    debug = BoolProperty(name="Debug", description="Unknown DXF-codes generate errors", default=toggle&T_Debug)
-    verbose = BoolProperty(name="Verbose", description="Print debug info", default=toggle&T_Verbose)
-
     ##### DRAW #####
     def draw(self, context):
         layout0 = self.layout

Modified: trunk/py/scripts/addons/io_import_scene_unreal_psk.py
===================================================================
--- trunk/py/scripts/addons/io_import_scene_unreal_psk.py	2011-07-25 08:48:58 UTC (rev 2179)
+++ trunk/py/scripts/addons/io_import_scene_unreal_psk.py	2011-07-25 09:09:46 UTC (rev 2180)
@@ -382,7 +382,7 @@
             bpy.context.scene.objects.active = ob_new
             #set mode to able to edit the bone
             bpy.ops.object.mode_set(mode='EDIT')
-			
+
             #newbone = ob_new.data.edit_bones.new('test')
             #newbone.tail.y = 1
             print("creating bone(s)")
@@ -391,8 +391,8 @@
                 bpy.ops.object.mode_set(mode='EDIT')
                 newbone = ob_new.data.edit_bones.new(bone.name)
             '''		
-		
-            
+
+
             armdata = bpy.data.armatures.new(objectname)
             ob_new = bpy.data.objects.new(meshname, armdata)
             #ob_new = bpy.data.objects.new(meshname, 'ARMATURE')
@@ -405,7 +405,7 @@
             bpy.context.scene.objects.active = ob_new
             #set mode to able to edit the bone
             bpy.ops.object.mode_set(mode='EDIT')
-			
+
             #newbone = ob_new.data.edit_bones.new('test')
             #newbone.tail.y = 1
             print("creating bone(s)")
@@ -420,7 +420,7 @@
                 #note bone location is set in the real space or global not local
                 bonesize = bpy.types.Scene.unrealbonesize
                 if bone.name != bone.parent:
-				
+
                     pos_x = bone.bindpos[0]
                     pos_y = bone.bindpos[1]
                     pos_z = bone.bindpos[2]
@@ -431,12 +431,12 @@
                     
                     rotmatrix = bone.bindmat.to_matrix().to_4x4().to_3x3()  # XXX, redundant matrix conversion?
                     newbone.transform(bone.bindmat.to_matrix().to_4x4(),True,True)
-                    #parent_head = parentbone.head * parentbone.matrix.to_quaternion().inverse()
-                    #parent_tail = parentbone.tail * parentbone.matrix.to_quaternion().inverse()
+                    #parent_head = parentbone.matrix.to_quaternion().inverse() * parentbone.head
+                    #parent_tail = parentbone.matrix.to_quaternion().inverse() * parentbone.tail
                     #location=Vector(pos_x,pos_y,pos_z)
                     #set_position = (parent_tail - parent_head) + location
                     #print("tmp head:",set_position)
-					
+
                     #pos_x = set_position.x
                     #pos_y = set_position.y
                     #pos_z = set_position.z
@@ -462,7 +462,7 @@
                     newbone.tail.y = bone.bindpos[1] + bonesize * rotmatrix[1][1]
                     newbone.tail.z = bone.bindpos[2] + bonesize * rotmatrix[1][2]
                     #newbone.roll = fixRoll(newbone)
-					#print("no parent")
+                    #print("no parent")
             
     bpy.context.scene.update()
     
@@ -549,13 +549,13 @@
     me_ob.update_tag()
     
     """
-	Material setup coding.
-	First the mesh has to be create first to get the uv texture setup working.
-	-Create material(s) list in the psk pack data from the list.(to do list)
-	-Append the material to the from create the mesh object.
-	-Create Texture(s)
-	-fae loop for uv assign and assign material index
-	
+    Material setup coding.
+    First the mesh has to be create first to get the uv texture setup working.
+    -Create material(s) list in the psk pack data from the list.(to do list)
+    -Append the material to the from create the mesh object.
+    -Create Texture(s)
+    -fae loop for uv assign and assign material index
+    
     """
     bpy.ops.object.mode_set(mode='OBJECT')
     #===================================================================================================
@@ -566,7 +566,7 @@
     print ("-------------------------")
     materialname = "pskmat"
     materials = []
-	
+
     for matcount in range(materialcount):
         #if texturedata != None:

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list