diff options
author | Constantin Rahn <conz@vrchannel.de> | 2011-01-19 17:33:45 +0300 |
---|---|---|
committer | Constantin Rahn <conz@vrchannel.de> | 2011-01-19 17:33:45 +0300 |
commit | 6fc3f7d09bd3a12933021d95342427ac63e99f9a (patch) | |
tree | 0295657b48e513ee7a12c90a3261d1fe73c4befe /render_povray/render.py | |
parent | 504e5fd2edbcc0044dffc79c4f5087f5bc43f7a0 (diff) |
Declare only required materials
Diffstat (limited to 'render_povray/render.py')
-rw-r--r-- | render_povray/render.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/render_povray/render.py b/render_povray/render.py index f3628a04..48b0bd71 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -426,14 +426,23 @@ def write_pov(filename, scene=None, info_callback=None): tabWrite('}\n\n') - # Level=1 Means No specular nor Mirror reflection - povHasnoSpecularMaps(Level=1) - # Level=2 Means translation of spec and mir levels for when no map influences them povHasnoSpecularMaps(Level=2) - - # Level=3 Means Maximum Spec and Mirror - povHasnoSpecularMaps(Level=3) + + if material: + special_texture_found = False + for t in material.texture_slots: + if t and t.texture.type == 'IMAGE' and t.use and t.texture.image and (t.use_map_specular or t.use_map_raymir or t.use_map_normal or t.use_map_alpha): + special_texture_found = True + continue # Some texture found + + if special_texture_found: + # Level=1 Means No specular nor Mirror reflection + povHasnoSpecularMaps(Level=1) + + # Level=3 Means Maximum Spec and Mirror + povHasnoSpecularMaps(Level=3) + def exportCamera(): camera = scene.camera @@ -1350,11 +1359,9 @@ def write_pov(filename, scene=None, info_callback=None): writeMaterial(material) if comments: file.write('\n') - # if comments: file.write('//--Blob objects--\n\n') exportMeta([l for l in sel if l.type == 'META']) - # if comments: file.write('\n') - if comments: file.write('//--Mesh objecs--\n') + if comments: file.write('//--Mesh objects--\n') exportMeshs(scene, sel) #What follow used to happen here: |