Skip to content
Snippets Groups Projects
Commit 849e7196 authored by Julien Duroure's avatar Julien Duroure
Browse files

glTF exporter: Fix T99306 : Fix camera & light export when Yup is off

parent 6d7056ab
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
bl_info = { bl_info = {
'name': 'glTF 2.0 format', 'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors', 'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 3, 10), "version": (3, 3, 11),
'blender': (3, 3, 0), 'blender': (3, 3, 0),
'location': 'File > Import-Export', 'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0', 'description': 'Import-Export as glTF 2.0',
......
...@@ -163,10 +163,16 @@ class VExportTree: ...@@ -163,10 +163,16 @@ class VExportTree:
# So real world matrix is collection world_matrix @ "world_matrix" of object # So real world matrix is collection world_matrix @ "world_matrix" of object
node.matrix_world = parent_coll_matrix_world @ blender_object.matrix_world.copy() node.matrix_world = parent_coll_matrix_world @ blender_object.matrix_world.copy()
if node.blender_type == VExportNode.CAMERA and self.export_settings[gltf2_blender_export_keys.CAMERAS]: if node.blender_type == VExportNode.CAMERA and self.export_settings[gltf2_blender_export_keys.CAMERAS]:
correction = Quaternion((2**0.5/2, -2**0.5/2, 0.0, 0.0)) if self.export_settings[gltf2_blender_export_keys.YUP]:
correction = Quaternion((2**0.5/2, -2**0.5/2, 0.0, 0.0))
else:
correction = Matrix.Identity(4).to_quaternion()
node.matrix_world @= correction.to_matrix().to_4x4() node.matrix_world @= correction.to_matrix().to_4x4()
elif node.blender_type == VExportNode.LIGHT and self.export_settings[gltf2_blender_export_keys.LIGHTS]: elif node.blender_type == VExportNode.LIGHT and self.export_settings[gltf2_blender_export_keys.LIGHTS]:
correction = Quaternion((2**0.5/2, -2**0.5/2, 0.0, 0.0)) if self.export_settings[gltf2_blender_export_keys.YUP]:
correction = Quaternion((2**0.5/2, -2**0.5/2, 0.0, 0.0))
else:
correction = Matrix.Identity(4).to_quaternion()
node.matrix_world @= correction.to_matrix().to_4x4() node.matrix_world @= correction.to_matrix().to_4x4()
elif node.blender_type == VExportNode.BONE: elif node.blender_type == VExportNode.BONE:
if self.export_settings['gltf_current_frame'] is True: if self.export_settings['gltf_current_frame'] is True:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment