Merge pull request #2085 from simonebarbieri/bugfix/blender-fix_textures

This commit is contained in:
Milan Kolar 2021-09-29 12:23:16 +01:00 committed by GitHub
commit d08a0600e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,6 +28,16 @@ class ExtractBlend(openpype.api.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':
node.image.pack()
bpy.data.libraries.write(filepath, data_blocks)