-
Notifications
You must be signed in to change notification settings - Fork 0
/
interface.py
69 lines (51 loc) · 1.76 KB
/
interface.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from bpy.types import Panel, Object
from .data_loader import data_loader
import bpy
class McbdePanel(Panel):
"""
Panel for the MCBDE addon.
"""
bl_idname = "MCBDE_Panel"
bl_label = "MCBDE"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_category = "MCBDE"
bl_options = {'HEADER_LAYOUT_EXPAND'}
def draw(self, context):
layout = self.layout
active_object = context.active_object
# Data section
layout.label(text="Minecraft Data:")
layout.prop(context.scene.mcbde, "minecraft_location")
layout.operator("object.load_data_button")
if not data_loader.is_initialized():
return
# Selection section
layout.label(text="Selected Blocks:")
col = layout.column()
if active_object and active_object.type == 'MESH' and active_object.mcbde:
col.prop(active_object.mcbde, "block_type")
# Adding the block properties
if "block_properties" in active_object.mcbde:
for property in active_object.mcbde.block_properties:
row = layout.row()
row.label(text=property.name)
row.prop(property, "value")
else:
layout.label(text="Select a mesh object with MCBDE properties.")
# Generation section
layout.label(text="Generation:")
col = layout.column()
col.operator("object.generate_button")
layout.prop(context.scene.mcbde, "command")
classes = (
McbdePanel,
)
def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)
def unregister():
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)