diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-09-07 20:18:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-09-07 20:18:39 +0300 |
commit | a133b7470974b1a6e327955a1cc4249375bc2386 (patch) | |
tree | d9432c2f7b949f6b65e0d0754c7e3c10737162cf /release | |
parent | 1601089ece8a1f62c4c8d965fbef8073ccf0e0e5 (diff) | |
parent | 60020f57d7a80679a9493eef3915c205c9c6c246 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/modules/nodeitems_utils.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index 4be6e340760..7dc456f6c98 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -59,8 +59,11 @@ class NodeItem: return self._label else: # if no custom label is defined, fall back to the node type UI name - cls = next(cls for cls in bpy.types.Node.__subclasses__() if cls.bl_rna.identifier == self.nodetype) - return cls.bl_rna.name + cls = bpy.types.Node.bl_rna_get_subclass(self.nodetype) + if cls is not None: + return cls.bl_rna.name + else: + return "Unknown" @property def translation_context(self): @@ -68,8 +71,11 @@ class NodeItem: return bpy.app.translations.contexts.default else: # if no custom label is defined, fall back to the node type UI name - cls = next(cls for cls in bpy.types.Node.__subclasses__() if cls.bl_rna.identifier == self.nodetype) - return cls.bl_rna.translation_context + cls = bpy.types.Node.bl_rna_get_subclass(self.nodetype) + if cls is not None: + return cls.bl_rna.translation_context + else: + return bpy.app.translations.contexts.default # NB: is a staticmethod because called with an explicit self argument # NodeItemCustom sets this as a variable attribute in __init__ |