[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4177] trunk/py/scripts/addons/ render_povray/render.py: Fixed:

Maurice Raybaud mauriceraybaud at hotmail.fr
Sat Jan 19 12:03:17 CET 2013


Revision: 4177
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4177
Author:   mauriceraybaud
Date:     2013-01-19 11:03:13 +0000 (Sat, 19 Jan 2013)
Log Message:
-----------
Fixed:
-better hairDiameter when using clumps
-use_renderEmitter property should now work.

Modified Paths:
--------------
    trunk/py/scripts/addons/render_povray/render.py

Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py	2013-01-18 19:16:46 UTC (rev 4176)
+++ trunk/py/scripts/addons/render_povray/render.py	2013-01-19 11:03:13 UTC (rev 4177)
@@ -25,7 +25,7 @@
 import time
 from math import atan, pi, degrees, sqrt
 import re
-
+import random
 ##############################SF###########################
 ##############find image texture
 
@@ -821,11 +821,12 @@
                 continue
                    
             # Export Hair
-
+            renderEmitter = True
             if hasattr(ob, 'particle_systems'):
+                renderEmitter = False
                 for pSys in ob.particle_systems:
-                    if not pSys.settings.use_render_emitter:
-                        continue #don't render mesh
+                    if pSys.settings.use_render_emitter:
+                        renderEmitter = True
                     for mod in [m for m in ob.modifiers if (m is not None) and (m.type == 'PARTICLE_SYSTEM')]:
                         if (pSys.settings.render_type == 'PATH') and mod.show_render and (pSys.name == mod.particle_system.name):
                             tstart = time.time()
@@ -834,10 +835,10 @@
                                 if pmaterial.strand.use_blender_units:
                                     strandStart = pmaterial.strand.root_size
                                     strandEnd = pmaterial.strand.tip_size
-                                    strandShape = pmaterial.strand.shape
+                                    strandShape = pmaterial.strand.shape 
                                 else:  # Blender unit conversion
-                                    strandStart = pmaterial.strand.root_size / 200
-                                    strandEnd = pmaterial.strand.tip_size / 200
+                                    strandStart = pmaterial.strand.root_size / 200.0
+                                    strandEnd = pmaterial.strand.tip_size / 200.0
                                     strandShape = pmaterial.strand.shape
                             else:
                                 pmaterial = "default"  # No material assigned in blender, use default one
@@ -864,7 +865,7 @@
                                         file.write('%i,\n' % (len(particle.hair_keys)))
                                     for controlPoint in particle.hair_keys:
                                         if pSys.settings.clump_factor != 0:
-                                            hDiameter = pSys.settings.clump_factor #* random.uniform(0.5, 1)
+                                            hDiameter = pSys.settings.clump_factor / 200.0 * random.uniform(0.5, 1)
                                         elif controlPointCounter == 0:
                                             hDiameter = strandStart
                                         else:
@@ -951,8 +952,8 @@
                             print('Totals hairstrands written: %i' % totalNumberOfHairs)
                             print('Number of tufts (particle systems)', len(ob.particle_systems))
 
-                                
-
+                            if renderEmitter == False:
+                                continue #don't render mesh, skip to next object.
             try:
                 me = ob.to_mesh(scene, True, 'RENDER')
             except:
@@ -1854,9 +1855,9 @@
                 # In pov, the scale has reversed influence compared to blender. these number
                 # should correct that
                 tabWrite("mm_per_unit %.6f\n" % \
-                         (material.subsurface_scattering.scale * (-100.0) + 15.0))
+                         (material.subsurface_scattering.scale * 10000.0))# formerly ...scale * (-100.0) + 15.0))
                 # In POV-Ray, the scale factor for all subsurface shaders needs to be the same
-                sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 100
+                sslt_samples = (11 - material.subsurface_scattering.error_threshold) * 10 # formerly ...*100
                 tabWrite("subsurface { samples %d, %d }\n" % (sslt_samples, sslt_samples / 10))
                 onceSss = 0
 



More information about the Bf-extensions-cvs mailing list