fix: handle multiple selected object highlight
This commit is contained in:
@ -484,3 +484,5 @@ def watchdog_worker(serial_feed, interval, stop_event):
|
|||||||
time.sleep(interval)
|
time.sleep(interval)
|
||||||
|
|
||||||
logger.info("watchdog thread stopped")
|
logger.info("watchdog thread stopped")
|
||||||
|
|
||||||
|
|
||||||
|
16
draw.py
16
draw.py
@ -125,6 +125,14 @@ class DrawFactory(object):
|
|||||||
local_username = bpy.context.window_manager.session.username
|
local_username = bpy.context.window_manager.session.username
|
||||||
|
|
||||||
if name != local_username:
|
if name != local_username:
|
||||||
|
key_to_remove = []
|
||||||
|
for k in self.d3d_items.keys():
|
||||||
|
if "{}/".format(client['id']) in k:
|
||||||
|
key_to_remove.append(k)
|
||||||
|
print(key_to_remove)
|
||||||
|
for k in key_to_remove:
|
||||||
|
del self.d3d_items[k]
|
||||||
|
|
||||||
if client['active_objects']:
|
if client['active_objects']:
|
||||||
for select_ob in client['active_objects']:
|
for select_ob in client['active_objects']:
|
||||||
indices = (
|
indices = (
|
||||||
@ -154,13 +162,7 @@ class DrawFactory(object):
|
|||||||
self.d3d_items["{}/{}".format(client['id'],
|
self.d3d_items["{}/{}".format(client['id'],
|
||||||
select_ob)] = (shader, batch, color)
|
select_ob)] = (shader, batch, color)
|
||||||
else:
|
else:
|
||||||
key_to_remove = []
|
pass
|
||||||
for k in self.d3d_items.keys():
|
|
||||||
if "{}/".format(client['id']) in k:
|
|
||||||
key_to_remove.append(k)
|
|
||||||
|
|
||||||
for k in key_to_remove:
|
|
||||||
del self.d3d_items[k]
|
|
||||||
|
|
||||||
def draw_client(self, client):
|
def draw_client(self, client):
|
||||||
if client:
|
if client:
|
||||||
|
@ -16,8 +16,6 @@ BPY_TYPES = {'Texture': 'textures','Material': 'materials', 'GreasePencil': 'gre
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=logging.INFO)
|
||||||
# UTILITY FUNCTIONS
|
# UTILITY FUNCTIONS
|
||||||
|
|
||||||
|
|
||||||
def revers(d):
|
def revers(d):
|
||||||
l = []
|
l = []
|
||||||
for i in d:
|
for i in d:
|
||||||
@ -134,6 +132,7 @@ def load_client(client=None, data=None):
|
|||||||
if client and data:
|
if client and data:
|
||||||
if net_settings.enable_draw:
|
if net_settings.enable_draw:
|
||||||
draw.renderer.draw_client(data)
|
draw.renderer.draw_client(data)
|
||||||
|
|
||||||
draw.renderer.draw_client_selected_objects(data)
|
draw.renderer.draw_client_selected_objects(data)
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,13 +52,11 @@ def upload_client_instance_position():
|
|||||||
|
|
||||||
def update_client_selected_object(context):
|
def update_client_selected_object(context):
|
||||||
session = bpy.context.window_manager.session
|
session = bpy.context.window_manager.session
|
||||||
|
|
||||||
username = bpy.context.window_manager.session.username
|
username = bpy.context.window_manager.session.username
|
||||||
client_key = "Client/{}".format(username)
|
client_key = "Client/{}".format(username)
|
||||||
client_data = client.instance.get(client_key)
|
client_data = client.instance.get(client_key)
|
||||||
|
|
||||||
selected_objects = helpers.get_selected_objects(context.scene)
|
selected_objects = helpers.get_selected_objects(context.scene)
|
||||||
|
|
||||||
if len(selected_objects) > 0:
|
if len(selected_objects) > 0:
|
||||||
|
|
||||||
for obj in selected_objects:
|
for obj in selected_objects:
|
||||||
@ -81,7 +79,6 @@ def init_datablocks():
|
|||||||
client.instance.set(key)
|
client.instance.set(key)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def default_tick():
|
def default_tick():
|
||||||
upload_client_instance_position()
|
upload_client_instance_position()
|
||||||
|
|
||||||
@ -404,8 +401,7 @@ def toogle_update_dirty(context, update):
|
|||||||
def depsgraph_update(scene):
|
def depsgraph_update(scene):
|
||||||
ctx = bpy.context
|
ctx = bpy.context
|
||||||
|
|
||||||
if client.instance.state() == 3:
|
if client.instance and client.instance.state() == 3:
|
||||||
|
|
||||||
if ctx.mode in ['OBJECT','PAINT_GPENCIL']:
|
if ctx.mode in ['OBJECT','PAINT_GPENCIL']:
|
||||||
updates = ctx.view_layer.depsgraph.updates
|
updates = ctx.view_layer.depsgraph.updates
|
||||||
username = ctx.window_manager.session.username
|
username = ctx.window_manager.session.username
|
||||||
|
Reference in New Issue
Block a user