refactor: io_bpy architecture revamp
This commit is contained in:
@ -51,7 +51,7 @@ from replication.interface import session
|
||||
from replication.porcelain import add, apply, commit
|
||||
from replication.repository import Repository
|
||||
|
||||
from . import bl_types, environment, timers, ui, utils
|
||||
from . import io_bpy, environment, timers, ui, utils
|
||||
from .presence import SessionStatusWidget, renderer, view3d_find
|
||||
from .timers import registry
|
||||
|
||||
@ -189,29 +189,15 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
|
||||
handler.setFormatter(formatter)
|
||||
|
||||
bpy_protocol = DataTranslationProtocol()
|
||||
supported_bl_types = []
|
||||
bpy_protocol = io_bpy.get_data_translation_protocol()
|
||||
|
||||
# init the factory with supported types
|
||||
for type in bl_types.types_to_register():
|
||||
type_module = getattr(bl_types, type)
|
||||
name = [e.capitalize() for e in type.split('_')[1:]]
|
||||
type_impl_name = 'Bl'+''.join(name)
|
||||
type_module_class = getattr(type_module, type_impl_name)
|
||||
|
||||
supported_bl_types.append(type_module_class.bl_id)
|
||||
|
||||
if type_impl_name not in settings.supported_datablocks:
|
||||
logging.info(f"{type_impl_name} not found, \
|
||||
for impl in bpy_protocol.implementations.values():
|
||||
if impl.__name__ not in settings.supported_datablocks:
|
||||
logging.info(f"{impl.__name__} not found, \
|
||||
regenerate type settings...")
|
||||
settings.generate_supported_types()
|
||||
|
||||
type_local_config = settings.supported_datablocks[type_impl_name]
|
||||
|
||||
bpy_protocol.register_type(
|
||||
type_module_class.bl_class,
|
||||
type_module_class)
|
||||
|
||||
if bpy.app.version[1] >= 91:
|
||||
python_binary_path = sys.executable
|
||||
else:
|
||||
@ -658,7 +644,7 @@ class ApplyArmatureOperator(bpy.types.Operator):
|
||||
|
||||
if event.type == 'TIMER':
|
||||
if session and session.state == STATE_ACTIVE:
|
||||
nodes = session.list(filter=bl_types.bl_armature.BlArmature)
|
||||
nodes = session.list(filter=io_bpy.bl_armature.BlArmature)
|
||||
|
||||
for node in nodes:
|
||||
node_ref = session.repository.get_node(node)
|
||||
@ -857,8 +843,8 @@ class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper):
|
||||
|
||||
# init the factory with supported types
|
||||
bpy_protocol = DataTranslationProtocol()
|
||||
for type in bl_types.types_to_register():
|
||||
type_module = getattr(bl_types, type)
|
||||
for type in io_bpy.types_to_register():
|
||||
type_module = getattr(io_bpy, type)
|
||||
name = [e.capitalize() for e in type.split('_')[1:]]
|
||||
type_impl_name = 'Bl'+''.join(name)
|
||||
type_module_class = getattr(type_module, type_impl_name)
|
||||
@ -928,7 +914,7 @@ classes = (
|
||||
)
|
||||
|
||||
def update_external_dependencies():
|
||||
nodes_ids = session.list(filter=bl_types.bl_file.BlFile)
|
||||
nodes_ids = session.list(filter=io_bpy.bl_file.BlFile)
|
||||
for node_id in nodes_ids:
|
||||
node = session.repository.get_node(node_id)
|
||||
if node and node.owner in [session.id, RP_COMMON] \
|
||||
|
Reference in New Issue
Block a user