From 87793fe8d1edb439fb468a39286118aba6d8959e Mon Sep 17 00:00:00 2001 From: Carson Katri Date: Sun, 12 Feb 2023 11:08:20 -0500 Subject: [PATCH] Use isinstance for Named Attribute --- api/static/attribute.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/static/attribute.py b/api/static/attribute.py index 8038a5e..009a890 100644 --- a/api/static/attribute.py +++ b/api/static/attribute.py @@ -44,12 +44,19 @@ class Attribute: """ Creates a "Named Attribute" node with the correct arguments passed, and returns the "Attribute" socket. """ - from geometry_script import named_attribute - return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).attribute + from geometry_script import named_attribute, Type + result = named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs) + # Handle Blender 3.5+, which includes an `exists` result. + if isinstance(result, Type): + return result + else: + return result.attribute def exists(self, *args, **kwargs): """ Creates a "Named Attribute" node with the correct arguments passed, and returns the "Exists" socket. + + > Only available in Blender 3.5+ """ from geometry_script import named_attribute return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).exists