fix: force user drawing update
This commit is contained in:
@@ -49,6 +49,10 @@ class BlUser(BlDatablock):
|
||||
|
||||
|
||||
def diff(self):
|
||||
if self.pointer.is_dirty:
|
||||
self.pointer.is_dirty = False
|
||||
return True
|
||||
|
||||
for i,coord in enumerate(self.pointer.location):
|
||||
if coord != self.buffer['location'][i]:
|
||||
return True
|
||||
|
||||
+11
-1
@@ -1,7 +1,7 @@
|
||||
import bpy
|
||||
import logging
|
||||
|
||||
from . import operators, utils
|
||||
from . import operators, utils, presence
|
||||
from .bl_types.bl_user import BlUser
|
||||
from .libs import debug
|
||||
from .libs.replication.replication.constants import FETCHED
|
||||
@@ -69,6 +69,16 @@ class ApplyTimer(Timer):
|
||||
|
||||
# class CheckNewTimer(Timer):
|
||||
|
||||
class RedrawTimer(Timer):
|
||||
def __init__(self, timout=1, target_type=None):
|
||||
self._type = target_type
|
||||
super().__init__(timout)
|
||||
|
||||
def execute(self):
|
||||
if presence.renderer:
|
||||
presence.refresh_3d_view()
|
||||
|
||||
return self._timeout
|
||||
|
||||
class Draw(Delayable):
|
||||
def __init__(self):
|
||||
|
||||
+12
-1
@@ -12,6 +12,7 @@ from pathlib import Path
|
||||
import bpy
|
||||
import mathutils
|
||||
from bpy_extras.io_utils import ExportHelper
|
||||
from bpy.app.handlers import persistent
|
||||
|
||||
from . import environment, presence, ui, utils, delayable
|
||||
from .libs import umsgpack
|
||||
@@ -131,7 +132,7 @@ class SessionStartOperator(bpy.types.Operator):
|
||||
settings.user_uuid = client.add(usr)
|
||||
delayables.append(delayable.ClientUpdate(
|
||||
client_uuid=settings.user_uuid))
|
||||
|
||||
# delayables.append(delayable.RedrawTimer(timout=0.5))
|
||||
for node in client.list():
|
||||
try:
|
||||
client.commit(node)
|
||||
@@ -302,6 +303,13 @@ class SessionCommit(bpy.types.Operator):
|
||||
client.push(uuid=self.target)
|
||||
return {"FINISHED"}
|
||||
|
||||
@persistent
|
||||
def redresh_handler(dummy):
|
||||
global client
|
||||
|
||||
user = client.get(uuid=bpy.context.window_manager.session.user_uuid)
|
||||
user.pointer.is_dirty = True
|
||||
|
||||
|
||||
classes = (
|
||||
SessionStartOperator,
|
||||
@@ -320,6 +328,7 @@ def register():
|
||||
register_class(cls)
|
||||
|
||||
presence.register()
|
||||
bpy.app.handlers.depsgraph_update_post.append(redresh_handler)
|
||||
|
||||
|
||||
def unregister():
|
||||
@@ -334,6 +343,8 @@ def unregister():
|
||||
from bpy.utils import unregister_class
|
||||
for cls in reversed(classes):
|
||||
unregister_class(cls)
|
||||
|
||||
bpy.app.handlers.depsgraph_update_post.remove(redresh_handler)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -96,6 +96,7 @@ def get_client_2d(coords):
|
||||
|
||||
class User():
|
||||
def __init__(self, username=None, color=(0, 0, 0, 1)):
|
||||
self.is_dirty = False
|
||||
self.name = username
|
||||
self.color = color
|
||||
self.location = [[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]
|
||||
|
||||
Reference in New Issue
Block a user