blob: 95fa292ded0dbc104abffddc1f97a21d1efe7b13 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# Copyright 2018 The glTF-Blender-IO authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from mathutils import Matrix, Quaternion
def matrix_gltf_to_blender(mat_input):
"""Matrix from glTF format to Blender format."""
mat = Matrix([mat_input[0:4], mat_input[4:8], mat_input[8:12], mat_input[12:16]])
mat.transpose()
return mat
def loc_gltf_to_blender(loc):
"""Location."""
return loc
def scale_gltf_to_blender(scale):
"""Scaling."""
return scale
def quaternion_gltf_to_blender(q):
"""Quaternion from glTF to Blender."""
return Quaternion([q[3], q[0], q[1], q[2]])
def scale_to_matrix(scale):
"""Scale to matrix."""
mat = Matrix()
for i in range(3):
mat[i][i] = scale[i]
return mat
|