Page MenuHome
Paste P938

D4211 test operator
ActivePublic

Authored by Philipp Oeser (lichtwerk) on Mar 18 2019, 10:43 AM.
import bpy
import nodeitems_utils
def main(context):
for cat in nodeitems_utils.node_categories_iter(context):
print("%s %s" % (cat.name, cat.identifier))
for item in cat.items(context):
if isinstance(item, nodeitems_utils.NodeItem):
print(" %s %s" % (item.nodetype, item.label))
nodetype = getattr(bpy.types, item.nodetype, None)
class SimpleOperator(bpy.types.Operator):
"""NodeItems utils example"""
bl_idname = "nodes.nodeitems_utils_example"
bl_label = "NodeItems utils example"
@classmethod
def poll(cls, context):
return True
def execute(self, context):
main(context)
return {'FINISHED'}
def register():
bpy.utils.register_class(SimpleOperator)
def unregister():
bpy.utils.unregister_class(SimpleOperator)
if __name__ == "__main__":
register()