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