diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-24 15:37:47 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-05-27 12:00:42 +0300 |
commit | 5dbda33462349a4ac78f08e8ed4ec7922ca7394f (patch) | |
tree | b73b67873cd42dc1a9a927227fd85e9bfb52285e /source/blender/makesrna/intern/rna_main_api.c | |
parent | 07d3d8c2fd75d633a7d6ba6aab47308860af676c (diff) |
Depsgraph API: Allow preserving custom data layers
This commit extends dependency graph API with an argument which
denotes that all custom data layers are to be preserved. This
forces modifier stack re-evaluation with more inclusive mask.
Far from ideal, since this might fail in certain configurations
with indirectly used objects which might be missing layers needed
for the current object evaluation. But this is how it worked for
a long time, so should be good enough for until more sophisticated
solution is found.
In order to use this new behavior two things are to be passed:
- Pass keep_all_data_layers=True
- Pass a valid dependency graph.
The dependency graph is only needed if keep_all_data_layers=True
and is NOT to be passed if keep_all_data_layers=False.
If keep_all_data_layers=True the dependency graph MUST be passed.
Reviewers: mont29, brecht
Reviewed By: mont29
Maniphest Tasks: T64994, T64794
Differential Revision: https://developer.blender.org/D4940
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index bd06cfc1936..aa8de7f23db 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -332,7 +332,11 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name) } /* copied from Mesh_getFromObject and adapted to RNA interface */ -static Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Object *object) +static Mesh *rna_Main_meshes_new_from_object(Main *bmain, + ReportList *reports, + Object *object, + bool preserve_all_data_layers, + Depsgraph *depsgraph) { switch (object->type) { case OB_FONT: @@ -346,7 +350,7 @@ static Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, O return NULL; } - return BKE_mesh_new_from_object_to_bmain(bmain, object); + return BKE_mesh_new_from_object_to_bmain(bmain, depsgraph, object, preserve_all_data_layers); } static Light *rna_Main_lights_new(Main *bmain, const char *name, int type) @@ -966,6 +970,19 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_flag(func, FUNC_USE_REPORTS); parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); + RNA_def_boolean(func, + "preserve_all_data_layers", + false, + "", + "Preserve all data layers in the mesh, like UV maps and vertex groups. " + "By default Blender only computes the subset of data layers needed for viewport " + "display and rendering, for better performance"); + RNA_def_pointer( + func, + "depsgraph", + "Depsgraph", + "Dependency Graph", + "Evaluated dependency graph which is required when preserve_all_data_layers is true"); parm = RNA_def_pointer(func, "mesh", "Mesh", |