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.vfx@gmail.com>2015-02-18 20:47:23 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-03-13 15:39:21 +0300
commit2ef2f085fb743c12d1cabd71d42dd00334de696b (patch)
tree7fa9e2fa759f925d7278d7addb2b1737e24bd27b /source/blender/makesrna/intern/rna_mesh_api.c
parent0e18a5643239203385258b7d64f2d6b15594fa46 (diff)
Add an option to mesh.calc_tessface() to get rid of polygons and loops
The purpose of this change is to add extra possibility to render engines and export scripts to reduce peak memory footprint during their operation. This new argument should be used with care since it'll leave mesh in not really compatible with blender format, but it's ok to be used on temp meshes. Unfortunately, it's hard to get scene where it'll show huge benefit because in my tests with cycles peak memory is reached in MEM_printmemlist_stats(). However, in the file with sintel dragon it gives around 1gig of memory benefit after removing the polys which would allow other heavy to compute stuff such as hair (or even pointiness calculation) to not be a peak memory usage. In any case, this change is nice to have IMO, and only means more parts of scene export code should be optimized memory-wise. Reviewers: campbellbarton Differential Revision: https://developer.blender.org/D1125
Diffstat (limited to 'source/blender/makesrna/intern/rna_mesh_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 3f487698420..a994bf5e9d1 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -141,6 +141,11 @@ static void rna_Mesh_free_tangents(Mesh *mesh)
CustomData_free_layers(&mesh->ldata, CD_MLOOPTANGENT, mesh->totloop);
}
+static void rna_Mesh_calc_tessface(Mesh *mesh, int free_mpoly)
+{
+ ED_mesh_calc_tessface(mesh, free_mpoly != 0);
+}
+
static void rna_Mesh_calc_smooth_groups(Mesh *mesh, int use_bitflags, int *r_poly_group_len,
int **r_poly_group, int *r_group_total)
{
@@ -269,8 +274,12 @@ void RNA_api_mesh(StructRNA *srna)
func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents");
RNA_def_function_ui_description(func, "Free tangents");
- func = RNA_def_function(srna, "calc_tessface", "ED_mesh_calc_tessface");
+ func = RNA_def_function(srna, "calc_tessface", "rna_Mesh_calc_tessface");
RNA_def_function_ui_description(func, "Calculate face tessellation (supports editmode too)");
+ RNA_def_boolean(func, "free_mpoly", 0, "Free MPoly", "Free data used by polygons and loops. "
+ "WARNING: This destructive operation removes regular faces, "
+ "only used on temporary mesh data-blocks to reduce memory footprint of render "
+ "engines and export scripts.");
func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups");
RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges");