47 static const char *rna_Mesh_unit_test_compare(
struct Mesh *
mesh,
60 static void rna_Mesh_create_normals_split(
Mesh *
mesh)
68 static void rna_Mesh_free_normals_split(
Mesh *
mesh)
75 float(*r_looptangents)[4];
79 memset(r_looptangents, 0,
sizeof(
float[4]) *
mesh->
totloop);
95 static void rna_Mesh_free_tangents(
Mesh *
mesh)
100 static void rna_Mesh_calc_looptri(
Mesh *
mesh)
105 static void rna_Mesh_calc_smooth_groups(
106 Mesh *
mesh,
bool use_bitflags,
int *r_poly_group_len,
int **r_poly_group,
int *r_group_total)
119 static void rna_Mesh_normals_split_custom_do(
Mesh *
mesh,
120 float (*custom_loopnors)[3],
121 const bool use_vertices)
131 static void rna_Mesh_normals_split_custom_set(
Mesh *
mesh,
139 if (normals_len != numloops * 3) {
142 "Number of custom normals is not number of loops (%f / %d)",
143 (
float)normals_len / 3.0f,
148 rna_Mesh_normals_split_custom_do(
mesh, loopnors,
false);
153 static void rna_Mesh_normals_split_custom_set_from_vertices(
Mesh *
mesh,
161 if (normals_len != numverts * 3) {
164 "Number of custom normals is not number of vertices (%f / %d)",
165 (
float)normals_len / 3.0f,
170 rna_Mesh_normals_split_custom_do(
mesh, vertnors,
true);
175 static void rna_Mesh_transform(
Mesh *
mesh,
float *mat,
bool shape_keys)
182 static void rna_Mesh_flip_normals(
Mesh *
mesh)
192 static void rna_Mesh_split_faces(
Mesh *
mesh,
bool free_loop_normals)
197 static void rna_Mesh_update_gpu_tag(
Mesh *
mesh)
202 static void rna_Mesh_count_selected_items(
Mesh *
mesh,
int r_count[3])
207 static void rna_Mesh_clear_geometry(
Mesh *
mesh)
221 const int normals_array_dim[] = {1, 3};
225 "Transform mesh vertices by a matrix "
226 "(Warning: inverts normals if matrix is negative)");
227 parm =
RNA_def_float_matrix(func,
"matrix", 4, 4,
NULL, 0.0f, 0.0f,
"",
"Matrix", 0.0f, 0.0f);
233 "Invert winding of all polygons "
234 "(clears tessellation, does not handle custom normals)");
239 func =
RNA_def_function(srna,
"create_normals_split",
"rna_Mesh_create_normals_split");
242 func =
RNA_def_function(srna,
"calc_normals_split",
"BKE_mesh_calc_normals_split");
244 "Calculate split vertex normals, which preserve sharp edges");
246 func =
RNA_def_function(srna,
"free_normals_split",
"rna_Mesh_free_normals_split");
252 func,
"free_loop_normals", 1,
"Free Loop Notmals",
"Free loop normals custom data layer");
258 "Compute tangents and bitangent signs, to be used together with the split normals "
259 "to get a complete tangent space for normal mapping "
260 "(split normals are also computed if not yet present)");
266 "Name of the UV map to use for tangent space computation");
271 func =
RNA_def_function(srna,
"calc_loop_triangles",
"rna_Mesh_calc_looptri");
273 "Calculate loop triangle tessellation (supports editmode too)");
275 func =
RNA_def_function(srna,
"calc_smooth_groups",
"rna_Mesh_calc_smooth_groups");
278 func,
"use_bitflags",
false,
"",
"Produce bitflags groups instead of simple numeric values");
283 func,
"groups", 0, 0, INT_MAX,
"groups",
"Total number of groups", 0, INT_MAX);
286 func =
RNA_def_function(srna,
"normals_split_custom_set",
"rna_Mesh_normals_split_custom_set");
288 "Define custom split normals of this mesh "
289 "(use zero-vectors to keep auto ones)");
297 "normals_split_custom_set_from_vertices",
298 "rna_Mesh_normals_split_custom_set_from_vertices");
301 "Define custom split normals of this mesh, from vertices' normals "
302 "(use zero-vectors to keep auto ones)");
310 RNA_def_boolean(func,
"calc_edges", 0,
"Calculate Edges",
"Force recalculation of edges");
314 "Calculate Loose Edges",
315 "Calculate the loose state of each edge");
320 func =
RNA_def_function(srna,
"unit_test_compare",
"rna_Mesh_unit_test_compare");
328 "Comparison tolerance threshold",
333 func,
"result",
"nothing", 64,
"Return value",
"String description of result of comparison");
339 "Remove all geometry from the mesh. Note that this does not free shape keys or materials");
343 "Validate geometry, return True when the mesh has had "
344 "invalid geometry corrected/removed");
345 RNA_def_boolean(func,
"verbose",
false,
"Verbose",
"Output information about the errors found");
350 "Remove temp/cached custom-data layers, like e.g. normals...");
354 func =
RNA_def_function(srna,
"validate_material_indices",
"BKE_mesh_validate_material_indices");
357 "Validate material indices of polygons, return True when the mesh has had "
358 "invalid indices corrected (to default 0)");
362 func =
RNA_def_function(srna,
"count_selected_items",
"rna_Mesh_count_selected_items ");
typedef float(TangentPoint)[2]
void CustomData_free_layers(struct CustomData *data, int type, int totelem)
bool CustomData_has_layer(const struct CustomData *data, int type)
void * CustomData_get_layer(const struct CustomData *data, int type)
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
const char * BKE_mesh_cmp(struct Mesh *me1, struct Mesh *me2, float thresh)
void BKE_mesh_tessface_clear(struct Mesh *mesh)
void BKE_mesh_calc_normals(struct Mesh *me)
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *me, eMeshBatchDirtyMode mode)
void BKE_mesh_clear_geometry(struct Mesh *me)
void BKE_mesh_calc_normals_split(struct Mesh *mesh)
void BKE_mesh_count_selected_items(const struct Mesh *mesh, int r_count[3])
void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float(*r_custom_vertnors)[3])
void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals)
void BKE_mesh_polygons_flip(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata, int totpoly)
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float(*r_custom_loopnors)[3])
void BKE_mesh_transform(struct Mesh *me, const float mat[4][4], bool do_keys)
int * BKE_mesh_calc_smoothgroups(const struct MEdge *medge, const int totedge, const struct MPoly *mpoly, const int totpoly, const struct MLoop *mloop, const int totloop, int *r_totgroup, const bool use_bitflags)
const struct MLoopTri * BKE_mesh_runtime_looptri_ensure(struct Mesh *mesh)
void BKE_mesh_runtime_clear_geometry(struct Mesh *mesh)
void BKE_mesh_calc_loop_tangent_single(struct Mesh *mesh, const char *uvmap, float(*r_looptangents)[4], struct ReportList *reports)
@ BKE_MESH_BATCH_DIRTY_ALL
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void DEG_id_tag_update(struct ID *id, int flag)
#define MAX_CUSTOMDATA_LAYER_NAME
static float normals[][3]
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_function_flag(FunctionRNA *func, int flag)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_api_mesh(StructRNA *srna)
struct CustomData pdata ldata
void WM_main_add_notifier(unsigned int type, void *reference)