[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2179] trunk/py/scripts/addons: swap vector multiplication order, also some style changes

Campbell Barton ideasman42 at gmail.com
Mon Jul 25 10:48:59 CEST 2011


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

Modified Paths:
--------------
    trunk/py/scripts/addons/io_export_pc2.py
    trunk/py/scripts/addons/io_export_unreal_psk_psa.py
    trunk/py/scripts/addons/io_import_images_as_planes.py
    trunk/py/scripts/addons/io_mesh_raw/export_raw.py
    trunk/py/scripts/addons/io_scene_map/export_map.py
    trunk/py/scripts/addons/io_shape_mdd/export_mdd.py
    trunk/py/scripts/addons/light_field_tools/light_field_tools.py
    trunk/py/scripts/addons/mesh_bsurfaces.py
    trunk/py/scripts/addons/mesh_looptools.py
    trunk/py/scripts/addons/object_add_chain.py
    trunk/py/scripts/addons/object_fracture/fracture_ops.py
    trunk/py/scripts/addons/object_grease_scatter.py
    trunk/py/scripts/addons/render_povray/render.py
    trunk/py/scripts/addons/space_view3d_math_vis/draw.py
    trunk/py/scripts/addons/space_view3d_panel_measure.py
    trunk/py/scripts/addons/space_view3d_spacebar_menu.py

Modified: trunk/py/scripts/addons/io_export_pc2.py
===================================================================
--- trunk/py/scripts/addons/io_export_pc2.py	2011-07-25 07:51:47 UTC (rev 2178)
+++ trunk/py/scripts/addons/io_export_pc2.py	2011-07-25 08:48:58 UTC (rev 2179)
@@ -49,7 +49,7 @@
 def getSampling(start, end, sampling):
     samples = [start - sampling
                + x * sampling
-               for x in range(start, int((end-start)*1/sampling)+1)]
+               for x in range(start, int((end-start) * 1.0 / sampling) + 1)]
     return samples
 
 def do_export(context, props, filepath):
@@ -113,40 +113,46 @@
     filename_ext = ".pc2"
     
     rot_x90 = BoolProperty(name="Convert to Y-up",
-                            description="Rotate 90 degrees around X to convert to y-up",
-                            default=True)
+            description="Rotate 90 degrees around X to convert to y-up",
+            default=True,
+            )
     world_space = BoolProperty(name="Export into Worldspace",
-                            description="Transform the Vertexcoordinates into Worldspace",
-                            default=False)
+            description="Transform the Vertexcoordinates into Worldspace",
+            default=False,
+            )
     apply_modifiers = BoolProperty(name="Apply Modifiers",
-                            description="Applies the Modifiers",
-                            default=True)
+            description="Applies the Modifiers",
+            default=True,
+            )
     range_start = IntProperty(name='Start Frame',
-                            description='First frame to use for Export',
-                            default=1)
+            description='First frame to use for Export',
+            default=1,
+            )
     range_end = IntProperty(name='End Frame',
-                            description='Last frame to use for Export',
-                            default=250)    
+            description='Last frame to use for Export',
+            default=250,
+            )
     sampling = EnumProperty(name='Sampling',
-                            description='Sampling --> frames per sample (0.1 yields 10 samples per frame)',
-                            items=[
-                            ('0.01', '0.01', ''),
-                            ('0.05', '0.05', ''),
-                            ('0.1', '0.1', ''),
-                            ('0.2', '0.2', ''),
-                            ('0.25', '0.25', ''),
-                            ('0.5', '0.5', ''),
-                            ('1', '1', ''),
-                            ('2', '2', ''),
-                            ('3', '3', ''),
-                            ('4', '4', ''),
-                            ('5', '5', ''),
-                            ('10', '10', '')],
-                            default='1')
+            description='Sampling --> frames per sample (0.1 yields 10 samples per frame)',
+            items=(('0.01', '0.01', ''),
+                   ('0.05', '0.05', ''),
+                   ('0.1', '0.1', ''),
+                   ('0.2', '0.2', ''),
+                   ('0.25', '0.25', ''),
+                   ('0.5', '0.5', ''),
+                   ('1', '1', ''),
+                   ('2', '2', ''),
+                   ('3', '3', ''),
+                   ('4', '4', ''),
+                   ('5', '5', ''),
+                   ('10', '10', ''),
+                   ),
+            default='1',
+            )
     
     @classmethod
     def poll(cls, context):
-        return context.active_object.type in ['MESH', 'CURVE', 'SURFACE', 'FONT']
+        return context.active_object.type in {'MESH', 'CURVE', 'SURFACE', 'FONT'}
 
     def execute(self, context):
         start_time = time.time()
@@ -176,7 +182,7 @@
             return {'RUNNING_MODAL'}
         elif False:
             # Redo popup
-            return wm.invoke_props_popup(self, event) #
+            return wm.invoke_props_popup(self, event)
         elif False:
             return self.execute(context)
 

Modified: trunk/py/scripts/addons/io_export_unreal_psk_psa.py
===================================================================
--- trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2011-07-25 07:51:47 UTC (rev 2178)
+++ trunk/py/scripts/addons/io_export_unreal_psk_psa.py	2011-07-25 08:48:58 UTC (rev 2179)
@@ -775,7 +775,7 @@
                     
                     # Transform position for export
                     #vpos = vert.co * object_material_index
-                    vpos = vert.co * current_obj.matrix_local
+                    vpos = current_obj.matrix_local * vert.co
                     # Create the point
                     p = VPoint()
                     p.Point.X = vpos.x
@@ -891,7 +891,7 @@
                     vert_weight = vgroup.weight
                     if(obvgroup.index == vgroup.group):
                         p = VPoint()
-                        vpos = current_vert.co * current_obj.matrix_local
+                        vpos = current_obj.matrix_local * current_vert.co
                         p.Point.X = vpos.x
                         p.Point.Y = vpos.y 
                         p.Point.Z = vpos.z
@@ -968,14 +968,14 @@
         quat = make_fquat(quat_root.to_quaternion())
         #print("DIR:",dir(child_parent.matrix.to_quaternion()))
         quat_parent = child_parent.matrix.to_quaternion().inverted()
-        parent_head = child_parent.head * quat_parent
-        parent_tail = child_parent.tail * quat_parent
+        parent_head = quat_parent * child_parent.head
+        parent_tail = quat_parent * child_parent.tail
         
         set_position = (parent_tail - parent_head) + blender_bone.head
     else:
         # ROOT BONE
         #This for root 
-        set_position = blender_bone.head * parent_matrix #ARMATURE OBJECT Locction
+        set_position = parent_matrix * blender_bone.head #ARMATURE OBJECT Locction
         rot_mat = blender_bone.matrix * parent_matrix.to_3x3() #ARMATURE OBJECT Rotation
         #print(dir(rot_mat))
         
@@ -1894,13 +1894,36 @@
     # List of operator properties, the attributes will be assigned
     # to the class instance from the operator settings before calling.
 
-    filepath = StringProperty(name="File Path", description="Filepath used for exporting the PSA file", maxlen= 1024, default= "", subtype='FILE_PATH')
-    filter_glob = StringProperty(default="*.psk;*.psa", options={'HIDDEN'})
-    pskexportbool = BoolProperty(name="Export PSK", description="Export Skeletal Mesh", default= True)
-    psaexportbool = BoolProperty(name="Export PSA", description="Export Action Set (Animation Data)", default= True)
-    
-    actionexportall = BoolProperty(name="All Actions", description="This will export all the actions that matches the current armature.", default=False)
-    ignoreactioncountexportbool = BoolProperty(name="Ignore Action Group Count", description="It will ignore action group count but as long it matches the armature bone count to over ride the animation data.", default= False)
+    filepath = StringProperty(
+            name="File Path",
+            description="Filepath used for exporting the PSA file",
+            maxlen= 1024,
+            subtype='FILE_PATH',
+            )
+    filter_glob = StringProperty(
+            default="*.psk;*.psa",
+            options={'HIDDEN'},
+            )
+    pskexportbool = BoolProperty(
+            name="Export PSK",
+            description="Export Skeletal Mesh",
+            default= True,
+            )
+    psaexportbool = BoolProperty(
+            name="Export PSA",
+            description="Export Action Set (Animation Data)",
+            default= True,
+            )
+    actionexportall = BoolProperty(
+            name="All Actions",
+            description="This will export all the actions that matches the current armature.",
+            default=False,
+            )
+    ignoreactioncountexportbool = BoolProperty(
+            name="Ignore Action Group Count",
+            description="It will ignore action group count but as long it matches the armature bone count to over ride the animation data.",
+            default= False,
+            )
 
     @classmethod
     def poll(cls, context):
@@ -1927,7 +1950,7 @@
             bpy.context.scene.unrealignoreactionmatchcount = True
         else:
             bpy.context.scene.unrealignoreactionmatchcount = False
-			
+
         write_data(self.filepath, context)
         
         self.report({'WARNING', 'INFO'}, exportmessage)

Modified: trunk/py/scripts/addons/io_import_images_as_planes.py
===================================================================
--- trunk/py/scripts/addons/io_import_images_as_planes.py	2011-07-25 07:51:47 UTC (rev 2178)
+++ trunk/py/scripts/addons/io_import_images_as_planes.py	2011-07-25 08:48:58 UTC (rev 2179)
@@ -232,18 +232,25 @@
     bl_options = {'REGISTER', 'UNDO'}
 
     ## OPTIONS ##
-    all_in_directory = BoolProperty(name="All in directory",
-                                description="Import all image files (of the selected type)" \
-                                            " in this directory.",
-                                default=False)
-    align = BoolProperty(name='Align Planes',
-                                description='Create Planes in a row',
-                                default=True)
-    align_offset = FloatProperty(name='Offset',
-                                description='Space between Planes',
-                                min=0, soft_min=0,
-                                default=0.1)
-    extEnum = [
+    all_in_directory = BoolProperty(
+            name="All in directory",
+            description=("Import all image files (of the selected type) "
+                         "in this directory."),
+            default=False,
+            )
+    align = BoolProperty(
+            name='Align Planes',
+            description='Create Planes in a row',
+            default=True,
+            )
+    align_offset = FloatProperty(
+            name='Offset',
+            description='Space between Planes',
+            min=0,
+            soft_min=0,
+            default=0.1,
+            )
+    extEnum = (
         ('*', 'All image formats',
             'Import all know image (or movie) formats.'),
         ('jpeg', 'JPEG (.jpg, .jpeg, .jpe)',
@@ -260,35 +267,44 @@

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list