31 static const char *rna_Mesh_unit_test_compare(
struct Mesh *
mesh,
44 static void rna_Mesh_create_normals_split(
Mesh *
mesh)
52 static void rna_Mesh_free_normals_split(
Mesh *
mesh)
59 float(*r_looptangents)[4];
63 memset(r_looptangents, 0,
sizeof(
float[4]) *
mesh->
totloop);
79 static void rna_Mesh_free_tangents(
Mesh *
mesh)
84 static void rna_Mesh_calc_looptri(
Mesh *
mesh)
89 static void rna_Mesh_calc_smooth_groups(
90 Mesh *
mesh,
bool use_bitflags,
int *r_poly_group_len,
int **r_poly_group,
int *r_group_total)
103 static void rna_Mesh_normals_split_custom_do(
Mesh *
mesh,
104 float (*custom_loopnors)[3],
105 const bool use_vertices)
115 static void rna_Mesh_normals_split_custom_set(
Mesh *
mesh,
123 if (normals_len != numloops * 3) {
126 "Number of custom normals is not number of loops (%f / %d)",
127 (
float)normals_len / 3.0f,
132 rna_Mesh_normals_split_custom_do(
mesh, loopnors,
false);
137 static void rna_Mesh_normals_split_custom_set_from_vertices(
Mesh *
mesh,
145 if (normals_len != numverts * 3) {
148 "Number of custom normals is not number of vertices (%f / %d)",
149 (
float)normals_len / 3.0f,
154 rna_Mesh_normals_split_custom_do(
mesh, vertnors,
true);
159 static void rna_Mesh_transform(
Mesh *
mesh,
float mat[16],
bool shape_keys)
166 static void rna_Mesh_flip_normals(
Mesh *
mesh)
176 static void rna_Mesh_split_faces(
Mesh *
mesh,
bool free_loop_normals)
181 static void rna_Mesh_update_gpu_tag(
Mesh *
mesh)
186 static void rna_Mesh_count_selected_items(
Mesh *
mesh,
int r_count[3])
191 static void rna_Mesh_clear_geometry(
Mesh *
mesh)
205 const int normals_array_dim[] = {1, 3};
209 "Transform mesh vertices by a matrix "
210 "(Warning: inverts normals if matrix is negative)");
211 parm =
RNA_def_float_matrix(func,
"matrix", 4, 4,
NULL, 0.0f, 0.0f,
"",
"Matrix", 0.0f, 0.0f);
217 "Invert winding of all polygons "
218 "(clears tessellation, does not handle custom normals)");
223 func =
RNA_def_function(srna,
"create_normals_split",
"rna_Mesh_create_normals_split");
226 func =
RNA_def_function(srna,
"calc_normals_split",
"BKE_mesh_calc_normals_split");
228 "Calculate split vertex normals, which preserve sharp edges");
230 func =
RNA_def_function(srna,
"free_normals_split",
"rna_Mesh_free_normals_split");
236 func,
"free_loop_normals", 1,
"Free Loop Normals",
"Free loop normals custom data layer");
242 "Compute tangents and bitangent signs, to be used together with the split normals "
243 "to get a complete tangent space for normal mapping "
244 "(split normals are also computed if not yet present)");
250 "Name of the UV map to use for tangent space computation");
255 func =
RNA_def_function(srna,
"calc_loop_triangles",
"rna_Mesh_calc_looptri");
257 "Calculate loop triangle tessellation (supports editmode too)");
259 func =
RNA_def_function(srna,
"calc_smooth_groups",
"rna_Mesh_calc_smooth_groups");
262 func,
"use_bitflags",
false,
"",
"Produce bitflags groups instead of simple numeric values");
267 func,
"groups", 0, 0, INT_MAX,
"groups",
"Total number of groups", 0, INT_MAX);
270 func =
RNA_def_function(srna,
"normals_split_custom_set",
"rna_Mesh_normals_split_custom_set");
272 "Define custom split normals of this mesh "
273 "(use zero-vectors to keep auto ones)");
281 "normals_split_custom_set_from_vertices",
282 "rna_Mesh_normals_split_custom_set_from_vertices");
285 "Define custom split normals of this mesh, from vertices' normals "
286 "(use zero-vectors to keep auto ones)");
294 RNA_def_boolean(func,
"calc_edges", 0,
"Calculate Edges",
"Force recalculation of edges");
298 "Calculate Loose Edges",
299 "Calculate the loose state of each edge");
304 func =
RNA_def_function(srna,
"unit_test_compare",
"rna_Mesh_unit_test_compare");
312 "Comparison tolerance threshold",
317 func,
"result",
"nothing", 64,
"Return value",
"String description of result of comparison");
323 "Remove all geometry from the mesh. Note that this does not free shape keys or materials");
327 "Validate geometry, return True when the mesh has had "
328 "invalid geometry corrected/removed");
329 RNA_def_boolean(func,
"verbose",
false,
"Verbose",
"Output information about the errors found");
334 "Remove temp/cached custom-data layers, like e.g. normals...");
338 func =
RNA_def_function(srna,
"validate_material_indices",
"BKE_mesh_validate_material_indices");
341 "Validate material indices of polygons, return True when the mesh has had "
342 "invalid indices corrected (to default 0)");
346 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_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_normals_tag_dirty(struct Mesh *mesh)
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, int totedge, const struct MPoly *mpoly, int totpoly, const struct MLoop *mloop, int totloop, int *r_totgroup, bool use_bitflags)
const struct MLoopTri * BKE_mesh_runtime_looptri_ensure(const 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, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void DEG_id_tag_update(struct ID *id, int flag)
@ ID_RECALC_GEOMETRY_ALL_MODES
#define MAX_CUSTOMDATA_LAYER_NAME
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
MutableSpan< float3 > normals
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)
void WM_main_add_notifier(unsigned int type, void *reference)