197b0d2f9705a974778ee3b162b20b406e23299b
[blender-staging.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 in the Render Layers tab")
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.prop(lineset, "name", text="", emboss=False, 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(align=True)
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 = 4 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             col = layout.column()
210             col.label(text="Selection By:")
211             row = col.row(align=True)
212             row.prop(lineset, "select_by_visibility", text="Visibility", toggle=True)
213             row.prop(lineset, "select_by_edge_types", text="Edge Types", toggle=True)
214             row.prop(lineset, "select_by_face_marks", text="Face Marks", toggle=True)
215             row.prop(lineset, "select_by_group", text="Group", toggle=True)
216             row.prop(lineset, "select_by_image_border", text="Image Border", toggle=True)
217
218             if lineset.select_by_visibility:
219                 col.label(text="Visibility:")
220                 row = col.row(align=True)
221                 row.prop(lineset, "visibility", expand=True)
222                 if lineset.visibility == 'RANGE':
223                     row = col.row(align=True)
224                     row.prop(lineset, "qi_start")
225                     row.prop(lineset, "qi_end")
226
227             if lineset.select_by_edge_types:
228                 col.label(text="Edge Types:")
229                 row = col.row()
230                 row.prop(lineset, "edge_type_negation", expand=True)
231                 row.prop(lineset, "edge_type_combination", expand=True)
232
233                 split = col.split()
234
235                 sub = split.column()
236                 self.draw_edge_type_buttons(sub, lineset, "silhouette")
237                 self.draw_edge_type_buttons(sub, lineset, "border")
238                 self.draw_edge_type_buttons(sub, lineset, "contour")
239                 self.draw_edge_type_buttons(sub, lineset, "suggestive_contour")
240                 self.draw_edge_type_buttons(sub, lineset, "ridge_valley")
241
242                 sub = split.column()
243                 self.draw_edge_type_buttons(sub, lineset, "crease")
244                 self.draw_edge_type_buttons(sub, lineset, "edge_mark")
245                 self.draw_edge_type_buttons(sub, lineset, "external_contour")
246                 self.draw_edge_type_buttons(sub, lineset, "material_boundary")
247
248             if lineset.select_by_face_marks:
249                 col.label(text="Face Marks:")
250                 row = col.row()
251                 row.prop(lineset, "face_mark_negation", expand=True)
252                 row.prop(lineset, "face_mark_condition", expand=True)
253
254             if lineset.select_by_group:
255                 col.label(text="Group:")
256                 row = col.row()
257                 row.prop(lineset, "group", text="")
258                 row.prop(lineset, "group_negation", expand=True)
259
260
261 class RENDERLAYER_PT_freestyle_linestyle(RenderLayerFreestyleEditorButtonsPanel, Panel):
262     bl_label = "Freestyle Line Style"
263     bl_options = {'DEFAULT_CLOSED'}
264     COMPAT_ENGINES = {'BLENDER_RENDER'}
265
266     def draw_modifier_box_header(self, box, modifier):
267         row = box.row()
268         row.context_pointer_set("modifier", modifier)
269         if modifier.expanded:
270             icon = 'TRIA_DOWN'
271         else:
272             icon = 'TRIA_RIGHT'
273         row.prop(modifier, "expanded", text="", icon=icon, emboss=False)
274         # TODO: Use icons rather than text label, would save some room!
275         row.label(text=modifier.rna_type.name)
276         row.prop(modifier, "name", text="")
277         if modifier.use:
278             icon = 'RESTRICT_RENDER_OFF'
279         else:
280             icon = 'RESTRICT_RENDER_ON'
281         row.prop(modifier, "use", text="", icon=icon)
282         sub = row.row(align=True)
283         sub.operator("scene.freestyle_modifier_copy", icon='NONE', text="Copy")
284         sub.operator("scene.freestyle_modifier_move", icon='TRIA_UP', text="").direction = 'UP'
285         sub.operator("scene.freestyle_modifier_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
286         sub.operator("scene.freestyle_modifier_remove", icon='X', text="")
287
288     def draw_modifier_common(self, box, modifier):
289         row = box.row()
290         row.prop(modifier, "blend", text="")
291         row.prop(modifier, "influence")
292
293     def draw_modifier_color_ramp_common(self, box, modifier, has_range):
294         box.template_color_ramp(modifier, "color_ramp", expand=True)
295         if has_range:
296             row = box.row(align=True)
297             row.prop(modifier, "range_min")
298             row.prop(modifier, "range_max")
299
300     def draw_modifier_curve_common(self, box, modifier, has_range, has_value):
301         row = box.row()
302         row.prop(modifier, "mapping", text="")
303         sub = row.column()
304         sub.prop(modifier, "invert")
305         if modifier.mapping == 'CURVE':
306             sub.active = False
307             box.template_curve_mapping(modifier, "curve")
308         if has_range:
309             row = box.row(align=True)
310             row.prop(modifier, "range_min")
311             row.prop(modifier, "range_max")
312         if has_value:
313             row = box.row(align=True)
314             row.prop(modifier, "value_min")
315             row.prop(modifier, "value_max")
316
317     def draw_color_modifier(self, context, modifier):
318         layout = self.layout
319
320         col = layout.column(align=True)
321         self.draw_modifier_box_header(col.box(), modifier)
322         if modifier.expanded:
323             box = col.box()
324             self.draw_modifier_common(box, modifier)
325
326             if modifier.type == 'ALONG_STROKE':
327                 self.draw_modifier_color_ramp_common(box, modifier, False)
328
329             elif modifier.type == 'DISTANCE_FROM_OBJECT':
330                 box.prop(modifier, "target")
331                 self.draw_modifier_color_ramp_common(box, modifier, True)
332                 prop = box.operator("scene.freestyle_fill_range_by_selection")
333                 prop.type = 'COLOR'
334                 prop.name = modifier.name
335
336             elif modifier.type == 'DISTANCE_FROM_CAMERA':
337                 self.draw_modifier_color_ramp_common(box, modifier, True)
338                 prop = box.operator("scene.freestyle_fill_range_by_selection")
339                 prop.type = 'COLOR'
340                 prop.name = modifier.name
341
342             elif modifier.type == 'MATERIAL':
343                 row = box.row()
344                 row.prop(modifier, "material_attribute", text="")
345                 sub = row.column()
346                 sub.prop(modifier, "use_ramp")
347                 if modifier.material_attribute in {'DIFF', 'SPEC'}:
348                     sub.active = True
349                     show_ramp = modifier.use_ramp
350                 else:
351                     sub.active = False
352                     show_ramp = True
353                 if show_ramp:
354                     self.draw_modifier_color_ramp_common(box, modifier, False)
355
356     def draw_alpha_modifier(self, context, modifier):
357         layout = self.layout
358
359         col = layout.column(align=True)
360         self.draw_modifier_box_header(col.box(), modifier)
361         if modifier.expanded:
362             box = col.box()
363             self.draw_modifier_common(box, modifier)
364
365             if modifier.type == 'ALONG_STROKE':
366                 self.draw_modifier_curve_common(box, modifier, False, False)
367
368             elif modifier.type == 'DISTANCE_FROM_OBJECT':
369                 box.prop(modifier, "target")
370                 self.draw_modifier_curve_common(box, modifier, True, False)
371                 prop = box.operator("scene.freestyle_fill_range_by_selection")
372                 prop.type = 'ALPHA'
373                 prop.name = modifier.name
374
375             elif modifier.type == 'DISTANCE_FROM_CAMERA':
376                 self.draw_modifier_curve_common(box, modifier, True, False)
377                 prop = box.operator("scene.freestyle_fill_range_by_selection")
378                 prop.type = 'ALPHA'
379                 prop.name = modifier.name
380
381             elif modifier.type == 'MATERIAL':
382                 box.prop(modifier, "material_attribute", text="")
383                 self.draw_modifier_curve_common(box, modifier, False, False)
384
385     def draw_thickness_modifier(self, context, modifier):
386         layout = self.layout
387
388         col = layout.column(align=True)
389         self.draw_modifier_box_header(col.box(), modifier)
390         if modifier.expanded:
391             box = col.box()
392             self.draw_modifier_common(box, modifier)
393
394             if modifier.type == 'ALONG_STROKE':
395                 self.draw_modifier_curve_common(box, modifier, False, True)
396
397             elif modifier.type == 'DISTANCE_FROM_OBJECT':
398                 box.prop(modifier, "target")
399                 self.draw_modifier_curve_common(box, modifier, True, True)
400                 prop = box.operator("scene.freestyle_fill_range_by_selection")
401                 prop.type = 'THICKNESS'
402                 prop.name = modifier.name
403
404             elif modifier.type == 'DISTANCE_FROM_CAMERA':
405                 self.draw_modifier_curve_common(box, modifier, True, True)
406                 prop = box.operator("scene.freestyle_fill_range_by_selection")
407                 prop.type = 'THICKNESS'
408                 prop.name = modifier.name
409
410             elif modifier.type == 'MATERIAL':
411                 box.prop(modifier, "material_attribute", text="")
412                 self.draw_modifier_curve_common(box, modifier, False, True)
413
414             elif modifier.type == 'CALLIGRAPHY':
415                 box.prop(modifier, "orientation")
416                 row = box.row(align=True)
417                 row.prop(modifier, "thickness_min")
418                 row.prop(modifier, "thickness_max")
419
420     def draw_geometry_modifier(self, context, modifier):
421         layout = self.layout
422
423         col = layout.column(align=True)
424         self.draw_modifier_box_header(col.box(), modifier)
425         if modifier.expanded:
426             box = col.box()
427
428             if modifier.type == 'SAMPLING':
429                 box.prop(modifier, "sampling")
430
431             elif modifier.type == 'BEZIER_CURVE':
432                 box.prop(modifier, "error")
433
434             elif modifier.type == 'SINUS_DISPLACEMENT':
435                 split = box.split()
436                 col = split.column()
437                 col.prop(modifier, "wavelength")
438                 col.prop(modifier, "amplitude")
439                 col = split.column()
440                 col.prop(modifier, "phase")
441
442             elif modifier.type == 'SPATIAL_NOISE':
443                 split = box.split()
444                 col = split.column()
445                 col.prop(modifier, "amplitude")
446                 col.prop(modifier, "scale")
447                 col.prop(modifier, "octaves")
448                 col = split.column()
449                 col.prop(modifier, "smooth")
450                 col.prop(modifier, "use_pure_random")
451
452             elif modifier.type == 'PERLIN_NOISE_1D':
453                 split = box.split()
454                 col = split.column()
455                 col.prop(modifier, "frequency")
456                 col.prop(modifier, "amplitude")
457                 col.prop(modifier, "seed")
458                 col = split.column()
459                 col.prop(modifier, "octaves")
460                 col.prop(modifier, "angle")
461
462             elif modifier.type == 'PERLIN_NOISE_2D':
463                 split = box.split()
464                 col = split.column()
465                 col.prop(modifier, "frequency")
466                 col.prop(modifier, "amplitude")
467                 col.prop(modifier, "seed")
468                 col = split.column()
469                 col.prop(modifier, "octaves")
470                 col.prop(modifier, "angle")
471
472             elif modifier.type == 'BACKBONE_STRETCHER':
473                 box.prop(modifier, "backbone_length")
474
475             elif modifier.type == 'TIP_REMOVER':
476                 box.prop(modifier, "tip_length")
477
478             elif modifier.type == 'POLYGONIZATION':
479                 box.prop(modifier, "error")
480
481             elif modifier.type == 'GUIDING_LINES':
482                 box.prop(modifier, "offset")
483
484             elif modifier.type == 'BLUEPRINT':
485                 row = box.row()
486                 row.prop(modifier, "shape", expand=True)
487                 box.prop(modifier, "rounds")
488                 row = box.row()
489                 if modifier.shape in {'CIRCLES', 'ELLIPSES'}:
490                     row.prop(modifier, "random_radius")
491                     row.prop(modifier, "random_center")
492                 elif modifier.shape == 'SQUARES':
493                     row.prop(modifier, "backbone_length")
494                     row.prop(modifier, "random_backbone")
495
496             elif modifier.type == '2D_OFFSET':
497                 row = box.row(align=True)
498                 row.prop(modifier, "start")
499                 row.prop(modifier, "end")
500                 row = box.row(align=True)
501                 row.prop(modifier, "x")
502                 row.prop(modifier, "y")
503
504             elif modifier.type == '2D_TRANSFORM':
505                 box.prop(modifier, "pivot")
506                 if modifier.pivot == 'PARAM':
507                     box.prop(modifier, "pivot_u")
508                 elif modifier.pivot == 'ABSOLUTE':
509                     row = box.row(align=True)
510                     row.prop(modifier, "pivot_x")
511                     row.prop(modifier, "pivot_y")
512                 row = box.row(align=True)
513                 row.prop(modifier, "scale_x")
514                 row.prop(modifier, "scale_y")
515                 box.prop(modifier, "angle")
516
517     def draw(self, context):
518         layout = self.layout
519
520         rd = context.scene.render
521         rl = rd.layers.active
522         lineset = rl.freestyle_settings.linesets.active
523
524         layout.active = rl.use_freestyle
525
526         if lineset is None:
527             return
528         linestyle = lineset.linestyle
529
530         layout.template_ID(lineset, "linestyle", new="scene.freestyle_linestyle_new")
531         if linestyle is None:
532             return
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(align=True)
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(align=True)
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__)