feat(client): preliminary work on watchdog system
This commit is contained in:
parent
f4cd489ea4
commit
5fd13eb5ba
@ -506,7 +506,8 @@ def watchdog_worker(feed,interval, stop_event):
|
|||||||
item.id = bpy.context.scene.session_settings.username
|
item.id = bpy.context.scene.session_settings.username
|
||||||
key = "{}/{}".format(datatype, item.name)
|
key = "{}/{}".format(datatype, item.name)
|
||||||
feed.put(('DUMP',key,None))
|
feed.put(('DUMP',key,None))
|
||||||
|
elif item.is_dirty:
|
||||||
|
logger.info("{} needs update".format(item.name))
|
||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
logger.info("watchdog thread stopped")
|
logger.info("watchdog thread stopped")
|
||||||
|
18
operators.py
18
operators.py
@ -505,19 +505,22 @@ def depsgraph_update(scene):
|
|||||||
update_selected_object(bpy.context)
|
update_selected_object(bpy.context)
|
||||||
|
|
||||||
selected_objects = helpers.get_selected_objects(scene)
|
selected_objects = helpers.get_selected_objects(scene)
|
||||||
if len(selected_objects) > 0:
|
# if len(selected_objects) > 0:
|
||||||
for updated_data in updates:
|
# for updated_data in updates:
|
||||||
if updated_data.id.name in selected_objects:
|
# if updated_data.id.name in selected_objects:
|
||||||
if updated_data.is_updated_transform or updated_data.is_updated_geometry:
|
# if updated_data.is_updated_transform or updated_data.is_updated_geometry:
|
||||||
client_instance.set(
|
# client_instance.set(
|
||||||
"{}/{}".format(updated_data.id.bl_rna.name, updated_data.id.name))
|
# "{}/{}".format(updated_data.id.bl_rna.name, updated_data.id.name))
|
||||||
|
for update in updates:
|
||||||
|
if update.id.id == username:
|
||||||
|
getattr(bpy.data, helpers.CORRESPONDANCE[update.id.__class__.__name__])[update.id.name].is_dirty= True
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
from bpy.utils import register_class
|
from bpy.utils import register_class
|
||||||
for cls in classes:
|
for cls in classes:
|
||||||
register_class(cls)
|
register_class(cls)
|
||||||
bpy.types.ID.id = bpy.props.StringProperty(default="None")
|
bpy.types.ID.id = bpy.props.StringProperty(default="None")
|
||||||
|
bpy.types.ID.is_dirty = bpy.props.BoolProperty(default=False)
|
||||||
bpy.types.Scene.session_settings = bpy.props.PointerProperty(
|
bpy.types.Scene.session_settings = bpy.props.PointerProperty(
|
||||||
type=session_settings)
|
type=session_settings)
|
||||||
bpy.app.handlers.depsgraph_update_post.append(depsgraph_update)
|
bpy.app.handlers.depsgraph_update_post.append(depsgraph_update)
|
||||||
@ -552,6 +555,7 @@ def unregister():
|
|||||||
|
|
||||||
del bpy.types.Scene.session_settings
|
del bpy.types.Scene.session_settings
|
||||||
del bpy.types.ID.id
|
del bpy.types.ID.id
|
||||||
|
del bpy.types.ID.is_dirty
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user