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)
This commit is contained in:
@@ -41,7 +41,7 @@ CCL_NAMESPACE_BEGIN
|
|||||||
|
|
||||||
static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render)
|
static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render)
|
||||||
{
|
{
|
||||||
return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1);
|
return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
|
static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)
|
||||||
|
@@ -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(struct PropertyRNA *parm);
|
||||||
int rna_parameter_size_alloc(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~! */
|
/* 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);
|
struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include "DNA_modifier_types.h"
|
#include "DNA_modifier_types.h"
|
||||||
|
|
||||||
#include "BLI_path_util.h"
|
#include "BLI_path_util.h"
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "RNA_define.h"
|
#include "RNA_define.h"
|
||||||
#include "RNA_access.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 */
|
/* copied from Mesh_getFromObject and adapted to RNA interface */
|
||||||
/* settings: 1 - preview, 2 - render */
|
/* 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;
|
Mesh *tmpmesh;
|
||||||
Curve *tmpcu = NULL, *copycu;
|
Curve *tmpcu = NULL, *copycu;
|
||||||
@@ -446,8 +449,10 @@ Mesh *rna_Main_meshes_new_from_object(Main *bmain, ReportList *reports, Scene *s
|
|||||||
break;
|
break;
|
||||||
} /* end copy materials */
|
} /* end copy materials */
|
||||||
|
|
||||||
/* cycles and exporters rely on this still */
|
if (calc_tessface) {
|
||||||
BKE_mesh_tessface_ensure(tmpmesh);
|
/* cycles and exporters rely on this still */
|
||||||
|
BKE_mesh_tessface_ensure(tmpmesh);
|
||||||
|
}
|
||||||
|
|
||||||
/* make sure materials get updated in objects */
|
/* make sure materials get updated in objects */
|
||||||
test_object_materials(&tmpmesh->id);
|
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);
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||||
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
||||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
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", "",
|
parm = RNA_def_pointer(func, "mesh", "Mesh", "",
|
||||||
"Mesh created from object, remove it if it is only used for export");
|
"Mesh created from object, remove it if it is only used for export");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
#include "RNA_define.h"
|
#include "RNA_define.h"
|
||||||
|
|
||||||
#include "DNA_constraint_types.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 */
|
/* copied from Mesh_getFromObject and adapted to RNA interface */
|
||||||
/* settings: 0 - preview, 1 - render */
|
/* 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 */
|
/* mostly a copy from convertblender.c */
|
||||||
@@ -442,6 +446,7 @@ void RNA_api_object(StructRNA *srna)
|
|||||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
RNA_def_property_flag(parm, PROP_REQUIRED);
|
||||||
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
|
||||||
RNA_def_property_flag(parm, PROP_REQUIRED);
|
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", "",
|
parm = RNA_def_pointer(func, "mesh", "Mesh", "",
|
||||||
"Mesh created from object, remove it if it is only used for export");
|
"Mesh created from object, remove it if it is only used for export");
|
||||||
RNA_def_function_return(func, parm);
|
RNA_def_function_return(func, parm);
|
||||||
|
Reference in New Issue
Block a user