Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorianfelix <florianfelixmeyer@gmail.com>2017-09-29 18:11:31 +0300
committerflorianfelix <florianfelixmeyer@gmail.com>2017-09-29 18:11:31 +0300
commit2edd24a4e6c5b77ddca88cbddaa581edf0d89e8b (patch)
treecedd9edec762d4f7827eb98c079a622c4110238e /io_online_sketchfab
parent1542092295c92adfaff687050a74cd7c34747c22 (diff)
Fix T51503 Added support for Cycles image textures
Diffstat (limited to 'io_online_sketchfab')
-rw-r--r--io_online_sketchfab/pack_for_export.py32
1 files changed, 23 insertions, 9 deletions
diff --git a/io_online_sketchfab/pack_for_export.py b/io_online_sketchfab/pack_for_export.py
index 16d38cca..e9fbde72 100644
--- a/io_online_sketchfab/pack_for_export.py
+++ b/io_online_sketchfab/pack_for_export.py
@@ -61,17 +61,31 @@ def prepare_assets(export_settings):
for ob in bpy.data.objects:
if ob.type == 'MESH':
+
for mat_slot in ob.material_slots:
- if not mat_slot.material:
- continue
- for tex_slot in mat_slot.material.texture_slots:
- if not tex_slot:
+ #CYCLES RENDER
+ if bpy.context.scene.render.engine == 'CYCLES':
+ if not mat_slot.material:
+ continue
+ if not mat_slot.material.node_tree:
continue
- tex = tex_slot.texture
- if tex.type == 'IMAGE':
- image = tex.image
- if image is not None:
- images.add(image)
+ imgnodes = [n for n in mat_slot.material.node_tree.nodes if n.type == 'TEX_IMAGE']
+ for node in imgnodes:
+ if node.image is not None:
+ images.add(node.image)
+ #BLENDER RENDER
+ else:
+ if not mat_slot.material:
+ continue
+ for tex_slot in mat_slot.material.texture_slots:
+ if not tex_slot:
+ continue
+ tex = tex_slot.texture
+ if tex.type == 'IMAGE':
+ image = tex.image
+ if image is not None:
+ images.add(image)
+
if ((export_settings['models'] == 'SELECTION' and ob.type == 'MESH') or
(export_settings['lamps'] == 'SELECTION' and ob.type == 'LAMP')):