eec753e1d041661cb7375a3b387c0f2aa0ffc3b8
[blender.git] / release / scripts / startup / bl_ui / properties_freestyle.py
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 bpy.types import Menu, Panel, UIList
22
23
24 # Render properties
25
26 class RenderFreestyleButtonsPanel():
27     bl_space_type = 'PROPERTIES'
28     bl_region_type = 'WINDOW'
29     bl_context = "render"
30     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
31
32     @classmethod
33     def poll(cls, context):
34         scene = context.scene
35         with_freestyle = bpy.app.build_options.freestyle
36         return scene and with_freestyle and(scene.render.engine in cls.COMPAT_ENGINES)
37
38
39 class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
40     bl_label = "Freestyle"
41     bl_options = {'DEFAULT_CLOSED'}
42     COMPAT_ENGINES = {'BLENDER_RENDER'}
43
44     def draw_header(self, context):
45         rd = context.scene.render
46         self.layout.prop(rd, "use_freestyle", text="")
47
48     def draw(self, context):
49         layout = self.layout
50
51         rd = context.scene.render
52
53         layout.active = rd.use_freestyle
54
55         row = layout.row()
56         row.label(text="Line Thickness:")
57         row.prop(rd, "line_thickness_mode", expand=True)
58
59         if (rd.line_thickness_mode == 'ABSOLUTE'):
60             layout.prop(rd, "line_thickness")
61
62         row = layout.row()
63         row.label(text="Line style settings are found in the Render Layers context")
64         row.operator("wm.properties_context_change", text="", icon='BUTS').context = 'RENDER_LAYER'
65
66
67 # Render layer properties
68
69 class RenderLayerFreestyleButtonsPanel():
70     bl_space_type = 'PROPERTIES'
71     bl_region_type = 'WINDOW'
72     bl_context = "render_layer"
73     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
74
75     @classmethod
76     def poll(cls, context):
77         scene = context.scene
78         rd = context.scene.render
79         with_freestyle = bpy.app.build_options.freestyle
80
81         return (scene and with_freestyle and rd.use_freestyle
82             and rd.layers.active and(scene.render.engine in cls.COMPAT_ENGINES))
83
84
85 class RenderLayerFreestyleEditorButtonsPanel(RenderLayerFreestyleButtonsPanel):
86     # COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
87
88     @classmethod
89     def poll(cls, context):
90         if not super().poll(context):
91             return False
92         rl = context.scene.render.layers.active
93         return rl and rl.freestyle_settings.mode == 'EDITOR'
94
95
96 class RENDERLAYER_UL_linesets(UIList):
97     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
98         lineset = item
99         if self.layout_type in {'DEFAULT', 'COMPACT'}:
100             layout.label(lineset.name, icon_value=icon)
101             layout.prop(lineset, "show_render", text="", index=index)
102         elif self.layout_type in {'GRID'}:
103             layout.alignment = 'CENTER'
104             layout.label("", icon_value=icon)
105
106
107 class RENDER_MT_lineset_specials(Menu):
108     bl_label = "Lineset Specials"
109
110     def draw(self, context):
111         layout = self.layout
112         layout.operator("scene.freestyle_lineset_copy", icon='COPYDOWN')
113         layout.operator("scene.freestyle_lineset_paste", icon='PASTEDOWN')
114
115
116 class RENDERLAYER_PT_freestyle(RenderLayerFreestyleButtonsPanel, Panel):
117     bl_label = "Freestyle"
118     COMPAT_ENGINES = {'BLENDER_RENDER'}
119
120     def draw(self, context):
121         layout = self.layout
122
123         rd = context.scene.render
124         rl = rd.layers.active
125         freestyle = rl.freestyle_settings
126
127         layout.active = rl.use_freestyle
128
129         layout.prop(freestyle, "mode", text="Control mode")
130         layout.label(text="Edge Detection Options:")
131
132         split = layout.split()
133
134         col = split.column()
135         col.prop(freestyle, "crease_angle")
136         col.prop(freestyle, "use_culling")
137         col.prop(freestyle, "use_advanced_options")
138
139         col = split.column()
140         col.prop(freestyle, "use_smoothness")
141         if freestyle.mode == 'SCRIPT':
142             col.prop(freestyle, "use_material_boundaries")
143
144         # Advanced options are hidden by default to warn new users
145         if freestyle.use_advanced_options:
146             if freestyle.mode == 'SCRIPT':
147                 row = layout.row()
148                 row.prop(freestyle, "use_ridges_and_valleys")
149                 row.prop(freestyle, "use_suggestive_contours")
150             row = layout.row()
151             row.prop(freestyle, "sphere_radius")
152             row.prop(freestyle, "kr_derivative_epsilon")
153
154         if freestyle.mode == 'SCRIPT':
155             row = layout.row()
156             row.label("Style modules:")
157             row.operator("scene.freestyle_module_add", text="Add")
158             for i, module in enumerate(freestyle.modules):
159                 box = layout.box()
160                 box.context_pointer_set("freestyle_module", module)
161                 row = box.row(align=True)
162                 row.prop(module, "use", text="")
163                 row.prop(module, "script", text="")
164                 row.operator("scene.freestyle_module_open", icon='FILESEL', text="")
165                 row.operator("scene.freestyle_module_remove", icon='X', text="")
166                 row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
167                 row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
168
169
170 class RENDERLAYER_PT_freestyle_lineset(RenderLayerFreestyleEditorButtonsPanel, Panel):
171     bl_label = "Freestyle Line Set"
172     COMPAT_ENGINES = {'BLENDER_RENDER'}
173
174     def draw_edge_type_buttons(self, box, lineset, edge_type):
175         # property names
176         select_edge_type = "select_" + edge_type
177         exclude_edge_type = "exclude_" + edge_type
178         # draw edge type buttons
179         row = box.row(align=True)
180         row.prop(lineset, select_edge_type)
181         sub = row.column()
182         sub.prop(lineset, exclude_edge_type, text="")
183         sub.active = getattr(lineset, select_edge_type)
184
185     def draw(self, context):
186         layout = self.layout
187
188         rd = context.scene.render
189         rl = rd.layers.active
190         freestyle = rl.freestyle_settings
191         lineset = freestyle.linesets.active
192
193         layout.active = rl.use_freestyle
194
195         row = layout.row()
196         rows = 5 if lineset else 2
197         row.template_list("RENDERLAYER_UL_linesets", "", freestyle, "linesets", freestyle.linesets, "active_index", rows=rows)
198
199         sub = row.column(align=True)
200         sub.operator("scene.freestyle_lineset_add", icon='ZOOMIN', text="")
201         sub.operator("scene.freestyle_lineset_remove", icon='ZOOMOUT', text="")
202         sub.menu("RENDER_MT_lineset_specials", icon='DOWNARROW_HLT', text="")
203         if lineset:
204             sub.separator()
205             sub.separator()
206             sub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
207             sub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
208
209             layout.prop(lineset, "name")
210
211             col = layout.column()
212             col.label(text="Selection By:")
213             row = col.row(align=True)
214             row.prop(lineset, "select_by_visibility", text="Visibility", toggle=True)
215             row.prop(lineset, "select_by_edge_types", text="Edge Types", toggle=True)
216             row.prop(lineset, "select_by_face_marks", text="Face Marks", toggle=True)
217             row.prop(lineset, "select_by_group", text="Group", toggle=True)
218             row.prop(lineset, "select_by_image_border", text="Image Border", toggle=True)
219
220             if lineset.select_by_visibility:
221                 col.label(text="Visibility:")
222                 row = col.row(align=True)
223                 row.prop(lineset, "visibility", expand=True)
224                 if lineset.visibility == 'RANGE':
225                     row = col.row(align=True)
226                     row.prop(lineset, "qi_start")
227                     row.prop(lineset, "qi_end")
228
229             if lineset.select_by_edge_types:
230                 col.label(text="Edge Types:")
231                 row = col.row()
232                 row.prop(lineset, "edge_type_negation", expand=True)
233                 row.prop(lineset, "edge_type_combination", expand=True)
234
235                 split = col.split()
236
237                 sub = split.column()
238                 self.draw_edge_type_buttons(sub, lineset, "silhouette")
239                 self.draw_edge_type_buttons(sub, lineset, "border")
240                 self.draw_edge_type_buttons(sub, lineset, "contour")
241                 self.draw_edge_type_buttons(sub, lineset, "suggestive_contour")
242                 self.draw_edge_type_buttons(sub, lineset, "ridge_valley")
243
244                 sub = split.column()
245                 self.draw_edge_type_buttons(sub, lineset, "crease")
246                 self.draw_edge_type_buttons(sub, lineset, "edge_mark")
247                 self.draw_edge_type_buttons(sub, lineset, "external_contour")
248                 self.draw_edge_type_buttons(sub, lineset, "material_boundary")
249
250             if lineset.select_by_face_marks:
251                 col.label(text="Face Marks:")
252                 row = col.row()
253                 row.prop(lineset, "face_mark_negation", expand=True)
254                 row.prop(lineset, "face_mark_condition", expand=True)
255
256             if lineset.select_by_group:
257                 col.label(text="Group:")
258                 row = col.row()
259                 row.prop(lineset, "group", text="")
260                 row.prop(lineset, "group_negation", expand=True)
261
262
263 class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel, Panel):
264     bl_label = "Freestyle Line Style"
265     bl_options = {'DEFAULT_CLOSED'}
266     COMPAT_ENGINES = {'BLENDER_RENDER'}
267
268     def draw_modifier_box_header(self, box, modifier):
269         row = box.row()
270         row.context_pointer_set("modifier", modifier)
271         if modifier.expanded:
272             icon = 'TRIA_DOWN'
273         else:
274             icon = 'TRIA_RIGHT'
275         row.prop(modifier, "expanded", text="", icon=icon, emboss=False)
276         # TODO: Use icons rather than text label, would save some room!
277         row.label(text=modifier.rna_type.name)
278         row.prop(modifier, "name", text="")
279         if modifier.use:
280             icon = 'RESTRICT_RENDER_OFF'
281         else:
282             icon = 'RESTRICT_RENDER_ON'
283         row.prop(modifier, "use", text="", icon=icon)
284         sub = row.row(align=True)
285         sub.operator("scene.freestyle_modifier_copy", icon='NONE', text="Copy")
286         sub.operator("scene.freestyle_modifier_move", icon='TRIA_UP', text="").direction = 'UP'
287         sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
288         sub.operator("scene.freestyle_modifier_remove", icon='X', text="")
289
290     def draw_modifier_common(self, box, modifier):
291         row = box.row()
292         row.prop(modifier, "blend", text="")
293         row.prop(modifier, "influence")
294
295     def draw_modifier_color_ramp_common(self, box, modifier, has_range):
296         box.template_color_ramp(modifier, "color_ramp", expand=True)
297         if has_range:
298             row = box.row(align=True)
299             row.prop(modifier, "range_min")
300             row.prop(modifier, "range_max")
301
302     def draw_modifier_curve_common(self, box, modifier, has_range, has_value):
303         row = box.row()
304         row.prop(modifier, "mapping", text="")
305         sub = row.column()
306         sub.prop(modifier, "invert")
307         if modifier.mapping == 'CURVE':
308             sub.active = False
309             box.template_curve_mapping(modifier, "curve")
310         if has_range:
311             row = box.row(align=True)
312             row.prop(modifier, "range_min")
313             row.prop(modifier, "range_max")
314         if has_value:
315             row = box.row(align=True)
316             row.prop(modifier, "value_min")
317             row.prop(modifier, "value_max")
318
319     def draw_color_modifier(self, context, modifier):
320         layout = self.layout
321
322         col = layout.column(align=True)
323         self.draw_modifier_box_header(col.box(), modifier)
324         if modifier.expanded:
325             box = col.box()
326             self.draw_modifier_common(box, modifier)
327
328             if modifier.type == 'ALONG_STROKE':
329                 self.draw_modifier_color_ramp_common(box, modifier, False)
330
331             elif modifier.type == 'DISTANCE_FROM_OBJECT':
332                 box.prop(modifier, "target")
333                 self.draw_modifier_color_ramp_common(box, modifier, True)
334                 prop = box.operator("scene.freestyle_fill_range_by_selection")
335                 prop.type = 'COLOR'
336                 prop.name = modifier.name
337
338             elif modifier.type == 'DISTANCE_FROM_CAMERA':
339                 self.draw_modifier_color_ramp_common(box, modifier, True)
340                 prop = box.operator("scene.freestyle_fill_range_by_selection")
341                 prop.type = 'COLOR'
342                 prop.name = modifier.name
343
344             elif modifier.type == 'MATERIAL':
345                 row = box.row()
346                 row.prop(modifier, "material_attribute", text="")
347                 sub = row.column()
348                 sub.prop(modifier, "use_ramp")
349                 if modifier.material_attribute in {'DIFF', 'SPEC'}:
350                     sub.active = True
351                     show_ramp = modifier.use_ramp
352                 else:
353                     sub.active = False
354                     show_ramp = True
355                 if show_ramp:
356                     self.draw_modifier_color_ramp_common(box, modifier, False)
357
358     def draw_alpha_modifier(self, context, modifier):
359         layout = self.layout
360
361         col = layout.column(align=True)
362         self.draw_modifier_box_header(col.box(), modifier)
363         if modifier.expanded:
364             box = col.box()
365             self.draw_modifier_common(box, modifier)
366
367             if modifier.type == 'ALONG_STROKE':
368                 self.draw_modifier_curve_common(box, modifier, False, False)
369
370             elif modifier.type == 'DISTANCE_FROM_OBJECT':
371                 box.prop(modifier, "target")
372                 self.draw_modifier_curve_common(box, modifier, True, False)
373                 prop = box.operator("scene.freestyle_fill_range_by_selection")
374                 prop.type = 'ALPHA'
375                 prop.name = modifier.name
376
377             elif modifier.type == 'DISTANCE_FROM_CAMERA':
378                 self.draw_modifier_curve_common(box, modifier, True, False)
379                 prop = box.operator("scene.freestyle_fill_range_by_selection")
380                 prop.type = 'ALPHA'
381                 prop.name = modifier.name
382
383             elif modifier.type == 'MATERIAL':
384                 box.prop(modifier, "material_attribute", text="")
385                 self.draw_modifier_curve_common(box, modifier, False, False)
386
387     def draw_thickness_modifier(self, context, modifier):
388         layout = self.layout
389
390         col = layout.column(align=True)
391         self.draw_modifier_box_header(col.box(), modifier)
392         if modifier.expanded:
393             box = col.box()
394             self.draw_modifier_common(box, modifier)
395
396             if modifier.type == 'ALONG_STROKE':
397                 self.draw_modifier_curve_common(box, modifier, False, True)
398
399             elif modifier.type == 'DISTANCE_FROM_OBJECT':
400                 box.prop(modifier, "target")
401                 self.draw_modifier_curve_common(box, modifier, True, True)
402                 prop = box.operator("scene.freestyle_fill_range_by_selection")
403                 prop.type = 'THICKNESS'
404                 prop.name = modifier.name
405
406             elif modifier.type == 'DISTANCE_FROM_CAMERA':
407                 self.draw_modifier_curve_common(box, modifier, True, True)
408                 prop = box.operator("scene.freestyle_fill_range_by_selection")
409                 prop.type = 'THICKNESS'
410                 prop.name = modifier.name
411
412             elif modifier.type == 'MATERIAL':
413                 box.prop(modifier, "material_attribute", text="")
414                 self.draw_modifier_curve_common(box, modifier, False, True)
415
416             elif modifier.type == 'CALLIGRAPHY':
417                 box.prop(modifier, "orientation")
418                 row = box.row(align=True)
419                 row.prop(modifier, "thickness_min")
420                 row.prop(modifier, "thickness_max")
421
422     def draw_geometry_modifier(self, context, modifier):
423         layout = self.layout
424
425         col = layout.column(align=True)
426         self.draw_modifier_box_header(col.box(), modifier)
427         if modifier.expanded:
428             box = col.box()
429
430             if modifier.type == 'SAMPLING':
431                 box.prop(modifier, "sampling")
432
433             elif modifier.type == 'BEZIER_CURVE':
434                 box.prop(modifier, "error")
435
436             elif modifier.type == 'SINUS_DISPLACEMENT':
437                 split = box.split()
438                 col = split.column()
439                 col.prop(modifier, "wavelength")
440                 col.prop(modifier, "amplitude")
441                 col = split.column()
442                 col.prop(modifier, "phase")
443
444             elif modifier.type == 'SPATIAL_NOISE':
445                 split = box.split()
446                 col = split.column()
447                 col.prop(modifier, "amplitude")
448                 col.prop(modifier, "scale")
449                 col.prop(modifier, "octaves")
450                 col = split.column()
451                 col.prop(modifier, "smooth")
452                 col.prop(modifier, "use_pure_random")
453
454             elif modifier.type == 'PERLIN_NOISE_1D':
455                 split = box.split()
456                 col = split.column()
457                 col.prop(modifier, "frequency")
458                 col.prop(modifier, "amplitude")
459                 col.prop(modifier, "seed")
460                 col = split.column()
461                 col.prop(modifier, "octaves")
462                 col.prop(modifier, "angle")
463
464             elif modifier.type == 'PERLIN_NOISE_2D':
465                 split = box.split()
466                 col = split.column()
467                 col.prop(modifier, "frequency")
468                 col.prop(modifier, "amplitude")
469                 col.prop(modifier, "seed")
470                 col = split.column()
471                 col.prop(modifier, "octaves")
472                 col.prop(modifier, "angle")
473
474             elif modifier.type == 'BACKBONE_STRETCHER':
475                 box.prop(modifier, "backbone_length")
476
477             elif modifier.type == 'TIP_REMOVER':
478                 box.prop(modifier, "tip_length")
479
480             elif modifier.type == 'POLYGONIZATION':
481                 box.prop(modifier, "error")
482
483             elif modifier.type == 'GUIDING_LINES':
484                 box.prop(modifier, "offset")
485
486             elif modifier.type == 'BLUEPRINT':
487                 row = box.row()
488                 row.prop(modifier, "shape", expand=True)
489                 box.prop(modifier, "rounds")
490                 row = box.row()
491                 if modifier.shape in {'CIRCLES', 'ELLIPSES'}:
492                     row.prop(modifier, "random_radius")
493                     row.prop(modifier, "random_center")
494                 elif modifier.shape == 'SQUARES':
495                     row.prop(modifier, "backbone_length")
496                     row.prop(modifier, "random_backbone")
497
498             elif modifier.type == '2D_OFFSET':
499                 row = box.row(align=True)
500                 row.prop(modifier, "start")
501                 row.prop(modifier, "end")
502                 row = box.row(align=True)
503                 row.prop(modifier, "x")
504                 row.prop(modifier, "y")
505
506             elif modifier.type == '2D_TRANSFORM':
507                 box.prop(modifier, "pivot")
508                 if modifier.pivot == 'PARAM':
509                     box.prop(modifier, "pivot_u")
510                 elif modifier.pivot == 'ABSOLUTE':
511                     row = box.row(align=True)
512                     row.prop(modifier, "pivot_x")
513                     row.prop(modifier, "pivot_y")
514                 row = box.row(align=True)
515                 row.prop(modifier, "scale_x")
516                 row.prop(modifier, "scale_y")
517                 box.prop(modifier, "angle")
518
519     def draw(self, context):
520         layout = self.layout
521
522         rd = context.scene.render
523         rl = rd.layers.active
524         lineset = rl.freestyle_settings.linesets.active
525
526         layout.active = rl.use_freestyle
527
528         if lineset is None:
529             return
530         linestyle = lineset.linestyle
531
532         layout.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
533         row = layout.row(align=True)
534         row.prop(linestyle, "panel", expand=True)
535         if linestyle.panel == 'STROKES':
536             ## Chaining
537             layout.label(text="Chaining:")
538             split = layout.split(align=True)
539             # First column
540             col = split.column()
541             col.prop(linestyle, "use_chaining", text="Enable Chaining")
542             sub = col.row()
543             sub.active = linestyle.use_chaining
544             sub.prop(linestyle, "use_same_object")
545             # Second column
546             col = split.column()
547             col.active = linestyle.use_chaining
548             col.prop(linestyle, "chaining", text="")
549             if linestyle.chaining == 'SKETCHY':
550                 col.prop(linestyle, "rounds")
551
552             ## Splitting
553             layout.label(text="Splitting:")
554             split = layout.split(align=True)
555             # First column
556             col = split.column()
557             row = col.row(align=True)
558             row.prop(linestyle, "use_angle_min", text="")
559             sub = row.row()
560             sub.active = linestyle.use_angle_min
561             sub.prop(linestyle, "angle_min")
562             row = col.row(align=True)
563             row.prop(linestyle, "use_angle_max", text="")
564             sub = row.row()
565             sub.active = linestyle.use_angle_max
566             sub.prop(linestyle, "angle_max")
567             # Second column
568             col = split.column()
569             row = col.row(align=True)
570             row.prop(linestyle, "use_split_length", text="")
571             sub = row.row()
572             sub.active = linestyle.use_split_length
573             sub.prop(linestyle, "split_length", text="2D Length")
574             row = col.row(align=True)
575             row.prop(linestyle, "material_boundary")
576             # End of columns
577             row = layout.row(align=True)
578             row.prop(linestyle, "use_split_pattern", text="")
579             sub = row.row()
580             sub.active = linestyle.use_split_pattern
581             sub.prop(linestyle, "split_dash1", text="D1")
582             sub.prop(linestyle, "split_gap1", text="G1")
583             sub.prop(linestyle, "split_dash2", text="D2")
584             sub.prop(linestyle, "split_gap2", text="G2")
585             sub.prop(linestyle, "split_dash3", text="D3")
586             sub.prop(linestyle, "split_gap3", text="G3")
587
588             ## Selection
589             layout.label(text="Selection:")
590             split = layout.split(align=True)
591             # First column
592             col = split.column()
593             row = col.row(align=True)
594             row.prop(linestyle, "use_length_min", text="")
595             sub = row.row()
596             sub.active = linestyle.use_length_min
597             sub.prop(linestyle, "length_min")
598             # Second column
599             col = split.column()
600             row = col.row(align=True)
601             row.prop(linestyle, "use_length_max", text="")
602             sub = row.row()
603             sub.active = linestyle.use_length_max
604             sub.prop(linestyle, "length_max")
605
606             ## Caps
607             layout.label(text="Caps:")
608             row = layout.row(align=True)
609             row.prop(linestyle, "caps", expand=True)
610
611             ## Dashed lines
612             layout.label(text="Dashed Line:")
613             row = layout.row(align=True)
614             row.prop(linestyle, "use_dashed_line", text="")
615             sub = row.row()
616             sub.active = linestyle.use_dashed_line
617             sub.prop(linestyle, "dash1", text="D1")
618             sub.prop(linestyle, "gap1", text="G1")
619             sub.prop(linestyle, "dash2", text="D2")
620             sub.prop(linestyle, "gap2", text="G2")
621             sub.prop(linestyle, "dash3", text="D3")
622             sub.prop(linestyle, "gap3", text="G3")
623
624         elif linestyle.panel == 'COLOR':
625             col = layout.column()
626             row = col.row()
627             row.label(text="Base Color:")
628             row.prop(linestyle, "color", text="")
629             col.label(text="Modifiers:")
630             col.operator_menu_enum("scene.freestyle_color_modifier_add", "type", text="Add Modifier")
631             for modifier in linestyle.color_modifiers:
632                 self.draw_color_modifier(context, modifier)
633
634         elif linestyle.panel == 'ALPHA':
635             col = layout.column()
636             row = col.row()
637             row.label(text="Base Transparency:")
638             row.prop(linestyle, "alpha")
639             col.label(text="Modifiers:")
640             col.operator_menu_enum("scene.freestyle_alpha_modifier_add", "type", text="Add Modifier")
641             for modifier in linestyle.alpha_modifiers:
642                 self.draw_alpha_modifier(context, modifier)
643
644         elif linestyle.panel == 'THICKNESS':
645             col = layout.column()
646             row = col.row()
647             row.label(text="Base Thickness:")
648             row.prop(linestyle, "thickness")
649             row = col.row()
650             row.prop(linestyle, "thickness_position", expand=True)
651             row = col.row()
652             row.prop(linestyle, "thickness_ratio")
653             row.active = (linestyle.thickness_position == 'RELATIVE')
654             col = layout.column()
655             col.label(text="Modifiers:")
656             col.operator_menu_enum("scene.freestyle_thickness_modifier_add", "type", text="Add Modifier")
657             for modifier in linestyle.thickness_modifiers:
658                 self.draw_thickness_modifier(context, modifier)
659
660         elif linestyle.panel == 'GEOMETRY':
661             col = layout.column()
662             col.label(text="Modifiers:")
663             col.operator_menu_enum("scene.freestyle_geometry_modifier_add", "type", text="Add Modifier")
664             for modifier in linestyle.geometry_modifiers:
665                 self.draw_geometry_modifier(context, modifier)
666
667         elif linestyle.panel == 'MISC':
668             pass
669
670
671 if __name__ == "__main__":  # only for live edit.
672     bpy.utils.register_module(__name__)