Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-25 02:20:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-25 02:20:54 +0400
commit86bd3cc31b636070da779f21b1fdc128faf1fc5d (patch)
tree485b42f72598708db283bd56c6ccb6ecdb5b742d /io_scene_x3d/__init__.py
parentb50a40ef9dbeb1554f66bedd21d0905875ba1172 (diff)
axis conversion for X3D and OBJ operators
Diffstat (limited to 'io_scene_x3d/__init__.py')
-rw-r--r--io_scene_x3d/__init__.py67
1 files changed, 63 insertions, 4 deletions
diff --git a/io_scene_x3d/__init__.py b/io_scene_x3d/__init__.py
index 9da01735..dd0e1e03 100644
--- a/io_scene_x3d/__init__.py
+++ b/io_scene_x3d/__init__.py
@@ -40,8 +40,8 @@ if "bpy" in locals():
import bpy
-from bpy.props import StringProperty, BoolProperty
-from bpy_extras.io_utils import ImportHelper, ExportHelper
+from bpy.props import StringProperty, BoolProperty, EnumProperty
+from bpy_extras.io_utils import ImportHelper, ExportHelper, axis_conversion
class ImportX3D(bpy.types.Operator, ImportHelper):
@@ -52,9 +52,38 @@ class ImportX3D(bpy.types.Operator, ImportHelper):
filename_ext = ".x3d"
filter_glob = StringProperty(default="*.x3d;*.wrl", options={'HIDDEN'})
+ global_axis_forward = EnumProperty(
+ name="Forward",
+ items=(('X', "X Forward", ""),
+ ('Y', "Y Forward", ""),
+ ('Z', "Z Forward", ""),
+ ('-X', "-X Forward", ""),
+ ('-Y', "-Y Forward", ""),
+ ('-Z', "-Z Forward", ""),
+ ),
+ default='Z',
+ )
+
+ global_axis_up = EnumProperty(
+ name="Up",
+ items=(('X', "X Up", ""),
+ ('Y', "Y Up", ""),
+ ('Z', "Z Up", ""),
+ ('-X', "-X Up", ""),
+ ('-Y', "-Y Up", ""),
+ ('-Z', "-Z Up", ""),
+ ),
+ default='-Y',
+ )
+
def execute(self, context):
from . import import_x3d
- return import_x3d.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
+
+ keywords = self.as_keywords(ignore=("global_axis_forward", "global_axis_up", "filter_glob"))
+ global_matrix = axis_conversion(from_forward=self.global_axis_forward, from_up=self.global_axis_up).to_4x4()
+ keywords["global_matrix"] = global_matrix
+
+ return import_x3d.load(self, context, **keywords)
class ExportX3D(bpy.types.Operator, ExportHelper):
@@ -70,9 +99,39 @@ class ExportX3D(bpy.types.Operator, ExportHelper):
use_triangulate = BoolProperty(name="Triangulate", description="Triangulate quads.", default=False)
use_compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
+ global_axis_forward = EnumProperty(
+ name="Forward",
+ items=(('X', "X Forward", ""),
+ ('Y', "Y Forward", ""),
+ ('Z', "Z Forward", ""),
+ ('-X', "-X Forward", ""),
+ ('-Y', "-Y Forward", ""),
+ ('-Z', "-Z Forward", ""),
+ ),
+ default='Z',
+ )
+
+ global_axis_up = EnumProperty(
+ name="Up",
+ items=(('X', "X Up", ""),
+ ('Y', "Y Up", ""),
+ ('Z', "Z Up", ""),
+ ('-X', "-X Up", ""),
+ ('-Y', "-Y Up", ""),
+ ('-Z', "-Z Up", ""),
+ ),
+ default='-Y',
+ )
+
def execute(self, context):
from . import export_x3d
- return export_x3d.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
+ from mathutils import Matrix
+
+ keywords = self.as_keywords(ignore=("global_axis_forward", "global_axis_up", "check_existing", "filter_glob"))
+ global_matrix = axis_conversion(to_forward=self.global_axis_forward, to_up=self.global_axis_up).to_4x4()
+ keywords["global_matrix"] = global_matrix
+
+ return export_x3d.save(self, context, **keywords)
def menu_func_import(self, context):