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:
Diffstat (limited to 'release/scripts/modules/nodeitems_utils.py')
-rw-r--r--release/scripts/modules/nodeitems_utils.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py
index 904062c36cd..117e35dd028 100644
--- a/release/scripts/modules/nodeitems_utils.py
+++ b/release/scripts/modules/nodeitems_utils.py
@@ -59,7 +59,11 @@ 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
+ bl_rna = bpy.types.Node.bl_rna_get_subclass(self.nodetype)
+ if bl_rna is not None:
+ return bl_rna.name
+ else:
+ return "Unknown"
@property
def translation_context(self):
@@ -67,7 +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
- return getattr(bpy.types, self.nodetype).bl_rna.translation_context
+ bl_rna = bpy.types.Node.bl_rna_get_subclass(self.nodetype)
+ if bl_rna is not None:
+ return 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__