Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / release / ui / buttons_data_text.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5         __space_type__ = "PROPERTIES"
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         __show_header__ = False
14
15         def draw(self, context):
16                 layout = self.layout
17                 
18                 ob = context.object
19                 curve = context.curve
20                 space = context.space_data
21
22                 split = layout.split(percentage=0.65)
23
24                 if ob:
25                         split.template_ID(ob, "data")
26                         split.itemS()
27                 elif curve:
28                         split.template_ID(space, "pin_id")
29                         split.itemS()
30
31 class DATA_PT_shape_text(DataButtonsPanel):
32         __label__ = "Shape Text"
33
34         def draw(self, context):
35                 layout = self.layout
36                 
37                 ob = context.object
38                 curve = context.curve
39                 space = context.space_data
40
41                 if curve:
42                         layout.itemR(curve, "curve_2d")                 
43                                                         
44                         split = layout.split()
45                 
46                         col = split.column()
47                         col.itemL(text="Caps:")
48                         col.itemR(curve, "front")
49                         col.itemR(curve, "back")
50                         col.itemL(text="Textures:")
51                         col.itemR(curve, "uv_orco")
52                         col.itemR(curve, "auto_texspace")
53                         
54                         col = split.column()    
55                         col.itemL(text="Resolution:")
56                         sub = col.column(align=True)
57                         sub.itemR(curve, "resolution_u", text="Preview U")
58                         sub.itemR(curve, "render_resolution_u", text="Render U")
59                         sub = col.column(align=True)
60                         sub.itemR(curve, "resolution_v", text="Preview V")
61                         sub.itemR(curve, "render_resolution_v", text="Render V")
62                         col.itemL(text="Display:")
63                         col.itemR(curve, "fast")
64
65 class DATA_PT_geometry_text(DataButtonsPanel):
66         __label__ = "Geometry"
67
68         def draw(self, context):
69                 layout = self.layout
70                 
71                 curve = context.curve
72
73                 split = layout.split()
74         
75                 col = split.column()
76                 col.itemL(text="Modification:")
77                 col.itemR(curve, "width")
78                 col.itemR(curve, "extrude")
79                 col.itemR(curve, "taper_object")
80                 
81                 col = split.column()
82                 col.itemL(text="Bevel:")
83                 col.itemR(curve, "bevel_depth", text="Depth")
84                 col.itemR(curve, "bevel_resolution", text="Resolution")
85                 col.itemR(curve, "bevel_object")
86
87 class DATA_PT_font(DataButtonsPanel):
88         __label__ = "Font"
89
90         def draw(self, context):
91                 layout = self.layout
92                 
93                 text = context.curve
94
95                 layout.itemR(text, "font")
96                 
97                 split = layout.split()
98                 
99                 col = split.column()    
100         #       col.itemR(text, "style")
101         #       col.itemR(text, "bold")
102         #       col.itemR(text, "italic")
103         #       col.itemR(text, "underline")
104         #       ToDo: These settings are in a sub struct (Edit Format). 
105                 col.itemR(text, "text_size")            
106                 col.itemR(text, "shear")
107
108                 col = split.column()
109                 col.itemR(text, "text_on_curve")
110                 col.itemR(text, "family")
111                 col.itemL(text="Underline:")
112                 col.itemR(text, "ul_position", text="Position")
113                 col.itemR(text, "ul_height", text="Height")
114         #       col.itemR(text, "edit_format")
115
116 class DATA_PT_paragraph(DataButtonsPanel):
117         __label__ = "Paragraph"
118
119         def draw(self, context):
120                 layout = self.layout
121                 
122                 text = context.curve
123
124                 layout.itemL(text="Align:")
125                 layout.itemR(text, "spacemode", expand=True)
126
127                 split = layout.split()
128                 
129                 col = split.column(align=True)  
130                 col.itemL(text="Spacing:")
131                 col.itemR(text, "spacing", text="Character")
132                 col.itemR(text, "word_spacing", text="Word")
133                 col.itemR(text, "line_dist", text="Line")
134
135                 col = split.column(align=True)
136                 col.itemL(text="Offset:")
137                 col.itemR(text, "x_offset", text="X")
138                 col.itemR(text, "y_offset", text="Y")
139                 #col.itemR(text, "wrap")
140
141 """             
142 class DATA_PT_textboxes(DataButtonsPanel):
143                 __label__ = "Text Boxes"
144
145                 def draw(self, context):
146                         layout = self.layout
147                         
148                         text = context.curve
149 """
150
151 bpy.types.register(DATA_PT_context_text)        
152 bpy.types.register(DATA_PT_shape_text)  
153 bpy.types.register(DATA_PT_geometry_text)
154 bpy.types.register(DATA_PT_font)
155 bpy.types.register(DATA_PT_paragraph)
156 #bpy.types.register(DATA_PT_textboxes)