FBX IO: Export normals matching the mesh's normals_domain #104976
@ -1183,7 +1183,7 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
|
||||
normal_source.foreach_get("vector", t_normal)
|
||||
t_normal = nors_transformed(t_normal, geom_mat_no, normal_fbx_dtype)
|
||||
if 0:
|
||||
lnidx_fbx_dtype = np.int32
|
||||
normal_idx_fbx_dtype = np.int32
|
||||
lay_nor = elem_data_single_int32(geom, b"LayerElementNormal", 0)
|
||||
elem_data_single_int32(lay_nor, b"Version", FBX_GEOMETRY_NORMAL_VERSION)
|
||||
elem_data_single_string(lay_nor, b"Name", b"")
|
||||
@ -1193,20 +1193,20 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
|
||||
# Tuple of unique sorted normals and then the index in the unique sorted normals of each normal in t_normal.
|
||||
# Since we don't care about how the normals are sorted, only that they're unique, we can use the fast unique
|
||||
# helper function.
|
||||
t_normal, t_lnidx = fast_first_axis_unique(t_normal.reshape(-1, 3), return_inverse=True)
|
||||
t_normal, t_normal_idx = fast_first_axis_unique(t_normal.reshape(-1, 3), return_inverse=True)
|
||||
|
||||
# Convert to the type for fbx
|
||||
t_lnidx = astype_view_signedness(t_lnidx, lnidx_fbx_dtype)
|
||||
t_normal_idx = astype_view_signedness(t_normal_idx, normal_idx_fbx_dtype)
|
||||
|
||||
elem_data_single_float64_array(lay_nor, b"Normals", t_normal)
|
||||
# Normal weights, no idea what it is.
|
||||
# t_lnw = np.zeros(len(t_normal), dtype=np.float64)
|
||||
# elem_data_single_float64_array(lay_nor, b"NormalsW", t_lnw)
|
||||
# t_normal_w = np.zeros(len(t_normal), dtype=np.float64)
|
||||
# elem_data_single_float64_array(lay_nor, b"NormalsW", t_normal_w)
|
||||
|
||||
elem_data_single_int32_array(lay_nor, b"NormalsIndex", t_lnidx)
|
||||
elem_data_single_int32_array(lay_nor, b"NormalsIndex", t_normal_idx)
|
||||
|
||||
del t_lnidx
|
||||
# del t_lnw
|
||||
del t_normal_idx
|
||||
# del t_normal_w
|
||||
else:
|
||||
lay_nor = elem_data_single_int32(geom, b"LayerElementNormal", 0)
|
||||
elem_data_single_int32(lay_nor, b"Version", FBX_GEOMETRY_NORMAL_VERSION)
|
||||
|
Loading…
Reference in New Issue
Block a user