Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Blender: fix texture missing when publishing blend files #2085

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions openpype/hosts/blender/plugins/publish/extract_blend.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ def process(self, instance):

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)

Expand Down