add support for lists to math node

This commit is contained in:
matt3o
2024-05-13 15:43:32 +02:00
parent 1a1b4bf5c4
commit 84d25b99c2
+8 -2
View File
@@ -1043,7 +1043,8 @@ operators = {
op_functions = {
'min': min,
'max': max
'max': max,
'round': round,
}
class SimpleMath:
@@ -1083,6 +1084,12 @@ class SimpleMath:
if node.func.id in op_functions:
args =[eval_(arg) for arg in node.args]
return op_functions[node.func.id](*args)
elif isinstance(node, ast.Subscript): # indexing or slicing
value = eval_(node.value)
if isinstance(node.slice, ast.Constant):
return value[node.slice.value]
else:
return 0
else:
return 0
@@ -1898,7 +1905,6 @@ class ImageBatchMultiple:
return (out,)
NODE_CLASS_MAPPINGS = {
"GetImageSize+": GetImageSize,