diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-10 17:44:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-10 17:44:18 +0400 |
commit | 1994ed00a388d7eed3c9d4dfda614c41693c114e (patch) | |
tree | 11e78de3ef76a5d65c25c5c301cdbbddac54d977 /source | |
parent | 9a6c5d8b3ef2e2ddd444d79c384bea0eeffca71f (diff) |
add option not to calculate tessellation faces when converting an object to a mesh. (OBJ export no longer needs, so save some CPU cycles and skip tessellation)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 9 |
3 files changed, 19 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index eaa69a8124c..c1f5698016c 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -398,7 +398,9 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA * int rna_parameter_size(struct PropertyRNA *parm); int rna_parameter_size_alloc(struct PropertyRNA *parm); -struct Mesh *rna_Main_meshes_new_from_object(struct Main *bmain, struct ReportList *reports, struct Scene *sce, struct Object *ob, int apply_modifiers, int settings); +struct Mesh *rna_Main_meshes_new_from_object( + struct Main *bmain, struct ReportList *reports, struct Scene *sce, + struct Object *ob, int apply_modifiers, int settings, int calc_tessface); /* XXX, these should not need to be defined here~! */ struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index ab94b88e3d7..7175c8eab78 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -37,6 +37,7 @@ #include "DNA_modifier_types.h" #include "BLI_path_util.h" +#include "BLI_utildefines.h" #include "RNA_define.h" #include "RNA_access.h" @@ -263,7 +264,9 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name) /* copied from Mesh_getFromObject and adapted to RNA interface */ /* settings: 1 - preview, 2 - render */ -Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *sce, Object *ob, int apply_modifiers, int settings) +Mesh *rna_Main_meshes_new_from_object( + Main *bmain, ReportList *reports, Scene *sce, + Object *ob, int apply_modifiers, int settings, int calc_tessface) { Mesh *tmpmesh; Curve *tmpcu = NULL, *copycu; @@ -446,8 +449,10 @@ Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *s break; } /* end copy materials */ - /* cycles and exporters rely on this still */ - BKE_mesh_tessface_ensure(tmpmesh); + if (calc_tessface) { + /* cycles and exporters rely on this still */ + BKE_mesh_tessface_ensure(tmpmesh); + } /* make sure materials get updated in objects */ test_object_materials(&tmpmesh->id); @@ -1138,6 +1143,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 51725bda7f9..2b7df1ca317 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -34,6 +34,8 @@ #include <string.h> #include <time.h> +#include "BLI_utildefines.h" + #include "RNA_define.h" #include "DNA_constraint_types.h" @@ -109,9 +111,11 @@ static void rna_Scene_mat_convert_space(Object *ob, ReportList *reports, bPoseCh /* copied from Mesh_getFromObject and adapted to RNA interface */ /* settings: 0 - preview, 1 - render */ -static Mesh *rna_Object_to_mesh(Object *ob, ReportList *reports, Scene *sce, int apply_modifiers, int settings) +static Mesh *rna_Object_to_mesh( + Object *ob, ReportList *reports, Scene *sce, + int apply_modifiers, int settings, int calc_tessface) { - return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings); + return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings, calc_tessface); } /* mostly a copy from convertblender.c */ @@ -442,6 +446,7 @@ void RNA_api_object(StructRNA *srna) RNA_def_property_flag(parm, PROP_REQUIRED); parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply"); RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_boolean(func, "calc_tessface", true, "Calculate Tessellation", "Calculate tessellation faces"); parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export"); RNA_def_function_return(func, parm); |