From 9aaca1bb5fb1d7e370e50d67a37f488b8aedfcd5 Mon Sep 17 00:00:00 2001 From: Waffle Date: Mon, 15 Jul 2019 16:36:02 -0400 Subject: [PATCH] Fixed Incorrect Tuple Usage in unpackData Fixed "IndexError: tuple index out of range" `value = tuple(float(value[i]) / divisor for i in value)` Was effectively attempting to access the value tuple using an element as an index. `value = tuple(float(i) / divisor for i in value)` Uses the elements from the tuple and modifies them. Ex: (0,0,0,255) becomes: (0.0, 0.0, 0.0, 255.0) Instead of throwing an error. --- docs/python_api/examples/renderdoc/decode_mesh.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/python_api/examples/renderdoc/decode_mesh.py b/docs/python_api/examples/renderdoc/decode_mesh.py index d09ce2c6b..3a46434ad 100644 --- a/docs/python_api/examples/renderdoc/decode_mesh.py +++ b/docs/python_api/examples/renderdoc/decode_mesh.py @@ -57,11 +57,11 @@ def unpackData(fmt, data): # If the format needs post-processing such as normalisation, do that now if fmt.compType == rd.CompType.UNorm: divisor = float((1 << fmt.compByteWidth) - 1) - value = tuple(float(value[i]) / divisor for i in value) + value = tuple(float(i) / divisor for i in value) elif fmt.compType == rd.CompType.SNorm: maxNeg = -(1 << (fmt.compByteWidth - 1)) divisor = float(-(maxNeg-1)) - value = tuple((float(value[i]) if (value[i] == maxNeg) else (float(value[i]) / divisor)) for i in value) + value = tuple((float(i) if (i == maxNeg) else (float(i) / divisor)) for i in value) # If the format is BGRA, swap the two components if fmt.BGRAOrder():