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:
authorJay Jasper <Jay_J>2022-03-26 09:35:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2022-03-26 09:40:34 +0300
commit0f6165054bb2c802156e8fcd1d2d55c501455bc2 (patch)
tree594b08daab338caa9e90aba77c843b180aa04ed4
parent5aa25f6a3f0a41aef27d6e477ad8b2e2771b000f (diff)
STL Export: add "global_space" matrix
Added an option to allow the user to export STLs using an arbitrary (custom) coordinate-space. This is not exposed in the UI and is intended for script authors exporting content. Ref D11517
-rw-r--r--io_mesh_stl/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/io_mesh_stl/__init__.py b/io_mesh_stl/__init__.py
index 56276e5f..3d1aec5c 100644
--- a/io_mesh_stl/__init__.py
+++ b/io_mesh_stl/__init__.py
@@ -43,6 +43,7 @@ from bpy.props import (
CollectionProperty,
EnumProperty,
FloatProperty,
+ FloatVectorProperty,
)
from bpy_extras.io_utils import (
ImportHelper,
@@ -227,6 +228,12 @@ class ExportSTL(Operator, ExportHelper):
('OBJECT', "Object", "Each object as a file"),
),
)
+ global_space: FloatVectorProperty(
+ name="Global Space",
+ description="Export in this reference space",
+ subtype='MATRIX',
+ size=(4, 4),
+ )
@property
def check_extension(self):
@@ -249,7 +256,8 @@ class ExportSTL(Operator, ExportHelper):
"filter_glob",
"use_scene_unit",
"use_mesh_modifiers",
- "batch_mode"
+ "batch_mode",
+ "global_space",
),
)
@@ -269,6 +277,9 @@ class ExportSTL(Operator, ExportHelper):
to_up=self.axis_up,
).to_4x4() @ Matrix.Scale(global_scale, 4)
+ if self.properties.is_property_set("global_space"):
+ global_matrix = global_matrix @ self.global_space.inverted()
+
if self.batch_mode == 'OFF':
faces = itertools.chain.from_iterable(
blender_utils.faces_from_mesh(ob, global_matrix, self.use_mesh_modifiers)