Skip to content

Commit 5b00ba9

Browse files
apply world matrice to the curve export
1 parent 21e158d commit 5b00ba9

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

exporter/__init__.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
bl_info = {
77
"name": "glTF Curve Exporter Extension",
88
"category": "Import-Export",
9-
"version": (1, 0, 1),
9+
"version": (1, 0, 2),
1010
"blender": (4, 2, 0),
1111
"location": "File > Export > glTF 2.0",
1212
"description": "Extension to export curve data in glTF files.",
@@ -88,25 +88,27 @@ def gather_curve_data(self, blender_object):
8888
curve_data = blender_object.data
8989
splines_data = []
9090

91+
world_matrix = blender_object.matrix_world
92+
9193
for spline in curve_data.splines:
9294
points = []
9395
if spline.type == 'BEZIER':
9496
points = [
9597
{
96-
"co": self.convert_vector_to_list(p.co),
97-
"handle_left": self.convert_vector_to_list(p.handle_left),
98-
"handle_right": self.convert_vector_to_list(p.handle_right)
98+
"co": self.convert_vector_to_list(world_matrix @ p.co),
99+
"handle_left": self.convert_vector_to_list(world_matrix @ p.handle_left),
100+
"handle_right": self.convert_vector_to_list(world_matrix @ p.handle_right)
99101
} for p in spline.bezier_points
100102
]
101103
elif spline.type == 'NURBS':
102104
points = [
103105
{
104-
"co": self.convert_vector_to_list(p.co),
106+
"co": self.convert_vector_to_list(world_matrix @ p.co),
105107
} for p in spline.points
106108
]
107109
else: # 'POLY'
108110
points = [
109-
{"co": self.convert_vector_to_list(p.co)} for p in spline.points
111+
{"co": self.convert_vector_to_list(world_matrix @ p.co)} for p in spline.points
110112
]
111113

112114
splines_data.append({
-9.07 KB
Binary file not shown.

gltf_curve_exporter.zip

-3.92 KB
Binary file not shown.

0 commit comments

Comments
 (0)