~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to release/scripts/ui/properties_data_curve.py

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# ##### BEGIN GPL LICENSE BLOCK #####
2
 
#
3
 
#  This program is free software; you can redistribute it and/or
4
 
#  modify it under the terms of the GNU General Public License
5
 
#  as published by the Free Software Foundation; either version 2
6
 
#  of the License, or (at your option) any later version.
7
 
#
8
 
#  This program is distributed in the hope that it will be useful,
9
 
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
#  GNU General Public License for more details.
12
 
#
13
 
#  You should have received a copy of the GNU General Public License
14
 
#  along with this program; if not, write to the Free Software Foundation,
15
 
#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16
 
#
17
 
# ##### END GPL LICENSE BLOCK #####
18
 
 
19
 
# <pep8 compliant>
20
 
import bpy
21
 
from rna_prop_ui import PropertyPanel
22
 
 
23
 
narrowui = bpy.context.user_preferences.view.properties_width_check
24
 
 
25
 
 
26
 
class DataButtonsPanel(bpy.types.Panel):
27
 
    bl_space_type = 'PROPERTIES'
28
 
    bl_region_type = 'WINDOW'
29
 
    bl_context = "data"
30
 
 
31
 
    def poll(self, context):
32
 
        return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
33
 
 
34
 
 
35
 
class DataButtonsPanelCurve(DataButtonsPanel):
36
 
    '''Same as above but for curves only'''
37
 
 
38
 
    def poll(self, context):
39
 
        return (context.object and context.object.type == 'CURVE' and context.curve)
40
 
 
41
 
 
42
 
class DataButtonsPanelActive(DataButtonsPanel):
43
 
    '''Same as above but for curves only'''
44
 
 
45
 
    def poll(self, context):
46
 
        curve = context.curve
47
 
        return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
48
 
 
49
 
 
50
 
class DATA_PT_context_curve(DataButtonsPanel):
51
 
    bl_label = ""
52
 
    bl_show_header = False
53
 
 
54
 
    def draw(self, context):
55
 
        layout = self.layout
56
 
 
57
 
        ob = context.object
58
 
        curve = context.curve
59
 
        space = context.space_data
60
 
        wide_ui = context.region.width > narrowui
61
 
 
62
 
 
63
 
        if wide_ui:
64
 
            split = layout.split(percentage=0.65)
65
 
 
66
 
            if ob:
67
 
                split.template_ID(ob, "data")
68
 
                split.separator()
69
 
            elif curve:
70
 
                split.template_ID(space, "pin_id")
71
 
                split.separator()
72
 
        else:
73
 
            layout.template_ID(ob, "data")
74
 
 
75
 
 
76
 
class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel):
77
 
    _context_path = "object.data"
78
 
 
79
 
 
80
 
class DATA_PT_shape_curve(DataButtonsPanel):
81
 
    bl_label = "Shape"
82
 
 
83
 
    def draw(self, context):
84
 
        layout = self.layout
85
 
 
86
 
        ob = context.object
87
 
        curve = context.curve
88
 
        wide_ui = context.region.width > narrowui
89
 
        is_surf = (ob.type == 'SURFACE')
90
 
        is_curve = (ob.type == 'CURVE')
91
 
        is_text = (ob.type == 'TEXT')
92
 
 
93
 
        if is_curve:
94
 
            row = layout.row()
95
 
            row.prop(curve, "dimensions", expand=True)
96
 
 
97
 
        split = layout.split()
98
 
 
99
 
        col = split.column()
100
 
        col.label(text="Resolution:")
101
 
        sub = col.column(align=True)
102
 
        sub.prop(curve, "resolution_u", text="Preview U")
103
 
        sub.prop(curve, "render_resolution_u", text="Render U")
104
 
        if is_curve:
105
 
            col.label(text="Twisting:")
106
 
            col.prop(curve, "twist_mode", text="")
107
 
            col.prop(curve, "twist_smooth", text="Smooth")
108
 
        if is_text:
109
 
            col.label(text="Display:")
110
 
            col.prop(curve, "fast", text="Fast Editing")
111
 
 
112
 
        if wide_ui:
113
 
            col = split.column()
114
 
 
115
 
        if is_surf:
116
 
            sub = col.column(align=True)
117
 
            sub.label(text="")
118
 
            sub.prop(curve, "resolution_v", text="Preview V")
119
 
            sub.prop(curve, "render_resolution_v", text="Render V")
120
 
 
121
 
        if is_curve or is_text:
122
 
            sub = col.column()
123
 
            sub.label(text="Caps:")
124
 
            sub.prop(curve, "front")
125
 
            sub.prop(curve, "back")
126
 
            sub.prop(curve, "use_deform_fill")
127
 
 
128
 
        col.label(text="Textures:")
129
 
        col.prop(curve, "map_along_length")
130
 
        col.prop(curve, "auto_texspace")
131
 
 
132
 
 
133
 
class DATA_PT_geometry_curve(DataButtonsPanel):
134
 
    bl_label = "Geometry"
135
 
 
136
 
    def poll(self, context):
137
 
        obj = context.object
138
 
        if obj and obj.type == 'SURFACE':
139
 
            return False
140
 
 
141
 
        return context.curve
142
 
 
143
 
    def draw(self, context):
144
 
        layout = self.layout
145
 
 
146
 
        curve = context.curve
147
 
        wide_ui = context.region.width > narrowui
148
 
 
149
 
        split = layout.split()
150
 
 
151
 
        col = split.column()
152
 
        col.label(text="Modification:")
153
 
        col.prop(curve, "width")
154
 
        col.prop(curve, "extrude")
155
 
        col.label(text="Taper Object:")
156
 
        col.prop(curve, "taper_object", text="")
157
 
 
158
 
        if wide_ui:
159
 
            col = split.column()
160
 
        col.label(text="Bevel:")
161
 
        col.prop(curve, "bevel_depth", text="Depth")
162
 
        col.prop(curve, "bevel_resolution", text="Resolution")
163
 
        col.label(text="Bevel Object:")
164
 
        col.prop(curve, "bevel_object", text="")
165
 
 
166
 
 
167
 
class DATA_PT_pathanim(DataButtonsPanelCurve):
168
 
    bl_label = "Path Animation"
169
 
 
170
 
    def draw_header(self, context):
171
 
        curve = context.curve
172
 
 
173
 
        self.layout.prop(curve, "use_path", text="")
174
 
 
175
 
    def draw(self, context):
176
 
        layout = self.layout
177
 
 
178
 
        curve = context.curve
179
 
        wide_ui = context.region.width > narrowui
180
 
 
181
 
        layout.active = curve.use_path
182
 
 
183
 
        col = layout.column()
184
 
        layout.prop(curve, "path_length", text="Frames")
185
 
        layout.prop(curve, "eval_time")
186
 
 
187
 
        split = layout.split()
188
 
 
189
 
        col = split.column()
190
 
        col.prop(curve, "use_path_follow")
191
 
        col.prop(curve, "use_stretch")
192
 
 
193
 
        if wide_ui:
194
 
            col = split.column()
195
 
        col.prop(curve, "use_radius")
196
 
        col.prop(curve, "use_time_offset", text="Offset Children")
197
 
 
198
 
 
199
 
class DATA_PT_active_spline(DataButtonsPanelActive):
200
 
    bl_label = "Active Spline"
201
 
 
202
 
    def draw(self, context):
203
 
        layout = self.layout
204
 
 
205
 
        ob = context.object
206
 
        curve = context.curve
207
 
        act_spline = curve.splines.active
208
 
        is_surf = (ob.type == 'SURFACE')
209
 
        is_poly = (act_spline.type == 'POLY')
210
 
 
211
 
        split = layout.split()
212
 
 
213
 
        if is_poly:
214
 
            # These settings are below but its easier to have
215
 
            # poly's set aside since they use so few settings
216
 
            col = split.column()
217
 
            col.label(text="Cyclic:")
218
 
            col.prop(act_spline, "smooth")
219
 
            col = split.column()
220
 
            col.prop(act_spline, "cyclic_u", text="U")
221
 
 
222
 
        else:
223
 
            col = split.column()
224
 
            col.label(text="Cyclic:")
225
 
            if act_spline.type == 'NURBS':
226
 
                col.label(text="Bezier:")
227
 
                col.label(text="Endpoint:")
228
 
                col.label(text="Order:")
229
 
 
230
 
            col.label(text="Resolution:")
231
 
 
232
 
            col = split.column()
233
 
            col.prop(act_spline, "cyclic_u", text="U")
234
 
 
235
 
            if act_spline.type == 'NURBS':
236
 
                sub = col.column()
237
 
                # sub.active = (not act_spline.cyclic_u)
238
 
                sub.prop(act_spline, "bezier_u", text="U")
239
 
                sub.prop(act_spline, "endpoint_u", text="U")
240
 
 
241
 
                sub = col.column()
242
 
                sub.prop(act_spline, "order_u", text="U")
243
 
            col.prop(act_spline, "resolution_u", text="U")
244
 
 
245
 
            if is_surf:
246
 
                col = split.column()
247
 
                col.prop(act_spline, "cyclic_v", text="V")
248
 
 
249
 
                # its a surface, assume its a nurb.
250
 
                sub = col.column()
251
 
                sub.active = (not act_spline.cyclic_v)
252
 
                sub.prop(act_spline, "bezier_v", text="V")
253
 
                sub.prop(act_spline, "endpoint_v", text="V")
254
 
                sub = col.column()
255
 
                sub.prop(act_spline, "order_v", text="V")
256
 
                sub.prop(act_spline, "resolution_v", text="V")
257
 
 
258
 
            if not is_surf:
259
 
                split = layout.split()
260
 
                col = split.column()
261
 
                col.active = (curve.dimensions == '3D')
262
 
 
263
 
                col.label(text="Interpolation:")
264
 
                col.prop(act_spline, "tilt_interpolation", text="Tilt")
265
 
                col.prop(act_spline, "radius_interpolation", text="Radius")
266
 
 
267
 
            layout.prop(act_spline, "smooth")
268
 
 
269
 
 
270
 
class DATA_PT_font(DataButtonsPanel):
271
 
    bl_label = "Font"
272
 
 
273
 
    def poll(self, context):
274
 
        return (context.object and context.object.type == 'TEXT' and context.curve)
275
 
 
276
 
    def draw(self, context):
277
 
        layout = self.layout
278
 
 
279
 
        text = context.curve
280
 
        char = context.curve.edit_format
281
 
        wide_ui = context.region.width > narrowui
282
 
 
283
 
        layout.template_ID(text, "font", open="font.open", unlink="font.unlink")
284
 
 
285
 
        #if wide_ui:
286
 
        #    layout.prop(text, "font")
287
 
        #else:
288
 
        #    layout.prop(text, "font", text="")
289
 
 
290
 
        split = layout.split()
291
 
 
292
 
        col = split.column()
293
 
        col.prop(text, "text_size", text="Size")
294
 
        if wide_ui:
295
 
            col = split.column()
296
 
        col.prop(text, "shear")
297
 
 
298
 
        split = layout.split()
299
 
 
300
 
        col = split.column()
301
 
        col.label(text="Object Font:")
302
 
        col.prop(text, "family", text="")
303
 
 
304
 
        if wide_ui:
305
 
            col = split.column()
306
 
        col.label(text="Text on Curve:")
307
 
        col.prop(text, "text_on_curve", text="")
308
 
 
309
 
        split = layout.split()
310
 
 
311
 
        col = split.column()
312
 
        colsub = col.column(align=True)
313
 
        colsub.label(text="Underline:")
314
 
        colsub.prop(text, "ul_position", text="Position")
315
 
        colsub.prop(text, "ul_height", text="Thickness")
316
 
 
317
 
        if wide_ui:
318
 
            col = split.column()
319
 
        col.label(text="Character:")
320
 
        col.prop(char, "bold")
321
 
        col.prop(char, "italic")
322
 
        col.prop(char, "underline")
323
 
        
324
 
        split = layout.split()
325
 
        col = split.column()
326
 
        col.prop(text, "small_caps_scale", text="Small Caps")
327
 
        
328
 
        col = split.column()
329
 
        col.prop(char, "use_small_caps")
330
 
 
331
 
 
332
 
class DATA_PT_paragraph(DataButtonsPanel):
333
 
    bl_label = "Paragraph"
334
 
 
335
 
    def poll(self, context):
336
 
        return (context.object and context.object.type == 'TEXT' and context.curve)
337
 
 
338
 
    def draw(self, context):
339
 
        layout = self.layout
340
 
 
341
 
        text = context.curve
342
 
        wide_ui = context.region.width > narrowui
343
 
 
344
 
        layout.label(text="Align:")
345
 
        if wide_ui:
346
 
            layout.prop(text, "spacemode", expand=True)
347
 
        else:
348
 
            layout.prop(text, "spacemode", text="")
349
 
 
350
 
        split = layout.split()
351
 
 
352
 
        col = split.column(align=True)
353
 
        col.label(text="Spacing:")
354
 
        col.prop(text, "spacing", text="Character")
355
 
        col.prop(text, "word_spacing", text="Word")
356
 
        col.prop(text, "line_dist", text="Line")
357
 
 
358
 
        if wide_ui:
359
 
            col = split.column(align=True)
360
 
        col.label(text="Offset:")
361
 
        col.prop(text, "offset_x", text="X")
362
 
        col.prop(text, "offset_y", text="Y")
363
 
 
364
 
 
365
 
class DATA_PT_textboxes(DataButtonsPanel):
366
 
    bl_label = "Text Boxes"
367
 
 
368
 
    def poll(self, context):
369
 
        return (context.object and context.object.type == 'TEXT' and context.curve)
370
 
 
371
 
    def draw(self, context):
372
 
        layout = self.layout
373
 
 
374
 
        text = context.curve
375
 
        wide_ui = context.region.width > narrowui
376
 
 
377
 
        split = layout.split()
378
 
        col = split.column()
379
 
        col.operator("font.textbox_add", icon='ZOOMIN')
380
 
        if wide_ui:
381
 
            col = split.column()
382
 
 
383
 
        for i, box in enumerate(text.textboxes):
384
 
 
385
 
            boxy = layout.box()
386
 
 
387
 
            row = boxy.row()
388
 
 
389
 
            split = row.split()
390
 
 
391
 
            col = split.column(align=True)
392
 
 
393
 
            col.label(text="Dimensions:")
394
 
            col.prop(box, "width", text="Width")
395
 
            col.prop(box, "height", text="Height")
396
 
 
397
 
            if wide_ui:
398
 
                col = split.column(align=True)
399
 
 
400
 
            col.label(text="Offset:")
401
 
            col.prop(box, "x", text="X")
402
 
            col.prop(box, "y", text="Y")
403
 
 
404
 
            row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
405
 
 
406
 
 
407
 
classes = [
408
 
    DATA_PT_context_curve,
409
 
    DATA_PT_shape_curve,
410
 
    DATA_PT_geometry_curve,
411
 
    DATA_PT_pathanim,
412
 
    DATA_PT_active_spline,
413
 
    DATA_PT_font,
414
 
    DATA_PT_paragraph,
415
 
    DATA_PT_textboxes,
416
 
 
417
 
    DATA_PT_custom_props_curve]
418
 
 
419
 
 
420
 
def register():
421
 
    register = bpy.types.register
422
 
    for cls in classes:
423
 
        register(cls)
424
 
 
425
 
 
426
 
def unregister():
427
 
    unregister = bpy.types.unregister
428
 
    for cls in classes:
429
 
        unregister(cls)
430
 
 
431
 
if __name__ == "__main__":
432
 
    register()