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