Skip to content

Commit

Permalink
Merge branch 'blender-v3.5-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
julienduroure committed Feb 23, 2023
2 parents f1b4254 + 87326ca commit 0713d7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (3, 6, 3),
"version": (3, 6, 4),
'blender': (3, 5, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
Expand Down Expand Up @@ -601,7 +601,7 @@ def __init__(self):
name='Shape Key Animations',
description='Export shape keys animations (morph targets)',
default=True
)
)

export_lights: BoolProperty(
name='Punctual Lights',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -868,26 +868,26 @@ def __set_morph_tangent_attribute(self, attr):
# Morph tangent are after these 3 others, so, they are already calculated
self.normals = self.attributes[attr['gltf_attribute_name_normal']]["data"]
self.morph_normals = self.attributes[attr['gltf_attribute_name_morph_normal']]["data"]
self.tangent = self.attributes[attr['gltf_attribute_name_tangent']]["data"]
self.tangents = self.attributes[attr['gltf_attribute_name_tangent']]["data"]

self.__calc_morph_tangents()
self.attributes[attr['gltf_attribute_name']] = {}
self.attributes[attr['gltf_attribute_name']]["data"] = self.morph_tangents

def __calc_morph_tangents(self):
# TODO: check if this works
self.morph_tangent_deltas = np.empty((len(self.normals), 3), dtype=np.float32)
self.morph_tangents = np.empty((len(self.normals), 3), dtype=np.float32)

for i in range(len(self.normals)):
n = Vector(self.normals[i])
morph_n = n + Vector(self.morph_normal_deltas[i]) # convert back to non-delta
morph_n = n + Vector(self.morph_normals[i]) # convert back to non-delta
t = Vector(self.tangents[i, :3])

rotation = morph_n.rotation_difference(n)

t_morph = Vector(t)
t_morph.rotate(rotation)
self.morph_tangent_deltas[i] = t_morph - t # back to delta
self.morph_tangents[i] = t_morph - t # back to delta

def __set_regular_attribute(self, attr):
res = np.empty((len(self.prim_dots), attr['len']), dtype=attr['type'])
Expand Down

0 comments on commit 0713d7d

Please sign in to comment.