4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * Contributor(s): Blender Foundation (2008).
22 * ***** END GPL LICENSE BLOCK *****
28 #include "RNA_define.h"
30 #include "rna_internal.h"
32 #include "DNA_linestyle_types.h"
33 #include "DNA_material_types.h"
34 #include "DNA_texture_types.h"
39 EnumPropertyItem linestyle_color_modifier_type_items[] ={
40 {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
41 {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
42 {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
43 {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
44 {0, NULL, 0, NULL, NULL}};
46 EnumPropertyItem linestyle_alpha_modifier_type_items[] ={
47 {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
48 {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
49 {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
50 {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
51 {0, NULL, 0, NULL, NULL}};
53 EnumPropertyItem linestyle_thickness_modifier_type_items[] ={
54 {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
55 {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", ""},
56 {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
57 {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
58 {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
59 {0, NULL, 0, NULL, NULL}};
61 EnumPropertyItem linestyle_geometry_modifier_type_items[] ={
62 {LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "Backbone Stretcher", ""},
63 {LS_MODIFIER_BEZIER_CURVE, "BEZIER_CURVE", ICON_MODIFIER, "Bezier Curve", ""},
64 {LS_MODIFIER_BLUEPRINT, "BLUEPRINT", ICON_MODIFIER, "Blueprint", ""},
65 {LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lines", ""},
66 {LS_MODIFIER_PERLIN_NOISE_1D, "PERLIN_NOISE_1D", ICON_MODIFIER, "Perlin Noise 1D", ""},
67 {LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin Noise 2D", ""},
68 {LS_MODIFIER_POLYGONIZATION, "POLYGONIZATION", ICON_MODIFIER, "Polygonization", ""},
69 {LS_MODIFIER_SAMPLING, "SAMPLING", ICON_MODIFIER, "Sampling", ""},
70 {LS_MODIFIER_SINUS_DISPLACEMENT, "SINUS_DISPLACEMENT", ICON_MODIFIER, "Sinus Displacement", ""},
71 {LS_MODIFIER_SPATIAL_NOISE, "SPATIAL_NOISE", ICON_MODIFIER, "Spatial Noise", ""},
72 {LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", ""},
73 {0, NULL, 0, NULL, NULL}};
77 static StructRNA *rna_LineStyle_color_modifier_refine(struct PointerRNA *ptr)
79 LineStyleModifier *m = (LineStyleModifier *)ptr->data;
82 case LS_MODIFIER_ALONG_STROKE:
83 return &RNA_LineStyleColorModifier_AlongStroke;
84 case LS_MODIFIER_DISTANCE_FROM_CAMERA:
85 return &RNA_LineStyleColorModifier_DistanceFromCamera;
86 case LS_MODIFIER_DISTANCE_FROM_OBJECT:
87 return &RNA_LineStyleColorModifier_DistanceFromObject;
88 case LS_MODIFIER_MATERIAL:
89 return &RNA_LineStyleColorModifier_Material;
91 return &RNA_LineStyleColorModifier;
95 static StructRNA *rna_LineStyle_alpha_modifier_refine(struct PointerRNA *ptr)
97 LineStyleModifier *m = (LineStyleModifier *)ptr->data;
100 case LS_MODIFIER_ALONG_STROKE:
101 return &RNA_LineStyleAlphaModifier_AlongStroke;
102 case LS_MODIFIER_DISTANCE_FROM_CAMERA:
103 return &RNA_LineStyleAlphaModifier_DistanceFromCamera;
104 case LS_MODIFIER_DISTANCE_FROM_OBJECT:
105 return &RNA_LineStyleAlphaModifier_DistanceFromObject;
106 case LS_MODIFIER_MATERIAL:
107 return &RNA_LineStyleAlphaModifier_Material;
109 return &RNA_LineStyleAlphaModifier;
113 static StructRNA *rna_LineStyle_thickness_modifier_refine(struct PointerRNA *ptr)
115 LineStyleModifier *m = (LineStyleModifier *)ptr->data;
118 case LS_MODIFIER_ALONG_STROKE:
119 return &RNA_LineStyleThicknessModifier_AlongStroke;
120 case LS_MODIFIER_DISTANCE_FROM_CAMERA:
121 return &RNA_LineStyleThicknessModifier_DistanceFromCamera;
122 case LS_MODIFIER_DISTANCE_FROM_OBJECT:
123 return &RNA_LineStyleThicknessModifier_DistanceFromObject;
124 case LS_MODIFIER_MATERIAL:
125 return &RNA_LineStyleThicknessModifier_Material;
126 case LS_MODIFIER_CALLIGRAPHY:
127 return &RNA_LineStyleThicknessModifier_Calligraphy;
129 return &RNA_LineStyleThicknessModifier;
133 static StructRNA *rna_LineStyle_geometry_modifier_refine(struct PointerRNA *ptr)
135 LineStyleModifier *m = (LineStyleModifier *)ptr->data;
138 case LS_MODIFIER_SAMPLING:
139 return &RNA_LineStyleGeometryModifier_Sampling;
140 case LS_MODIFIER_BEZIER_CURVE:
141 return &RNA_LineStyleGeometryModifier_BezierCurve;
142 case LS_MODIFIER_SINUS_DISPLACEMENT:
143 return &RNA_LineStyleGeometryModifier_SinusDisplacement;
144 case LS_MODIFIER_SPATIAL_NOISE:
145 return &RNA_LineStyleGeometryModifier_SpatialNoise;
146 case LS_MODIFIER_PERLIN_NOISE_1D:
147 return &RNA_LineStyleGeometryModifier_PerlinNoise1D;
148 case LS_MODIFIER_PERLIN_NOISE_2D:
149 return &RNA_LineStyleGeometryModifier_PerlinNoise2D;
150 case LS_MODIFIER_BACKBONE_STRETCHER:
151 return &RNA_LineStyleGeometryModifier_BackboneStretcher;
152 case LS_MODIFIER_TIP_REMOVER:
153 return &RNA_LineStyleGeometryModifier_TipRemover;
154 case LS_MODIFIER_POLYGONIZATION:
155 return &RNA_LineStyleGeometryModifier_Polygonalization;
156 case LS_MODIFIER_GUIDING_LINES:
157 return &RNA_LineStyleGeometryModifier_GuidingLines;
158 case LS_MODIFIER_BLUEPRINT:
159 return &RNA_LineStyleGeometryModifier_Blueprint;
161 return &RNA_LineStyleGeometryModifier;
165 static char *rna_LineStyle_color_modifier_path(PointerRNA *ptr)
167 return BLI_sprintfN("color_modifiers[\"%s\"]", ((LineStyleModifier*)ptr->data)->name);
170 static char *rna_LineStyle_alpha_modifier_path(PointerRNA *ptr)
172 return BLI_sprintfN("alpha_modifiers[\"%s\"]", ((LineStyleModifier*)ptr->data)->name);
175 static char *rna_LineStyle_thickness_modifier_path(PointerRNA *ptr)
177 return BLI_sprintfN("thickness_modifiers[\"%s\"]", ((LineStyleModifier*)ptr->data)->name);
180 static char *rna_LineStyle_geometry_modifier_path(PointerRNA *ptr)
182 return BLI_sprintfN("geometry_modifiers[\"%s\"]", ((LineStyleModifier*)ptr->data)->name);
187 #include "DNA_material_types.h"
189 static void rna_def_modifier_type_common(StructRNA *srna, EnumPropertyItem *modifier_type_items, int blend, int color)
193 static EnumPropertyItem color_blend_items[] = {
194 {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
195 {MA_RAMP_ADD, "ADD", 0, "Add", ""},
196 {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
197 {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
198 {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
199 {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
200 {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
201 {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
202 {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
203 {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
204 {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""},
205 {MA_RAMP_BURN, "BURN", 0, "Burn", ""},
206 {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
207 {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
208 {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
209 {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
210 {MA_RAMP_SOFT, "SOFT LIGHT", 0, "Soft Light", ""},
211 {MA_RAMP_LINEAR, "LINEAR LIGHT", 0, "Linear Light", ""},
212 {0, NULL, 0, NULL, NULL}};
214 static EnumPropertyItem value_blend_items[] = {
215 {LS_VALUE_BLEND, "MIX", 0, "Mix", ""},
216 {LS_VALUE_ADD, "ADD", 0, "Add", ""},
217 {LS_VALUE_SUB, "SUBTRACT", 0, "Subtract", ""},
218 {LS_VALUE_MULT, "MULTIPLY", 0, "Multiply", ""},
219 {LS_VALUE_DIV, "DIVIDE", 0, "Divide", ""},
220 {LS_VALUE_DIFF, "DIFFERENCE", 0, "Divide", ""},
221 {LS_VALUE_MIN, "MININUM", 0, "Minimum", ""},
222 {LS_VALUE_MAX, "MAXIMUM", 0, "Maximum", ""},
223 {0, NULL, 0, NULL, NULL}};
225 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
226 RNA_def_property_enum_sdna(prop, NULL, "modifier.type");
227 RNA_def_property_enum_items(prop, modifier_type_items);
228 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
229 RNA_def_property_ui_text(prop, "Modifier Type", "Type of the modifier");
231 prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
232 RNA_def_property_string_sdna(prop, NULL, "modifier.name");
233 RNA_def_property_ui_text(prop, "Modifier Name", "Name of the modifier");
234 RNA_def_property_update(prop, NC_SCENE, NULL);
235 RNA_def_struct_name_property(srna, prop);
238 prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
239 RNA_def_property_enum_sdna(prop, NULL, "modifier.blend");
240 RNA_def_property_enum_items(prop, (color) ? color_blend_items : value_blend_items);
241 RNA_def_property_ui_text(prop, "Blend", "Specify how the modifier value is blended into the base value");
242 RNA_def_property_update(prop, NC_SCENE, NULL);
244 prop= RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
245 RNA_def_property_float_sdna(prop, NULL, "modifier.influence");
246 RNA_def_property_range(prop, 0.0f, 1.0f);
247 RNA_def_property_ui_text(prop, "Influence", "Influence factor by which the modifier changes the property");
248 RNA_def_property_update(prop, NC_SCENE, NULL);
251 prop= RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
252 RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_ENABLED);
253 RNA_def_property_ui_text(prop, "Use", "Enable or disable this modifier during stroke rendering");
255 prop= RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
256 RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_EXPANDED);
257 RNA_def_property_ui_text(prop, "Expanded", "True if the modifier tab is expanded");
260 static void rna_def_color_modifier(StructRNA *srna)
262 rna_def_modifier_type_common(srna, linestyle_color_modifier_type_items, 1, 1);
265 static void rna_def_alpha_modifier(StructRNA *srna)
267 rna_def_modifier_type_common(srna, linestyle_alpha_modifier_type_items, 1, 0);
270 static void rna_def_thickness_modifier(StructRNA *srna)
272 rna_def_modifier_type_common(srna, linestyle_thickness_modifier_type_items, 1, 0);
275 static void rna_def_geometry_modifier(StructRNA *srna)
277 rna_def_modifier_type_common(srna, linestyle_geometry_modifier_type_items, 0, 0);
280 static void rna_def_modifier_color_ramp_common(StructRNA *srna, int range)
284 prop= RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
285 RNA_def_property_pointer_sdna(prop, NULL, "color_ramp");
286 RNA_def_property_struct_type(prop, "ColorRamp");
287 RNA_def_property_ui_text(prop, "Color Ramp", "Color ramp used to change line color");
288 RNA_def_property_update(prop, NC_SCENE, NULL);
291 prop= RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_NONE);
292 RNA_def_property_float_sdna(prop, NULL, "range_min");
293 RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the input range the mapping is applied");
294 RNA_def_property_update(prop, NC_SCENE, NULL);
296 prop= RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_NONE);
297 RNA_def_property_float_sdna(prop, NULL, "range_max");
298 RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the input range the mapping is applied");
299 RNA_def_property_update(prop, NC_SCENE, NULL);
303 static void rna_def_modifier_curve_common(StructRNA *srna, int range, int value)
307 static EnumPropertyItem mapping_items[] = {
308 {0, "LINEAR", 0, "Linear", "Use linear mapping"},
309 {LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"},
310 {0, NULL, 0, NULL, NULL}};
312 prop= RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
313 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
314 RNA_def_property_enum_items(prop, mapping_items);
315 RNA_def_property_ui_text(prop, "Mapping", "Select the mapping type");
316 RNA_def_property_update(prop, NC_SCENE, NULL);
318 prop= RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
319 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_INVERT);
320 RNA_def_property_ui_text(prop, "Invert", "Invert the fade-out direction of the linear mapping");
321 RNA_def_property_update(prop, NC_SCENE, NULL);
323 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
324 RNA_def_property_pointer_sdna(prop, NULL, "curve");
325 RNA_def_property_struct_type(prop, "CurveMapping");
326 RNA_def_property_ui_text(prop, "Curve", "Curve used for the curve mapping");
327 RNA_def_property_update(prop, NC_SCENE, NULL);
330 prop= RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_NONE);
331 RNA_def_property_float_sdna(prop, NULL, "range_min");
332 RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the input range the mapping is applied");
333 RNA_def_property_update(prop, NC_SCENE, NULL);
335 prop= RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_NONE);
336 RNA_def_property_float_sdna(prop, NULL, "range_max");
337 RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the input range the mapping is applied");
338 RNA_def_property_update(prop, NC_SCENE, NULL);
342 prop= RNA_def_property(srna, "value_min", PROP_FLOAT, PROP_NONE);
343 RNA_def_property_float_sdna(prop, NULL, "value_min");
344 RNA_def_property_ui_text(prop, "Value Min", "Minimum output value of the mapping");
345 RNA_def_property_update(prop, NC_SCENE, NULL);
347 prop= RNA_def_property(srna, "value_max", PROP_FLOAT, PROP_NONE);
348 RNA_def_property_float_sdna(prop, NULL, "value_max");
349 RNA_def_property_ui_text(prop, "Value Max", "Maximum output value of the mapping");
350 RNA_def_property_update(prop, NC_SCENE, NULL);
354 static void rna_def_modifier_material_common(StructRNA *srna)
358 static EnumPropertyItem mat_attr_items[] = {
359 {LS_MODIFIER_MATERIAL_DIFF, "DIFF", 0, "Diffuse", ""},
360 {LS_MODIFIER_MATERIAL_DIFF_R, "DIFF_R", 0, "Diffuse Red", ""},
361 {LS_MODIFIER_MATERIAL_DIFF_G, "DIFF_G", 0, "Diffuse Green", ""},
362 {LS_MODIFIER_MATERIAL_DIFF_B, "DIFF_B", 0, "Diffuse Blue", ""},
363 {LS_MODIFIER_MATERIAL_SPEC, "SPEC", 0, "Specular", ""},
364 {LS_MODIFIER_MATERIAL_SPEC_R, "SPEC_R", 0, "Specular Red", ""},
365 {LS_MODIFIER_MATERIAL_SPEC_G, "SPEC_G", 0, "Specular Green", ""},
366 {LS_MODIFIER_MATERIAL_SPEC_B, "SPEC_B", 0, "Specular Blue", ""},
367 {LS_MODIFIER_MATERIAL_SPEC_HARD, "SPEC_HARD", 0, "Specular Hardness", ""},
368 {LS_MODIFIER_MATERIAL_ALPHA, "ALPHA", 0, "Alpha", ""},
369 {0, NULL, 0, NULL, NULL}};
371 prop= RNA_def_property(srna, "material_attr", PROP_ENUM, PROP_NONE);
372 RNA_def_property_enum_sdna(prop, NULL, "mat_attr");
373 RNA_def_property_enum_items(prop, mat_attr_items);
374 RNA_def_property_ui_text(prop, "Material Attribute", "Specify which material attribute is used");
375 RNA_def_property_update(prop, NC_SCENE, NULL);
379 static void rna_def_linestyle_modifiers(BlenderRNA *brna)
384 static EnumPropertyItem blueprint_shape_items[] = {
385 {LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a blueprint using circular contour strokes"},
386 {LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Draw a blueprint using elliptic contour strokes"},
387 {LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a blueprint using square contour strokes"},
388 {0, NULL, 0, NULL, NULL}};
390 srna= RNA_def_struct(brna, "LineStyleModifier", NULL);
391 RNA_def_struct_ui_text(srna, "Line Style Modifier", "Base type to define modifiers");
393 /* line color modifiers */
395 srna= RNA_def_struct(brna, "LineStyleColorModifier", "LineStyleModifier");
396 RNA_def_struct_sdna(srna, "LineStyleModifier");
397 RNA_def_struct_refine_func(srna, "rna_LineStyle_color_modifier_refine");
398 RNA_def_struct_path_func(srna, "rna_LineStyle_color_modifier_path");
399 RNA_def_struct_ui_text(srna, "Line Style Color Modifier", "Base type to define line color modifiers");
401 srna= RNA_def_struct(brna, "LineStyleColorModifier_AlongStroke", "LineStyleColorModifier");
402 RNA_def_struct_ui_text(srna, "Along Stroke", "Change line color along stroke");
403 rna_def_color_modifier(srna);
404 rna_def_modifier_color_ramp_common(srna, 0);
406 srna= RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromCamera", "LineStyleColorModifier");
407 RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line color based on the distance from the camera");
408 rna_def_color_modifier(srna);
409 rna_def_modifier_color_ramp_common(srna, 1);
411 srna= RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromObject", "LineStyleColorModifier");
412 RNA_def_struct_ui_text(srna, "Distance from Object", "Change line color based on the distance from an object");
413 rna_def_color_modifier(srna);
414 rna_def_modifier_color_ramp_common(srna, 1);
416 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
417 RNA_def_property_pointer_sdna(prop, NULL, "target");
418 RNA_def_property_struct_type(prop, "Object");
419 RNA_def_property_flag(prop, PROP_EDITABLE);
420 RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
421 RNA_def_property_update(prop, NC_SCENE, NULL);
423 srna= RNA_def_struct(brna, "LineStyleColorModifier_Material", "LineStyleColorModifier");
424 RNA_def_struct_ui_text(srna, "Material", "Change line color based on a material attribute");
425 rna_def_color_modifier(srna);
426 rna_def_modifier_material_common(srna);
427 rna_def_modifier_color_ramp_common(srna, 0);
429 prop= RNA_def_property(srna, "use_ramp", PROP_BOOLEAN, PROP_NONE);
430 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_USE_RAMP);
431 RNA_def_property_ui_text(prop, "Ramp", "Use color ramp to map the BW average into an RGB color");
432 RNA_def_property_update(prop, NC_SCENE, NULL);
434 /* alpha transparency modifiers */
436 srna= RNA_def_struct(brna, "LineStyleAlphaModifier", "LineStyleModifier");
437 RNA_def_struct_sdna(srna, "LineStyleModifier");
438 RNA_def_struct_refine_func(srna, "rna_LineStyle_alpha_modifier_refine");
439 RNA_def_struct_path_func(srna, "rna_LineStyle_alpha_modifier_path");
440 RNA_def_struct_ui_text(srna, "Line Style Alpha Modifier", "Base type to define alpha transparency modifiers");
442 srna= RNA_def_struct(brna, "LineStyleAlphaModifier_AlongStroke", "LineStyleAlphaModifier");
443 RNA_def_struct_ui_text(srna, "Along Stroke", "Change alpha transparency along stroke");
444 rna_def_alpha_modifier(srna);
445 rna_def_modifier_curve_common(srna, 0, 0);
447 srna= RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromCamera", "LineStyleAlphaModifier");
448 RNA_def_struct_ui_text(srna, "Distance from Camera", "Change alpha transparency based on the distance from the camera");
449 rna_def_alpha_modifier(srna);
450 rna_def_modifier_curve_common(srna, 1, 0);
452 srna= RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromObject", "LineStyleAlphaModifier");
453 RNA_def_struct_ui_text(srna, "Distance from Object", "Change alpha transparency based on the distance from an object");
454 rna_def_alpha_modifier(srna);
455 rna_def_modifier_curve_common(srna, 1, 0);
457 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
458 RNA_def_property_pointer_sdna(prop, NULL, "target");
459 RNA_def_property_struct_type(prop, "Object");
460 RNA_def_property_flag(prop, PROP_EDITABLE);
461 RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
462 RNA_def_property_update(prop, NC_SCENE, NULL);
464 srna= RNA_def_struct(brna, "LineStyleAlphaModifier_Material", "LineStyleAlphaModifier");
465 RNA_def_struct_ui_text(srna, "Material", "Change alpha transparency based on a material attribute");
466 rna_def_alpha_modifier(srna);
467 rna_def_modifier_material_common(srna);
468 rna_def_modifier_curve_common(srna, 0, 0);
470 /* line thickness modifiers */
472 srna= RNA_def_struct(brna, "LineStyleThicknessModifier", "LineStyleModifier");
473 RNA_def_struct_sdna(srna, "LineStyleModifier");
474 RNA_def_struct_refine_func(srna, "rna_LineStyle_thickness_modifier_refine");
475 RNA_def_struct_path_func(srna, "rna_LineStyle_thickness_modifier_path");
476 RNA_def_struct_ui_text(srna, "Line Style Thickness Modifier", "Base type to define line thickness modifiers");
478 srna= RNA_def_struct(brna, "LineStyleThicknessModifier_AlongStroke", "LineStyleThicknessModifier");
479 RNA_def_struct_ui_text(srna, "Along Stroke", "Change line thickness along stroke");
480 rna_def_thickness_modifier(srna);
481 rna_def_modifier_curve_common(srna, 0, 1);
483 srna= RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromCamera", "LineStyleThicknessModifier");
484 RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line thickness based on the distance from the camera");
485 rna_def_thickness_modifier(srna);
486 rna_def_modifier_curve_common(srna, 1, 1);
488 srna= RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromObject", "LineStyleThicknessModifier");
489 RNA_def_struct_ui_text(srna, "Distance from Object", "Change line thickness based on the distance from an object");
490 rna_def_thickness_modifier(srna);
491 rna_def_modifier_curve_common(srna, 1, 1);
493 prop= RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
494 RNA_def_property_pointer_sdna(prop, NULL, "target");
495 RNA_def_property_struct_type(prop, "Object");
496 RNA_def_property_flag(prop, PROP_EDITABLE);
497 RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
498 RNA_def_property_update(prop, NC_SCENE, NULL);
500 srna= RNA_def_struct(brna, "LineStyleThicknessModifier_Material", "LineStyleThicknessModifier");
501 RNA_def_struct_ui_text(srna, "Material", "Change line thickness based on a material attribute");
502 rna_def_thickness_modifier(srna);
503 rna_def_modifier_material_common(srna);
504 rna_def_modifier_curve_common(srna, 0, 1);
506 srna= RNA_def_struct(brna, "LineStyleThicknessModifier_Calligraphy", "LineStyleThicknessModifier");
507 RNA_def_struct_ui_text(srna, "Calligraphy", "Change line thickness so that stroke looks like made with a calligraphic pen");
508 rna_def_thickness_modifier(srna);
510 prop= RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_NONE);
511 RNA_def_property_float_sdna(prop, NULL, "orientation");
512 RNA_def_property_ui_text(prop, "Orientation", "Angle of the main direction");
513 RNA_def_property_update(prop, NC_SCENE, NULL);
515 prop= RNA_def_property(srna, "min_thickness", PROP_FLOAT, PROP_NONE);
516 RNA_def_property_float_sdna(prop, NULL, "min_thickness");
517 RNA_def_property_range(prop, 0.0f, 10000.0f);
518 RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness in the direction perpendicular to the main direction");
519 RNA_def_property_update(prop, NC_SCENE, NULL);
521 prop= RNA_def_property(srna, "max_thickness", PROP_FLOAT, PROP_NONE);
522 RNA_def_property_float_sdna(prop, NULL, "max_thickness");
523 RNA_def_property_range(prop, 0.0f, 10000.0f);
524 RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness in the main direction");
525 RNA_def_property_update(prop, NC_SCENE, NULL);
527 /* geometry modifiers */
529 srna= RNA_def_struct(brna, "LineStyleGeometryModifier", "LineStyleModifier");
530 RNA_def_struct_sdna(srna, "LineStyleModifier");
531 RNA_def_struct_refine_func(srna, "rna_LineStyle_geometry_modifier_refine");
532 RNA_def_struct_path_func(srna, "rna_LineStyle_geometry_modifier_path");
533 RNA_def_struct_ui_text(srna, "Line Style Geometry Modifier", "Base type to define stroke geometry modifiers");
535 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_Sampling", "LineStyleGeometryModifier");
536 RNA_def_struct_ui_text(srna, "Sampling", "Specify a new sampling value that determines the resolution of stroke polylines");
537 rna_def_geometry_modifier(srna);
539 prop= RNA_def_property(srna, "sampling", PROP_FLOAT, PROP_NONE);
540 RNA_def_property_float_sdna(prop, NULL, "sampling");
541 RNA_def_property_ui_text(prop, "Sampling", "New sampling value to be used for subsequent modifiers");
542 RNA_def_property_update(prop, NC_SCENE, NULL);
544 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_BezierCurve", "LineStyleGeometryModifier");
545 RNA_def_struct_ui_text(srna, "Bezier Curve", "Replace stroke backbone geometry by a Bezier curve approximation of the original backbone geometry");
546 rna_def_geometry_modifier(srna);
548 prop= RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
549 RNA_def_property_float_sdna(prop, NULL, "error");
550 RNA_def_property_ui_text(prop, "Error", "Maximum distance allowed between the new Bezier curve and the original backbone geometry)");
551 RNA_def_property_update(prop, NC_SCENE, NULL);
553 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_SinusDisplacement", "LineStyleGeometryModifier");
554 RNA_def_struct_ui_text(srna, "Sinus Displacement", "Add sinus displacement to stroke backbone geometry");
555 rna_def_geometry_modifier(srna);
557 prop= RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_NONE);
558 RNA_def_property_float_sdna(prop, NULL, "wavelength");
559 RNA_def_property_ui_text(prop, "Wavelength", "Wavelength of the sinus displacement");
560 RNA_def_property_update(prop, NC_SCENE, NULL);
562 prop= RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
563 RNA_def_property_float_sdna(prop, NULL, "amplitude");
564 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the sinus displacement");
565 RNA_def_property_update(prop, NC_SCENE, NULL);
567 prop= RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
568 RNA_def_property_float_sdna(prop, NULL, "phase");
569 RNA_def_property_ui_text(prop, "Phase", "Phase of the sinus displacement");
570 RNA_def_property_update(prop, NC_SCENE, NULL);
572 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_SpatialNoise", "LineStyleGeometryModifier");
573 RNA_def_struct_ui_text(srna, "Spatial Noise", "Add spatial noise to stroke backbone geometry");
574 rna_def_geometry_modifier(srna);
576 prop= RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
577 RNA_def_property_float_sdna(prop, NULL, "amplitude");
578 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the spatial noise");
579 RNA_def_property_update(prop, NC_SCENE, NULL);
581 prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
582 RNA_def_property_float_sdna(prop, NULL, "scale");
583 RNA_def_property_ui_text(prop, "Scale", "Scale of the spatial noise");
584 RNA_def_property_update(prop, NC_SCENE, NULL);
586 prop= RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
587 RNA_def_property_int_sdna(prop, NULL, "octaves");
588 RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the spatial noise)");
589 RNA_def_property_update(prop, NC_SCENE, NULL);
591 prop= RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
592 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_SMOOTH);
593 RNA_def_property_ui_text(prop, "Smooth", "If true, the spatial noise is smooth");
594 RNA_def_property_update(prop, NC_SCENE, NULL);
596 prop= RNA_def_property(srna, "pure_random", PROP_BOOLEAN, PROP_NONE);
597 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_PURERANDOM);
598 RNA_def_property_ui_text(prop, "Pure Random", "If true, the spatial noise does not show any coherence");
599 RNA_def_property_update(prop, NC_SCENE, NULL);
601 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise1D", "LineStyleGeometryModifier");
602 RNA_def_struct_ui_text(srna, "Perlin Noise 1D", "Add one-dimensional Perlin noise to stroke backbone geometry");
603 rna_def_geometry_modifier(srna);
605 prop= RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
606 RNA_def_property_float_sdna(prop, NULL, "frequency");
607 RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
608 RNA_def_property_update(prop, NC_SCENE, NULL);
610 prop= RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
611 RNA_def_property_float_sdna(prop, NULL, "amplitude");
612 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
613 RNA_def_property_update(prop, NC_SCENE, NULL);
615 prop= RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
616 RNA_def_property_int_sdna(prop, NULL, "octaves");
617 RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
618 RNA_def_property_update(prop, NC_SCENE, NULL);
620 prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
621 RNA_def_property_float_sdna(prop, NULL, "angle");
622 RNA_def_property_ui_text(prop, "Angle", "Displacement direction in degrees");
623 RNA_def_property_update(prop, NC_SCENE, NULL);
625 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
626 RNA_def_property_int_sdna(prop, NULL, "seed");
627 RNA_def_property_ui_text(prop, "Seed", "Seed for random number generation. If negative, time is used as a seed instead");
628 RNA_def_property_update(prop, NC_SCENE, NULL);
630 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise2D", "LineStyleGeometryModifier");
631 RNA_def_struct_ui_text(srna, "Perlin Noise 2D", "Add two-dimensional Perlin noise to stroke backbone geometry");
632 rna_def_geometry_modifier(srna);
634 prop= RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
635 RNA_def_property_float_sdna(prop, NULL, "frequency");
636 RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
637 RNA_def_property_update(prop, NC_SCENE, NULL);
639 prop= RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
640 RNA_def_property_float_sdna(prop, NULL, "amplitude");
641 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
642 RNA_def_property_update(prop, NC_SCENE, NULL);
644 prop= RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
645 RNA_def_property_int_sdna(prop, NULL, "octaves");
646 RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
647 RNA_def_property_update(prop, NC_SCENE, NULL);
649 prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
650 RNA_def_property_float_sdna(prop, NULL, "angle");
651 RNA_def_property_ui_text(prop, "Angle", "Displacement direction in degrees");
652 RNA_def_property_update(prop, NC_SCENE, NULL);
654 prop= RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
655 RNA_def_property_int_sdna(prop, NULL, "seed");
656 RNA_def_property_ui_text(prop, "Seed", "Seed for random number generation. If negative, time is used as a seed instead");
657 RNA_def_property_update(prop, NC_SCENE, NULL);
659 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_BackboneStretcher", "LineStyleGeometryModifier");
660 RNA_def_struct_ui_text(srna, "Backbone Stretcher", "Stretch the beginning and the end of stroke backbone");
661 rna_def_geometry_modifier(srna);
663 prop= RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
664 RNA_def_property_float_sdna(prop, NULL, "backbone_length");
665 RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
666 RNA_def_property_update(prop, NC_SCENE, NULL);
668 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_TipRemover", "LineStyleGeometryModifier");
669 RNA_def_struct_ui_text(srna, "Tip Remover", "Remove a piece of stroke at the beginning and the end of stroke backbone");
670 rna_def_geometry_modifier(srna);
672 prop= RNA_def_property(srna, "tip_length", PROP_FLOAT, PROP_NONE);
673 RNA_def_property_float_sdna(prop, NULL, "tip_length");
674 RNA_def_property_ui_text(prop, "Tip Length", "Length of tips to be removed");
675 RNA_def_property_update(prop, NC_SCENE, NULL);
677 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_Polygonalization", "LineStyleGeometryModifier");
678 RNA_def_struct_ui_text(srna, "Polygonalization", "Modify the stroke geometry so that it looks more \"polygonal\"");
679 rna_def_geometry_modifier(srna);
681 prop= RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
682 RNA_def_property_float_sdna(prop, NULL, "error");
683 RNA_def_property_ui_text(prop, "Error", "Maximum distance between the original stroke and its polygonal approximation");
684 RNA_def_property_update(prop, NC_SCENE, NULL);
686 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_GuidingLines", "LineStyleGeometryModifier");
687 RNA_def_struct_ui_text(srna, "Guiding Lines", "Modify the stroke geometry so that it corresponds to its main direction line");
688 rna_def_geometry_modifier(srna);
690 prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
691 RNA_def_property_float_sdna(prop, NULL, "offset");
692 RNA_def_property_ui_text(prop, "Offset", "Displacement that is applied to the main direction line along its normal");
693 RNA_def_property_update(prop, NC_SCENE, NULL);
695 srna= RNA_def_struct(brna, "LineStyleGeometryModifier_Blueprint", "LineStyleGeometryModifier");
696 RNA_def_struct_ui_text(srna, "Blueprint", "Produce a blueprint using circular, elliptic, and square contour strokes");
697 rna_def_geometry_modifier(srna);
699 prop= RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
700 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
701 RNA_def_property_enum_items(prop, blueprint_shape_items);
702 RNA_def_property_ui_text(prop, "Shape", "Select the shape of blueprint contour strokes");
703 RNA_def_property_update(prop, NC_SCENE, NULL);
705 prop= RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
706 RNA_def_property_int_sdna(prop, NULL, "rounds");
707 RNA_def_property_range(prop, 1, 1000);
708 RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in contour strokes");
709 RNA_def_property_update(prop, NC_SCENE, NULL);
711 prop= RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
712 RNA_def_property_float_sdna(prop, NULL, "backbone_length");
713 RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
714 RNA_def_property_update(prop, NC_SCENE, NULL);
716 prop= RNA_def_property(srna, "random_radius", PROP_INT, PROP_UNSIGNED);
717 RNA_def_property_int_sdna(prop, NULL, "random_radius");
718 RNA_def_property_ui_text(prop, "Random Radius", "Randomness of the radius");
719 RNA_def_property_update(prop, NC_SCENE, NULL);
721 prop= RNA_def_property(srna, "random_center", PROP_INT, PROP_UNSIGNED);
722 RNA_def_property_int_sdna(prop, NULL, "random_center");
723 RNA_def_property_ui_text(prop, "Random Center", "Randomness of the center");
724 RNA_def_property_update(prop, NC_SCENE, NULL);
726 prop= RNA_def_property(srna, "random_backbone", PROP_INT, PROP_UNSIGNED);
727 RNA_def_property_int_sdna(prop, NULL, "random_backbone");
728 RNA_def_property_ui_text(prop, "Random Backbone", "Randomness of the backbone stretching");
729 RNA_def_property_update(prop, NC_SCENE, NULL);
733 static void rna_def_linestyle(BlenderRNA *brna)
738 static EnumPropertyItem panel_items[] = {
739 {LS_PANEL_STROKES, "STROKES", 0, "Strokes", "Show the panel for stroke construction"},
740 {LS_PANEL_COLOR, "COLOR", 0, "Color", "Show the panel for line color options"},
741 {LS_PANEL_ALPHA, "ALPHA", 0, "Alpha", "Show the panel for alpha transparency options"},
742 {LS_PANEL_THICKNESS, "THICKNESS", 0, "Thickness", "Show the panel for line thickness options"},
743 {LS_PANEL_GEOMETRY, "GEOMETRY", 0, "Geometry", "Show the panel for stroke geometry options"},
744 {LS_PANEL_MISC, "MISC", 0, "Misc", "Show the panel for miscellaneous options"},
745 {0, NULL, 0, NULL, NULL}};
746 static EnumPropertyItem chaining_items[] = {
747 {LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"},
748 {LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining with a multiple touch"},
749 {0, NULL, 0, NULL, NULL}};
750 static EnumPropertyItem cap_items[] = {
751 {LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"},
752 {LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"},
753 {LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and extended)"},
754 {0, NULL, 0, NULL, NULL}};
756 srna= RNA_def_struct(brna, "FreestyleLineStyle", "ID");
757 RNA_def_struct_ui_text(srna, "Freestyle Line Style", "Freestyle line style, reusable by multiple line sets");
758 RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA); /* FIXME: use a proper icon */
760 prop= RNA_def_property(srna, "panel", PROP_ENUM, PROP_NONE);
761 RNA_def_property_enum_bitflag_sdna(prop, NULL, "panel");
762 RNA_def_property_enum_items(prop, panel_items);
763 RNA_def_property_ui_text(prop, "Panel", "Select the property panel to be shown");
764 RNA_def_property_update(prop, NC_SCENE, NULL);
766 prop= RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
767 RNA_def_property_float_sdna(prop, NULL, "r");
768 RNA_def_property_array(prop, 3);
769 RNA_def_property_ui_text(prop, "Color", "Base line color, possibly modified by line color modifiers");
770 RNA_def_property_update(prop, NC_SCENE, NULL);
772 prop= RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
773 RNA_def_property_float_sdna(prop, NULL, "alpha");
774 RNA_def_property_range(prop, 0.0f, 1.0f);
775 RNA_def_property_ui_text(prop, "Alpha", "Base alpha transparency, possibly modified by alpha transparency modifiers");
776 RNA_def_property_update(prop, NC_SCENE, NULL);
778 prop= RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
779 RNA_def_property_float_sdna(prop, NULL, "thickness");
780 RNA_def_property_range(prop, 0.0f, 10000.0f);
781 RNA_def_property_ui_text(prop, "Thickness", "Base line thickness, possibly modified by line thickness modifiers");
782 RNA_def_property_update(prop, NC_SCENE, NULL);
784 prop= RNA_def_property(srna, "color_modifiers", PROP_COLLECTION, PROP_NONE);
785 RNA_def_property_collection_sdna(prop, NULL, "color_modifiers", NULL);
786 RNA_def_property_struct_type(prop, "LineStyleColorModifier");
787 RNA_def_property_ui_text(prop, "Color Modifiers", "List of line color modifiers");
789 prop= RNA_def_property(srna, "alpha_modifiers", PROP_COLLECTION, PROP_NONE);
790 RNA_def_property_collection_sdna(prop, NULL, "alpha_modifiers", NULL);
791 RNA_def_property_struct_type(prop, "LineStyleAlphaModifier");
792 RNA_def_property_ui_text(prop, "Alpha Modifiers", "List of alpha trancparency modifiers");
794 prop= RNA_def_property(srna, "thickness_modifiers", PROP_COLLECTION, PROP_NONE);
795 RNA_def_property_collection_sdna(prop, NULL, "thickness_modifiers", NULL);
796 RNA_def_property_struct_type(prop, "LineStyleThicknessModifier");
797 RNA_def_property_ui_text(prop, "Thickness Modifiers", "List of line thickness modifiers");
799 prop= RNA_def_property(srna, "use_chaining", PROP_BOOLEAN, PROP_NONE);
800 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_CHAINING);
801 RNA_def_property_ui_text(prop, "Chaining", "Enable chaining of feature edges");
802 RNA_def_property_update(prop, NC_SCENE, NULL);
804 prop= RNA_def_property(srna, "chaining", PROP_ENUM, PROP_NONE);
805 RNA_def_property_enum_sdna(prop, NULL, "chaining");
806 RNA_def_property_enum_items(prop, chaining_items);
807 RNA_def_property_ui_text(prop, "Chaining", "Select the way how feature edges are jointed to form chains");
808 RNA_def_property_update(prop, NC_SCENE, NULL);
810 prop= RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
811 RNA_def_property_int_sdna(prop, NULL, "rounds");
812 RNA_def_property_range(prop, 1, 1000);
813 RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in a sketchy multiple touch");
814 RNA_def_property_update(prop, NC_SCENE, NULL);
816 prop= RNA_def_property(srna, "geometry_modifiers", PROP_COLLECTION, PROP_NONE);
817 RNA_def_property_collection_sdna(prop, NULL, "geometry_modifiers", NULL);
818 RNA_def_property_struct_type(prop, "LineStyleGeometryModifier");
819 RNA_def_property_ui_text(prop, "Geometry Modifiers", "List of stroke geometry modifiers");
821 prop= RNA_def_property(srna, "same_object", PROP_BOOLEAN, PROP_NONE);
822 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SAME_OBJECT);
823 RNA_def_property_ui_text(prop, "Same Object", "If true, only feature edges of the same object are joined");
824 RNA_def_property_update(prop, NC_SCENE, NULL);
826 prop= RNA_def_property(srna, "use_min_length", PROP_BOOLEAN, PROP_NONE);
827 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_LENGTH);
828 RNA_def_property_ui_text(prop, "Use Min 2D Length", "Enable the selection of chains by a minimum 2D length");
829 RNA_def_property_update(prop, NC_SCENE, NULL);
831 prop= RNA_def_property(srna, "min_length", PROP_FLOAT, PROP_NONE);
832 RNA_def_property_float_sdna(prop, NULL, "min_length");
833 RNA_def_property_range(prop, 0.0f, 10000.0f);
834 RNA_def_property_ui_text(prop, "Min 2D Length", "Minimum 2D length for the selection of chains");
835 RNA_def_property_update(prop, NC_SCENE, NULL);
837 prop= RNA_def_property(srna, "use_max_length", PROP_BOOLEAN, PROP_NONE);
838 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_LENGTH);
839 RNA_def_property_ui_text(prop, "Use Max 2D Length", "Enable the selection of chains by a maximum 2D length");
840 RNA_def_property_update(prop, NC_SCENE, NULL);
842 prop= RNA_def_property(srna, "max_length", PROP_FLOAT, PROP_NONE);
843 RNA_def_property_float_sdna(prop, NULL, "max_length");
844 RNA_def_property_range(prop, 0.0f, 10000.0f);
845 RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum 2D length for the selection of chains");
846 RNA_def_property_update(prop, NC_SCENE, NULL);
848 prop= RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NONE);
849 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY);
850 RNA_def_property_ui_text(prop, "Material Boundary", "If true, chains of feature edges are split at material boundaries");
851 RNA_def_property_update(prop, NC_SCENE, NULL);
853 prop= RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE);
854 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE);
855 RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed line");
856 RNA_def_property_update(prop, NC_SCENE, NULL);
858 prop= RNA_def_property(srna, "caps", PROP_ENUM, PROP_NONE);
859 RNA_def_property_enum_bitflag_sdna(prop, NULL, "caps");
860 RNA_def_property_enum_items(prop, cap_items);
861 RNA_def_property_ui_text(prop, "Cap", "Select the shape of both ends of strokes");
862 RNA_def_property_update(prop, NC_SCENE, NULL);
864 prop= RNA_def_property(srna, "dash1", PROP_INT, PROP_UNSIGNED);
865 RNA_def_property_int_sdna(prop, NULL, "dash1");
866 RNA_def_property_range(prop, 0, USHRT_MAX);
867 RNA_def_property_ui_text(prop, "Dash #1", "Length of the 1st dash");
868 RNA_def_property_update(prop, NC_SCENE, NULL);
870 prop= RNA_def_property(srna, "gap1", PROP_INT, PROP_UNSIGNED);
871 RNA_def_property_int_sdna(prop, NULL, "gap1");
872 RNA_def_property_range(prop, 0, USHRT_MAX);
873 RNA_def_property_ui_text(prop, "Gap #1", "Length of the 1st gap");
874 RNA_def_property_update(prop, NC_SCENE, NULL);
876 prop= RNA_def_property(srna, "dash2", PROP_INT, PROP_UNSIGNED);
877 RNA_def_property_int_sdna(prop, NULL, "dash2");
878 RNA_def_property_range(prop, 0, USHRT_MAX);
879 RNA_def_property_ui_text(prop, "Dash #2", "Length of the 2nd dash");
880 RNA_def_property_update(prop, NC_SCENE, NULL);
882 prop= RNA_def_property(srna, "gap2", PROP_INT, PROP_UNSIGNED);
883 RNA_def_property_int_sdna(prop, NULL, "gap2");
884 RNA_def_property_range(prop, 0, USHRT_MAX);
885 RNA_def_property_ui_text(prop, "Gap #2", "Length of the 2nd gap");
886 RNA_def_property_update(prop, NC_SCENE, NULL);
888 prop= RNA_def_property(srna, "dash3", PROP_INT, PROP_UNSIGNED);
889 RNA_def_property_int_sdna(prop, NULL, "dash3");
890 RNA_def_property_range(prop, 0, USHRT_MAX);
891 RNA_def_property_ui_text(prop, "Dash #3", "Length of the 3rd dash");
892 RNA_def_property_update(prop, NC_SCENE, NULL);
894 prop= RNA_def_property(srna, "gap3", PROP_INT, PROP_UNSIGNED);
895 RNA_def_property_int_sdna(prop, NULL, "gap3");
896 RNA_def_property_range(prop, 0, USHRT_MAX);
897 RNA_def_property_ui_text(prop, "Gap #3", "Length of the 3rd gap");
898 RNA_def_property_update(prop, NC_SCENE, NULL);
902 void RNA_def_linestyle(BlenderRNA *brna)
904 rna_def_linestyle_modifiers(brna);
905 rna_def_linestyle(brna);