diff --git a/meshroom/core/attribute.py b/meshroom/core/attribute.py index 3377a74c..5c341886 100644 --- a/meshroom/core/attribute.py +++ b/meshroom/core/attribute.py @@ -4,7 +4,7 @@ import collections import re import weakref -from meshroom.common import BaseObject, Property, Variant, Signal, ListModel, DictModel +from meshroom.common import BaseObject, Property, Variant, Signal, ListModel, DictModel, Slot from meshroom.core import desc, pyCompatibility, hashValue @@ -371,6 +371,22 @@ class GroupAttribute(Attribute): for key, value in exportedValue.items(): self._value.get(key).value = value + @Slot(str, result=Attribute) + def childAttribute(self, key): + """ + Get child attribute by name or None if none was found. + + Args: + key (str): the name of the child attribute + + Returns: + Attribute: the child attribute or None + """ + try: + return self._value.get(key) + except KeyError: + return None + def uid(self, uidIndex): uids = [] for k, v in self._value.items():