diff options
Diffstat (limited to 'blenderkit/append_link.py')
-rw-r--r-- | blenderkit/append_link.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/blenderkit/append_link.py b/blenderkit/append_link.py index b6bfb791..2301daac 100644 --- a/blenderkit/append_link.py +++ b/blenderkit/append_link.py @@ -88,6 +88,8 @@ def append_scene(file_name, scenename=None, link=False, fake_user=False): def link_collection(file_name, obnames=[], location=(0, 0, 0), link=False, parent = None, **kwargs): '''link an instanced group - model type asset''' sel = utils.selection_get() + print('link collection') + print(kwargs) with bpy.data.libraries.load(file_name, link=link, relative=True) as (data_from, data_to): scols = [] @@ -115,6 +117,12 @@ def link_collection(file_name, obnames=[], location=(0, 0, 0), link=False, paren main_object.instance_collection = col break; + #sometimes, the lib might already be without the actual link. + if not main_object.instance_collection and kwargs['name']: + col = bpy.data.collections.get(kwargs['name']) + if col: + main_object.instance_collection = col + main_object.name = main_object.instance_collection.name # bpy.ops.wm.link(directory=file_name + "/Collection/", filename=kwargs['name'], link=link, instance_collections=True, |