[Bf-extensions-cvs] [0f616505] master: STL Export: add "global_space" matrix
Jay Jasper
noreply at git.blender.org
Sat Mar 26 07:40:52 CET 2022
Commit: 0f6165054bb2c802156e8fcd1d2d55c501455bc2
Author: Jay Jasper
Date: Sat Mar 26 17:35:31 2022 +1100
Branches: master
https://developer.blender.org/rBA0f6165054bb2c802156e8fcd1d2d55c501455bc2
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
===================================================================
M io_mesh_stl/__init__.py
===================================================================
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)
More information about the Bf-extensions-cvs
mailing list