Resolve T52687: Add node label shows as 'Unknown'

Add type access method, need to extend to other types
for now just get node UI working properly again.
This commit is contained in:
2017-09-09 22:35:33 +10:00
parent 3c3d0898b0
commit 11a9434c2d
2 changed files with 60 additions and 13 deletions

View File

@@ -59,9 +59,9 @@ class NodeItem:
return self._label
else:
# if no custom label is defined, fall back to the node type UI name
cls = bpy.types.Node.bl_rna_get_subclass(self.nodetype)
if cls is not None:
return cls.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"
@@ -71,9 +71,9 @@ class NodeItem:
return bpy.app.translations.contexts.default
else:
# if no custom label is defined, fall back to the node type UI name
cls = bpy.types.Node.bl_rna_get_subclass(self.nodetype)
if cls is not None:
return cls.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