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_mesh_ply/__init__.py
parent81507f54080373b9f23f212e23e3ea6299490140 (diff)
option to apply scale on export. also add global scale options for exporters. OBJ/X3D/VRML/PLY/STL
Diffstat (limited to 'io_mesh_ply/__init__.py')
-rw-r--r--io_mesh_ply/__init__.py65
1 files changed, 60 insertions, 5 deletions
diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py
index 92b0bbdd..d7b8ff7e 100644
--- a/io_mesh_ply/__init__.py
+++ b/io_mesh_ply/__init__.py
@@ -46,8 +46,16 @@ if "bpy" in locals():
import os
import bpy
-from bpy.props import CollectionProperty, StringProperty, BoolProperty
-from bpy_extras.io_utils import ImportHelper, ExportHelper
+from bpy.props import (CollectionProperty,
+ StringProperty,
+ BoolProperty,
+ EnumProperty,
+ FloatProperty,
+ )
+from bpy_extras.io_utils import (ImportHelper,
+ ExportHelper,
+ axis_conversion,
+ )
class ImportPLY(bpy.types.Operator, ImportHelper):
@@ -110,17 +118,60 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
use_colors = BoolProperty(
name="Vertex Colors",
description="Export the active vertex color layer",
- default=True)
+ default=True,
+ )
+
+ 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='Y',
+ )
+ 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='Z',
+ )
+ global_scale = FloatProperty(
+ name="Scale",
+ min=0.01, max=1000.0,
+ default=1.0,
+ )
@classmethod
def poll(cls, context):
return context.active_object != None
def execute(self, context):
+ from . import export_ply
+
+ 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() * Matrix.Scale(self.global_scale, 4)
+ keywords["global_matrix"] = global_matrix
+
filepath = self.filepath
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
- from . import export_ply
- keywords = self.as_keywords(ignore=("check_existing", "filter_glob"))
+
return export_ply.save(self, context, **keywords)
def draw(self, context):
@@ -133,6 +184,10 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
row.prop(self, "use_uv_coords")
row.prop(self, "use_colors")
+ layout.prop(self, "axis_forward")
+ layout.prop(self, "axis_up")
+ layout.prop(self, "global_scale")
+
def menu_func_import(self, context):
self.layout.operator(ImportPLY.bl_idname, text="Stanford (.ply)")