[Bf-blender-cvs] [5d65aee07ad] master: Workaround node types not being exposed

Campbell Barton noreply at git.blender.org
Wed Sep 6 21:12:56 CEST 2017


Commit: 5d65aee07ad084d35765be073904a7d94cd7c809
Author: Campbell Barton
Date:   Thu Sep 7 05:17:02 2017 +1000
Branches: master
https://developer.blender.org/rB5d65aee07ad084d35765be073904a7d94cd7c809

Workaround node types not being exposed

We might want to have a utility function for this,
for now just keep it working.

===================================================================

M	release/scripts/modules/nodeitems_utils.py

===================================================================

diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py
index 904062c36cd..4be6e340760 100644
--- a/release/scripts/modules/nodeitems_utils.py
+++ b/release/scripts/modules/nodeitems_utils.py
@@ -59,7 +59,8 @@ class NodeItem:
             return self._label
         else:
             # if no custom label is defined, fall back to the node type UI name
-            return getattr(bpy.types, self.nodetype).bl_rna.name
+            cls = next(cls for cls in bpy.types.Node.__subclasses__() if cls.bl_rna.identifier == self.nodetype)
+            return cls.bl_rna.name
 
     @property
     def translation_context(self):
@@ -67,7 +68,8 @@ class NodeItem:
             return bpy.app.translations.contexts.default
         else:
             # if no custom label is defined, fall back to the node type UI name
-            return getattr(bpy.types, self.nodetype).bl_rna.translation_context
+            cls = next(cls for cls in bpy.types.Node.__subclasses__() if cls.bl_rna.identifier == self.nodetype)
+            return cls.bl_rna.translation_context
 
     # NB: is a staticmethod because called with an explicit self argument
     # NodeItemCustom sets this as a variable attribute in __init__



More information about the Bf-blender-cvs mailing list