Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2022-01-10 18:05:17 +0300
committerSergey Sharybin <sergey@blender.org>2022-01-10 18:54:12 +0300
commit292c2cefe30b3b4798324e0f04e3a4a529829c94 (patch)
treea2ef4c57898f432eedd895c1a83ba1af178e6155 /intern/cycles/blender
parent20cb2c72a559786b69a3f45695b072dd0beae99a (diff)
Fix T93727: Tiled render error in Cycles after changing temp directory
Consider temporary directory to be variant part of session configuration which gets communicated to the tile manager on render reset. This allows to be able to render with one temp directory, change the directory, render again and have proper render result even with enabled persistent data. For the ease of access to the temp directory expose it via the render engine API (engine.temp_directory). Differential Revision: https://developer.blender.org/D13790
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/addon/engine.py3
-rw-r--r--intern/cycles/blender/python.cpp10
-rw-r--r--intern/cycles/blender/sync.cpp8
3 files changed, 13 insertions, 8 deletions
diff --git a/intern/cycles/blender/addon/engine.py b/intern/cycles/blender/addon/engine.py
index 910ac4a373e..88526212d31 100644
--- a/intern/cycles/blender/addon/engine.py
+++ b/intern/cycles/blender/addon/engine.py
@@ -60,9 +60,8 @@ def init():
path = os.path.dirname(__file__)
user_path = os.path.dirname(os.path.abspath(bpy.utils.user_resource('CONFIG', path='')))
- temp_path = bpy.app.tempdir
- _cycles.init(path, user_path, temp_path, bpy.app.background)
+ _cycles.init(path, user_path, bpy.app.background)
_parse_command_line()
diff --git a/intern/cycles/blender/python.cpp b/intern/cycles/blender/python.cpp
index f509d5c2eeb..f3279ff03a3 100644
--- a/intern/cycles/blender/python.cpp
+++ b/intern/cycles/blender/python.cpp
@@ -138,20 +138,18 @@ static const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
static PyObject *init_func(PyObject * /*self*/, PyObject *args)
{
- PyObject *path, *user_path, *temp_path;
+ PyObject *path, *user_path;
int headless;
- if (!PyArg_ParseTuple(args, "OOOi", &path, &user_path, &temp_path, &headless)) {
+ if (!PyArg_ParseTuple(args, "OOi", &path, &user_path, &headless)) {
return nullptr;
}
- PyObject *path_coerce = nullptr, *user_path_coerce = nullptr, *temp_path_coerce = nullptr;
+ PyObject *path_coerce = nullptr, *user_path_coerce = nullptr;
path_init(PyC_UnicodeAsByte(path, &path_coerce),
- PyC_UnicodeAsByte(user_path, &user_path_coerce),
- PyC_UnicodeAsByte(temp_path, &temp_path_coerce));
+ PyC_UnicodeAsByte(user_path, &user_path_coerce));
Py_XDECREF(path_coerce);
Py_XDECREF(user_path_coerce);
- Py_XDECREF(temp_path_coerce);
BlenderSession::headless = headless;
diff --git a/intern/cycles/blender/sync.cpp b/intern/cycles/blender/sync.cpp
index 56137374d8e..588e057b9ad 100644
--- a/intern/cycles/blender/sync.cpp
+++ b/intern/cycles/blender/sync.cpp
@@ -832,6 +832,14 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine &b_engine,
SessionParams params;
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
+ if (background && !b_engine.is_preview()) {
+ /* Viewport and preview renders do not require temp directory and do request session
+ * parameters more often than the background render.
+ * Optimize RNA-C++ usage and memory allocation a bit by saving string access which we know is
+ * not needed for viewport render. */
+ params.temp_dir = b_engine.temporary_directory();
+ }
+
/* feature set */
params.experimental = (get_enum(cscene, "feature_set") != 0);