[core] add isInput property in Attribute desc

This commit is contained in:
Yann Lanthony 2017-10-30 16:21:51 +01:00
parent b22c2b5a62
commit a0cdc65143
2 changed files with 5 additions and 5 deletions

View file

@ -21,6 +21,7 @@ class Attribute(BaseObject):
uid = Property(Variant, lambda self: self._uid, constant=True) uid = Property(Variant, lambda self: self._uid, constant=True)
group = Property(str, lambda self: self._group, constant=True) group = Property(str, lambda self: self._group, constant=True)
isOutput = Property(bool, lambda self: self._isOutput, constant=True) isOutput = Property(bool, lambda self: self._isOutput, constant=True)
isInput = Property(bool, lambda self: not self._isOutput, constant=True)
class ListAttribute(Attribute): class ListAttribute(Attribute):

View file

@ -88,7 +88,6 @@ class Attribute(BaseObject):
self.attributeDesc = attributeDesc self.attributeDesc = attributeDesc
self._value = getattr(attributeDesc, 'value', None) self._value = getattr(attributeDesc, 'value', None)
self._label = getattr(attributeDesc, 'label', None) self._label = getattr(attributeDesc, 'label', None)
self._isOutput = getattr(attributeDesc, 'isOutput', False)
# invalidation value for output attributes # invalidation value for output attributes
self._invalidationValue = "" self._invalidationValue = ""
@ -125,7 +124,7 @@ class Attribute(BaseObject):
@property @property
def isOutput(self): def isOutput(self):
return self._isOutput return self.attributeDesc.isOutput
def uid(self): def uid(self):
""" """
@ -142,7 +141,7 @@ class Attribute(BaseObject):
@property @property
def isLink(self): def isLink(self):
""" Whether the attribute is a link to another attribute. """ """ Whether the attribute is a link to another attribute. """
return not self.isOutput and self in self.node.graph.edges.keys() return self.attributeDesc.isInput and self in self.node.graph.edges.keys()
def getLinkParam(self): def getLinkParam(self):
return self.node.graph.edge(self).src if self.isLink else None return self.node.graph.edge(self).src if self.isLink else None
@ -461,7 +460,7 @@ class Node(BaseObject):
# Evaluate output params # Evaluate output params
for name, attr in self._attributes.objects.items(): for name, attr in self._attributes.objects.items():
if not attr.attributeDesc.isOutput: if attr.attributeDesc.isInput:
continue # skip inputs continue # skip inputs
attr.value = attr.attributeDesc.value.format( attr.value = attr.attributeDesc.value.format(
nodeType=self.nodeType, nodeType=self.nodeType,