[ui] improve atts filtering and add search bar ...

...for node attributes and 3D inspector

- add search bar for node attributes
- add search bar for 3D inspector
- improve attributes filtering by adding more flexibility
and fixing some issues
This commit is contained in:
Abdelrahman AL MAROUK 2023-07-03 09:25:17 +02:00
parent 6c2e9eb583
commit b5093ac3a0
6 changed files with 408 additions and 301 deletions

View file

@ -111,6 +111,10 @@ class Attribute(BaseObject):
def getLabel(self):
return self._label
@Slot(str, result=bool)
def matchText(self, text):
return self.fullLabel.lower().find(text.lower()) > -1
def getFullLabel(self):
""" Full Label includes the name of all parent groups, e.g. 'groupLabel subGroupLabel Label' """
@ -349,6 +353,7 @@ class Attribute(BaseObject):
isOutput = Property(bool, isOutput.fget, constant=True)
isLinkChanged = Signal()
isLink = Property(bool, isLink.fget, notify=isLinkChanged)
isLinkNested = isLink
hasOutputConnectionsChanged = Signal()
hasOutputConnections = Property(bool, hasOutputConnections.fget, notify=hasOutputConnectionsChanged)
isDefault = Property(bool, _isDefault, notify=valueChanged)
@ -502,10 +507,19 @@ class ListAttribute(Attribute):
for attr in self._value:
attr.updateInternals()
@property
def isLinkNested(self):
""" Whether the attribute or any of its elements is a link to another attribute. """
# note: directly use self.node.graph._edges to avoid using the property that may become invalid at some point
return self.isLink \
or self.node.graph and self.isInput and self.node.graph._edges \
and any(v in self.node.graph._edges.keys() for v in self._value)
# Override value property setter
value = Property(Variant, Attribute._get_value, _set_value, notify=Attribute.valueChanged)
isDefault = Property(bool, _isDefault, notify=Attribute.valueChanged)
baseType = Property(str, getBaseType, constant=True)
isLinkNested = Property(bool, isLinkNested.fget)
class GroupAttribute(Attribute):
@ -622,6 +636,10 @@ class GroupAttribute(Attribute):
for attr in self._value:
attr.updateInternals()
@Slot(str, result=bool)
def matchText(self, text):
return super().matchText(text) or any(c.matchText(text) for c in self._value)
# Override value property
value = Property(Variant, Attribute._get_value, _set_value, notify=Attribute.valueChanged)
isDefault = Property(bool, _isDefault, notify=Attribute.valueChanged)