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