diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-15 17:52:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-15 18:00:01 +0300 |
commit | c44cdd5905d3112a46a984b8d49710fb1c1546a0 (patch) | |
tree | 14ca93c9d06f76c7042be2583833a07064abf24b /intern/cycles/blender/blender_python.cpp | |
parent | c5dba540d73ec664ac3bfff02f73413906d66273 (diff) |
Cycles: Allow rendering a range of resumable chunks
The range is controlled using the following command line arguments:
--cycles-resumable-start-chunk
--cycles-resumable-end-chunk
Those are 1-based index of range for rendering.
Diffstat (limited to 'intern/cycles/blender/blender_python.cpp')
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index fc0df3410c6..557c4e8c5f0 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -644,7 +644,7 @@ static PyObject *debug_flags_reset_func(PyObject * /*self*/, PyObject * /*args*/ Py_RETURN_NONE; } -static PyObject *set_resumable_chunks_func(PyObject * /*self*/, PyObject *args) +static PyObject *set_resumable_chunk_func(PyObject * /*self*/, PyObject *args) { int num_resumable_chunks, current_resumable_chunk; if(!PyArg_ParseTuple(args, "ii", @@ -679,6 +679,53 @@ static PyObject *set_resumable_chunks_func(PyObject * /*self*/, PyObject *args) Py_RETURN_NONE; } +static PyObject *set_resumable_chunk_range_func(PyObject * /*self*/, PyObject *args) +{ + int num_chunks, start_chunk, end_chunk; + if(!PyArg_ParseTuple(args, "iii", + &num_chunks, + &start_chunk, + &end_chunk)) { + Py_RETURN_NONE; + } + + if(num_chunks <= 0) { + fprintf(stderr, "Cycles: Bad value for number of resumable chunks.\n"); + abort(); + Py_RETURN_NONE; + } + if(start_chunk < 1 || start_chunk > num_chunks) { + fprintf(stderr, "Cycles: Bad value for start chunk number.\n"); + abort(); + Py_RETURN_NONE; + } + if(end_chunk < 1 || end_chunk > num_chunks) { + fprintf(stderr, "Cycles: Bad value for start chunk number.\n"); + abort(); + Py_RETURN_NONE; + } + if(start_chunk > end_chunk) { + fprintf(stderr, "Cycles: End chunk should be higher than start one.\n"); + abort(); + Py_RETURN_NONE; + } + + VLOG(1) << "Initialized resumable render: " + << "num_resumable_chunks=" << num_chunks << ", " + << "start_resumable_chunk=" << start_chunk + << "end_resumable_chunk=" << end_chunk; + BlenderSession::num_resumable_chunks = num_chunks; + BlenderSession::start_resumable_chunk = start_chunk; + BlenderSession::end_resumable_chunk = end_chunk; + + printf("Cycles: Will render chunks %d to %d of %d\n", + start_chunk, + end_chunk, + num_chunks); + + Py_RETURN_NONE; +} + static PyObject *get_device_types_func(PyObject * /*self*/, PyObject * /*args*/) { vector<DeviceInfo>& devices = Device::available_devices(); @@ -718,7 +765,8 @@ static PyMethodDef methods[] = { {"debug_flags_reset", debug_flags_reset_func, METH_NOARGS, ""}, /* Resumable render */ - {"set_resumable_chunks", set_resumable_chunks_func, METH_VARARGS, ""}, + {"set_resumable_chunk", set_resumable_chunk_func, METH_VARARGS, ""}, + {"set_resumable_chunk_range", set_resumable_chunk_range_func, METH_VARARGS, ""}, /* Compute Device selection */ {"get_device_types", get_device_types_func, METH_VARARGS, ""}, |