[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4474] trunk/py/scripts/addons: options to scale x3d and obj on export

Campbell Barton ideasman42 at gmail.com
Mon Apr 15 18:50:07 CEST 2013


Revision: 4474
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4474
Author:   campbellbarton
Date:     2013-04-15 16:50:06 +0000 (Mon, 15 Apr 2013)
Log Message:
-----------
options to scale x3d and obj on export

Modified Paths:
--------------
    trunk/py/scripts/addons/io_scene_obj/__init__.py
    trunk/py/scripts/addons/io_scene_x3d/__init__.py

Modified: trunk/py/scripts/addons/io_scene_obj/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_scene_obj/__init__.py	2013-04-15 15:02:58 UTC (rev 4473)
+++ trunk/py/scripts/addons/io_scene_obj/__init__.py	2013-04-15 16:50:06 UTC (rev 4474)
@@ -291,15 +291,6 @@
             default=False,
             )
 
-    global_scale = FloatProperty(
-            name="Scale",
-            description="Scale all data",
-            min=0.01, max=1000.0,
-            soft_min=0.01,
-            soft_max=1000.0,
-            default=1.0,
-            )
-
     axis_forward = EnumProperty(
             name="Forward",
             items=(('X', "X Forward", ""),
@@ -323,6 +314,11 @@
                    ),
             default='Y',
             )
+    global_scale = FloatProperty(
+            name="Scale",
+            min=0.01, max=1000.0,
+            default=1.0,
+            )
 
     path_mode = path_reference_mode
 
@@ -339,13 +335,7 @@
                                             "filter_glob",
                                             ))
 
-        global_matrix = Matrix()
-
-        global_matrix[0][0] = \
-        global_matrix[1][1] = \
-        global_matrix[2][2] = self.global_scale
-
-        global_matrix = (global_matrix *
+        global_matrix = (Matrix.Scale(self.global_scale, 4) *
                          axis_conversion(to_forward=self.axis_forward,
                                          to_up=self.axis_up,
                                          ).to_4x4())

Modified: trunk/py/scripts/addons/io_scene_x3d/__init__.py
===================================================================
--- trunk/py/scripts/addons/io_scene_x3d/__init__.py	2013-04-15 15:02:58 UTC (rev 4473)
+++ trunk/py/scripts/addons/io_scene_x3d/__init__.py	2013-04-15 16:50:06 UTC (rev 4474)
@@ -39,7 +39,7 @@
         imp.reload(export_x3d)
 
 import bpy
-from bpy.props import StringProperty, BoolProperty, EnumProperty
+from bpy.props import StringProperty, BoolProperty, EnumProperty, FloatProperty
 from bpy_extras.io_utils import (ImportHelper,
                                  ExportHelper,
                                  axis_conversion,
@@ -168,20 +168,28 @@
                    ),
             default='Y',
             )
+    global_scale = FloatProperty(
+            name="Scale",
+            min=0.01, max=1000.0,
+            default=1.0,
+            )
 
     path_mode = path_reference_mode
 
     def execute(self, context):
         from . import export_x3d
 
+        from mathutils import Matrix
+
         keywords = self.as_keywords(ignore=("axis_forward",
                                             "axis_up",
+                                            "global_scale",
                                             "check_existing",
                                             "filter_glob",
                                             ))
         global_matrix = axis_conversion(to_forward=self.axis_forward,
                                         to_up=self.axis_up,
-                                        ).to_4x4()
+                                        ).to_4x4() * Matrix.Scale(self.global_scale, 4)
         keywords["global_matrix"] = global_matrix
 
         return export_x3d.save(self, context, **keywords)



More information about the Bf-extensions-cvs mailing list