OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
| 3 * |
| 4 * This program is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU General Public License |
| 6 * as published by the Free Software Foundation; either version 2 |
| 7 * of the License, or (at your option) any later version. |
| 8 * |
| 9 * This program is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * You should have received a copy of the GNU General Public License |
| 15 * along with this program; if not, write to the Free Software Foundation, |
| 16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 * |
| 18 * Contributor(s): Blender Foundation (2008). |
| 19 * |
| 20 * ***** END GPL LICENSE BLOCK ***** |
| 21 */ |
| 22 |
| 23 /** \file blender/makesrna/intern/rna_linestyle.c |
| 24 * \ingroup RNA |
| 25 */ |
| 26 |
| 27 #include <stdio.h> |
| 28 #include <stdlib.h> |
| 29 |
| 30 #include "RNA_define.h" |
| 31 #include "RNA_enum_types.h" |
| 32 |
| 33 #include "rna_internal.h" |
| 34 |
| 35 #include "DNA_linestyle_types.h" |
| 36 #include "DNA_material_types.h" |
| 37 #include "DNA_texture_types.h" |
| 38 |
| 39 #include "WM_types.h" |
| 40 #include "WM_api.h" |
| 41 |
| 42 EnumPropertyItem linestyle_color_modifier_type_items[] = { |
| 43 {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke"
, ""}, |
| 44 {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER
, "Distance from Camera", ""}, |
| 45 {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER
, "Distance from Object", ""}, |
| 46 {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""}, |
| 47 {0, NULL, 0, NULL, NULL} |
| 48 }; |
| 49 |
| 50 EnumPropertyItem linestyle_alpha_modifier_type_items[] = { |
| 51 {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke"
, ""}, |
| 52 {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER
, "Distance from Camera", ""}, |
| 53 {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER
, "Distance from Object", ""}, |
| 54 {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""}, |
| 55 {0, NULL, 0, NULL, NULL} |
| 56 }; |
| 57 |
| 58 EnumPropertyItem linestyle_thickness_modifier_type_items[] = { |
| 59 {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke"
, ""}, |
| 60 {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", "
"}, |
| 61 {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER
, "Distance from Camera", ""}, |
| 62 {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER
, "Distance from Object", ""}, |
| 63 {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""}, |
| 64 {0, NULL, 0, NULL, NULL} |
| 65 }; |
| 66 |
| 67 EnumPropertyItem linestyle_geometry_modifier_type_items[] = { |
| 68 {LS_MODIFIER_2D_OFFSET, "2D_OFFSET", ICON_MODIFIER, "2D Offset", ""}, |
| 69 {LS_MODIFIER_2D_TRANSFORM, "2D_TRANSFORM", ICON_MODIFIER, "2D Transform"
, ""}, |
| 70 {LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "B
ackbone Stretcher", ""}, |
| 71 {LS_MODIFIER_BEZIER_CURVE, "BEZIER_CURVE", ICON_MODIFIER, "Bezier Curve"
, ""}, |
| 72 {LS_MODIFIER_BLUEPRINT, "BLUEPRINT", ICON_MODIFIER, "Blueprint", ""}, |
| 73 {LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lin
es", ""}, |
| 74 {LS_MODIFIER_PERLIN_NOISE_1D, "PERLIN_NOISE_1D", ICON_MODIFIER, "Perlin
Noise 1D", ""}, |
| 75 {LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin
Noise 2D", ""}, |
| 76 {LS_MODIFIER_POLYGONIZATION, "POLYGONIZATION", ICON_MODIFIER, "Polygoniz
ation", ""}, |
| 77 {LS_MODIFIER_SAMPLING, "SAMPLING", ICON_MODIFIER, "Sampling", ""}, |
| 78 {LS_MODIFIER_SINUS_DISPLACEMENT, "SINUS_DISPLACEMENT", ICON_MODIFIER, "S
inus Displacement", ""}, |
| 79 {LS_MODIFIER_SPATIAL_NOISE, "SPATIAL_NOISE", ICON_MODIFIER, "Spatial Noi
se", ""}, |
| 80 {LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", "
"}, |
| 81 {0, NULL, 0, NULL, NULL} |
| 82 }; |
| 83 |
| 84 #ifdef RNA_RUNTIME |
| 85 |
| 86 #include "BKE_linestyle.h" |
| 87 |
| 88 static StructRNA *rna_LineStyle_color_modifier_refine(struct PointerRNA *ptr) |
| 89 { |
| 90 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 91 |
| 92 switch (m->type) { |
| 93 case LS_MODIFIER_ALONG_STROKE: |
| 94 return &RNA_LineStyleColorModifier_AlongStroke; |
| 95 case LS_MODIFIER_DISTANCE_FROM_CAMERA: |
| 96 return &RNA_LineStyleColorModifier_DistanceFromCamera; |
| 97 case LS_MODIFIER_DISTANCE_FROM_OBJECT: |
| 98 return &RNA_LineStyleColorModifier_DistanceFromObject; |
| 99 case LS_MODIFIER_MATERIAL: |
| 100 return &RNA_LineStyleColorModifier_Material; |
| 101 default: |
| 102 return &RNA_LineStyleColorModifier; |
| 103 } |
| 104 } |
| 105 |
| 106 static StructRNA *rna_LineStyle_alpha_modifier_refine(struct PointerRNA *ptr) |
| 107 { |
| 108 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 109 |
| 110 switch (m->type) { |
| 111 case LS_MODIFIER_ALONG_STROKE: |
| 112 return &RNA_LineStyleAlphaModifier_AlongStroke; |
| 113 case LS_MODIFIER_DISTANCE_FROM_CAMERA: |
| 114 return &RNA_LineStyleAlphaModifier_DistanceFromCamera; |
| 115 case LS_MODIFIER_DISTANCE_FROM_OBJECT: |
| 116 return &RNA_LineStyleAlphaModifier_DistanceFromObject; |
| 117 case LS_MODIFIER_MATERIAL: |
| 118 return &RNA_LineStyleAlphaModifier_Material; |
| 119 default: |
| 120 return &RNA_LineStyleAlphaModifier; |
| 121 } |
| 122 } |
| 123 |
| 124 static StructRNA *rna_LineStyle_thickness_modifier_refine(struct PointerRNA *ptr
) |
| 125 { |
| 126 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 127 |
| 128 switch (m->type) { |
| 129 case LS_MODIFIER_ALONG_STROKE: |
| 130 return &RNA_LineStyleThicknessModifier_AlongStroke; |
| 131 case LS_MODIFIER_DISTANCE_FROM_CAMERA: |
| 132 return &RNA_LineStyleThicknessModifier_DistanceFromCamer
a; |
| 133 case LS_MODIFIER_DISTANCE_FROM_OBJECT: |
| 134 return &RNA_LineStyleThicknessModifier_DistanceFromObjec
t; |
| 135 case LS_MODIFIER_MATERIAL: |
| 136 return &RNA_LineStyleThicknessModifier_Material; |
| 137 case LS_MODIFIER_CALLIGRAPHY: |
| 138 return &RNA_LineStyleThicknessModifier_Calligraphy; |
| 139 default: |
| 140 return &RNA_LineStyleThicknessModifier; |
| 141 } |
| 142 } |
| 143 |
| 144 static StructRNA *rna_LineStyle_geometry_modifier_refine(struct PointerRNA *ptr) |
| 145 { |
| 146 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 147 |
| 148 switch (m->type) { |
| 149 case LS_MODIFIER_SAMPLING: |
| 150 return &RNA_LineStyleGeometryModifier_Sampling; |
| 151 case LS_MODIFIER_BEZIER_CURVE: |
| 152 return &RNA_LineStyleGeometryModifier_BezierCurve; |
| 153 case LS_MODIFIER_SINUS_DISPLACEMENT: |
| 154 return &RNA_LineStyleGeometryModifier_SinusDisplacement; |
| 155 case LS_MODIFIER_SPATIAL_NOISE: |
| 156 return &RNA_LineStyleGeometryModifier_SpatialNoise; |
| 157 case LS_MODIFIER_PERLIN_NOISE_1D: |
| 158 return &RNA_LineStyleGeometryModifier_PerlinNoise1D; |
| 159 case LS_MODIFIER_PERLIN_NOISE_2D: |
| 160 return &RNA_LineStyleGeometryModifier_PerlinNoise2D; |
| 161 case LS_MODIFIER_BACKBONE_STRETCHER: |
| 162 return &RNA_LineStyleGeometryModifier_BackboneStretcher; |
| 163 case LS_MODIFIER_TIP_REMOVER: |
| 164 return &RNA_LineStyleGeometryModifier_TipRemover; |
| 165 case LS_MODIFIER_POLYGONIZATION: |
| 166 return &RNA_LineStyleGeometryModifier_Polygonalization; |
| 167 case LS_MODIFIER_GUIDING_LINES: |
| 168 return &RNA_LineStyleGeometryModifier_GuidingLines; |
| 169 case LS_MODIFIER_BLUEPRINT: |
| 170 return &RNA_LineStyleGeometryModifier_Blueprint; |
| 171 case LS_MODIFIER_2D_OFFSET: |
| 172 return &RNA_LineStyleGeometryModifier_2DOffset; |
| 173 case LS_MODIFIER_2D_TRANSFORM: |
| 174 return &RNA_LineStyleGeometryModifier_2DTransform; |
| 175 default: |
| 176 return &RNA_LineStyleGeometryModifier; |
| 177 } |
| 178 } |
| 179 |
| 180 static char *rna_LineStyle_color_modifier_path(PointerRNA *ptr) |
| 181 { |
| 182 return BLI_sprintfN("color_modifiers[\"%s\"]", ((LineStyleModifier *)ptr
->data)->name); |
| 183 } |
| 184 |
| 185 static char *rna_LineStyle_alpha_modifier_path(PointerRNA *ptr) |
| 186 { |
| 187 return BLI_sprintfN("alpha_modifiers[\"%s\"]", ((LineStyleModifier *)ptr
->data)->name); |
| 188 } |
| 189 |
| 190 static char *rna_LineStyle_thickness_modifier_path(PointerRNA *ptr) |
| 191 { |
| 192 return BLI_sprintfN("thickness_modifiers[\"%s\"]", ((LineStyleModifier *
)ptr->data)->name); |
| 193 } |
| 194 |
| 195 static char *rna_LineStyle_geometry_modifier_path(PointerRNA *ptr) |
| 196 { |
| 197 return BLI_sprintfN("geometry_modifiers[\"%s\"]", ((LineStyleModifier *)
ptr->data)->name); |
| 198 } |
| 199 |
| 200 static void rna_LineStyleColorModifier_name_set(PointerRNA *ptr, const char *val
ue) |
| 201 { |
| 202 FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data; |
| 203 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 204 |
| 205 BLI_strncpy_utf8(m->name, value, sizeof(m->name)); |
| 206 BLI_uniquename(&linestyle->color_modifiers, m, "ColorModifier", '.', |
| 207 offsetof(LineStyleModifier, name), sizeof(m->name)); |
| 208 } |
| 209 |
| 210 static void rna_LineStyleAlphaModifier_name_set(PointerRNA *ptr, const char *val
ue) |
| 211 { |
| 212 FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data; |
| 213 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 214 |
| 215 BLI_strncpy_utf8(m->name, value, sizeof(m->name)); |
| 216 BLI_uniquename(&linestyle->alpha_modifiers, m, "AlphaModifier", '.', |
| 217 offsetof(LineStyleModifier, name), sizeof(m->name)); |
| 218 } |
| 219 |
| 220 static void rna_LineStyleThicknessModifier_name_set(PointerRNA *ptr, const char
*value) |
| 221 { |
| 222 FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data; |
| 223 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 224 |
| 225 BLI_strncpy_utf8(m->name, value, sizeof(m->name)); |
| 226 BLI_uniquename(&linestyle->thickness_modifiers, m, "ThicknessModifier",
'.', |
| 227 offsetof(LineStyleModifier, name), sizeof(m->name)); |
| 228 } |
| 229 |
| 230 static void rna_LineStyleGeometryModifier_name_set(PointerRNA *ptr, const char *
value) |
| 231 { |
| 232 FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data; |
| 233 LineStyleModifier *m = (LineStyleModifier *)ptr->data; |
| 234 |
| 235 BLI_strncpy_utf8(m->name, value, sizeof(m->name)); |
| 236 BLI_uniquename(&linestyle->geometry_modifiers, m, "GeometryModifier", '.
', |
| 237 offsetof(LineStyleModifier, name), sizeof(m->name)); |
| 238 } |
| 239 |
| 240 #else |
| 241 |
| 242 #include "BLI_math.h" |
| 243 |
| 244 static void rna_def_modifier_type_common(StructRNA *srna, EnumPropertyItem *modi
fier_type_items, |
| 245 char *set_name_func, int blend, int col
or) |
| 246 { |
| 247 PropertyRNA *prop; |
| 248 |
| 249 /* TODO: Check this is not already defined somewhere else, e.g. in nodes
... */ |
| 250 static EnumPropertyItem value_blend_items[] = { |
| 251 {LS_VALUE_BLEND, "MIX", 0, "Mix", ""}, |
| 252 {LS_VALUE_ADD, "ADD", 0, "Add", ""}, |
| 253 {LS_VALUE_SUB, "SUBTRACT", 0, "Subtract", ""}, |
| 254 {LS_VALUE_MULT, "MULTIPLY", 0, "Multiply", ""}, |
| 255 {LS_VALUE_DIV, "DIVIDE", 0, "Divide", ""}, |
| 256 {LS_VALUE_DIFF, "DIFFERENCE", 0, "Difference", ""}, |
| 257 {LS_VALUE_MIN, "MININUM", 0, "Minimum", ""},· |
| 258 {LS_VALUE_MAX, "MAXIMUM", 0, "Maximum", ""},· |
| 259 {0, NULL, 0, NULL, NULL} |
| 260 }; |
| 261 |
| 262 prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); |
| 263 RNA_def_property_enum_sdna(prop, NULL, "modifier.type"); |
| 264 RNA_def_property_enum_items(prop, modifier_type_items); |
| 265 RNA_def_property_clear_flag(prop, PROP_EDITABLE); |
| 266 RNA_def_property_ui_text(prop, "Modifier Type", "Type of the modifier"); |
| 267 |
| 268 prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); |
| 269 RNA_def_property_string_sdna(prop, NULL, "modifier.name"); |
| 270 RNA_def_property_string_funcs(prop, NULL, NULL, set_name_func); |
| 271 RNA_def_property_ui_text(prop, "Modifier Name", "Name of the modifier"); |
| 272 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 273 RNA_def_struct_name_property(srna, prop); |
| 274 |
| 275 if (blend) { |
| 276 prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE); |
| 277 RNA_def_property_enum_sdna(prop, NULL, "modifier.blend"); |
| 278 RNA_def_property_enum_items(prop, (color) ? ramp_blend_items : v
alue_blend_items); |
| 279 RNA_def_property_ui_text(prop, "Blend", "Specify how the modifie
r value is blended into the base value"); |
| 280 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 281 |
| 282 prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACT
OR); |
| 283 RNA_def_property_float_sdna(prop, NULL, "modifier.influence"); |
| 284 RNA_def_property_range(prop, 0.0f, 1.0f); |
| 285 RNA_def_property_ui_text(prop, "Influence", "Influence factor by
which the modifier changes the property"); |
| 286 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 287 } |
| 288 |
| 289 prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE); |
| 290 RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_
ENABLED); |
| 291 RNA_def_property_ui_text(prop, "Use", "Enable or disable this modifier d
uring stroke rendering"); |
| 292 |
| 293 prop = RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE); |
| 294 RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_
EXPANDED); |
| 295 RNA_def_property_ui_text(prop, "Expanded", "True if the modifier tab is
expanded"); |
| 296 } |
| 297 |
| 298 static void rna_def_color_modifier(StructRNA *srna) |
| 299 { |
| 300 rna_def_modifier_type_common(srna, linestyle_color_modifier_type_items, |
| 301 "rna_LineStyleColorModifier_name_set", TRUE
, TRUE); |
| 302 } |
| 303 |
| 304 static void rna_def_alpha_modifier(StructRNA *srna) |
| 305 { |
| 306 rna_def_modifier_type_common(srna, linestyle_alpha_modifier_type_items, |
| 307 "rna_LineStyleAlphaModifier_name_set", TRUE
, FALSE); |
| 308 } |
| 309 |
| 310 static void rna_def_thickness_modifier(StructRNA *srna) |
| 311 { |
| 312 rna_def_modifier_type_common(srna, linestyle_thickness_modifier_type_ite
ms, |
| 313 "rna_LineStyleThicknessModifier_name_set",
TRUE, FALSE); |
| 314 } |
| 315 |
| 316 static void rna_def_geometry_modifier(StructRNA *srna) |
| 317 { |
| 318 rna_def_modifier_type_common(srna, linestyle_geometry_modifier_type_item
s, |
| 319 "rna_LineStyleGeometryModifier_name_set", F
ALSE, FALSE); |
| 320 } |
| 321 |
| 322 static void rna_def_modifier_color_ramp_common(StructRNA *srna, int range) |
| 323 { |
| 324 PropertyRNA *prop; |
| 325 |
| 326 prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE); |
| 327 RNA_def_property_pointer_sdna(prop, NULL, "color_ramp"); |
| 328 RNA_def_property_struct_type(prop, "ColorRamp"); |
| 329 RNA_def_property_ui_text(prop, "Color Ramp", "Color ramp used to change
line color"); |
| 330 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 331 |
| 332 if (range) { |
| 333 prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_NONE
); |
| 334 RNA_def_property_float_sdna(prop, NULL, "range_min"); |
| 335 RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the
input range the mapping is applied"); |
| 336 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 337 |
| 338 prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_NONE
); |
| 339 RNA_def_property_float_sdna(prop, NULL, "range_max"); |
| 340 RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the
input range the mapping is applied"); |
| 341 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 342 } |
| 343 } |
| 344 |
| 345 static void rna_def_modifier_curve_common(StructRNA *srna, int range, int value) |
| 346 { |
| 347 PropertyRNA *prop; |
| 348 |
| 349 static EnumPropertyItem mapping_items[] = { |
| 350 {0, "LINEAR", 0, "Linear", "Use linear mapping"}, |
| 351 {LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"
}, |
| 352 {0, NULL, 0, NULL, NULL} |
| 353 }; |
| 354 |
| 355 prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE); |
| 356 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); |
| 357 RNA_def_property_enum_items(prop, mapping_items); |
| 358 RNA_def_property_ui_text(prop, "Mapping", "Select the mapping type"); |
| 359 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 360 |
| 361 prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE); |
| 362 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_INVERT); |
| 363 RNA_def_property_ui_text(prop, "Invert", "Invert the fade-out direction
of the linear mapping"); |
| 364 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 365 |
| 366 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); |
| 367 RNA_def_property_pointer_sdna(prop, NULL, "curve"); |
| 368 RNA_def_property_struct_type(prop, "CurveMapping"); |
| 369 RNA_def_property_ui_text(prop, "Curve", "Curve used for the curve mappin
g"); |
| 370 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 371 |
| 372 if (range) { |
| 373 prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_NONE
); |
| 374 RNA_def_property_float_sdna(prop, NULL, "range_min"); |
| 375 RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the
input range the mapping is applied"); |
| 376 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 377 |
| 378 prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_NONE
); |
| 379 RNA_def_property_float_sdna(prop, NULL, "range_max"); |
| 380 RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the
input range the mapping is applied"); |
| 381 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 382 } |
| 383 |
| 384 if (value) { |
| 385 prop = RNA_def_property(srna, "value_min", PROP_FLOAT, PROP_NONE
); |
| 386 RNA_def_property_float_sdna(prop, NULL, "value_min"); |
| 387 RNA_def_property_ui_text(prop, "Value Min", "Minimum output valu
e of the mapping"); |
| 388 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 389 |
| 390 prop = RNA_def_property(srna, "value_max", PROP_FLOAT, PROP_NONE
); |
| 391 RNA_def_property_float_sdna(prop, NULL, "value_max"); |
| 392 RNA_def_property_ui_text(prop, "Value Max", "Maximum output valu
e of the mapping"); |
| 393 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 394 } |
| 395 } |
| 396 |
| 397 static void rna_def_modifier_material_common(StructRNA *srna) |
| 398 { |
| 399 PropertyRNA *prop; |
| 400 |
| 401 static EnumPropertyItem mat_attr_items[] = { |
| 402 {LS_MODIFIER_MATERIAL_DIFF, "DIFF", 0, "Diffuse", ""}, |
| 403 {LS_MODIFIER_MATERIAL_DIFF_R, "DIFF_R", 0, "Diffuse Red", ""}, |
| 404 {LS_MODIFIER_MATERIAL_DIFF_G, "DIFF_G", 0, "Diffuse Green", ""}, |
| 405 {LS_MODIFIER_MATERIAL_DIFF_B, "DIFF_B", 0, "Diffuse Blue", ""}, |
| 406 {LS_MODIFIER_MATERIAL_SPEC, "SPEC", 0, "Specular", ""}, |
| 407 {LS_MODIFIER_MATERIAL_SPEC_R, "SPEC_R", 0, "Specular Red", ""}, |
| 408 {LS_MODIFIER_MATERIAL_SPEC_G, "SPEC_G", 0, "Specular Green", ""}
, |
| 409 {LS_MODIFIER_MATERIAL_SPEC_B, "SPEC_B", 0, "Specular Blue", ""}, |
| 410 {LS_MODIFIER_MATERIAL_SPEC_HARD, "SPEC_HARD", 0, "Specular Hardn
ess", ""}, |
| 411 {LS_MODIFIER_MATERIAL_ALPHA, "ALPHA", 0, "Alpha", ""}, |
| 412 {0, NULL, 0, NULL, NULL} |
| 413 }; |
| 414 |
| 415 prop = RNA_def_property(srna, "material_attr", PROP_ENUM, PROP_NONE); |
| 416 RNA_def_property_enum_sdna(prop, NULL, "mat_attr"); |
| 417 RNA_def_property_enum_items(prop, mat_attr_items); |
| 418 RNA_def_property_ui_text(prop, "Material Attribute", "Specify which mate
rial attribute is used"); |
| 419 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 420 |
| 421 } |
| 422 |
| 423 static void rna_def_linestyle_modifiers(BlenderRNA *brna) |
| 424 { |
| 425 StructRNA *srna; |
| 426 PropertyRNA *prop; |
| 427 |
| 428 static EnumPropertyItem blueprint_shape_items[] = { |
| 429 {LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a
blueprint using circular contour strokes"}, |
| 430 {LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Dra
w a blueprint using elliptic contour strokes"}, |
| 431 {LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a
blueprint using square contour strokes"}, |
| 432 {0, NULL, 0, NULL, NULL} |
| 433 }; |
| 434 |
| 435 static EnumPropertyItem transform_pivot_items[] = { |
| 436 {LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER, "CENTER", 0, "Stroke Cen
ter", ""}, |
| 437 {LS_MODIFIER_2D_TRANSFORM_PIVOT_START, "START", 0, "Stroke Start
", ""}, |
| 438 {LS_MODIFIER_2D_TRANSFORM_PIVOT_END, "END", 0, "Stroke End", ""}
, |
| 439 {LS_MODIFIER_2D_TRANSFORM_PIVOT_PARAM, "PARAM", 0, "Stroke Point
Parameter", ""}, |
| 440 {LS_MODIFIER_2D_TRANSFORM_PIVOT_ABSOLUTE, "ABSOLUTE", 0, "Absolu
te 2D Point", ""}, |
| 441 {0, NULL, 0, NULL, NULL} |
| 442 }; |
| 443 |
| 444 srna = RNA_def_struct(brna, "LineStyleModifier", NULL); |
| 445 RNA_def_struct_ui_text(srna, "Line Style Modifier", "Base type to define
modifiers"); |
| 446 |
| 447 /* line color modifiers */ |
| 448 |
| 449 srna = RNA_def_struct(brna, "LineStyleColorModifier", "LineStyleModifier
"); |
| 450 RNA_def_struct_sdna(srna, "LineStyleModifier"); |
| 451 RNA_def_struct_refine_func(srna, "rna_LineStyle_color_modifier_refine"); |
| 452 RNA_def_struct_path_func(srna, "rna_LineStyle_color_modifier_path"); |
| 453 RNA_def_struct_ui_text(srna, "Line Style Color Modifier", "Base type to
define line color modifiers"); |
| 454 |
| 455 srna = RNA_def_struct(brna, "LineStyleColorModifier_AlongStroke", "LineS
tyleColorModifier"); |
| 456 RNA_def_struct_ui_text(srna, "Along Stroke", "Change line color along st
roke"); |
| 457 rna_def_color_modifier(srna); |
| 458 rna_def_modifier_color_ramp_common(srna, FALSE); |
| 459 |
| 460 srna = RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromCamera",
"LineStyleColorModifier"); |
| 461 RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line color
based on the distance from the camera"); |
| 462 rna_def_color_modifier(srna); |
| 463 rna_def_modifier_color_ramp_common(srna, TRUE); |
| 464 |
| 465 srna = RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromObject",
"LineStyleColorModifier"); |
| 466 RNA_def_struct_ui_text(srna, "Distance from Object", "Change line color
based on the distance from an object"); |
| 467 rna_def_color_modifier(srna); |
| 468 rna_def_modifier_color_ramp_common(srna, TRUE); |
| 469 |
| 470 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); |
| 471 RNA_def_property_pointer_sdna(prop, NULL, "target"); |
| 472 RNA_def_property_struct_type(prop, "Object"); |
| 473 RNA_def_property_flag(prop, PROP_EDITABLE); |
| 474 RNA_def_property_ui_text(prop, "Target", "Target object from which the d
istance is measured"); |
| 475 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 476 |
| 477 srna = RNA_def_struct(brna, "LineStyleColorModifier_Material", "LineStyl
eColorModifier"); |
| 478 RNA_def_struct_ui_text(srna, "Material", "Change line color based on a m
aterial attribute"); |
| 479 rna_def_color_modifier(srna); |
| 480 rna_def_modifier_material_common(srna); |
| 481 rna_def_modifier_color_ramp_common(srna, FALSE); |
| 482 |
| 483 prop = RNA_def_property(srna, "use_ramp", PROP_BOOLEAN, PROP_NONE); |
| 484 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_USE_RAMP)
; |
| 485 RNA_def_property_ui_text(prop, "Ramp", "Use color ramp to map the BW ave
rage into an RGB color"); |
| 486 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 487 |
| 488 /* alpha transparency modifiers */ |
| 489 |
| 490 srna = RNA_def_struct(brna, "LineStyleAlphaModifier", "LineStyleModifier
"); |
| 491 RNA_def_struct_sdna(srna, "LineStyleModifier"); |
| 492 RNA_def_struct_refine_func(srna, "rna_LineStyle_alpha_modifier_refine"); |
| 493 RNA_def_struct_path_func(srna, "rna_LineStyle_alpha_modifier_path"); |
| 494 RNA_def_struct_ui_text(srna, "Line Style Alpha Modifier", "Base type to
define alpha transparency modifiers"); |
| 495 |
| 496 srna = RNA_def_struct(brna, "LineStyleAlphaModifier_AlongStroke", "LineS
tyleAlphaModifier"); |
| 497 RNA_def_struct_ui_text(srna, "Along Stroke", "Change alpha transparency
along stroke"); |
| 498 rna_def_alpha_modifier(srna); |
| 499 rna_def_modifier_curve_common(srna, FALSE, FALSE); |
| 500 |
| 501 srna = RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromCamera",
"LineStyleAlphaModifier"); |
| 502 RNA_def_struct_ui_text(srna, "Distance from Camera", |
| 503 "Change alpha transparency based on the distance
from the camera"); |
| 504 rna_def_alpha_modifier(srna); |
| 505 rna_def_modifier_curve_common(srna, TRUE, FALSE); |
| 506 |
| 507 srna= RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromObject",
"LineStyleAlphaModifier"); |
| 508 RNA_def_struct_ui_text(srna, "Distance from Object", |
| 509 "Change alpha transparency based on the distance
from an object"); |
| 510 rna_def_alpha_modifier(srna); |
| 511 rna_def_modifier_curve_common(srna, TRUE, FALSE); |
| 512 |
| 513 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); |
| 514 RNA_def_property_pointer_sdna(prop, NULL, "target"); |
| 515 RNA_def_property_struct_type(prop, "Object"); |
| 516 RNA_def_property_flag(prop, PROP_EDITABLE); |
| 517 RNA_def_property_ui_text(prop, "Target", "Target object from which the d
istance is measured"); |
| 518 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 519 |
| 520 srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Material", "LineStyl
eAlphaModifier"); |
| 521 RNA_def_struct_ui_text(srna, "Material", "Change alpha transparency base
d on a material attribute"); |
| 522 rna_def_alpha_modifier(srna); |
| 523 rna_def_modifier_material_common(srna); |
| 524 rna_def_modifier_curve_common(srna, FALSE, FALSE); |
| 525 |
| 526 /* line thickness modifiers */ |
| 527 |
| 528 srna = RNA_def_struct(brna, "LineStyleThicknessModifier", "LineStyleModi
fier"); |
| 529 RNA_def_struct_sdna(srna, "LineStyleModifier"); |
| 530 RNA_def_struct_refine_func(srna, "rna_LineStyle_thickness_modifier_refin
e"); |
| 531 RNA_def_struct_path_func(srna, "rna_LineStyle_thickness_modifier_path"); |
| 532 RNA_def_struct_ui_text(srna, "Line Style Thickness Modifier", "Base type
to define line thickness modifiers"); |
| 533 |
| 534 srna = RNA_def_struct(brna, "LineStyleThicknessModifier_AlongStroke", "L
ineStyleThicknessModifier"); |
| 535 RNA_def_struct_ui_text(srna, "Along Stroke", "Change line thickness alon
g stroke"); |
| 536 rna_def_thickness_modifier(srna); |
| 537 rna_def_modifier_curve_common(srna, FALSE, TRUE); |
| 538 |
| 539 srna = RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromCame
ra", "LineStyleThicknessModifier"); |
| 540 RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line thickn
ess based on the distance from the camera"); |
| 541 rna_def_thickness_modifier(srna); |
| 542 rna_def_modifier_curve_common(srna, TRUE, TRUE); |
| 543 |
| 544 srna = RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromObje
ct", "LineStyleThicknessModifier"); |
| 545 RNA_def_struct_ui_text(srna, "Distance from Object", "Change line thickn
ess based on the distance from an object"); |
| 546 rna_def_thickness_modifier(srna); |
| 547 rna_def_modifier_curve_common(srna, TRUE, TRUE); |
| 548 |
| 549 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE); |
| 550 RNA_def_property_pointer_sdna(prop, NULL, "target"); |
| 551 RNA_def_property_struct_type(prop, "Object"); |
| 552 RNA_def_property_flag(prop, PROP_EDITABLE); |
| 553 RNA_def_property_ui_text(prop, "Target", "Target object from which the d
istance is measured"); |
| 554 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 555 |
| 556 srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Material", "Line
StyleThicknessModifier"); |
| 557 RNA_def_struct_ui_text(srna, "Material", "Change line thickness based on
a material attribute"); |
| 558 rna_def_thickness_modifier(srna); |
| 559 rna_def_modifier_material_common(srna); |
| 560 rna_def_modifier_curve_common(srna, FALSE, TRUE); |
| 561 |
| 562 srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Calligraphy", "L
ineStyleThicknessModifier"); |
| 563 RNA_def_struct_ui_text(srna, "Calligraphy", |
| 564 "Change line thickness so that stroke looks like
made with a calligraphic pen"); |
| 565 rna_def_thickness_modifier(srna); |
| 566 |
| 567 prop = RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_ANGLE); |
| 568 RNA_def_property_float_sdna(prop, NULL, "orientation"); |
| 569 RNA_def_property_ui_text(prop, "Orientation", "Angle of the main directi
on"); |
| 570 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 571 |
| 572 prop = RNA_def_property(srna, "min_thickness", PROP_FLOAT, PROP_NONE); |
| 573 RNA_def_property_float_sdna(prop, NULL, "min_thickness"); |
| 574 RNA_def_property_range(prop, 0.0f, 10000.0f); |
| 575 RNA_def_property_ui_text(prop, "Min Thickness", |
| 576 "Minimum thickness in the direction perpendicul
ar to the main direction"); |
| 577 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 578 |
| 579 prop = RNA_def_property(srna, "max_thickness", PROP_FLOAT, PROP_NONE); |
| 580 RNA_def_property_float_sdna(prop, NULL, "max_thickness"); |
| 581 RNA_def_property_range(prop, 0.0f, 10000.0f); |
| 582 RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness in th
e main direction"); |
| 583 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 584 |
| 585 /* geometry modifiers */ |
| 586 |
| 587 srna = RNA_def_struct(brna, "LineStyleGeometryModifier", "LineStyleModif
ier"); |
| 588 RNA_def_struct_sdna(srna, "LineStyleModifier"); |
| 589 RNA_def_struct_refine_func(srna, "rna_LineStyle_geometry_modifier_refine
"); |
| 590 RNA_def_struct_path_func(srna, "rna_LineStyle_geometry_modifier_path"); |
| 591 RNA_def_struct_ui_text(srna, "Line Style Geometry Modifier", "Base type
to define stroke geometry modifiers"); |
| 592 |
| 593 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Sampling", "LineS
tyleGeometryModifier"); |
| 594 RNA_def_struct_ui_text(srna, "Sampling", |
| 595 "Specify a new sampling value that determines the
resolution of stroke polylines"); |
| 596 rna_def_geometry_modifier(srna); |
| 597 |
| 598 prop = RNA_def_property(srna, "sampling", PROP_FLOAT, PROP_NONE); |
| 599 RNA_def_property_float_sdna(prop, NULL, "sampling"); |
| 600 RNA_def_property_ui_text(prop, "Sampling", "New sampling value to be use
d for subsequent modifiers"); |
| 601 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 602 |
| 603 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_BezierCurve", "Li
neStyleGeometryModifier"); |
| 604 RNA_def_struct_ui_text(srna, "Bezier Curve", |
| 605 "Replace stroke backbone geometry by a Bezier cur
ve approximation of the " |
| 606 "original backbone geometry"); |
| 607 rna_def_geometry_modifier(srna); |
| 608 |
| 609 prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE); |
| 610 RNA_def_property_float_sdna(prop, NULL, "error"); |
| 611 RNA_def_property_ui_text(prop, "Error", |
| 612 "Maximum distance allowed between the new Bezie
r curve and the " |
| 613 "original backbone geometry)"); |
| 614 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 615 |
| 616 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_SinusDisplacement
", "LineStyleGeometryModifier"); |
| 617 RNA_def_struct_ui_text(srna, "Sinus Displacement", "Add sinus displaceme
nt to stroke backbone geometry"); |
| 618 rna_def_geometry_modifier(srna); |
| 619 |
| 620 prop = RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_NONE); |
| 621 RNA_def_property_float_sdna(prop, NULL, "wavelength"); |
| 622 RNA_def_property_ui_text(prop, "Wavelength", "Wavelength of the sinus di
splacement"); |
| 623 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 624 |
| 625 prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE); |
| 626 RNA_def_property_float_sdna(prop, NULL, "amplitude"); |
| 627 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the sinus disp
lacement"); |
| 628 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 629 |
| 630 prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE); |
| 631 RNA_def_property_float_sdna(prop, NULL, "phase"); |
| 632 RNA_def_property_ui_text(prop, "Phase", "Phase of the sinus displacement
"); |
| 633 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 634 |
| 635 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_SpatialNoise", "L
ineStyleGeometryModifier"); |
| 636 RNA_def_struct_ui_text(srna, "Spatial Noise", "Add spatial noise to stro
ke backbone geometry"); |
| 637 rna_def_geometry_modifier(srna); |
| 638 |
| 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 spatial no
ise"); |
| 642 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 643 |
| 644 prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE); |
| 645 RNA_def_property_float_sdna(prop, NULL, "scale"); |
| 646 RNA_def_property_ui_text(prop, "Scale", "Scale of the spatial noise"); |
| 647 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 648 |
| 649 prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED); |
| 650 RNA_def_property_int_sdna(prop, NULL, "octaves"); |
| 651 RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the
amount of detail of the spatial noise)"); |
| 652 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 653 |
| 654 prop = RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE); |
| 655 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_N
OISE_SMOOTH); |
| 656 RNA_def_property_ui_text(prop, "Smooth", "If true, the spatial noise is
smooth"); |
| 657 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 658 |
| 659 prop = RNA_def_property(srna, "pure_random", PROP_BOOLEAN, PROP_NONE); |
| 660 RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_N
OISE_PURERANDOM); |
| 661 RNA_def_property_ui_text(prop, "Pure Random", "If true, the spatial nois
e does not show any coherence"); |
| 662 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 663 |
| 664 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise1D", "
LineStyleGeometryModifier"); |
| 665 RNA_def_struct_ui_text(srna, "Perlin Noise 1D", "Add one-dimensional Per
lin noise to stroke backbone geometry"); |
| 666 rna_def_geometry_modifier(srna); |
| 667 |
| 668 prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE); |
| 669 RNA_def_property_float_sdna(prop, NULL, "frequency"); |
| 670 RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noi
se"); |
| 671 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 672 |
| 673 prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE); |
| 674 RNA_def_property_float_sdna(prop, NULL, "amplitude"); |
| 675 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noi
se"); |
| 676 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 677 |
| 678 prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED); |
| 679 RNA_def_property_int_sdna(prop, NULL, "octaves"); |
| 680 RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the
amount of detail of the Perlin noise)"); |
| 681 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 682 |
| 683 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); |
| 684 RNA_def_property_float_sdna(prop, NULL, "angle"); |
| 685 RNA_def_property_ui_text(prop, "Angle", "Displacement direction"); |
| 686 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 687 |
| 688 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); |
| 689 RNA_def_property_int_sdna(prop, NULL, "seed"); |
| 690 RNA_def_property_ui_text(prop, "Seed", |
| 691 "Seed for random number generation (if negative
, time is used as a seed instead)"); |
| 692 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 693 |
| 694 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise2D", "
LineStyleGeometryModifier"); |
| 695 RNA_def_struct_ui_text(srna, "Perlin Noise 2D", "Add two-dimensional Per
lin noise to stroke backbone geometry"); |
| 696 rna_def_geometry_modifier(srna); |
| 697 |
| 698 prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE); |
| 699 RNA_def_property_float_sdna(prop, NULL, "frequency"); |
| 700 RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noi
se"); |
| 701 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 702 |
| 703 prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE); |
| 704 RNA_def_property_float_sdna(prop, NULL, "amplitude"); |
| 705 RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noi
se"); |
| 706 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 707 |
| 708 prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED); |
| 709 RNA_def_property_int_sdna(prop, NULL, "octaves"); |
| 710 RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the
amount of detail of the Perlin noise)"); |
| 711 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 712 |
| 713 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); |
| 714 RNA_def_property_float_sdna(prop, NULL, "angle"); |
| 715 RNA_def_property_ui_text(prop, "Angle", "Displacement direction"); |
| 716 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 717 |
| 718 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE); |
| 719 RNA_def_property_int_sdna(prop, NULL, "seed"); |
| 720 RNA_def_property_ui_text(prop, "Seed", |
| 721 "Seed for random number generation (if negative
, time is used as a seed instead)"); |
| 722 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 723 |
| 724 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_BackboneStretcher
", "LineStyleGeometryModifier"); |
| 725 RNA_def_struct_ui_text(srna, "Backbone Stretcher", "Stretch the beginnin
g and the end of stroke backbone"); |
| 726 rna_def_geometry_modifier(srna); |
| 727 |
| 728 prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE); |
| 729 RNA_def_property_float_sdna(prop, NULL, "backbone_length"); |
| 730 RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone st
retching"); |
| 731 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 732 |
| 733 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_TipRemover", "Lin
eStyleGeometryModifier"); |
| 734 RNA_def_struct_ui_text(srna, "Tip Remover", |
| 735 "Remove a piece of stroke at the beginning and th
e end of stroke backbone"); |
| 736 rna_def_geometry_modifier(srna); |
| 737 |
| 738 prop = RNA_def_property(srna, "tip_length", PROP_FLOAT, PROP_NONE); |
| 739 RNA_def_property_float_sdna(prop, NULL, "tip_length"); |
| 740 RNA_def_property_ui_text(prop, "Tip Length", "Length of tips to be remov
ed"); |
| 741 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 742 |
| 743 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Polygonalization"
, "LineStyleGeometryModifier"); |
| 744 RNA_def_struct_ui_text(srna, "Polygonalization", "Modify the stroke geom
etry so that it looks more 'polygonal'"); |
| 745 rna_def_geometry_modifier(srna); |
| 746 |
| 747 prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE); |
| 748 RNA_def_property_float_sdna(prop, NULL, "error"); |
| 749 RNA_def_property_ui_text(prop, "Error", |
| 750 "Maximum distance between the original stroke a
nd its polygonal approximation"); |
| 751 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 752 |
| 753 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_GuidingLines", "L
ineStyleGeometryModifier"); |
| 754 RNA_def_struct_ui_text(srna, "Guiding Lines", |
| 755 "Modify the stroke geometry so that it correspond
s to its main direction line"); |
| 756 rna_def_geometry_modifier(srna); |
| 757 |
| 758 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE); |
| 759 RNA_def_property_float_sdna(prop, NULL, "offset"); |
| 760 RNA_def_property_ui_text(prop, "Offset", |
| 761 "Displacement that is applied to the main direc
tion line along its normal"); |
| 762 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 763 |
| 764 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Blueprint", "Line
StyleGeometryModifier"); |
| 765 RNA_def_struct_ui_text(srna, "Blueprint", |
| 766 "Produce a blueprint using circular, elliptic, an
d square contour strokes"); |
| 767 rna_def_geometry_modifier(srna); |
| 768 |
| 769 prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE); |
| 770 RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); |
| 771 RNA_def_property_enum_items(prop, blueprint_shape_items); |
| 772 RNA_def_property_ui_text(prop, "Shape", "Select the shape of blueprint c
ontour strokes"); |
| 773 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 774 |
| 775 prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED); |
| 776 RNA_def_property_int_sdna(prop, NULL, "rounds"); |
| 777 RNA_def_property_range(prop, 1, 1000); |
| 778 RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in contour st
rokes"); |
| 779 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 780 |
| 781 prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE); |
| 782 RNA_def_property_float_sdna(prop, NULL, "backbone_length"); |
| 783 RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone st
retching"); |
| 784 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 785 |
| 786 prop = RNA_def_property(srna, "random_radius", PROP_INT, PROP_UNSIGNED); |
| 787 RNA_def_property_int_sdna(prop, NULL, "random_radius"); |
| 788 RNA_def_property_ui_text(prop, "Random Radius", "Randomness of the radiu
s"); |
| 789 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 790 |
| 791 prop = RNA_def_property(srna, "random_center", PROP_INT, PROP_UNSIGNED); |
| 792 RNA_def_property_int_sdna(prop, NULL, "random_center"); |
| 793 RNA_def_property_ui_text(prop, "Random Center", "Randomness of the cente
r"); |
| 794 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 795 |
| 796 prop = RNA_def_property(srna, "random_backbone", PROP_INT, PROP_UNSIGNED
); |
| 797 RNA_def_property_int_sdna(prop, NULL, "random_backbone"); |
| 798 RNA_def_property_ui_text(prop, "Random Backbone", "Randomness of the bac
kbone stretching"); |
| 799 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 800 |
| 801 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DOffset", "LineS
tyleGeometryModifier"); |
| 802 RNA_def_struct_ui_text(srna, "2D Offset", "Add two-dimensional offsets t
o stroke backbone geometry"); |
| 803 rna_def_geometry_modifier(srna); |
| 804 |
| 805 prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE); |
| 806 RNA_def_property_float_sdna(prop, NULL, "start"); |
| 807 RNA_def_property_ui_text(prop, "Start", "Displacement that is applied fr
om the beginning of the stroke"); |
| 808 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 809 |
| 810 prop = RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE); |
| 811 RNA_def_property_float_sdna(prop, NULL, "end"); |
| 812 RNA_def_property_ui_text(prop, "End", "Displacement that is applied from
the end of the stroke"); |
| 813 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 814 |
| 815 prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE); |
| 816 RNA_def_property_float_sdna(prop, NULL, "x"); |
| 817 RNA_def_property_ui_text(prop, "X", "Displacement that is applied to the
X coordinates of stroke vertices"); |
| 818 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 819 |
| 820 prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE); |
| 821 RNA_def_property_float_sdna(prop, NULL, "y"); |
| 822 RNA_def_property_ui_text(prop, "Y", "Displacement that is applied to the
Y coordinates of stroke vertices"); |
| 823 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 824 |
| 825 srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DTransform", "Li
neStyleGeometryModifier"); |
| 826 RNA_def_struct_ui_text(srna, "2D Transform", |
| 827 "Apply two-dimensional scaling and rotation to st
roke backbone geometry"); |
| 828 rna_def_geometry_modifier(srna); |
| 829 |
| 830 prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE); |
| 831 RNA_def_property_enum_sdna(prop, NULL, "pivot"); |
| 832 RNA_def_property_enum_items(prop, transform_pivot_items); |
| 833 RNA_def_property_ui_text(prop, "Pivot", "Pivot of scaling and rotation o
perations"); |
| 834 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 835 |
| 836 prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE); |
| 837 RNA_def_property_float_sdna(prop, NULL, "scale_x"); |
| 838 RNA_def_property_ui_text(prop, "Scale X", "Scaling factor that is applie
d along the X axis"); |
| 839 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 840 |
| 841 prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE); |
| 842 RNA_def_property_float_sdna(prop, NULL, "scale_y"); |
| 843 RNA_def_property_ui_text(prop, "Scale Y", "Scaling factor that is applie
d along the Y axis"); |
| 844 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 845 |
| 846 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); |
| 847 RNA_def_property_float_sdna(prop, NULL, "angle"); |
| 848 RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation angle"); |
| 849 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 850 |
| 851 prop = RNA_def_property(srna, "pivot_u", PROP_FLOAT, PROP_FACTOR); |
| 852 RNA_def_property_float_sdna(prop, NULL, "pivot_u"); |
| 853 RNA_def_property_range(prop, 0.f, 1.f); |
| 854 RNA_def_property_ui_text(prop, "Stroke Point Parameter", |
| 855 "Pivot in terms of the stroke point parameter u
(0 <= u <= 1)"); |
| 856 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 857 |
| 858 prop = RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE); |
| 859 RNA_def_property_float_sdna(prop, NULL, "pivot_x"); |
| 860 RNA_def_property_ui_text(prop, "Pivot X", "2D X coordinate of the absolu
te pivot"); |
| 861 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 862 |
| 863 prop = RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE); |
| 864 RNA_def_property_float_sdna(prop, NULL, "pivot_y"); |
| 865 RNA_def_property_ui_text(prop, "Pivot Y", "2D Y coordinate of the absolu
te pivot"); |
| 866 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 867 } |
| 868 |
| 869 static void rna_def_linestyle(BlenderRNA *brna) |
| 870 { |
| 871 StructRNA *srna; |
| 872 PropertyRNA *prop; |
| 873 |
| 874 static EnumPropertyItem panel_items[] = { |
| 875 {LS_PANEL_STROKES, "STROKES", 0, "Strokes", "Show the panel for
stroke construction"}, |
| 876 {LS_PANEL_COLOR, "COLOR", 0, "Color", "Show the panel for line c
olor options"}, |
| 877 {LS_PANEL_ALPHA, "ALPHA", 0, "Alpha", "Show the panel for alpha
transparency options"}, |
| 878 {LS_PANEL_THICKNESS, "THICKNESS", 0, "Thickness", "Show the pane
l for line thickness options"}, |
| 879 {LS_PANEL_GEOMETRY, "GEOMETRY", 0, "Geometry", "Show the panel f
or stroke geometry options"}, |
| 880 #if 0 /* hidden for now */ |
| 881 {LS_PANEL_MISC, "MISC", 0, "Misc", "Show the panel for miscellan
eous options"}, |
| 882 #endif |
| 883 {0, NULL, 0, NULL, NULL} |
| 884 }; |
| 885 static EnumPropertyItem chaining_items[] = { |
| 886 {LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"}, |
| 887 {LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining
with a multiple touch"}, |
| 888 {0, NULL, 0, NULL, NULL} |
| 889 }; |
| 890 static EnumPropertyItem cap_items[] = { |
| 891 {LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"}, |
| 892 {LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"}, |
| 893 {LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and ex
tended)"}, |
| 894 {0, NULL, 0, NULL, NULL} |
| 895 }; |
| 896 static EnumPropertyItem thickness_position_items[] = { |
| 897 {LS_THICKNESS_CENTER, "CENTER", 0, "Center", "Stroke is centered
along stroke geometry"}, |
| 898 {LS_THICKNESS_INSIDE, "INSIDE", 0, "Inside", "Stroke is drawn in
side stroke geometry"}, |
| 899 {LS_THICKNESS_OUTSIDE, "OUTSIDE", 0, "Outside", "Stroke is drawn
outside stroke geometry"}, |
| 900 {LS_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Stroke think
ness is split by a user-defined ratio"}, |
| 901 {0, NULL, 0, NULL, NULL} |
| 902 }; |
| 903 |
| 904 srna = RNA_def_struct(brna, "FreestyleLineStyle", "ID"); |
| 905 RNA_def_struct_ui_text(srna, "Freestyle Line Style", "Freestyle line sty
le, reusable by multiple line sets"); |
| 906 RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA); /* FIXME: use a proper ic
on */ |
| 907 |
| 908 prop = RNA_def_property(srna, "panel", PROP_ENUM, PROP_NONE); |
| 909 RNA_def_property_enum_bitflag_sdna(prop, NULL, "panel"); |
| 910 RNA_def_property_enum_items(prop, panel_items); |
| 911 RNA_def_property_ui_text(prop, "Panel", "Select the property panel to be
shown"); |
| 912 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 913 |
| 914 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); |
| 915 RNA_def_property_float_sdna(prop, NULL, "r"); |
| 916 RNA_def_property_array(prop, 3); |
| 917 RNA_def_property_ui_text(prop, "Color", "Base line color, possibly modif
ied by line color modifiers"); |
| 918 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 919 |
| 920 prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR); |
| 921 RNA_def_property_float_sdna(prop, NULL, "alpha"); |
| 922 RNA_def_property_range(prop, 0.0f, 1.0f); |
| 923 RNA_def_property_ui_text(prop, "Alpha", |
| 924 "Base alpha transparency, possibly modified by
alpha transparency modifiers"); |
| 925 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 926 |
| 927 prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE); |
| 928 RNA_def_property_float_sdna(prop, NULL, "thickness"); |
| 929 RNA_def_property_range(prop, 0.0f, 10000.0f); |
| 930 RNA_def_property_ui_text(prop, "Thickness", "Base line thickness, possib
ly modified by line thickness modifiers"); |
| 931 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 932 |
| 933 prop = RNA_def_property(srna, "thickness_position", PROP_ENUM, PROP_NONE
); |
| 934 RNA_def_property_enum_bitflag_sdna(prop, NULL, "thickness_position"); |
| 935 RNA_def_property_enum_items(prop, thickness_position_items); |
| 936 RNA_def_property_ui_text(prop, "Thickness Position", "Select the positio
n of stroke thickness"); |
| 937 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 938 |
| 939 prop = RNA_def_property(srna, "thickness_ratio", PROP_FLOAT, PROP_FACTOR
); |
| 940 RNA_def_property_float_sdna(prop, NULL, "thickness_ratio"); |
| 941 RNA_def_property_range(prop, 0.f, 1.f); |
| 942 RNA_def_property_ui_text(prop, "Thickness Ratio", |
| 943 "A number between 0 (inside) and 1 (outside) sp
ecifying the relative position of " |
| 944 "stroke thickness"); |
| 945 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 946 |
| 947 prop = RNA_def_property(srna, "color_modifiers", PROP_COLLECTION, PROP_N
ONE); |
| 948 RNA_def_property_collection_sdna(prop, NULL, "color_modifiers", NULL); |
| 949 RNA_def_property_struct_type(prop, "LineStyleColorModifier"); |
| 950 RNA_def_property_ui_text(prop, "Color Modifiers", "List of line color mo
difiers"); |
| 951 |
| 952 prop = RNA_def_property(srna, "alpha_modifiers", PROP_COLLECTION, PROP_N
ONE); |
| 953 RNA_def_property_collection_sdna(prop, NULL, "alpha_modifiers", NULL); |
| 954 RNA_def_property_struct_type(prop, "LineStyleAlphaModifier"); |
| 955 RNA_def_property_ui_text(prop, "Alpha Modifiers", "List of alpha trancpa
rency modifiers"); |
| 956 |
| 957 prop = RNA_def_property(srna, "thickness_modifiers", PROP_COLLECTION, PR
OP_NONE); |
| 958 RNA_def_property_collection_sdna(prop, NULL, "thickness_modifiers", NULL
); |
| 959 RNA_def_property_struct_type(prop, "LineStyleThicknessModifier"); |
| 960 RNA_def_property_ui_text(prop, "Thickness Modifiers", "List of line thic
kness modifiers"); |
| 961 |
| 962 prop = RNA_def_property(srna, "use_chaining", PROP_BOOLEAN, PROP_NONE); |
| 963 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_CHAININ
G); |
| 964 RNA_def_property_ui_text(prop, "Chaining", "Enable chaining of feature e
dges"); |
| 965 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 966 |
| 967 prop = RNA_def_property(srna, "chaining", PROP_ENUM, PROP_NONE); |
| 968 RNA_def_property_enum_sdna(prop, NULL, "chaining"); |
| 969 RNA_def_property_enum_items(prop, chaining_items); |
| 970 RNA_def_property_ui_text(prop, "Chaining", "Select the way how feature e
dges are jointed to form chains"); |
| 971 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 972 |
| 973 prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED); |
| 974 RNA_def_property_int_sdna(prop, NULL, "rounds"); |
| 975 RNA_def_property_range(prop, 1, 1000); |
| 976 RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in a sketchy
multiple touch"); |
| 977 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 978 |
| 979 prop = RNA_def_property(srna, "geometry_modifiers", PROP_COLLECTION, PRO
P_NONE); |
| 980 RNA_def_property_collection_sdna(prop, NULL, "geometry_modifiers", NULL)
; |
| 981 RNA_def_property_struct_type(prop, "LineStyleGeometryModifier"); |
| 982 RNA_def_property_ui_text(prop, "Geometry Modifiers", "List of stroke geo
metry modifiers"); |
| 983 |
| 984 prop = RNA_def_property(srna, "same_object", PROP_BOOLEAN, PROP_NONE); |
| 985 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SAME_OBJECT); |
| 986 RNA_def_property_ui_text(prop, "Same Object", "If true, only feature edg
es of the same object are joined"); |
| 987 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 988 |
| 989 prop = RNA_def_property(srna, "use_split_length", PROP_BOOLEAN, PROP_NON
E); |
| 990 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_LENGTH); |
| 991 RNA_def_property_ui_text(prop, "Use Split Length", "Enable chain splitti
ng by curvilinear 2D length"); |
| 992 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 993 |
| 994 prop = RNA_def_property(srna, "split_length", PROP_FLOAT, PROP_NONE); |
| 995 RNA_def_property_float_sdna(prop, NULL, "split_length"); |
| 996 RNA_def_property_range(prop, 0.0f, 10000.0f); |
| 997 RNA_def_property_ui_text(prop, "Split Length", "Curvilinear 2D length fo
r chain splitting"); |
| 998 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 999 |
| 1000 prop = RNA_def_property(srna, "use_min_angle", PROP_BOOLEAN, PROP_NONE); |
| 1001 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_ANGLE); |
| 1002 RNA_def_property_ui_text(prop, "Use Min 2D Angle", |
| 1003 "Split chains at points with angles smaller tha
n the minimum 2D angle"); |
| 1004 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1005 |
| 1006 prop = RNA_def_property(srna, "min_angle", PROP_FLOAT, PROP_ANGLE); |
| 1007 RNA_def_property_float_sdna(prop, NULL, "min_angle"); |
| 1008 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); |
| 1009 RNA_def_property_ui_text(prop, "Min 2D Angle", "Minimum 2D angle for spl
itting chains"); |
| 1010 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1011 |
| 1012 prop = RNA_def_property(srna, "use_max_angle", PROP_BOOLEAN, PROP_NONE); |
| 1013 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_ANGLE); |
| 1014 RNA_def_property_ui_text(prop, "Use Max 2D Angle", |
| 1015 "Split chains at points with angles larger than
the maximum 2D angle"); |
| 1016 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1017 |
| 1018 prop = RNA_def_property(srna, "max_angle", PROP_FLOAT, PROP_ANGLE); |
| 1019 RNA_def_property_float_sdna(prop, NULL, "max_angle"); |
| 1020 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f)); |
| 1021 RNA_def_property_ui_text(prop, "Max 2D Angle", "Maximum 2D angle for spl
itting chains"); |
| 1022 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1023 |
| 1024 prop = RNA_def_property(srna, "use_min_length", PROP_BOOLEAN, PROP_NONE)
; |
| 1025 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_LENGTH); |
| 1026 RNA_def_property_ui_text(prop, "Use Min 2D Length", "Enable the selectio
n of chains by a minimum 2D length"); |
| 1027 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1028 |
| 1029 prop = RNA_def_property(srna, "min_length", PROP_FLOAT, PROP_NONE); |
| 1030 RNA_def_property_float_sdna(prop, NULL, "min_length"); |
| 1031 RNA_def_property_range(prop, 0.0f, 10000.0f); |
| 1032 RNA_def_property_ui_text(prop, "Min 2D Length", "Minimum curvilinear 2D
length for the selection of chains"); |
| 1033 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1034 |
| 1035 prop = RNA_def_property(srna, "use_max_length", PROP_BOOLEAN, PROP_NONE)
; |
| 1036 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_LENGTH); |
| 1037 RNA_def_property_ui_text(prop, "Use Max 2D Length", "Enable the selectio
n of chains by a maximum 2D length"); |
| 1038 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1039 |
| 1040 prop = RNA_def_property(srna, "max_length", PROP_FLOAT, PROP_NONE); |
| 1041 RNA_def_property_float_sdna(prop, NULL, "max_length"); |
| 1042 RNA_def_property_range(prop, 0.0f, 10000.0f); |
| 1043 RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum curvilinear 2D
length for the selection of chains"); |
| 1044 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1045 |
| 1046 prop = RNA_def_property(srna, "use_split_pattern", PROP_BOOLEAN, PROP_NO
NE); |
| 1047 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_PATTERN); |
| 1048 RNA_def_property_ui_text(prop, "Use Split Pattern", "Enable chain splitt
ing by dashed line patterns"); |
| 1049 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1050 |
| 1051 prop = RNA_def_property(srna, "split_dash1", PROP_INT, PROP_UNSIGNED); |
| 1052 RNA_def_property_int_sdna(prop, NULL, "split_dash1"); |
| 1053 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1054 RNA_def_property_ui_text(prop, "Split Dash 1", "Length of the 1st dash f
or splitting"); |
| 1055 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1056 |
| 1057 prop = RNA_def_property(srna, "split_gap1", PROP_INT, PROP_UNSIGNED); |
| 1058 RNA_def_property_int_sdna(prop, NULL, "split_gap1"); |
| 1059 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1060 RNA_def_property_ui_text(prop, "Split Gap 1", "Length of the 1st gap for
splitting"); |
| 1061 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1062 |
| 1063 prop = RNA_def_property(srna, "split_dash2", PROP_INT, PROP_UNSIGNED); |
| 1064 RNA_def_property_int_sdna(prop, NULL, "split_dash2"); |
| 1065 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1066 RNA_def_property_ui_text(prop, "Split Dash 2", "Length of the 2nd dash f
or splitting"); |
| 1067 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1068 |
| 1069 prop = RNA_def_property(srna, "split_gap2", PROP_INT, PROP_UNSIGNED); |
| 1070 RNA_def_property_int_sdna(prop, NULL, "split_gap2"); |
| 1071 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1072 RNA_def_property_ui_text(prop, "Split Gap 2", "Length of the 2nd gap for
splitting"); |
| 1073 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1074 |
| 1075 prop = RNA_def_property(srna, "split_dash3", PROP_INT, PROP_UNSIGNED); |
| 1076 RNA_def_property_int_sdna(prop, NULL, "split_dash3"); |
| 1077 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1078 RNA_def_property_ui_text(prop, "Split Dash 3", "Length of the 3rd dash f
or splitting"); |
| 1079 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1080 |
| 1081 prop = RNA_def_property(srna, "split_gap3", PROP_INT, PROP_UNSIGNED); |
| 1082 RNA_def_property_int_sdna(prop, NULL, "split_gap3"); |
| 1083 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1084 RNA_def_property_ui_text(prop, "Split Gap 3", "Length of the 3rd gap for
splitting"); |
| 1085 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1086 |
| 1087 prop = RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NO
NE); |
| 1088 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY); |
| 1089 RNA_def_property_ui_text(prop, "Material Boundary", "If true, chains of
feature edges are split at material boundaries"); |
| 1090 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1091 |
| 1092 prop = RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE
); |
| 1093 RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE); |
| 1094 RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed
line"); |
| 1095 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1096 |
| 1097 prop = RNA_def_property(srna, "caps", PROP_ENUM, PROP_NONE); |
| 1098 RNA_def_property_enum_bitflag_sdna(prop, NULL, "caps"); |
| 1099 RNA_def_property_enum_items(prop, cap_items); |
| 1100 RNA_def_property_ui_text(prop, "Cap", "Select the shape of both ends of
strokes"); |
| 1101 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1102 |
| 1103 prop = RNA_def_property(srna, "dash1", PROP_INT, PROP_UNSIGNED); |
| 1104 RNA_def_property_int_sdna(prop, NULL, "dash1"); |
| 1105 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1106 RNA_def_property_ui_text(prop, "Dash 1", "Length of the 1st dash for das
hed lines"); |
| 1107 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1108 |
| 1109 prop = RNA_def_property(srna, "gap1", PROP_INT, PROP_UNSIGNED); |
| 1110 RNA_def_property_int_sdna(prop, NULL, "gap1"); |
| 1111 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1112 RNA_def_property_ui_text(prop, "Gap 1", "Length of the 1st gap for dashe
d lines"); |
| 1113 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1114 |
| 1115 prop = RNA_def_property(srna, "dash2", PROP_INT, PROP_UNSIGNED); |
| 1116 RNA_def_property_int_sdna(prop, NULL, "dash2"); |
| 1117 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1118 RNA_def_property_ui_text(prop, "Dash 2", "Length of the 2nd dash for das
hed lines"); |
| 1119 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1120 |
| 1121 prop = RNA_def_property(srna, "gap2", PROP_INT, PROP_UNSIGNED); |
| 1122 RNA_def_property_int_sdna(prop, NULL, "gap2"); |
| 1123 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1124 RNA_def_property_ui_text(prop, "Gap 2", "Length of the 2nd gap for dashe
d lines"); |
| 1125 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1126 |
| 1127 prop = RNA_def_property(srna, "dash3", PROP_INT, PROP_UNSIGNED); |
| 1128 RNA_def_property_int_sdna(prop, NULL, "dash3"); |
| 1129 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1130 RNA_def_property_ui_text(prop, "Dash 3", "Length of the 3rd dash for das
hed lines"); |
| 1131 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1132 |
| 1133 prop = RNA_def_property(srna, "gap3", PROP_INT, PROP_UNSIGNED); |
| 1134 RNA_def_property_int_sdna(prop, NULL, "gap3"); |
| 1135 RNA_def_property_range(prop, 0, USHRT_MAX); |
| 1136 RNA_def_property_ui_text(prop, "Gap 3", "Length of the 3rd gap for dashe
d lines"); |
| 1137 RNA_def_property_update(prop, NC_LINESTYLE, NULL); |
| 1138 } |
| 1139 |
| 1140 void RNA_def_linestyle(BlenderRNA *brna) |
| 1141 { |
| 1142 rna_def_linestyle_modifiers(brna); |
| 1143 rna_def_linestyle(brna); |
| 1144 } |
| 1145 |
| 1146 #endif |
OLD | NEW |