6e46bf61f534afa8df174dbaec6a463926c6c00e
[blender.git] / release / ui / buttons_data_curve.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 == 'CURVE' and context.curve)
11
12
13 class DATA_PT_context_curve(DataButtonsPanel):
14         __idname__ = "DATA_PT_context_curve"
15         __label__ = " "
16         
17         def poll(self, context):
18                 return (context.object and context.object.type == 'CURVE')
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_curve(DataButtonsPanel):
38         __idname__ = "DATA_PT_shape_curve"
39         __label__ = "Shape"
40         
41         def poll(self, context):
42                 return (context.object and context.object.type == 'CURVE')
43
44         def draw(self, context):
45                 layout = self.layout
46                 
47                 ob = context.object
48                 curve = context.curve
49                 space = context.space_data
50
51
52
53                 if curve:
54                         layout.itemR(curve, "curve_2d")                 
55                                                         
56                         split = layout.split()
57                 
58                         col = split.column()
59                         colsub = col.column()
60                         colsub.active = curve.curve_2d
61                         colsub.itemL(text="Caps:")
62                         colsub.itemR(curve, "front")
63                         colsub.itemR(curve, "back")
64                         
65                         col.itemL(text="Textures:")
66 #                       col.itemR(curve, "uv_orco")
67                         col.itemR(curve, "auto_texspace")
68                         
69                         sub = split.column()    
70                         sub.itemL(text="Resolution:")
71                         sub.itemR(curve, "resolution_u", text="Preview U")
72                         sub.itemR(curve, "resolution_v", text="Preview V")
73                         sub.itemR(curve, "render_resolution_u", text="Render U")
74                         sub.itemR(curve, "render_resolution_v", text="Render V")
75
76 #                       sub.itemL(text="Display:")
77 #                       sub.itemL(text="HANDLES")
78 #                       sub.itemL(text="NORMALS")
79 #                       sub.itemR(curve, "vertex_normal_flip")
80
81 class DATA_PT_geometry_curve(DataButtonsPanel):
82         __idname__ = "DATA_PT_geometry_curve"
83         __label__ = "Geometry "
84
85         def draw(self, context):
86                 layout = self.layout
87                 curve = context.curve
88
89                 split = layout.split()
90         
91                 sub = split.column()
92                 sub.itemL(text="Modification:")
93                 sub.itemR(curve, "width")
94                 sub.itemR(curve, "extrude")
95                 sub.itemR(curve, "taper_object", icon="ICON_OUTLINER_OB_CURVE")
96                 
97                 sub = split.column()
98                 sub.itemL(text="Bevel:")
99                 sub.itemR(curve, "bevel_depth", text="Depth")
100                 sub.itemR(curve, "bevel_resolution", text="Resolution")
101                 sub.itemR(curve, "bevel_object", icon="ICON_OUTLINER_OB_CURVE")
102         
103 class DATA_PT_pathanim(DataButtonsPanel):
104         __idname__ = "DATA_PT_pathanim"
105         __label__ = "Path Animation"
106         
107         def draw_header(self, context):
108                 layout = self.layout
109                 curve = context.curve
110
111                 layout.itemR(curve, "path", text="")
112
113         def draw(self, context):
114                 curve = context.curve
115                 layout = self.layout
116                 layout.active = curve.path      
117                 
118                 split = layout.split()          
119                 
120                 sub = split.column()
121                 sub.itemR(curve, "path_length", text="Frames")
122                 sub.itemR(curve, "follow")
123
124                 sub = split.column()
125                 sub.itemR(curve, "stretch")
126                 sub.itemR(curve, "offset_path_distance", text="Offset Children")
127         
128 class DATA_PT_current_curve(DataButtonsPanel):
129         __idname__ = "DATA_PT_current_curve"
130         __label__ = "Current Curve"
131
132         def draw(self, context):
133                 layout = self.layout
134                 currentcurve = context.curve.curves[0] # XXX
135
136                 split = layout.split()
137         
138                 sub = split.column()
139                 sub.itemL(text="Cyclic:")
140                 sub.itemR(currentcurve, "cyclic_u", text="U")
141                 sub.itemR(currentcurve, "cyclic_v", text="V")
142                 sub.itemL(text="Order:")
143                 sub.itemR(currentcurve, "order_u", text="U")
144                 sub.itemR(currentcurve, "order_v", text="V")
145                 sub.itemL(text="Endpoints:")
146                 sub.itemR(currentcurve, "endpoint_u", text="U")
147                 sub.itemR(currentcurve, "endpoint_v", text="V")
148                 
149                 sub = split.column()
150                 sub.itemL(text="Bezier:")
151                 sub.itemR(currentcurve, "bezier_u", text="U")
152                 sub.itemR(currentcurve, "bezier_v", text="V")
153                 sub.itemL(text="Resolution:")
154                 sub.itemR(currentcurve, "resolution_u", text="U")
155                 sub.itemR(currentcurve, "resolution_v", text="V")
156                 sub.itemL(text="Interpolation:")
157                 sub.itemR(currentcurve, "tilt_interpolation", text="Tilt")
158                 sub.itemR(currentcurve, "radius_interpolation", text="Tilt")
159                 sub.itemR(currentcurve, "smooth")
160                 
161 bpy.types.register(DATA_PT_context_curve)
162 bpy.types.register(DATA_PT_shape_curve)
163 bpy.types.register(DATA_PT_geometry_curve)
164 bpy.types.register(DATA_PT_pathanim)
165 bpy.types.register(DATA_PT_current_curve)