feat: Use proper Vector data type
Signed-off-by: Lucas Schwiderski <lucas@lschwiderski.de>
This commit is contained in:
parent
1c6d160a1a
commit
888e8e48fa
1 changed files with 8 additions and 8 deletions
|
@ -18,7 +18,7 @@
|
|||
import zlib
|
||||
import json
|
||||
import bpy
|
||||
import mathutils
|
||||
from mathutils import Vector, Matrix
|
||||
|
||||
|
||||
def parse_sjson(file_path, skip_editor_data=True):
|
||||
|
@ -181,9 +181,9 @@ def create_object(self, context, name, node_data, geometries):
|
|||
and additional data from the file.
|
||||
"""
|
||||
print("[create_object]", name, node_data)
|
||||
# A list of tuples, where each tuple represents a Vector3(x, y, z).
|
||||
# A list of vectors that represent vertex locations.
|
||||
vertices = []
|
||||
# A list of tuples, where each tuple contains three indices into `vertices`.
|
||||
# A list of vectors, where each vector contains three indices into `vertices`.
|
||||
# Those three indices define the vertices that make up the face.
|
||||
faces = []
|
||||
|
||||
|
@ -207,20 +207,20 @@ def create_object(self, context, name, node_data, geometries):
|
|||
# Iterate over data in sets of three values that represent
|
||||
# `x`, `y` and `z`.
|
||||
for j in range(0, len(stream_data), 3):
|
||||
vertices.append((
|
||||
vertices.append(Vector((
|
||||
stream_data[j],
|
||||
stream_data[j + 1],
|
||||
stream_data[j + 2],
|
||||
))
|
||||
)))
|
||||
|
||||
# Get face definitions. Values are vertex indices.
|
||||
# Iteration works just like vertices above.
|
||||
for j in range(0, len(index_stream), 3):
|
||||
faces.append((
|
||||
faces.append(Vector((
|
||||
index_stream[j],
|
||||
index_stream[j + 1],
|
||||
index_stream[j + 2],
|
||||
))
|
||||
)))
|
||||
else:
|
||||
# TODO: Implement other channel types
|
||||
self.report(
|
||||
|
@ -249,7 +249,7 @@ def import_node(self, context, name, node_data, global_data):
|
|||
|
||||
# Needs to happen before scaling can be applied.
|
||||
# TODO: Check if above is true, was seen on Stackoverflow.
|
||||
obj.matrix_world = mathutils.Matrix()
|
||||
obj.matrix_world = Matrix()
|
||||
# TODO: Apply tranformation matrix in `node_data["local"]`
|
||||
|
||||
if "children" in node_data:
|
||||
|
|
Loading…
Add table
Reference in a new issue