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