FBX Import: Base patch for numpy and foreach_set speedup #104499
@ -244,6 +244,11 @@ def array_to_matrix4(arr):
|
|||||||
return Matrix(tuple(zip(*[iter(arr)]*4))).transposed()
|
return Matrix(tuple(zip(*[iter(arr)]*4))).transposed()
|
||||||
|
|
||||||
|
|
||||||
|
def parray_as_ndarray(arr):
|
||||||
|
"""Convert an array.array into an np.ndarray that shares the same memory"""
|
||||||
|
return np.frombuffer(arr, dtype=arr.typecode)
|
||||||
|
|
||||||
|
|
||||||
def similar_values(v1, v2, e=1e-6):
|
def similar_values(v1, v2, e=1e-6):
|
||||||
"""Return True if v1 and v2 are nearly the same."""
|
"""Return True if v1 and v2 are nearly the same."""
|
||||||
if v1 == v2:
|
if v1 == v2:
|
||||||
|
@ -18,6 +18,9 @@ import bpy
|
|||||||
from bpy.app.translations import pgettext_tip as tip_
|
from bpy.app.translations import pgettext_tip as tip_
|
||||||
from mathutils import Matrix, Euler, Vector
|
from mathutils import Matrix, Euler, Vector
|
||||||
|
|
||||||
|
# Also imported in .fbx_utils, so importing here is unlikely to further affect Blender startup time.
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# Utils
|
# Utils
|
||||||
from . import parse_fbx, fbx_utils
|
from . import parse_fbx, fbx_utils
|
||||||
@ -34,6 +37,10 @@ from .fbx_utils import (
|
|||||||
similar_values,
|
similar_values,
|
||||||
similar_values_iter,
|
similar_values_iter,
|
||||||
FBXImportSettings,
|
FBXImportSettings,
|
||||||
|
vcos_transformed,
|
||||||
|
nors_transformed,
|
||||||
|
parray_as_ndarray,
|
||||||
|
astype_view_signedness,
|
||||||
)
|
)
|
||||||
|
|
||||||
# global singleton, assign on execution
|
# global singleton, assign on execution
|
||||||
|
Loading…
Reference in New Issue
Block a user