FBX IO: Speed up export by multithreading array compression #105018
@ -4,8 +4,10 @@
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from . import data_types
|
from . import data_types
|
||||||
|
from .fbx_utils_threading import MultiThreadedTaskConsumer
|
||||||
except:
|
except:
|
||||||
import data_types
|
import data_types
|
||||||
|
from fbx_utils_threading import MultiThreadedTaskConsumer
|
||||||
|
|
||||||
from struct import pack
|
from struct import pack
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
@ -64,9 +66,6 @@ class FBXElem:
|
|||||||
|
|
||||||
Writing to a file is temporarily disabled as a safeguard."""
|
Writing to a file is temporarily disabled as a safeguard."""
|
||||||
# __enter__()
|
# __enter__()
|
||||||
# Can't import fbx_utils at the top of this file because json2fbx.py imports this file, but json2fbx.py can't
|
|
||||||
# import fbx_utils due to fbx_utils importing bpy.
|
|
||||||
from . import fbx_utils
|
|
||||||
orig_func = cls._add_compressed_array_helper
|
orig_func = cls._add_compressed_array_helper
|
||||||
orig_write = cls._write
|
orig_write = cls._write
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ class FBXElem:
|
|||||||
data = pack('<3I', length, encoding, comp_len) + data
|
data = pack('<3I', length, encoding, comp_len) + data
|
||||||
props[insert_at] = data
|
props[insert_at] = data
|
||||||
|
|
||||||
with fbx_utils.MultiThreadedTaskConsumer.new_cpu_bound_cm(insert_compressed_array) as wrapped_func:
|
with MultiThreadedTaskConsumer.new_cpu_bound_cm(insert_compressed_array) as wrapped_func:
|
||||||
try:
|
try:
|
||||||
def _add_compressed_array_helper_multi(self, data, length):
|
def _add_compressed_array_helper_multi(self, data, length):
|
||||||
# Append a dummy value that will be replaced with the compressed array data later.
|
# Append a dummy value that will be replaced with the compressed array data later.
|
||||||
|
Loading…
Reference in New Issue
Block a user