在 GGUI 中使用 scene.lines(vertices, width, indices, color, per_vertex_color)
这个函数的时候,出现了
Warning! Odd drawing count will be cut to neast even number
这个警告
我觉得 bug 在于,文档里提到 vertex_count
只有在 indices
没有提供的时候可用。
vertex_count (int, optional):
only available when `indices` is not provided, which is the number
of vertices to draw. There are 2 cases that we will change your
`vertex_count`. [1] If the `vertex_count` is an odd number, then we
will change it to `vertex_count` - 1. [2] If `vertex_offset` plus
`vertex_count` greater than vertices.shape[0], then we will reduce
`vertex_count` to no more than vertices.shape[0].
python 代码中的逻辑不支持这一点。代码中的逻辑是 vertex_count
在为空的时候,就为 vertices
的个数,与 indices
是否为空没有关系。
if vertex_count is None:
vertex_count = vertices.shape[0]
if index_count is None:
if indices is None:
index_count = vertex_count
else:
index_count = indices.shape[0]
if vertex_count % 2:
print("Warning! Odd drawing count will be cut to neast even number")
vertex_count -= 1