Commit: 9c20eda0add3e223cd473eb883806a04522d345b
Author: Germano Cavalcante
Date:   Fri Oct 21 14:24:18 2022 -0300
Branches: master
https://developer.blender.org/rB9c20eda0add3e223cd473eb883806a04522d345b

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

Allow empty VBOs in Python GPUBatch creation.

===================================================================

M       release/scripts/modules/gpu_extras/batch.py

===================================================================

diff --git a/release/scripts/modules/gpu_extras/batch.py 
b/release/scripts/modules/gpu_extras/batch.py
index ba8e3879a8e..6c9ab52c1a3 100644
--- a/release/scripts/modules/gpu_extras/batch.py
+++ b/release/scripts/modules/gpu_extras/batch.py
@@ -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

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to