Python: add MeshLoop.index, same as already existed for vert/edge/face/poly.

This commit is contained in:
Brecht Van Lommel 2012-02-24 15:53:26 +00:00
parent f4bb31f26b
commit cf092e5a2f

@ -942,6 +942,13 @@ static int rna_MeshPolygon_index_get(PointerRNA *ptr)
return (int)(mpoly - me->mpoly); return (int)(mpoly - me->mpoly);
} }
static int rna_MeshLoop_index_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
MLoop *mloop= (MLoop*)ptr->data;
return (int)(mloop - me->mloop);
}
/* path construction */ /* path construction */
static char *rna_VertexGroupElement_path(PointerRNA *ptr) static char *rna_VertexGroupElement_path(PointerRNA *ptr)
@ -1426,6 +1433,11 @@ static void rna_def_mloop(BlenderRNA *brna)
prop= RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED); prop= RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "e"); RNA_def_property_int_sdna(prop, NULL, "e");
RNA_def_property_ui_text(prop, "Edge", "Edge index"); RNA_def_property_ui_text(prop, "Edge", "Edge index");
prop= RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Index", "Index number of the loop");
} }
static void rna_def_mpolygon(BlenderRNA *brna) static void rna_def_mpolygon(BlenderRNA *brna)