Patch from William
[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_context(DataButtonsPanel):
13         __idname__ = "DATA_PT_context"
14         __label__ = " "
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(ob, "data")
31                         split.itemS()
32                 elif curve:
33                         split.template_ID(space, "pin_id")
34                         split.itemS()
35
36
37 class DATA_PT_shape_text(DataButtonsPanel):
38         __idname__ = "DATA_PT_shape_text"
39         __label__ = "Shape Text"
40         
41         def poll(self, context):
42                 ob = context.object
43                 return (context.object and context.object.type == 'TEXT')
44
45         def draw(self, context):
46                 layout = self.layout
47                 
48                 ob = context.object
49                 curve = context.curve
50                 space = context.space_data
51
52                 if curve:
53                         layout.itemR(curve, "curve_2d")                 
54                                                         
55                         split = layout.split()
56                 
57                         sub = split.column()
58                         sub.itemL(text="Caps:")
59                         sub.itemR(curve, "front")
60                         sub.itemR(curve, "back")
61                         
62                         sub.itemL(text="Textures:")
63                         sub.itemR(curve, "uv_orco")
64                         sub.itemR(curve, "auto_texspace")
65                         
66                         sub = split.column()    
67                         sub.itemL(text="Resolution:")
68                         sub.itemR(curve, "resolution_u", text="Preview U")
69                         sub.itemR(curve, "resolution_v", text="Preview V")
70                         sub.itemR(curve, "render_resolution_u", text="Render U")
71                         sub.itemR(curve, "render_resolution_v", text="Render V")
72
73                         sub.itemL(text="Display:")
74                         sub.itemR(curve, "fast")
75
76 class DATA_PT_geometry(DataButtonsPanel):
77         __idname__ = "DATA_PT_geometry"
78         __label__ = "Geometry"
79
80         def draw(self, context):
81                 layout = self.layout
82                 curve = context.curve
83
84                 split = layout.split()
85         
86                 sub = split.column()
87                 sub.itemL(text="Modification:")
88                 sub.itemR(curve, "width")
89                 sub.itemR(curve, "extrude")
90                 sub.itemR(curve, "taper_object")
91                 
92                 sub = split.column()
93                 sub.itemL(text="Bevel:")
94                 sub.itemR(curve, "bevel_depth", text="Depth")
95                 sub.itemR(curve, "bevel_resolution", text="Resolution")
96                 sub.itemR(curve, "bevel_object")
97
98 class DATA_PT_font(DataButtonsPanel):
99         __idname__ = "DATA_PT_font"
100         __label__ = "Font"
101
102         def draw(self, context):
103                 layout = self.layout
104                 text = context.curve
105
106                 layout.row()
107                 layout.itemR(text, "font")
108                 
109                 split = layout.split()
110                 
111                 sub = split.column()    
112         #       sub.itemR(text, "style")
113         #       sub.itemR(text, "bold")
114         #       sub.itemR(text, "italic")
115         #       sub.itemR(text, "underline")
116         #       ToDo: These settings are in a sub struct (Edit Format). 
117                 sub.itemR(text, "text_size")            
118                 sub.itemR(text, "shear")
119
120                 sub = split.column()
121                 sub.itemR(text, "text_on_curve")
122                 sub.itemR(text, "family")
123                 sub.itemL(text="Underline:")
124                 sub.itemR(text, "ul_position", text="Position")
125                 sub.itemR(text, "ul_height", text="Height")
126
127         #       sub.itemR(text, "edit_format")
128
129 class DATA_PT_paragraph(DataButtonsPanel):
130         __idname__ = "DATA_PT_paragraph"
131         __label__ = "Paragraph"
132
133         def draw(self, context):
134                 layout = self.layout
135                 text = context.curve
136
137                 layout.itemL(text="Align:")
138                 layout.itemR(text, "spacemode", expand=True)
139
140                 split = layout.split()
141                 
142                 sub = split.column()    
143                 sub.itemL(text="Spacing:")
144                 sub.itemR(text, "spacing", text="Character")
145                 sub.itemR(text, "word_spacing", text="Word")
146                 sub.itemR(text, "line_dist", text="Line")
147
148                 sub = split.column()
149                 sub.itemL(text="Offset:")
150                 sub.itemR(text, "x_offset", text="X")
151                 sub.itemR(text, "y_offset", text="Y")
152                 sub.itemR(text, "wrap")
153
154 """             
155 class DATA_PT_textboxes(DataButtonsPanel):
156                 __idname__ = "DATA_PT_textboxes"
157                 __label__ = "Text Boxes"
158
159                 def draw(self, context):
160                         layout = self.layout
161                         text = context.curve
162 """
163
164 bpy.types.register(DATA_PT_context)     
165 bpy.types.register(DATA_PT_shape_text)  
166 bpy.types.register(DATA_PT_geometry)
167 bpy.types.register(DATA_PT_font)
168 bpy.types.register(DATA_PT_paragraph)
169 #bpy.types.register(DATA_PT_textboxes)