Skip to content

Commit 87793fe

Browse files
committed
Use isinstance for Named Attribute
1 parent 34c1eb5 commit 87793fe

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

api/static/attribute.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,19 @@ def __call__(self, *args, **kwargs):
4444
"""
4545
Creates a "Named Attribute" node with the correct arguments passed, and returns the "Attribute" socket.
4646
"""
47-
from geometry_script import named_attribute
48-
return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).attribute
47+
from geometry_script import named_attribute, Type
48+
result = named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs)
49+
# Handle Blender 3.5+, which includes an `exists` result.
50+
if isinstance(result, Type):
51+
return result
52+
else:
53+
return result.attribute
4954

5055
def exists(self, *args, **kwargs):
5156
"""
5257
Creates a "Named Attribute" node with the correct arguments passed, and returns the "Exists" socket.
58+
59+
> Only available in Blender 3.5+
5360
"""
5461
from geometry_script import named_attribute
5562
return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).exists

0 commit comments

Comments
 (0)