def send_scene_content(): """ Initial data send to fill a new room. """ from mixer.handlers import HandlerManager, send_scene_data_to_server if get_mixer_prefs().no_send_scene_content: return with HandlerManager(False): # mesh baking may trigger depsgraph_updatewhen more than one view layer and # cause to reenter send_scene_data_to_server() and send duplicate messages share_data.clear_before_state() share_data.init_proxy() share_data.client.send_group_begin() # Temporary waiting for material sync. Should move to send_scene_data_to_server for material in bpy.data.materials: share_data.client.send_material(material) send_scene_data_to_server(None, None) shot_manager.send_scene() share_data.client.send_frame_start_end(bpy.context.scene.frame_start, bpy.context.scene.frame_end) share_data.start_frame = bpy.context.scene.frame_start share_data.end_frame = bpy.context.scene.frame_end share_data.client.send_frame(bpy.context.scene.frame_current) share_data.client.send_group_end()
def leave_current_room(): logger.info("leave_current_room") if share_data.client and share_data.client.current_room: share_data.leave_current_room() HandlerManager.set_handlers(False) share_data.clear_before_state()
def leave_current_room(): logger.info("leave_current_room") if share_data.client and share_data.client.current_room: share_data.leave_current_room() HandlerManager.set_handlers(False) share_data.clear_before_state() if share_data.current_statistics is not None and share_data.auto_save_statistics: save_statistics(share_data.current_statistics, share_data.statistics_directory) share_data.current_statistics = None share_data.auto_save_statistics = False share_data.statistics_directory = None
def clear_scene_content(): """ Clear data before joining a room. """ from mixer.handlers import HandlerManager with HandlerManager(False): data = [ "cameras", "collections", "curves", "grease_pencils", "images", "lights", "objects", "materials", "metaballs", "meshes", "textures", "worlds", "sounds", ] for name in data: collection = getattr(bpy.data, name) for obj in collection: collection.remove(obj) # Cannot remove the last scene at this point, treat it differently for scene in bpy.data.scenes[:-1]: scene_api.delete_scene(scene) share_data.clear_before_state() if len(bpy.data.scenes) == 1: scene = bpy.data.scenes[0] scene.name = "__last_scene_to_be_removed__"