kopia lustrzana https://github.com/carson-katri/geometry-script
Use isinstance for Named Attribute
rodzic
34c1eb50c8
commit
87793fe8d1
|
@ -44,12 +44,19 @@ class Attribute:
|
||||||
"""
|
"""
|
||||||
Creates a "Named Attribute" node with the correct arguments passed, and returns the "Attribute" socket.
|
Creates a "Named Attribute" node with the correct arguments passed, and returns the "Attribute" socket.
|
||||||
"""
|
"""
|
||||||
from geometry_script import named_attribute
|
from geometry_script import named_attribute, Type
|
||||||
return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).attribute
|
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):
|
def exists(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Creates a "Named Attribute" node with the correct arguments passed, and returns the "Exists" socket.
|
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
|
from geometry_script import named_attribute
|
||||||
return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).exists
|
return named_attribute(data_type=self.data_type, name=self.name, *args, **kwargs).exists
|
||||||
|
|
Ładowanie…
Reference in New Issue