fix: implementation not found if a new type is added

This commit is contained in:
Swann 2020-09-23 17:37:21 +02:00
parent 9b1b8f11fd
commit 4f731c6640
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB

View File

@ -72,20 +72,20 @@ class SessionStartOperator(bpy.types.Operator):
use_extern_update = settings.update_method == 'DEPSGRAPH' use_extern_update = settings.update_method == 'DEPSGRAPH'
users.clear() users.clear()
delayables.clear() delayables.clear()
logger = logging.getLogger() logger = logging.getLogger()
if len(logger.handlers)==1: if len(logger.handlers) == 1:
formatter = logging.Formatter( formatter = logging.Formatter(
fmt='%(asctime)s CLIENT %(levelname)-8s %(message)s', fmt='%(asctime)s CLIENT %(levelname)-8s %(message)s',
datefmt='%H:%M:%S' datefmt='%H:%M:%S'
) )
log_directory = os.path.join( log_directory = os.path.join(
settings.cache_directory, settings.cache_directory,
"multiuser_client.log") "multiuser_client.log")
os.makedirs(settings.cache_directory, exist_ok=True) os.makedirs(settings.cache_directory, exist_ok=True)
handler = logging.FileHandler(log_directory, mode='w') handler = logging.FileHandler(log_directory, mode='w')
logger.addHandler(handler) logger.addHandler(handler)
@ -106,7 +106,11 @@ class SessionStartOperator(bpy.types.Operator):
supported_bl_types.append(type_module_class.bl_id) 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] type_local_config = settings.supported_datablocks[type_impl_name]
bpy_factory.register_type( bpy_factory.register_type(
@ -139,7 +143,7 @@ class SessionStartOperator(bpy.types.Operator):
runtime_settings.is_host = True runtime_settings.is_host = True
runtime_settings.internet_ip = environment.get_ip() runtime_settings.internet_ip = environment.get_ip()
try: try:
for scene in bpy.data.scenes: for scene in bpy.data.scenes:
client.add(scene) client.add(scene)
@ -620,7 +624,7 @@ class ClearCache(bpy.types.Operator):
return True return True
def execute(self, context): def execute(self, context):
cache_dir = utils.get_preferences().cache_directory cache_dir = utils.get_preferences().cache_directory
try: try:
for root, dirs, files in os.walk(cache_dir): for root, dirs, files in os.walk(cache_dir):
for name in files: for name in files:
@ -638,6 +642,7 @@ class ClearCache(bpy.types.Operator):
row = self.layout row = self.layout
row.label(text=f" Do you really want to remove local cache ? ") row.label(text=f" Do you really want to remove local cache ? ")
classes = ( classes = (
SessionStartOperator, SessionStartOperator,
SessionStopOperator, SessionStopOperator,