Fix #105577: Python MeshPolygon API allows negative material indices

This was lost in the refactor to store material indices in a generic attribute.
The attribute API still allows this, but that will be handled separately
since it's a more complex task. The existing API that already clamped
input values should still do that.
This commit is contained in:
2023-03-17 17:07:44 -04:00
parent cc6d8cd573
commit d260cacc9d

View File

@@ -698,7 +698,7 @@ static void rna_MeshPolygon_material_index_set(PointerRNA *ptr, int value)
Mesh *mesh = rna_mesh(ptr);
int *material_indices = BKE_mesh_material_indices_for_write(mesh);
const int index = rna_MeshPolygon_index_get(ptr);
material_indices[index] = value;
material_indices[index] = max_ii(0, value);
}
static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)