Bake-API: reduce memory footprint when baking more than one object (Fix T41092)
Combine all the highpoly pixel arrays into a single array with a lookup object_id for each of the highpoly objects. Note: This changes the Bake API, external engines should refer to the bake_api.c for the latest API. Many thanks for Sergey Sharybin for the complete review, changes suggestion and feedback. (you rock!) Reviewers: sergey Subscribers: pildanovak, marcclintdion, monio, metalliandy, brecht Maniphest Tasks: T41092 Differential Revision: https://developer.blender.org/D772
This commit is contained in:
@@ -189,9 +189,9 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
|
||||
PyObject *pysession, *pyobject;
|
||||
PyObject *pypixel_array, *pyresult;
|
||||
const char *pass_type;
|
||||
int num_pixels, depth;
|
||||
int num_pixels, depth, object_id;
|
||||
|
||||
if(!PyArg_ParseTuple(args, "OOsOiiO", &pysession, &pyobject, &pass_type, &pypixel_array, &num_pixels, &depth, &pyresult))
|
||||
if(!PyArg_ParseTuple(args, "OOsiOiiO", &pysession, &pyobject, &pass_type, &object_id, &pypixel_array, &num_pixels, &depth, &pyresult))
|
||||
return NULL;
|
||||
|
||||
BlenderSession *session = (BlenderSession*)PyLong_AsVoidPtr(pysession);
|
||||
@@ -208,7 +208,7 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args)
|
||||
|
||||
python_thread_state_save(&session->python_thread_state);
|
||||
|
||||
session->bake(b_object, pass_type, b_bake_pixel, (size_t)num_pixels, depth, (float *)b_result);
|
||||
session->bake(b_object, pass_type, object_id, b_bake_pixel, (size_t)num_pixels, depth, (float *)b_result);
|
||||
|
||||
python_thread_state_restore(&session->python_thread_state);
|
||||
|
||||
|
Reference in New Issue
Block a user