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

View File

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

View File

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

View File

@ -93,7 +93,7 @@ def get_armature_edition_context(armature):
def get_selected_objects(scene): 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): def load_dict(src_dict, target):