2.5 Buttons
[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                 ob = context.active_object
11                 return (ob and ob.type == 'CURVE')
12
13 class DATA_PT_shape_curve(DataButtonsPanel):
14                 __idname__ = "DATA_PT_shape_curve"
15                 __label__ = "Shape"
16
17                 def draw(self, context):
18                         curve = context.active_object.data
19                         layout = self.layout
20
21                         layout.itemR(curve, "curve_2d")                 
22                                                         
23                         split = layout.split()
24                 
25                         col = split.column()
26                         colsub = col.column()
27                         colsub.active = curve.curve_2d
28                         colsub.itemL(text="Caps:")
29                         colsub.itemR(curve, "front")
30                         colsub.itemR(curve, "back")
31                         
32                         col.itemL(text="Textures:")
33                         col.itemR(curve, "uv_orco")
34                         col.itemR(curve, "auto_texspace")
35                         
36                         sub = split.column()    
37                         sub.itemL(text="Resolution:")
38                         sub.itemR(curve, "resolution_u", text="Preview U")
39                         sub.itemR(curve, "resolution_v", text="Preview V")
40                         sub.itemR(curve, "render_resolution_u", text="Render U")
41                         sub.itemR(curve, "render_resolution_v", text="Render V")
42
43                         sub.itemL(text="Display:")
44                         sub.itemL(text="HANDLES")
45                         sub.itemL(text="NORMALS")
46                         sub.itemR(curve, "vertex_normal_flip")
47
48 class DATA_PT_geometry(DataButtonsPanel):
49                 __idname__ = "DATA_PT_geometry"
50                 __label__ = "Geometry"
51
52                 def draw(self, context):
53                         curve = context.active_object.data
54                         layout = self.layout
55
56                         split = layout.split()
57                 
58                         sub = split.column()
59                         sub.itemL(text="Modification:")
60                         sub.itemR(curve, "width")
61                         sub.itemR(curve, "extrude")
62                         sub.itemR(curve, "taper_object")
63                         
64                         sub = split.column()
65                         sub.itemL(text="Bevel:")
66                         sub.itemR(curve, "bevel_depth", text="Depth")
67                         sub.itemR(curve, "bevel_resolution", text="Resolution")
68                         sub.itemR(curve, "bevel_object")
69         
70 class DATA_PT_pathanim(DataButtonsPanel):
71                 __idname__ = "DATA_PT_pathanim"
72                 __label__ = "Path Animation"
73                 
74                 def draw_header(self, context):
75                         curve = context.active_object.data
76
77                         layout = self.layout
78                         layout.itemR(curve, "path", text="")
79
80                 def draw(self, context):
81                         curve = context.active_object.data
82                         layout = self.layout
83                         layout.active = curve.path      
84                         
85                         split = layout.split()          
86                         
87                         sub = split.column()
88                         sub.itemR(curve, "path_length", text="Frames")
89                         sub.itemR(curve, "follow")
90
91                         sub = split.column()
92                         sub.itemR(curve, "stretch")
93                         sub.itemR(curve, "offset_path_distance", text="Offset Children")
94         
95 class DATA_PT_current_curve(DataButtonsPanel):
96                 __idname__ = "DATA_PT_current_curve"
97                 __label__ = "Current Curve"
98
99                 def draw(self, context):
100                         currentcurve = context.active_object.data.curves[0]
101                         layout = self.layout
102
103                         split = layout.split()
104                 
105                         sub = split.column()
106                         sub.itemL(text="Cyclic:")
107                         sub.itemR(currentcurve, "cyclic_u", text="U")
108                         sub.itemR(currentcurve, "cyclic_v", text="V")
109                         sub.itemL(text="Order:")
110                         sub.itemR(currentcurve, "order_u", text="U")
111                         sub.itemR(currentcurve, "order_v", text="V")
112                         sub.itemL(text="Endpoints:")
113                         sub.itemR(currentcurve, "endpoint_u", text="U")
114                         sub.itemR(currentcurve, "endpoint_v", text="V")
115                         
116                         sub = split.column()
117                         sub.itemL(text="Bezier:")
118                         sub.itemR(currentcurve, "bezier_u", text="U")
119                         sub.itemR(currentcurve, "bezier_v", text="V")
120                         sub.itemL(text="Resolution:")
121                         sub.itemR(currentcurve, "resolution_u", text="U")
122                         sub.itemR(currentcurve, "resolution_v", text="V")
123                         sub.itemL(text="Interpolation:")
124                         sub.itemR(currentcurve, "tilt_interpolation", text="Tilt")
125                         sub.itemR(currentcurve, "radius_interpolation", text="Tilt")
126                         sub.itemR(currentcurve, "smooth")
127                         
128 bpy.types.register(DATA_PT_shape_curve)
129 bpy.types.register(DATA_PT_geometry)
130 bpy.types.register(DATA_PT_pathanim)
131 bpy.types.register(DATA_PT_current_curve)