Cycles: Initialize "headless" flags on engine initialization

This flag is global for all the sessions and never changes. so it doesn't
really make sense to pass it around to all sessions and synchronization
routines.

Switched to a static member of BlenderSession now, but it's probably more
logical to introduce some sort of BlenderGlobals. Doesn't currently worth
a hassle for a single boolean flag tho.
This commit is contained in:
2015-02-18 21:16:52 +05:00
parent 6f3500db05
commit c9fa37fbcd
7 changed files with 27 additions and 24 deletions

View File

@@ -73,8 +73,9 @@ static const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
static PyObject *init_func(PyObject *self, PyObject *args)
{
PyObject *path, *user_path;
int headless;
if(!PyArg_ParseTuple(args, "OO", &path, &user_path)) {
if(!PyArg_ParseTuple(args, "OOi", &path, &user_path, &headless)) {
return NULL;
}
@@ -84,16 +85,18 @@ static PyObject *init_func(PyObject *self, PyObject *args)
Py_XDECREF(path_coerce);
Py_XDECREF(user_path_coerce);
BlenderSession::headless = headless;
Py_RETURN_NONE;
}
static PyObject *create_func(PyObject *self, PyObject *args)
{
PyObject *pyengine, *pyuserpref, *pydata, *pyscene, *pyregion, *pyv3d, *pyrv3d;
int preview_osl, headless;
int preview_osl;
if(!PyArg_ParseTuple(args, "OOOOOOOii", &pyengine, &pyuserpref, &pydata, &pyscene,
&pyregion, &pyv3d, &pyrv3d, &preview_osl, &headless))
if(!PyArg_ParseTuple(args, "OOOOOOOi", &pyengine, &pyuserpref, &pydata, &pyscene,
&pyregion, &pyv3d, &pyrv3d, &preview_osl))
{
return NULL;
}
@@ -147,7 +150,7 @@ static PyObject *create_func(PyObject *self, PyObject *args)
}
/* offline session or preview render */
session = new BlenderSession(engine, userpref, data, scene, headless);
session = new BlenderSession(engine, userpref, data, scene);
}
python_thread_state_save(&session->python_thread_state);