diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2015-04-17 18:25:37 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2015-04-17 18:25:37 +0300 |
commit | 394c5318c6fe981f94fc78f312fc0295209288dc (patch) | |
tree | d58e99fa5e27fe283c3f44621a093e4889148b3f /source/blender/makesrna | |
parent | 45e929dc127e5b037c9e073ad84c3d76ca11ac50 (diff) |
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
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 2f2d72577d5..dbb572b7333 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -154,8 +154,10 @@ static void engine_render(RenderEngine *engine, struct Scene *scene) RNA_parameter_list_free(&list); } -static void engine_bake(RenderEngine *engine, struct Scene *scene, struct Object *object, const int pass_type, - const struct BakePixel *pixel_array, const int num_pixels, const int depth, void *result) +static void engine_bake(RenderEngine *engine, struct Scene *scene, + struct Object *object, const int pass_type, + const int object_id, const struct BakePixel *pixel_array, + const int num_pixels, const int depth, void *result) { extern FunctionRNA rna_RenderEngine_bake_func; PointerRNA ptr; @@ -169,6 +171,7 @@ static void engine_bake(RenderEngine *engine, struct Scene *scene, struct Object RNA_parameter_set_lookup(&list, "scene", &scene); RNA_parameter_set_lookup(&list, "object", &object); RNA_parameter_set_lookup(&list, "pass_type", &pass_type); + RNA_parameter_set_lookup(&list, "object_id", &object_id); RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array); RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels); RNA_parameter_set_lookup(&list, "depth", &depth); @@ -423,6 +426,8 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REQUIRED); prop = RNA_def_enum(func, "pass_type", render_pass_type_items, 0, "Pass", "Pass to bake"); RNA_def_property_flag(prop, PROP_REQUIRED); + prop = RNA_def_int(func, "object_id", 0, 0, INT_MAX, "Object Id", "Id of the current object being baked in relation to the others", 0, INT_MAX); + RNA_def_property_flag(prop, PROP_REQUIRED); prop = RNA_def_pointer(func, "pixel_array", "BakePixel", "", ""); RNA_def_property_flag(prop, PROP_REQUIRED); prop = RNA_def_int(func, "num_pixels", 0, 0, INT_MAX, "Number of Pixels", "Size of the baking batch", 0, INT_MAX); @@ -816,6 +821,10 @@ static void rna_def_render_bake_pixel(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "primitive_id"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "object_id", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "object_id"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE); RNA_def_property_array(prop, 2); RNA_def_property_float_sdna(prop, NULL, "uv"); |