36272ca5d3de2a7d267396a7304bdb9bfb18d123
[blender-staging.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 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
32 class DATA_PT_shape_curve(DataButtonsPanel):
33         __label__ = "Shape"
34         
35         def draw(self, context):
36                 layout = self.layout
37                 
38                 ob = context.object
39                 curve = context.curve
40                 space = context.space_data
41
42                 if curve:
43                         layout.itemR(curve, "curve_2d")                 
44                                                         
45                         split = layout.split()
46                 
47                         col = split.column()
48                         colsub = col.column()
49                         colsub.active = curve.curve_2d
50                         colsub.itemL(text="Caps:")
51                         colsub.itemR(curve, "front")
52                         colsub.itemR(curve, "back")
53                         
54                         col.itemL(text="Textures:")
55 #                       col.itemR(curve, "uv_orco")
56                         col.itemR(curve, "auto_texspace")
57                         
58                         sub = split.column()    
59                         sub.itemL(text="Resolution:")
60                         sub.itemR(curve, "resolution_u", text="Preview U")
61                         sub.itemR(curve, "resolution_v", text="Preview V")
62                         sub.itemR(curve, "render_resolution_u", text="Render U")
63                         sub.itemR(curve, "render_resolution_v", text="Render V")
64
65 #                       sub.itemL(text="Display:")
66 #                       sub.itemL(text="HANDLES")
67 #                       sub.itemL(text="NORMALS")
68 #                       sub.itemR(curve, "vertex_normal_flip")
69
70 class DATA_PT_geometry_curve(DataButtonsPanel):
71         __label__ = "Geometry "
72
73         def draw(self, context):
74                 layout = self.layout
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                 curve = context.curve
97
98                 layout.itemR(curve, "path", text="")
99
100         def draw(self, context):
101                 curve = context.curve
102                 layout = self.layout
103                 layout.active = curve.path      
104                 
105                 split = layout.split()          
106                 
107                 sub = split.column()
108                 sub.itemR(curve, "path_length", text="Frames")
109                 sub.itemR(curve, "follow")
110
111                 sub = split.column()
112                 sub.itemR(curve, "stretch")
113                 sub.itemR(curve, "offset_path_distance", text="Offset Children")
114         
115 class DATA_PT_current_curve(DataButtonsPanel):
116         __label__ = "Current Curve"
117
118         def draw(self, context):
119                 layout = self.layout
120                 currentcurve = context.curve.curves[0] # XXX
121
122                 split = layout.split()
123         
124                 sub = split.column()
125                 sub.itemL(text="Cyclic:")
126                 sub.itemR(currentcurve, "cyclic_u", text="U")
127                 sub.itemR(currentcurve, "cyclic_v", text="V")
128                 sub.itemL(text="Order:")
129                 sub.itemR(currentcurve, "order_u", text="U")
130                 sub.itemR(currentcurve, "order_v", text="V")
131                 sub.itemL(text="Endpoints:")
132                 sub.itemR(currentcurve, "endpoint_u", text="U")
133                 sub.itemR(currentcurve, "endpoint_v", text="V")
134                 
135                 sub = split.column()
136                 sub.itemL(text="Bezier:")
137                 sub.itemR(currentcurve, "bezier_u", text="U")
138                 sub.itemR(currentcurve, "bezier_v", text="V")
139                 sub.itemL(text="Resolution:")
140                 sub.itemR(currentcurve, "resolution_u", text="U")
141                 sub.itemR(currentcurve, "resolution_v", text="V")
142                 sub.itemL(text="Interpolation:")
143                 sub.itemR(currentcurve, "tilt_interpolation", text="Tilt")
144                 sub.itemR(currentcurve, "radius_interpolation", text="Tilt")
145                 sub.itemR(currentcurve, "smooth")
146                 
147 bpy.types.register(DATA_PT_context_curve)
148 bpy.types.register(DATA_PT_shape_curve)
149 bpy.types.register(DATA_PT_geometry_curve)
150 bpy.types.register(DATA_PT_pathanim)
151 bpy.types.register(DATA_PT_current_curve)
152