Fix T101244: Empty point list in shader batch creation cause error

Allow empty VBOs in Python GPUBatch creation.
This commit is contained in:
Germano Cavalcante 2022-10-21 14:24:18 -03:00
parent 116d7b0042
commit 9c20eda0ad
Notes: blender-bot 2023-05-29 09:17:12 +02:00
Referenced by issue #101244, Empty point list in shader batch creation cause error
1 changed files with 2 additions and 2 deletions

View File

@ -34,13 +34,13 @@ def batch_for_shader(shader, type, content, *, indices=None):
return 'I32'
def recommended_attr_len(attr_name):
item = content[attr_name][0]
attr_len = 1
try:
item = content[attr_name][0]
while True:
attr_len *= len(item)
item = item[0]
except TypeError:
except (TypeError, IndexError):
pass
return attr_len