**System Information**
Operating system: n/a
Graphics card: n/a
**Blender Version**
Broken: 2.80 master latest as of April 12, 2019
Worked: (optional)
Is there a bug in RNA_Blender_cpp.h for MeshPolygons to retrieve vertices, see RNA_Blender_cpp.h
I am trying to dump the vertices and normals in a scene as follows:
BL::Depsgraph::object_instances_iterator b_instance_iter;
for (b_depsgraph.object_instances.begin(b_instance_iter);
b_instance_iter != b_depsgraph.object_instances.end();
++b_instance_iter)
{
BL::DepsgraphObjectInstance b_instance = *b_instance_iter;
BL::Object b_ob = b_instance.object();
if (b_ob.type() == BL::Object::type_MESH)
{
BL::Mesh b_mesh = object_to_mesh(
b_data, //BL::BlendData& data,
b_ob, //BL::Object& object,
b_depsgraph, //BL::Depsgraph& depsgraph,
false, //bool calc_undeformed,
Mesh::SubdivisionType::SUBDIVISION_NONE);
BL::Mesh::polygons_iterator p;
for (b_mesh.polygons.begin(p); p != b_mesh.polygons.end(); ++p)
{
//p->vertices is defined returning BL:Array<int, 3> but it is returning 4 values
int3 polyv3 = get_int3(p->vertices());
the last line above is a macro to: INT_ARRAY_PROPERTY(MeshPolygon, 3, vertices)
which calls:
void MeshPolygon_vertices_get(PointerRNA *ptr, int values[])
{
rna_MeshPoly_vertices_get(ptr, values);
}
which calls:
static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values)
{
Mesh *me = rna_mesh(ptr);
MPoly *mp = (MPoly *)ptr->data;
MLoop *ml = &me->mloop[mp->loopstart];
unsigned int i;
for (i = mp->totloop; i > 0; i--, values++, ml++) {
*values = ml->v;
}
}
that can write four values and overwrite the BL::Array<int, 3> vertices as defined here:
class MeshPolygon : public Pointer {
public:
MeshPolygon(const PointerRNA &ptr_arg) :
Pointer(ptr_arg)
{}
inline Struct rna_type(void);
inline Array<int, 3> vertices(void); <<<< HERE
Let me recap: MeshPolygon::vertices is defined as returning an Array of 3 ints but it can return four values.
Blender in debug mode (with memory checking it triggering on this problem)