node_kit/ui.py

48 lines
1.2 KiB
Python

"""
This module contains blender UI elements
:author: Autour de Minuit
:maintainers: Florentin LUCE
:date: 2024
"""
import bpy
class NODEKIT_MT_node_kit(bpy.types.Menu):
bl_label = "Node kit"
def draw(self, context):
layout = self.layout
layout.operator('node_kit.copy_node_tree', text='Copy Nodes', icon='COPYDOWN')
layout.operator('node_kit.paste_node_tree', text='Paste Nodes', icon='PASTEDOWN')
layout.separator()
layout.operator('node_kit.remap_node_group_duplicates', text='Remap Node Groups Duplicates', icon='NODE_INSERT_OFF')
layout.operator('node_kit.update_nodes', text='Update Nodes', icon='IMPORT')
layout.separator()
layout.operator('node_kit.pack_nodes', text='Pack Nodes', icon='PACKAGE')
layout.operator('node_kit.unpack_nodes', text='UnPack Nodes', icon='UGLYPACKAGE')
classes = (
NODEKIT_MT_node_kit,
)
def draw_menu(self, context):
self.layout.menu('NODEKIT_MT_node_kit')
def register():
for c in classes:
bpy.utils.register_class(c)
bpy.types.NODE_MT_editor_menus.append(draw_menu)
def unregister():
for c in reversed(classes):
bpy.utils.unregister_class(c)
bpy.types.NODE_MT_editor_menus.remove(draw_menu)