/
nodetree_source_panel.py
52 lines (41 loc) · 1.81 KB
/
nodetree_source_panel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Nikita Akimov
# interplanety@interplanety.org
#
# GitHub
# https://github.com/Korchy/blender_nodetree_source
from bpy.types import Panel
from bpy.utils import register_class, unregister_class
class NODETREE_SOURCE_PT_panel_3d_view(Panel):
bl_idname = 'NODETREE_SOURCE_PT_panel_3d_view'
bl_label = 'NodeTree Source Builder'
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'NodeTree Source'
def draw(self, context):
layout = self.layout
layout.operator('nodetree_source.material_to_text', icon='NODETREE')
layout.operator('nodetree_source.material_to_library', icon='PACKAGE')
box = layout.box()
box.label(text='Export')
box.operator('nodetree_source.library_to_add_on', icon='FILE_SCRIPT')
box.prop(data=context.preferences.addons[__package__].preferences, property='export_path')
class NODETREE_SOURCE_PT_panel_shader_editor(Panel):
bl_idname = 'NODETREE_SOURCE_PT_panel_shader_editor'
bl_label = 'NodeTree Source Builder'
bl_space_type = 'NODE_EDITOR'
bl_region_type = 'UI'
bl_category = 'NodeTree Source'
def draw(self, context):
layout = self.layout
layout.operator('nodetree_source.material_to_text', icon='NODETREE')
layout.operator('nodetree_source.material_to_library', icon='PACKAGE')
box = layout.box()
box.label(text='Export')
box.operator('nodetree_source.library_to_add_on', icon='FILE_SCRIPT')
box.prop(data=context.preferences.addons[__package__].preferences, property='export_path')
def register():
register_class(NODETREE_SOURCE_PT_panel_3d_view)
register_class(NODETREE_SOURCE_PT_panel_shader_editor)
def unregister():
unregister_class(NODETREE_SOURCE_PT_panel_shader_editor)
unregister_class(NODETREE_SOURCE_PT_panel_3d_view)