Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_mesh.c
| Show First 20 Lines • Show All 412 Lines • ▼ Show 20 Lines | |||||
| static float rna_MeshPolygon_area_get(PointerRNA *ptr) | static float rna_MeshPolygon_area_get(PointerRNA *ptr) | ||||
| { | { | ||||
| Mesh *me = (Mesh *)ptr->id.data; | Mesh *me = (Mesh *)ptr->id.data; | ||||
| MPoly *mp = (MPoly *)ptr->data; | MPoly *mp = (MPoly *)ptr->data; | ||||
| return BKE_mesh_calc_poly_area(mp, me->mloop + mp->loopstart, me->mvert); | return BKE_mesh_calc_poly_area(mp, me->mloop + mp->loopstart, me->mvert); | ||||
| } | } | ||||
| static void rna_MeshPolygon_flip(ID *id, MPoly *mp) | |||||
| { | |||||
| Mesh *me = (Mesh *)id; | |||||
| BKE_mesh_polygon_flip(mp, me->mloop, &me->ldata); | |||||
| BKE_mesh_tessface_clear(me); | |||||
| } | |||||
| static void rna_MeshTessFace_normal_get(PointerRNA *ptr, float *values) | static void rna_MeshTessFace_normal_get(PointerRNA *ptr, float *values) | ||||
| { | { | ||||
| Mesh *me = rna_mesh(ptr); | Mesh *me = rna_mesh(ptr); | ||||
| MFace *mface = (MFace *)ptr->data; | MFace *mface = (MFace *)ptr->data; | ||||
| if (mface->v4) | if (mface->v4) | ||||
| normal_quad_v3(values, me->mvert[mface->v1].co, me->mvert[mface->v2].co, | normal_quad_v3(values, me->mvert[mface->v1].co, me->mvert[mface->v2].co, | ||||
| me->mvert[mface->v3].co, me->mvert[mface->v4].co); | me->mvert[mface->v3].co, me->mvert[mface->v4].co); | ||||
| ▲ Show 20 Lines • Show All 1,704 Lines • ▼ Show 20 Lines | RNA_def_property_ui_text(prop, "Bitangent", | ||||
| "Bitangent vector of this vertex for this polygon (must be computed beforehand using " | "Bitangent vector of this vertex for this polygon (must be computed beforehand using " | ||||
| "calc_tangents, *use it only if really needed*, slower access than bitangent_sign)"); | "calc_tangents, *use it only if really needed*, slower access than bitangent_sign)"); | ||||
| } | } | ||||
| static void rna_def_mpolygon(BlenderRNA *brna) | static void rna_def_mpolygon(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| FunctionRNA *func; | |||||
| srna = RNA_def_struct(brna, "MeshPolygon", NULL); | srna = RNA_def_struct(brna, "MeshPolygon", NULL); | ||||
| RNA_def_struct_sdna(srna, "MPoly"); | RNA_def_struct_sdna(srna, "MPoly"); | ||||
| RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh data-block"); | RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh data-block"); | ||||
| RNA_def_struct_path_func(srna, "rna_MeshPolygon_path"); | RNA_def_struct_path_func(srna, "rna_MeshPolygon_path"); | ||||
| RNA_def_struct_ui_icon(srna, ICON_FACESEL); | RNA_def_struct_ui_icon(srna, ICON_FACESEL); | ||||
| /* Faked, actually access to loop vertex values, don't this way because manually setting up | /* Faked, actually access to loop vertex values, don't this way because manually setting up | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | #endif | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL); | RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this polygon"); | RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this polygon"); | ||||
| prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL); | RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "Index", "Index of this polygon"); | RNA_def_property_ui_text(prop, "Index", "Index of this polygon"); | ||||
| func = RNA_def_function(srna, "flip", "rna_MeshPolygon_flip"); | |||||
| RNA_def_function_flag(func, FUNC_USE_SELF_ID); | |||||
| RNA_def_function_ui_description(func, "Invert winding of this polygon (flip its normal)"); | |||||
| } | } | ||||
| /* mesh.loop_uvs */ | /* mesh.loop_uvs */ | ||||
| static void rna_def_mloopuv(BlenderRNA *brna) | static void rna_def_mloopuv(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| ▲ Show 20 Lines • Show All 1,482 Lines • Show Last 20 Lines | |||||