mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Differentiate Append and Import loaders
This commit is contained in:
parent
2a49265ba7
commit
c053762fed
1 changed files with 31 additions and 4 deletions
|
|
@ -16,7 +16,7 @@ class AppendBlendLoader(plugin.AssetLoader):
|
|||
families = ["*"]
|
||||
|
||||
label = "Append Workfile"
|
||||
order = 10
|
||||
order = 9
|
||||
icon = "arrow-circle-down"
|
||||
color = "#775555"
|
||||
|
||||
|
|
@ -25,10 +25,37 @@ class AppendBlendLoader(plugin.AssetLoader):
|
|||
for attr in dir(data_to):
|
||||
setattr(data_to, attr, getattr(data_from, attr))
|
||||
|
||||
# We do not containerize imported content, it remains unmanaged
|
||||
return
|
||||
|
||||
class ImportBlendLoader(plugin.AssetLoader):
|
||||
"""Import workfile in the current Blender scene (unmanaged)
|
||||
|
||||
Warning:
|
||||
The loaded content will be unmanaged and is *not* visible in the
|
||||
scene inventory. It's purely intended to merge content into your scene
|
||||
so you could also use it as a new base.
|
||||
"""
|
||||
|
||||
representations = ["blend"]
|
||||
families = ["*"]
|
||||
|
||||
label = "Import Workfile"
|
||||
order = 9
|
||||
icon = "arrow-circle-down"
|
||||
color = "#775555"
|
||||
|
||||
def load(self, context, name=None, namespace=None, data=None):
|
||||
with bpy.data.libraries.load(self.fname) as (data_from, data_to):
|
||||
for attr in dir(data_to):
|
||||
if attr == "scenes":
|
||||
continue
|
||||
setattr(data_to, attr, getattr(data_from, attr))
|
||||
|
||||
# Add objects to current scene
|
||||
# scene = bpy.context.scene
|
||||
# for obj in data_to.objects:
|
||||
# scene.collection.objects.link(obj)
|
||||
scene = bpy.context.scene
|
||||
for obj in data_to.objects:
|
||||
scene.collection.objects.link(obj)
|
||||
|
||||
# We do not containerize imported content, it remains unmanaged
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue