Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-09-06 22:17:02 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-09-06 22:17:02 +0300
commit5d65aee07ad084d35765be073904a7d94cd7c809 (patch)
tree496ed0912db4417bb6cfcb551fc9ebf87df86bde /release/scripts/modules/nodeitems_utils.py
parent8172e8e528f9f19d566cdbd229e8ef7c7170acc2 (diff)
Workaround node types not being exposed
We might want to have a utility function for this, for now just keep it working.
Diffstat (limited to 'release/scripts/modules/nodeitems_utils.py')
-rw-r--r--release/scripts/modules/nodeitems_utils.py6
1 files changed, 4 insertions, 2 deletions
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__