refactor: bl_collection lint

feat: late update replication
This commit is contained in:
Swann
2020-09-02 16:44:11 +02:00
parent a46d5fa227
commit 605bcc7581
2 changed files with 16 additions and 12 deletions

View File

@ -44,7 +44,7 @@ from . import environment, utils
DEPENDENCIES = {
("replication", '0.0.21a3'),
("replication", '0.0.21a4'),
}

View File

@ -23,6 +23,7 @@ from .. import utils
from .bl_datablock import BlDatablock
from .dump_anything import Loader, Dumper
def dump_collection_children(collection):
collection_children = []
for child in collection.children:
@ -30,6 +31,7 @@ def dump_collection_children(collection):
collection_children.append(child.uuid)
return collection_children
def dump_collection_objects(collection):
collection_objects = []
for object in collection.objects:
@ -38,6 +40,7 @@ def dump_collection_objects(collection):
return collection_objects
def load_collection_objects(dumped_objects, collection):
for object in dumped_objects:
object_ref = utils.find_from_attr('uuid', object, bpy.data.objects)
@ -51,6 +54,7 @@ def load_collection_objects(dumped_objects, collection):
if object.uuid not in dumped_objects:
collection.objects.unlink(object)
def load_collection_childrens(dumped_childrens, collection):
for child_collection in dumped_childrens:
collection_ref = utils.find_from_attr(
@ -67,6 +71,7 @@ def load_collection_childrens(dumped_childrens, collection):
if child_collection.uuid not in dumped_childrens:
collection.children.unlink(child_collection)
class BlCollection(BlDatablock):
bl_id = "collections"
bl_icon = 'FILE_FOLDER'
@ -75,7 +80,6 @@ class BlCollection(BlDatablock):
bl_delay_apply = 1
bl_automatic_push = True
def _construct(self, data):
if self.is_library:
with bpy.data.libraries.load(filepath=bpy.data.libraries[self.data['library']].filepath, link=True) as (sourceData, targetData):