fix(rcf): hide select on selected objects

This commit is contained in:
Swann Martinez
2019-03-14 10:09:46 +01:00
parent 1441ddeb80
commit 756c3faf67
2 changed files with 54 additions and 45 deletions

View File

@ -470,6 +470,7 @@ class session_draw_clients(bpy.types.Operator):
index = 0
index_object = 0
for key, values in client.property_map.items():
if values.body is not None:
if values.mtype == "object":
if values.id != client.id:
indices = (
@ -528,6 +529,17 @@ class session_draw_clients(bpy.types.Operator):
except:
pass
def is_object_selected(self,obj):
#TODO: function to find occurence
global client
for k,v in client.property_map.items():
if v.mtype == 'object':
if client.id != v.id:
if obj.name in v.body:
return True
return False
def modal(self, context, event):
if context.area:
@ -550,27 +562,24 @@ class session_draw_clients(bpy.types.Operator):
client.push_update(key, 'client', current_coords)
# Active object bounding box
if len(context.selected_objects) > 0:
# Hide selected objects
for object in context.scene.objects:
# TODO: fix
try:
#TODO: function to find occurence
for k,v in client.property_map.items():
if v.mtype == 'object':
if client.id.decode() not in k:
if object.name in v.body:
if self.is_object_selected(object):
object.hide_select = True
break
else:
object.hide_select = False
except:
pass
# Active object bounding box
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.id.decode())
client.push_update(key, 'object', session.active_object.name)
elif len(context.selected_objects) == 0 and session.active_object:
session.active_object = None
key = "net/objects/{}".format(client.id.decode())
client.push_update(key, 'object', None)
# Draw clients
if len(client.property_map) > 0:

View File

@ -120,7 +120,7 @@ class SessionPropertiesPanel(bpy.types.Panel):
item_box = area_msg.box()
detail_item_box = item_box.row()
# detail_item_box = item_box.row()
detail_item_box.label(text="{} ({}) ".format(key, values.mtype, values.id.decode()))
detail_item_box.label(text="{} ({}) {} ".format(key, values.mtype, values.id.decode()))
detail_item_box.operator("session.remove_prop",text="",icon="X").property_path = key
else:
area_msg.label(text="Empty")