[Bf-extensions-cvs] [1b3bbeea] master: Fourth pass at 2.8 API related updates

Maurice Raybaud noreply at git.blender.org
Mon Apr 22 20:41:35 CEST 2019


Commit: 1b3bbeea01d4cb1aca3ccd2986fee85b253c8d3c
Author: Maurice Raybaud
Date:   Mon Apr 22 20:41:27 2019 +0200
Branches: master
https://developer.blender.org/rBA1b3bbeea01d4cb1aca3ccd2986fee85b253c8d3c

Fourth pass at 2.8 API related updates

===================================================================

M	render_povray/render.py
M	render_povray/ui.py

===================================================================

diff --git a/render_povray/render.py b/render_povray/render.py
index 31beb174..033013b8 100644
--- a/render_povray/render.py
+++ b/render_povray/render.py
@@ -190,7 +190,7 @@ def safety(name, Level):
 csg_list = []
 
 def is_renderable(scene, ob):
-    return (ob.is_visible(scene) and not ob.hide_render and ob not in csg_list)
+    return (not ob.hide_render and ob not in csg_list)
 
 
 def renderable_objects(scene):
@@ -518,7 +518,7 @@ def write_pov(filename, scene=None, info_callback=None):
 
         # DH disabled for now, this isn't the correct context
         active_object = None  # bpy.context.active_object # does not always work  MR
-        matrix = global_matrix * camera.matrix_world
+        matrix = global_matrix @ camera.matrix_world
         focal_point = camera.data.dof_distance
 
         # compute resolution
@@ -554,7 +554,7 @@ def write_pov(filename, scene=None, info_callback=None):
                 tabWrite("confidence %.3g\n" % camera.data.pov.dof_confidence)
                 if camera.data.dof_object:
                     focalOb = scene.objects[camera.data.dof_object.name]
-                    matrixBlur = global_matrix * focalOb.matrix_world
+                    matrixBlur = global_matrix @ focalOb.matrix_world
                     tabWrite("focal_point <%.4f,%.4f,%.4f>\n"% matrixBlur.translation[:])
                 else:
                     tabWrite("focal_point <0, 0, %f>\n" % focal_point)
@@ -577,7 +577,7 @@ def write_pov(filename, scene=None, info_callback=None):
         for ob in lamps:
             lamp = ob.data
 
-            matrix = global_matrix * ob.matrix_world
+            matrix = global_matrix @ ob.matrix_world
 
             # Color is modified by energy #multiplied by 2 for a better match --Maurice
             color = tuple([c * (lamp.energy) for c in lamp.color])
@@ -653,14 +653,14 @@ def write_pov(filename, scene=None, info_callback=None):
                     tabWrite("adaptive 1\n")
                     tabWrite("jitter\n")
 
-            # HEMI never has any shadow_method attribute
-            if(not scene.render.use_shadows or lamp.type == 'HEMI' or
-               (lamp.type != 'HEMI' and lamp.shadow_method == 'NOSHADOW')):
+            # No shadow checked either at global or light level:
+            if(not scene.render.use_shadows or
+               (lamp.shadow_method == 'NOSHADOW')):
                 tabWrite("shadowless\n")
 
-            # Sun shouldn't be attenuated. Hemi and area lights have no falloff attribute so they
+            # Sun shouldn't be attenuated. Area lights have no falloff attribute so they
             # are put to type 2 attenuation a little higher above.
-            if lamp.type not in {'SUN', 'AREA', 'HEMI'}:
+            if lamp.type not in {'SUN', 'AREA'}:
                 if lamp.falloff_type == 'INVERSE_SQUARE':
                     tabWrite("fade_distance %.6f\n" % (sqrt(lamp.distance/2.0)))
                     tabWrite("fade_power %d\n" % 2)  # Use blenders lamp quad equivalent
@@ -707,7 +707,7 @@ def write_pov(filename, scene=None, info_callback=None):
                         # ob.rotation_euler.x, ob.rotation_euler.y, ob.rotation_euler.z))
 
             direction = (ob.location.x,ob.location.y,ob.location.z) # not taking matrix into account
-            rmatrix = global_matrix * ob.matrix_world
+            rmatrix = global_matrix @ ob.matrix_world
 
             #ob.rotation_euler.to_matrix().to_4x4() * mathutils.Vector((0,0,1))
             # XXX Is result of the below offset by 90 degrees?
@@ -748,7 +748,7 @@ def write_pov(filename, scene=None, info_callback=None):
             #tabWrite("texture {%s}\n"%povMatName)
             write_object_modifiers(scene,ob,file)
             #tabWrite("rotate x*90\n")
-            #matrix = global_matrix * ob.matrix_world
+            #matrix = global_matrix @ ob.matrix_world
             #writeMatrix(matrix)
             tabWrite("}\n")
             #continue #Don't render proxy mesh, skip to next object
@@ -762,7 +762,7 @@ def write_pov(filename, scene=None, info_callback=None):
         dataname = string_strip_hyphen(bpy.path.clean_name(dataname_orig))
 
         global_matrix = mathutils.Matrix.Rotation(-pi / 2.0, 4, 'X')
-        matrix=global_matrix*ob.matrix_world
+        matrix = global_matrix @ ob.matrix_world
         bezier_sweep = False
         if ob.pov.curveshape == 'sphere_sweep':
             #inlined spheresweep macro, which itself calls Shapes.inc:
@@ -1654,14 +1654,14 @@ def write_pov(filename, scene=None, info_callback=None):
                             if elem.type == 'BALL':
                                 tabWrite("sphere { <%.6g, %.6g, %.6g>, %.4g, %.4g " %
                                          (loc.x, loc.y, loc.z, elem.radius, stiffness))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
                             elif elem.type == 'ELLIPSOID':
                                 tabWrite("sphere{ <%.6g, %.6g, %.6g>,%.4g,%.4g " %
                                          (loc.x / elem.size_x, loc.y / elem.size_y, loc.z / elem.size_z,
                                           elem.radius, stiffness))
                                 tabWrite("scale <%.6g, %.6g, %.6g>" % (elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
                             elif elem.type == 'CAPSULE':
                                 tabWrite("cylinder{ <%.6g, %.6g, %.6g>,<%.6g, %.6g, %.6g>,%.4g,%.4g " %
@@ -1669,26 +1669,26 @@ def write_pov(filename, scene=None, info_callback=None):
                                           (loc.x + elem.size_x), (loc.y), (loc.z),
                                           elem.radius, stiffness))
                                 #tabWrite("scale <%.6g, %.6g, %.6g>" % (elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
 
                             elif elem.type == 'CUBE':
                                 tabWrite("cylinder { -x*8, +x*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale  <1/4,1,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
                                 tabWrite("cylinder { -y*8, +y*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1,1/4,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
                                 tabWrite("cylinder { -z*8, +z*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1,1,1/4> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
 
                             elif elem.type == 'PLANE':
                                 tabWrite("cylinder { -x*8, +x*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale  <1/4,1,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
                                 tabWrite("cylinder { -y*8, +y*8,%.4g,%.4g translate<%.6g,%.6g,%.6g> scale <1,1/4,1> scale <%.6g, %.6g, %.6g>\n" % (elem.radius*2.0, stiffness/4.0, loc.x, loc.y, loc.z, elem.size_x, elem.size_y, elem.size_z))
-                                writeMatrix(global_matrix * elems[1].matrix_world)
+                                writeMatrix(global_matrix @ elems[1].matrix_world)
                                 tabWrite("}\n")
 
                         try:
@@ -1783,7 +1783,7 @@ def write_pov(filename, scene=None, info_callback=None):
 
                 writeObjectMaterial(material, elems[1])
 
-                writeMatrix(global_matrix * ob.matrix_world)
+                writeMatrix(global_matrix @ ob.matrix_world)
                 # Importance for radiosity sampling added here
                 tabWrite("radiosity { \n")
                 # importance > ob.pov.importance_value
@@ -2050,7 +2050,7 @@ def write_pov(filename, scene=None, info_callback=None):
 
                 # We apply object's transformations to get final loc/rot/size in world space!
                 # Note: we could combine the two previous transformations with this matrix directly...
-                writeMatrix(global_matrix * smoke_obj.matrix_world)
+                writeMatrix(global_matrix @ smoke_obj.matrix_world)
 
                 # END OF TRANSFORMATIONS
 
@@ -2246,7 +2246,7 @@ def write_pov(filename, scene=None, info_callback=None):
                                 file.write('    #local I = I + HairStep;\n')
                                 file.write('  #end\n')
 
-                                writeMatrix(global_matrix * ob.matrix_world)
+                                writeMatrix(global_matrix @ ob.matrix_world)
 
 
                                 file.write('}')
@@ -2298,7 +2298,7 @@ def write_pov(filename, scene=None, info_callback=None):
                 #   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list