feat: uuid based selection

This commit is contained in:
Swann 2019-10-08 21:48:45 +02:00
parent e047874dbd
commit 5e1f019f24
5 changed files with 8 additions and 15 deletions

View File

@ -43,7 +43,6 @@ class BlObject(BlDatablock):
return instance
def load(self, data, target):
target.uuid = data['uuid']
target.matrix_world = mathutils.Matrix(data["matrix_world"])
# Load modifiers
@ -75,7 +74,6 @@ class BlObject(BlDatablock):
"rotation_mode",
"parent",
"data",
"uuid",
"children",
"library"
]

View File

@ -105,8 +105,7 @@ class DynamicRightSelectTimer(Timer):
# change new selection to our
for obj in obj_ours:
node = operators.client.get(
reference=bpy.data.objects[obj])
node = operators.client.get(uuid=obj)
if node and node.owner == RP_COMMON:
operators.client.change_owner(
node.uuid, settings.username)
@ -120,17 +119,15 @@ class DynamicRightSelectTimer(Timer):
# change old selection right to common
for obj in obj_common:
_object = bpy.data.objects.get(obj)
node = operators.client.get(reference=_object)
node = operators.client.get(uuid=obj)
if node and (node.owner == settings.username or node.owner == RP_COMMON):
operators.client.change_owner(
node.uuid, RP_COMMON)
else:
for obj in bpy.data.objects:
if obj.hide_select and obj.name not in user_ref.data['selected_objects']:
if obj.hide_select and obj.uuid not in user_ref.data['selected_objects']:
obj.hide_select = False
elif not obj.hide_select and obj.name in user_ref.data['selected_objects']:
elif not obj.hide_select and obj.uuid in user_ref.data['selected_objects']:
obj.hide_select = True
class Draw(Delayable):

@ -1 +1 @@
Subproject commit fb92463c13032222e847e83b8417de99d7fd37e0
Subproject commit 7e4eb2fb70964448d6f54de09f2b10a46d60529f

View File

@ -202,10 +202,8 @@ class DrawFactory(object):
(4, 5), (5, 6), (6, 7), (4, 7),
(0, 4), (1, 5), (2, 6), (3, 7)
)
if select_ob in bpy.data.objects.keys():
ob = bpy.data.objects[select_ob]
else:
ob = utils.find_from_attr("uuid",select_ob,bpy.data.objects)
if not ob:
return
bbox_corners = [ob.matrix_world @ mathutils.Vector(

View File

@ -93,7 +93,7 @@ def get_armature_edition_context(armature):
def get_selected_objects(scene):
return [obj.name for obj in scene.objects if obj.select_get()]
return [obj.uuid for obj in scene.objects if obj.select_get()]
def load_dict(src_dict, target):