mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'develop' into feature/OP-7176_Use-folder-path-as-unique-identifier
This commit is contained in:
commit
404b2f4442
4 changed files with 29 additions and 21 deletions
|
|
@ -31,16 +31,22 @@ class ExtractBlend(publish.Extractor):
|
|||
for obj in instance:
|
||||
data_blocks.add(obj)
|
||||
# Pack used images in the blend files.
|
||||
if obj.type == 'MESH':
|
||||
for material_slot in obj.material_slots:
|
||||
mat = material_slot.material
|
||||
if mat and mat.use_nodes:
|
||||
tree = mat.node_tree
|
||||
if tree.type == 'SHADER':
|
||||
for node in tree.nodes:
|
||||
if node.bl_idname == 'ShaderNodeTexImage':
|
||||
if node.image:
|
||||
node.image.pack()
|
||||
if obj.type != 'MESH':
|
||||
continue
|
||||
for material_slot in obj.material_slots:
|
||||
mat = material_slot.material
|
||||
if not(mat and mat.use_nodes):
|
||||
continue
|
||||
tree = mat.node_tree
|
||||
if tree.type != 'SHADER':
|
||||
continue
|
||||
for node in tree.nodes:
|
||||
if node.bl_idname != 'ShaderNodeTexImage':
|
||||
continue
|
||||
# Check if image is not packed already
|
||||
# and pack it if not.
|
||||
if node.image and node.image.packed_file is None:
|
||||
node.image.pack()
|
||||
|
||||
bpy.data.libraries.write(filepath, data_blocks)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue