I'm trying to write script that will automatically reload file every few seconds. In order to do that I wrote following plugin:
bl_info = {"name": "[PonyKart] Auto scene update", "category": "Scene"}
import bpy
import threading
DELAY=30
timer=None
def reloader():
print("Updating")
bpy.ops.wm.save_reload()
def register():
print("Timer registered")
timer=threading.Timer(DELAY,reloader)
timer.start()
def unregister():
print("Timer cancelled")
timer.cancel()
But while it indeed does save file properly, it crashes Blender after doing so (I so i think it crashes when Blender opens file)
Just for reference here is code responsible for save_reload from amaranth plugin:
"""Save and Reload the current blend file"""
bl_idname = "wm.save_reload"
bl_label = "Save & Reload"
def save_reload(self, context, path):
if not path:
bpy.ops.wm.save_as_mainfile("INVOKE_AREA")
return
bpy.ops.wm.save_mainfile()
self.report({"INFO"}, "Saved & Reloaded")
bpy.ops.wm.open_mainfile("EXEC_DEFAULT", filepath=path)
def execute(self, context):
path = bpy.data.filepath
self.save_reload(context, path)
return {"FINISHED"}
I'm trying to allow online collaboration on single file. When person A works on file a.blend and person B on file b.blend and they cross-link each others grouped objects (lets say personA_group and personB_group) then with periodic file reaload users can get updated info on scene. Maybe it's not super realtime, but it works and uses relatively stable Blender mechanics.
I know there's verse and I know it doesn't work. Apart from spending like days trying to set it up after I managed to do it it crashes every few minutes and glitches as hell. It's so extremely unstable on hi-poly meshes that it's unusable. Also requires high bandwidth while method above (if we enable Blender file compression) requires only sending few MB file (usually around 1-2) over network every lets say 60 sec. It's possible to implement such mechanics using samba share. According to initial tests file reload over our samba share takes around 3-4 seconds using awfully slow connection so it's usable.