refactor: bl_collection lint
feat: late update replication
This commit is contained in:
@ -44,7 +44,7 @@ from . import environment, utils
|
|||||||
|
|
||||||
|
|
||||||
DEPENDENCIES = {
|
DEPENDENCIES = {
|
||||||
("replication", '0.0.21a3'),
|
("replication", '0.0.21a4'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ from .. import utils
|
|||||||
from .bl_datablock import BlDatablock
|
from .bl_datablock import BlDatablock
|
||||||
from .dump_anything import Loader, Dumper
|
from .dump_anything import Loader, Dumper
|
||||||
|
|
||||||
|
|
||||||
def dump_collection_children(collection):
|
def dump_collection_children(collection):
|
||||||
collection_children = []
|
collection_children = []
|
||||||
for child in collection.children:
|
for child in collection.children:
|
||||||
@ -30,6 +31,7 @@ def dump_collection_children(collection):
|
|||||||
collection_children.append(child.uuid)
|
collection_children.append(child.uuid)
|
||||||
return collection_children
|
return collection_children
|
||||||
|
|
||||||
|
|
||||||
def dump_collection_objects(collection):
|
def dump_collection_objects(collection):
|
||||||
collection_objects = []
|
collection_objects = []
|
||||||
for object in collection.objects:
|
for object in collection.objects:
|
||||||
@ -38,6 +40,7 @@ def dump_collection_objects(collection):
|
|||||||
|
|
||||||
return collection_objects
|
return collection_objects
|
||||||
|
|
||||||
|
|
||||||
def load_collection_objects(dumped_objects, collection):
|
def load_collection_objects(dumped_objects, collection):
|
||||||
for object in dumped_objects:
|
for object in dumped_objects:
|
||||||
object_ref = utils.find_from_attr('uuid', object, bpy.data.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:
|
if object.uuid not in dumped_objects:
|
||||||
collection.objects.unlink(object)
|
collection.objects.unlink(object)
|
||||||
|
|
||||||
|
|
||||||
def load_collection_childrens(dumped_childrens, collection):
|
def load_collection_childrens(dumped_childrens, collection):
|
||||||
for child_collection in dumped_childrens:
|
for child_collection in dumped_childrens:
|
||||||
collection_ref = utils.find_from_attr(
|
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:
|
if child_collection.uuid not in dumped_childrens:
|
||||||
collection.children.unlink(child_collection)
|
collection.children.unlink(child_collection)
|
||||||
|
|
||||||
|
|
||||||
class BlCollection(BlDatablock):
|
class BlCollection(BlDatablock):
|
||||||
bl_id = "collections"
|
bl_id = "collections"
|
||||||
bl_icon = 'FILE_FOLDER'
|
bl_icon = 'FILE_FOLDER'
|
||||||
@ -75,7 +80,6 @@ class BlCollection(BlDatablock):
|
|||||||
bl_delay_apply = 1
|
bl_delay_apply = 1
|
||||||
bl_automatic_push = True
|
bl_automatic_push = True
|
||||||
|
|
||||||
|
|
||||||
def _construct(self, data):
|
def _construct(self, data):
|
||||||
if self.is_library:
|
if self.is_library:
|
||||||
with bpy.data.libraries.load(filepath=bpy.data.libraries[self.data['library']].filepath, link=True) as (sourceData, targetData):
|
with bpy.data.libraries.load(filepath=bpy.data.libraries[self.data['library']].filepath, link=True) as (sourceData, targetData):
|
||||||
@ -91,7 +95,7 @@ class BlCollection(BlDatablock):
|
|||||||
|
|
||||||
def _load_implementation(self, data, target):
|
def _load_implementation(self, data, target):
|
||||||
loader = Loader()
|
loader = Loader()
|
||||||
loader.load(target,data)
|
loader.load(target, data)
|
||||||
|
|
||||||
# Objects
|
# Objects
|
||||||
load_collection_objects(data['objects'], target)
|
load_collection_objects(data['objects'], target)
|
||||||
|
Reference in New Issue
Block a user