1
# ##### BEGIN GPL LICENSE BLOCK #####
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.
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.
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.
17
# ##### END GPL LICENSE BLOCK #####
21
from rna_prop_ui import PropertyPanel
23
narrowui = bpy.context.user_preferences.view.properties_width_check
26
class DataButtonsPanel(bpy.types.Panel):
27
bl_space_type = 'PROPERTIES'
28
bl_region_type = 'WINDOW'
31
def poll(self, context):
32
return (context.object and context.object.type in ('CURVE', 'SURFACE', 'TEXT') and context.curve)
35
class DataButtonsPanelCurve(DataButtonsPanel):
36
'''Same as above but for curves only'''
38
def poll(self, context):
39
return (context.object and context.object.type == 'CURVE' and context.curve)
42
class DataButtonsPanelActive(DataButtonsPanel):
43
'''Same as above but for curves only'''
45
def poll(self, context):
47
return (curve and type(curve) is not bpy.types.TextCurve and curve.splines.active)
50
class DATA_PT_context_curve(DataButtonsPanel):
52
bl_show_header = False
54
def draw(self, context):
59
space = context.space_data
60
wide_ui = context.region.width > narrowui
64
split = layout.split(percentage=0.65)
67
split.template_ID(ob, "data")
70
split.template_ID(space, "pin_id")
73
layout.template_ID(ob, "data")
76
class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel):
77
_context_path = "object.data"
80
class DATA_PT_shape_curve(DataButtonsPanel):
83
def draw(self, context):
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')
95
row.prop(curve, "dimensions", expand=True)
97
split = layout.split()
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")
105
col.label(text="Twisting:")
106
col.prop(curve, "twist_mode", text="")
107
col.prop(curve, "twist_smooth", text="Smooth")
109
col.label(text="Display:")
110
col.prop(curve, "fast", text="Fast Editing")
116
sub = col.column(align=True)
118
sub.prop(curve, "resolution_v", text="Preview V")
119
sub.prop(curve, "render_resolution_v", text="Render V")
121
if is_curve or is_text:
123
sub.label(text="Caps:")
124
sub.prop(curve, "front")
125
sub.prop(curve, "back")
126
sub.prop(curve, "use_deform_fill")
128
col.label(text="Textures:")
129
col.prop(curve, "map_along_length")
130
col.prop(curve, "auto_texspace")
133
class DATA_PT_geometry_curve(DataButtonsPanel):
134
bl_label = "Geometry"
136
def poll(self, context):
138
if obj and obj.type == 'SURFACE':
143
def draw(self, context):
146
curve = context.curve
147
wide_ui = context.region.width > narrowui
149
split = layout.split()
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="")
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="")
167
class DATA_PT_pathanim(DataButtonsPanelCurve):
168
bl_label = "Path Animation"
170
def draw_header(self, context):
171
curve = context.curve
173
self.layout.prop(curve, "use_path", text="")
175
def draw(self, context):
178
curve = context.curve
179
wide_ui = context.region.width > narrowui
181
layout.active = curve.use_path
183
col = layout.column()
184
layout.prop(curve, "path_length", text="Frames")
185
layout.prop(curve, "eval_time")
187
split = layout.split()
190
col.prop(curve, "use_path_follow")
191
col.prop(curve, "use_stretch")
195
col.prop(curve, "use_radius")
196
col.prop(curve, "use_time_offset", text="Offset Children")
199
class DATA_PT_active_spline(DataButtonsPanelActive):
200
bl_label = "Active Spline"
202
def draw(self, context):
206
curve = context.curve
207
act_spline = curve.splines.active
208
is_surf = (ob.type == 'SURFACE')
209
is_poly = (act_spline.type == 'POLY')
211
split = layout.split()
214
# These settings are below but its easier to have
215
# poly's set aside since they use so few settings
217
col.label(text="Cyclic:")
218
col.prop(act_spline, "smooth")
220
col.prop(act_spline, "cyclic_u", text="U")
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:")
230
col.label(text="Resolution:")
233
col.prop(act_spline, "cyclic_u", text="U")
235
if act_spline.type == 'NURBS':
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")
242
sub.prop(act_spline, "order_u", text="U")
243
col.prop(act_spline, "resolution_u", text="U")
247
col.prop(act_spline, "cyclic_v", text="V")
249
# its a surface, assume its a nurb.
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")
255
sub.prop(act_spline, "order_v", text="V")
256
sub.prop(act_spline, "resolution_v", text="V")
259
split = layout.split()
261
col.active = (curve.dimensions == '3D')
263
col.label(text="Interpolation:")
264
col.prop(act_spline, "tilt_interpolation", text="Tilt")
265
col.prop(act_spline, "radius_interpolation", text="Radius")
267
layout.prop(act_spline, "smooth")
270
class DATA_PT_font(DataButtonsPanel):
273
def poll(self, context):
274
return (context.object and context.object.type == 'TEXT' and context.curve)
276
def draw(self, context):
280
char = context.curve.edit_format
281
wide_ui = context.region.width > narrowui
283
layout.template_ID(text, "font", open="font.open", unlink="font.unlink")
286
# layout.prop(text, "font")
288
# layout.prop(text, "font", text="")
290
split = layout.split()
293
col.prop(text, "text_size", text="Size")
296
col.prop(text, "shear")
298
split = layout.split()
301
col.label(text="Object Font:")
302
col.prop(text, "family", text="")
306
col.label(text="Text on Curve:")
307
col.prop(text, "text_on_curve", text="")
309
split = layout.split()
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")
319
col.label(text="Character:")
320
col.prop(char, "bold")
321
col.prop(char, "italic")
322
col.prop(char, "underline")
324
split = layout.split()
326
col.prop(text, "small_caps_scale", text="Small Caps")
329
col.prop(char, "use_small_caps")
332
class DATA_PT_paragraph(DataButtonsPanel):
333
bl_label = "Paragraph"
335
def poll(self, context):
336
return (context.object and context.object.type == 'TEXT' and context.curve)
338
def draw(self, context):
342
wide_ui = context.region.width > narrowui
344
layout.label(text="Align:")
346
layout.prop(text, "spacemode", expand=True)
348
layout.prop(text, "spacemode", text="")
350
split = layout.split()
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")
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")
365
class DATA_PT_textboxes(DataButtonsPanel):
366
bl_label = "Text Boxes"
368
def poll(self, context):
369
return (context.object and context.object.type == 'TEXT' and context.curve)
371
def draw(self, context):
375
wide_ui = context.region.width > narrowui
377
split = layout.split()
379
col.operator("font.textbox_add", icon='ZOOMIN')
383
for i, box in enumerate(text.textboxes):
391
col = split.column(align=True)
393
col.label(text="Dimensions:")
394
col.prop(box, "width", text="Width")
395
col.prop(box, "height", text="Height")
398
col = split.column(align=True)
400
col.label(text="Offset:")
401
col.prop(box, "x", text="X")
402
col.prop(box, "y", text="Y")
404
row.operator("font.textbox_remove", text='', icon='X', emboss=False).index = i
408
DATA_PT_context_curve,
410
DATA_PT_geometry_curve,
412
DATA_PT_active_spline,
417
DATA_PT_custom_props_curve]
421
register = bpy.types.register
427
unregister = bpy.types.unregister
431
if __name__ == "__main__":