From 4f731c664061ac737eb3af7b7f070239f76fef8f Mon Sep 17 00:00:00 2001 From: Swann Date: Wed, 23 Sep 2020 17:37:21 +0200 Subject: [PATCH] fix: implementation not found if a new type is added --- multi_user/operators.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/multi_user/operators.py b/multi_user/operators.py index 2cf41bc..7f4afc6 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -72,20 +72,20 @@ class SessionStartOperator(bpy.types.Operator): use_extern_update = settings.update_method == 'DEPSGRAPH' users.clear() delayables.clear() - + logger = logging.getLogger() - if len(logger.handlers)==1: + if len(logger.handlers) == 1: formatter = logging.Formatter( fmt='%(asctime)s CLIENT %(levelname)-8s %(message)s', datefmt='%H:%M:%S' ) - + log_directory = os.path.join( settings.cache_directory, "multiuser_client.log") os.makedirs(settings.cache_directory, exist_ok=True) - + handler = logging.FileHandler(log_directory, mode='w') logger.addHandler(handler) @@ -106,7 +106,11 @@ class SessionStartOperator(bpy.types.Operator): supported_bl_types.append(type_module_class.bl_id) - # Retreive local replicated types settings + if type_impl_name not in settings.supported_datablocks: + logging.info(f"{type_impl_name} not found, \ + regenerate type settings...") + settings.generate_supported_types() + type_local_config = settings.supported_datablocks[type_impl_name] bpy_factory.register_type( @@ -139,7 +143,7 @@ class SessionStartOperator(bpy.types.Operator): runtime_settings.is_host = True runtime_settings.internet_ip = environment.get_ip() - + try: for scene in bpy.data.scenes: client.add(scene) @@ -620,7 +624,7 @@ class ClearCache(bpy.types.Operator): return True def execute(self, context): - cache_dir = utils.get_preferences().cache_directory + cache_dir = utils.get_preferences().cache_directory try: for root, dirs, files in os.walk(cache_dir): for name in files: @@ -638,6 +642,7 @@ class ClearCache(bpy.types.Operator): row = self.layout row.label(text=f" Do you really want to remove local cache ? ") + classes = ( SessionStartOperator, SessionStopOperator,