Cycles: Fallback to bottom-top tile order when rendering from the command line
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 10 Feb 2015 20:02:36 +0000 (01:02 +0500)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 10 Feb 2015 20:11:57 +0000 (01:11 +0500)
In the worst case it'll do nothing, in the best case it might give some percent
of speedup because of better cache coherency.

Currently it's all handled as an override on blender_python level, don't really
see reason to penetrate the boolean flag further into sync code. This can always
be done later if needed.

intern/cycles/blender/addon/__init__.py
intern/cycles/blender/addon/engine.py
intern/cycles/blender/blender_python.cpp

index 64e4a8391d1e464ef871d4e27b18e5aeb698ebe8..57025388bdab6e8d23530789938ab88a359c4f2b 100644 (file)
@@ -59,7 +59,7 @@ class CyclesRender(bpy.types.RenderEngine):
                               None, None, None, use_osl)
         else:
             if not self.session:
-                engine.create(self, data, scene)
+                engine.create(self, data, scene, background=bpy.app.background)
             else:
                 engine.reset(self, data, scene)
 
index e1d82db25e101ebfa4e9fb28185ad32c7a9ec6db..492a254b9b99d7bfd74b1ba36b5c087f6aa0edfd 100644 (file)
@@ -28,7 +28,7 @@ def init():
     _cycles.init(path, user_path)
 
 
-def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False):
+def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=False, background=False):
     import bpy
     import _cycles
 
@@ -42,7 +42,7 @@ def create(engine, data, scene, region=None, v3d=None, rv3d=None, preview_osl=Fa
     if rv3d:
         rv3d = rv3d.as_pointer()
 
-    engine.session = _cycles.create(engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl)
+    engine.session = _cycles.create(engine.as_pointer(), userpref, data, scene, region, v3d, rv3d, preview_osl, background)
 
 
 def free(engine):
index 37191bb797a6ff731929748f74177afa094660b5..120d6b0d4de7320b8072ed9c5488a6bef603755a 100644 (file)
@@ -90,10 +90,13 @@ static PyObject *init_func(PyObject *self, PyObject *args)
 static PyObject *create_func(PyObject *self, PyObject *args)
 {
        PyObject *pyengine, *pyuserpref, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
-       int preview_osl;
+       int preview_osl, background;
 
-       if(!PyArg_ParseTuple(args, "OOOOOOOi", &pyengine, &pyuserpref, &pydata, &pyscene, &pyregion, &pyv3d, &pyrv3d, &preview_osl))
+       if(!PyArg_ParseTuple(args, "OOOOOOOii", &pyengine, &pyuserpref, &pydata, &pyscene,
+                            &pyregion, &pyv3d, &pyrv3d, &preview_osl, &background))
+       {
                return NULL;
+       }
 
        /* RNA */
        PointerRNA engineptr;
@@ -143,6 +146,12 @@ static PyObject *create_func(PyObject *self, PyObject *args)
                        RNA_boolean_set(&cscene, "use_progressive_refine", true);
                }
 
+               /* Use more optimal tile order when rendering from the command line. */
+               if(background) {
+                       PointerRNA cscene = RNA_pointer_get(&sceneptr, "cycles");
+                       RNA_enum_set(&cscene, "tile_order", (int)TILE_BOTTOM_TO_TOP);
+               }
+
                /* offline session or preview render */
                session = new BlenderSession(engine, userpref, data, scene);
        }