fa463d49c0d6917dec847563bed7b2d9de40f414
[blender.git] / release / ui / buttons_data_metaball.py
1 import bpy
2
3 class DataButtonsPanel(bpy.types.Panel):
4         __space_type__ = "BUTTONS_WINDOW"
5         __region_type__ = "WINDOW"
6         __context__ = "data"
7         
8         def poll(self, context):
9                 return (context.meta_ball)
10
11 class DATA_PT_context_metaball(DataButtonsPanel):
12         __show_header__ = False
13         
14         def draw(self, context):
15                 layout = self.layout
16                 
17                 ob = context.object
18                 mball = context.meta_ball
19                 space = context.space_data
20
21                 split = layout.split(percentage=0.65)
22
23                 if ob:
24                         split.template_ID(ob, "data")
25                         split.itemS()
26                 elif mball:
27                         split.template_ID(space, "pin_id")
28                         split.itemS()
29
30 class DATA_PT_metaball(DataButtonsPanel):
31         __label__ = "Metaball"
32
33         def draw(self, context):
34                 layout = self.layout
35                 
36                 mball = context.meta_ball
37                 
38                 split = layout.split()
39                 
40                 col = split.column()
41                 col.itemL(text="Resolution:")
42                 sub = col.column(align=True)
43                 sub.itemR(mball, "wire_size", text="View")
44                 sub.itemR(mball, "render_size", text="Render")  
45                 
46                 col = split.column()
47                 col.itemL(text="Settings:")
48                 col.itemR(mball, "threshold", text="Threshold")
49
50                 layout.itemL(text="Update:")
51                 layout.itemR(mball, "flag", expand=True)
52
53 class DATA_PT_metaball_element(DataButtonsPanel):
54         __label__ = "Active Element"
55         
56         def poll(self, context):
57                 return (context.meta_ball and context.meta_ball.last_selected_element)
58
59         def draw(self, context):
60                 layout = self.layout
61                 
62                 metaelem = context.meta_ball.last_selected_element
63                 
64                 split = layout.split(percentage=0.3)
65                 split.itemL(text="Type:")       
66                 split.itemR(metaelem, "type", text="")
67                 
68                 split = layout.split()
69                 
70                 col = split.column()
71                 col.itemL(text="Size:") 
72                 col.itemR(metaelem, "size", text="")
73                 
74                 col = split.column()
75                 col.itemL(text="Settings:")
76                 col.itemR(metaelem, "stiffness", text="Stiffness")
77                 col.itemR(metaelem, "negative", text="Negative")
78                 col.itemR(metaelem, "hide", text="Hide")
79
80 bpy.types.register(DATA_PT_context_metaball)
81 bpy.types.register(DATA_PT_metaball)
82 bpy.types.register(DATA_PT_metaball_element)