UI:
[blender-staging.git] / release / ui / buttons_data_text.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "BUTTONS_WINDOW"
6         __region_type__ = "WINDOW"
7         __context__ = "data"
8         
9         def poll(self, context):
10                 return (context.object and context.object.type == 'TEXT' and context.curve)
11                 
12 class DATA_PT_shape_text(DataButtonsPanel):
13         __idname__ = "DATA_PT_shape_text"
14         __label__ = "Shape Text"
15         
16         def poll(self, context):
17                 ob = context.object
18                 return (context.object and context.object.type == 'TEXT')
19
20         def draw(self, context):
21                 layout = self.layout
22                 
23                 ob = context.object
24                 curve = context.curve
25                 space = context.space_data
26
27                 split = layout.split(percentage=0.65)
28
29                 if ob:
30                         split.template_ID(context, ob, "data")
31                         split.itemS()
32                 elif curve:
33                         split.template_ID(context, space, "pin_id")
34                         split.itemS()
35
36                 if curve:
37                         layout.itemS()
38                         layout.itemR(curve, "curve_2d")                 
39                                                         
40                         split = layout.split()
41                 
42                         sub = split.column()
43                         sub.itemL(text="Caps:")
44                         sub.itemR(curve, "front")
45                         sub.itemR(curve, "back")
46                         
47                         sub.itemL(text="Textures:")
48                         sub.itemR(curve, "uv_orco")
49                         sub.itemR(curve, "auto_texspace")
50                         
51                         sub = split.column()    
52                         sub.itemL(text="Resolution:")
53                         sub.itemR(curve, "resolution_u", text="Preview U")
54                         sub.itemR(curve, "resolution_v", text="Preview V")
55                         sub.itemR(curve, "render_resolution_u", text="Render U")
56                         sub.itemR(curve, "render_resolution_v", text="Render V")
57
58                         sub.itemL(text="Display:")
59                         sub.itemR(curve, "fast")
60                         
61 class DATA_PT_font(DataButtonsPanel):
62         __idname__ = "DATA_PT_font"
63         __label__ = "Font"
64
65         def draw(self, context):
66                 layout = self.layout
67                 text = context.curve
68
69                 layout.row()
70                 layout.itemR(text, "font")
71                 
72                 split = layout.split()
73                 
74                 sub = split.column()    
75         #       sub.itemR(text, "style")
76         #       sub.itemR(text, "bold")
77         #       sub.itemR(text, "italic")
78         #       sub.itemR(text, "underline")
79         #       ToDo: These settings are in a sub struct (Edit Format). 
80                 sub.itemR(text, "text_size")            
81                 sub.itemR(text, "shear")
82
83                 sub = split.column()
84                 sub.itemR(text, "text_on_curve")
85                 sub.itemR(text, "family")
86                 sub.itemL(text="Underline:")
87                 sub.itemR(text, "ul_position", text="Position")
88                 sub.itemR(text, "ul_height", text="Height")
89
90         #       sub.itemR(text, "edit_format")
91
92 class DATA_PT_paragraph(DataButtonsPanel):
93         __idname__ = "DATA_PT_paragraph"
94         __label__ = "Paragraph"
95
96         def draw(self, context):
97                 layout = self.layout
98                 text = context.curve
99
100                 layout.itemL(text="Align:")
101                 layout.itemR(text, "spacemode", expand=True)
102
103                 split = layout.split()
104                 
105                 sub = split.column()    
106                 sub.itemL(text="Spacing:")
107                 sub.itemR(text, "spacing", text="Character")
108                 sub.itemR(text, "word_spacing", text="Word")
109                 sub.itemR(text, "line_dist", text="Line")
110
111                 sub = split.column()
112                 sub.itemL(text="Offset:")
113                 sub.itemR(text, "x_offset", text="X")
114                 sub.itemR(text, "y_offset", text="Y")
115                 sub.itemR(text, "wrap")
116
117 """             
118 class DATA_PT_textboxes(DataButtonsPanel):
119                 __idname__ = "DATA_PT_textboxes"
120                 __label__ = "Text Boxes"
121
122                 def draw(self, context):
123                         layout = self.layout
124                         text = context.curve
125 """
126
127 bpy.types.register(DATA_PT_shape_text)  
128 bpy.types.register(DATA_PT_font)
129 bpy.types.register(DATA_PT_paragraph)
130 #bpy.types.register(DATA_PT_textboxes)