feat(rcf): bring back selected object lock
This commit is contained in:
parent
91611f01e2
commit
331b8794da
6
draw.py
6
draw.py
@ -108,7 +108,8 @@ class HUD(object):
|
|||||||
name = client[0].split('/')[1]
|
name = client[0].split('/')[1]
|
||||||
local_username = bpy.context.scene.session_settings.username
|
local_username = bpy.context.scene.session_settings.username
|
||||||
|
|
||||||
if name != local_username and client[1]['active_objects']:
|
if name != local_username:
|
||||||
|
if client[1]['active_objects']:
|
||||||
for select_ob in client[1]['active_objects']:
|
for select_ob in client[1]['active_objects']:
|
||||||
indices = (
|
indices = (
|
||||||
(0, 1), (1, 2), (2, 3), (0, 3),
|
(0, 1), (1, 2), (2, 3), (0, 3),
|
||||||
@ -135,7 +136,8 @@ class HUD(object):
|
|||||||
|
|
||||||
self.d3d_items["{}/{}".format(client[0],
|
self.d3d_items["{}/{}".format(client[0],
|
||||||
select_ob)] = (shader, batch, color)
|
select_ob)] = (shader, batch, color)
|
||||||
|
else:
|
||||||
|
self.d3d_items.clear()
|
||||||
def draw_clients(self):
|
def draw_clients(self):
|
||||||
clients = self.client.get("Client")
|
clients = self.client.get("Client")
|
||||||
|
|
||||||
|
@ -78,14 +78,15 @@ def load_client(client=None, data=None):
|
|||||||
# localy_selected = get_selected_objects(C.scene)
|
# localy_selected = get_selected_objects(C.scene)
|
||||||
# Draw client
|
# Draw client
|
||||||
|
|
||||||
|
client_data = data
|
||||||
# Load selected object
|
# Load selected object
|
||||||
if data['active_objects']:
|
|
||||||
for obj in C.scene.objects:
|
for obj in C.scene.objects:
|
||||||
if obj.name in data['active_objects']:
|
if client_data['active_objects'] and obj.name in client_data['active_objects']:
|
||||||
D.objects[obj.name].hide_select = True
|
D.objects[obj.name].hide_select = True
|
||||||
else:
|
else:
|
||||||
D.objects[obj.name].hide_select = False
|
D.objects[obj.name].hide_select = False
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def load_mesh(target=None, data=None, create=False):
|
def load_mesh(target=None, data=None, create=False):
|
||||||
|
59
operators.py
59
operators.py
@ -84,31 +84,48 @@ def update_selected_object(context):
|
|||||||
global client_instance
|
global client_instance
|
||||||
session = bpy.context.scene.session_settings
|
session = bpy.context.scene.session_settings
|
||||||
|
|
||||||
|
username = bpy.context.scene.session_settings.username
|
||||||
|
client_key = "Client/{}".format(username)
|
||||||
|
client_data = client_instance.get(client_key)
|
||||||
|
|
||||||
# Active object bounding box
|
# Active object bounding box
|
||||||
if len(context.selected_objects) > 0:
|
if len(context.selected_objects) > 0:
|
||||||
if session.active_object is not context.selected_objects[0] or session.active_object.is_evaluated:
|
|
||||||
session.active_object = context.selected_objects[0]
|
|
||||||
key = "net/objects/{}".format(client_instance.id.decode())
|
|
||||||
data = {}
|
|
||||||
data['color'] = [session.client_instance_color.r,
|
|
||||||
session.client_instance_color.g, session.client_instance_color.b]
|
|
||||||
data['object'] = session.active_object.name
|
|
||||||
client_instance.push_update(
|
|
||||||
key, 'client_instanceObject', data)
|
|
||||||
|
|
||||||
return True
|
|
||||||
elif len(context.selected_objects) == 0 and session.active_object:
|
|
||||||
session.active_object = None
|
|
||||||
data = {}
|
|
||||||
data['color'] = [session.client_instance_color.r,
|
|
||||||
session.client_instance_color.g, session.client_instance_color.b]
|
|
||||||
data['object'] = None
|
|
||||||
key = "net/objects/{}".format(client_instance.id.decode())
|
|
||||||
client_instance.push_update(key, 'client_instanceObject', data)
|
|
||||||
|
|
||||||
return True
|
for obj in context.selected_objects:
|
||||||
|
if obj.name not in client_data[0][1]['active_objects']:
|
||||||
|
client_data[0][1]['active_objects'] = helpers.get_selected_objects(context.scene)
|
||||||
|
|
||||||
return False
|
client_instance.set(client_key,client_data[0][1])
|
||||||
|
break
|
||||||
|
elif client_data[0][1]['active_objects']:
|
||||||
|
client_data[0][1]['active_objects'] = []
|
||||||
|
client_instance.set(client_key,client_data[0][1])
|
||||||
|
|
||||||
|
|
||||||
|
# if session.active_object is not context.selected_objects[0] or session.active_object.is_evaluated:
|
||||||
|
# session.active_object = context.selected_objects[0]
|
||||||
|
# key = "net/objects/{}".format(client_instance.id.decode())
|
||||||
|
# data = {}
|
||||||
|
# data['color'] = [session.client_instance_color.r,
|
||||||
|
# session.client_instance_color.g, session.client_instance_color.b]
|
||||||
|
# data['object'] = session.active_object.name
|
||||||
|
# client_instance.push_update(
|
||||||
|
# key, 'client_instanceObject', data)
|
||||||
|
|
||||||
|
# return True
|
||||||
|
# elif len(context.selected_objects) == 0 and session.active_object:
|
||||||
|
# session.active_object = None
|
||||||
|
# data = {}
|
||||||
|
# data['color'] = [session.client_instance_color.r,
|
||||||
|
# session.client_instance_color.g, session.client_instance_color.b]
|
||||||
|
# data['object'] = None
|
||||||
|
# key = "net/objects/{}".format(client_instance.id.decode())
|
||||||
|
# client_instance.push_update(key, 'client_instanceObject', data)
|
||||||
|
|
||||||
|
# return True
|
||||||
|
|
||||||
|
# return False
|
||||||
|
|
||||||
|
|
||||||
def init_datablocks():
|
def init_datablocks():
|
||||||
@ -447,6 +464,8 @@ def depsgraph_update(scene):
|
|||||||
if client_instance and client_instance.agent.is_alive():
|
if client_instance and client_instance.agent.is_alive():
|
||||||
updates = bpy.context.depsgraph.updates
|
updates = bpy.context.depsgraph.updates
|
||||||
|
|
||||||
|
update_selected_object(bpy.context)
|
||||||
|
|
||||||
if is_dirty(updates):
|
if is_dirty(updates):
|
||||||
for update in ordered(updates):
|
for update in ordered(updates):
|
||||||
if update[2] == "Master Collection":
|
if update[2] == "Master Collection":
|
||||||
|
Loading…
x
Reference in New Issue
Block a user