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>2013-04-15 21:21:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-15 21:21:17 +0400
commite88ccb06cc638467174f8b2e0ad3af1828db2c68 (patch)
treeabb90f6cdfd7f294e3d45fadb633a736eaf9ad82 /io_scene_vrml2
parent81507f54080373b9f23f212e23e3ea6299490140 (diff)
option to apply scale on export. also add global scale options for exporters. OBJ/X3D/VRML/PLY/STL
Diffstat (limited to 'io_scene_vrml2')
-rw-r--r--io_scene_vrml2/__init__.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/io_scene_vrml2/__init__.py b/io_scene_vrml2/__init__.py
index 7e02d6b0..02f5073c 100644
--- a/io_scene_vrml2/__init__.py
+++ b/io_scene_vrml2/__init__.py
@@ -39,8 +39,16 @@ if "bpy" in locals():
import os
import bpy
-from bpy.props import CollectionProperty, StringProperty, BoolProperty, EnumProperty
-from bpy_extras.io_utils import ExportHelper, path_reference_mode, axis_conversion
+from bpy.props import (CollectionProperty,
+ StringProperty,
+ BoolProperty,
+ EnumProperty,
+ FloatProperty,
+ )
+from bpy_extras.io_utils import (ExportHelper,
+ path_reference_mode,
+ axis_conversion,
+ )
class ExportVRML(bpy.types.Operator, ExportHelper):
"""Export mesh objects as a VRML2, """ \
@@ -101,6 +109,11 @@ class ExportVRML(bpy.types.Operator, ExportHelper):
),
default='Y',
)
+ global_scale = FloatProperty(
+ name="Scale",
+ min=0.01, max=1000.0,
+ default=1.0,
+ )
path_mode = path_reference_mode
@@ -110,20 +123,24 @@ class ExportVRML(bpy.types.Operator, ExportHelper):
return (obj is not None) and obj.type == 'MESH'
def execute(self, context):
- filepath = self.filepath
- filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
from . import export_vrml2
+ 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
+ filepath = self.filepath
+ filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
+
return export_vrml2.save(self, context, **keywords)
def draw(self, context):
@@ -140,6 +157,7 @@ class ExportVRML(bpy.types.Operator, ExportHelper):
row.prop(self, "color_type")
layout.prop(self, "axis_forward")
layout.prop(self, "axis_up")
+ layout.prop(self, "global_scale")
layout.prop(self, "path_mode")