1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2005 Blender Foundation. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 */ 23 24 #pragma once 25 26 #include "DNA_ID.h" 27 #include "DNA_curve_types.h" 28 #include "DNA_texture_types.h" /* for MTex */ 29 30 struct CurveMapping; 31 struct Image; 32 struct MTex; 33 struct Material; 34 35 typedef struct BrushClone { 36 /** Image for clone tool. */ 37 struct Image *image; 38 /** Offset of clone image from canvas. */ 39 float offset[2]; 40 /** Transparency for drawing of clone image. */ 41 float alpha; 42 char _pad[4]; 43 } BrushClone; 44 45 typedef struct BrushGpencilSettings { 46 /** Amount of smoothing to apply to newly created strokes. */ 47 float draw_smoothfac; 48 char _pad2[4]; 49 /** Amount of alpha strength to apply to newly created strokes. */ 50 float draw_strength; 51 /** Amount of jitter to apply to newly created strokes. */ 52 float draw_jitter; 53 /** Angle when the brush has full thickness. */ 54 float draw_angle; 55 /** Factor to apply when angle change (only 90 degrees). */ 56 float draw_angle_factor; 57 /** Factor of randomness for pressure. */ 58 float draw_random_press; 59 /** Factor of strength for strength. */ 60 float draw_random_strength; 61 /** Number of times to apply smooth factor to new strokes. */ 62 short draw_smoothlvl; 63 /** Number of times to subdivide new strokes. */ 64 short draw_subdivide; 65 /** Layers used for fill. */ 66 short fill_layer_mode; 67 short fill_direction; 68 69 /** Factor for transparency. */ 70 float fill_threshold; 71 /** Number of pixel to consider the leak is too small (x 2). */ 72 short fill_leak; 73 /** Fill zoom factor */ 74 short fill_factor; 75 int flag2; 76 77 /** Number of simplify steps. */ 78 int fill_simplylvl; 79 /** Type of control lines drawing mode. */ 80 int fill_draw_mode; 81 /** Icon identifier. */ 82 int icon_id; 83 84 /** Maximum distance before generate new point for very fast mouse movements. */ 85 int input_samples; 86 /** Random factor for UV rotation. */ 87 float uv_random; 88 /** Moved to 'Brush.gpencil_tool'. */ 89 int brush_type DNA_DEPRECATED; 90 /** Soft, hard or stroke. */ 91 int eraser_mode; 92 /** Smooth while drawing factor. */ 93 float active_smooth; 94 /** Factor to apply to strength for soft eraser. */ 95 float era_strength_f; 96 /** Factor to apply to thickness for soft eraser. */ 97 float era_thickness_f; 98 /** Internal grease pencil drawing flags. */ 99 int flag; 100 101 /** gradient control along y for color */ 102 float hardeness; 103 /** factor xy of shape for dots gradients */ 104 float aspect_ratio[2]; 105 /** Simplify adaptive factor */ 106 float simplify_f; 107 108 /** Mix colorfactor */ 109 float vertex_factor; 110 int vertex_mode; 111 112 /** eGP_Sculpt_Flag. */ 113 int sculpt_flag; 114 /** eGP_Sculpt_Mode_Flag. */ 115 int sculpt_mode_flag; 116 /** Preset type (used to reset brushes - internal). */ 117 short preset_type; 118 /** Brush preselected mode (Active/Material/Vertexcolor). */ 119 short brush_draw_mode; 120 121 /** Randomness for Hue. */ 122 float random_hue; 123 /** Randomness for Saturation. */ 124 float random_saturation; 125 /** Randomness for Value. */ 126 float random_value; 127 128 struct CurveMapping *curve_sensitivity; 129 struct CurveMapping *curve_strength; 130 struct CurveMapping *curve_jitter; 131 struct CurveMapping *curve_rand_pressure; 132 struct CurveMapping *curve_rand_strength; 133 struct CurveMapping *curve_rand_uv; 134 struct CurveMapping *curve_rand_hue; 135 struct CurveMapping *curve_rand_saturation; 136 struct CurveMapping *curve_rand_value; 137 138 /* optional link of material to replace default in context */ 139 /** Material. */ 140 struct Material *material; 141 } BrushGpencilSettings; 142 143 /* BrushGpencilSettings->preset_type. 144 * Use a range for each group and not continuous values.*/ 145 typedef enum eGPBrush_Presets { 146 GP_BRUSH_PRESET_UNKNOWN = 0, 147 148 /* Draw 1-99. */ 149 GP_BRUSH_PRESET_AIRBRUSH = 1, 150 GP_BRUSH_PRESET_INK_PEN = 2, 151 GP_BRUSH_PRESET_INK_PEN_ROUGH = 3, 152 GP_BRUSH_PRESET_MARKER_BOLD = 4, 153 GP_BRUSH_PRESET_MARKER_CHISEL = 5, 154 GP_BRUSH_PRESET_PEN = 6, 155 GP_BRUSH_PRESET_PENCIL_SOFT = 7, 156 GP_BRUSH_PRESET_PENCIL = 8, 157 GP_BRUSH_PRESET_FILL_AREA = 9, 158 GP_BRUSH_PRESET_ERASER_SOFT = 10, 159 GP_BRUSH_PRESET_ERASER_HARD = 11, 160 GP_BRUSH_PRESET_ERASER_POINT = 12, 161 GP_BRUSH_PRESET_ERASER_STROKE = 13, 162 GP_BRUSH_PRESET_TINT = 14, 163 164 /* Vertex Paint 100-199. */ 165 GP_BRUSH_PRESET_VERTEX_DRAW = 100, 166 GP_BRUSH_PRESET_VERTEX_BLUR = 101, 167 GP_BRUSH_PRESET_VERTEX_AVERAGE = 102, 168 GP_BRUSH_PRESET_VERTEX_SMEAR = 103, 169 GP_BRUSH_PRESET_VERTEX_REPLACE = 104, 170 171 /* Sculpt 200-299. */ 172 GP_BRUSH_PRESET_SMOOTH_STROKE = 200, 173 GP_BRUSH_PRESET_STRENGTH_STROKE = 201, 174 GP_BRUSH_PRESET_THICKNESS_STROKE = 202, 175 GP_BRUSH_PRESET_GRAB_STROKE = 203, 176 GP_BRUSH_PRESET_PUSH_STROKE = 204, 177 GP_BRUSH_PRESET_TWIST_STROKE = 205, 178 GP_BRUSH_PRESET_PINCH_STROKE = 206, 179 GP_BRUSH_PRESET_RANDOMIZE_STROKE = 207, 180 GP_BRUSH_PRESET_CLONE_STROKE = 208, 181 182 /* Weight Paint 300-399. */ 183 GP_BRUSH_PRESET_DRAW_WEIGHT = 300, 184 } eGPBrush_Presets; 185 186 /* BrushGpencilSettings->gp_flag */ 187 typedef enum eGPDbrush_Flag { 188 /* brush use pressure */ 189 GP_BRUSH_USE_PRESSURE = (1 << 0), 190 /* brush use pressure for alpha factor */ 191 GP_BRUSH_USE_STRENGTH_PRESSURE = (1 << 1), 192 /* brush use pressure for alpha factor */ 193 GP_BRUSH_USE_JITTER_PRESSURE = (1 << 2), 194 /* fill hide transparent */ 195 GP_BRUSH_FILL_HIDE = (1 << 6), 196 /* show fill help lines */ 197 GP_BRUSH_FILL_SHOW_HELPLINES = (1 << 7), 198 /* lazy mouse */ 199 GP_BRUSH_STABILIZE_MOUSE = (1 << 8), 200 /* lazy mouse override (internal only) */ 201 GP_BRUSH_STABILIZE_MOUSE_TEMP = (1 << 9), 202 /* default eraser brush for quick switch */ 203 GP_BRUSH_DEFAULT_ERASER = (1 << 10), 204 /* settings group */ 205 GP_BRUSH_GROUP_SETTINGS = (1 << 11), 206 /* Random settings group */ 207 GP_BRUSH_GROUP_RANDOM = (1 << 12), 208 /* Keep material assigned to brush */ 209 GP_BRUSH_MATERIAL_PINNED = (1 << 13), 210 /* Do not show fill color while drawing (no lasso mode) */ 211 GP_BRUSH_DISSABLE_LASSO = (1 << 14), 212 /* Do not erase strokes oLcluded */ 213 GP_BRUSH_OCCLUDE_ERASER = (1 << 15), 214 /* Post process trim stroke */ 215 GP_BRUSH_TRIM_STROKE = (1 << 16), 216 } eGPDbrush_Flag; 217 218 typedef enum eGPDbrush_Flag2 { 219 /* Brush use random Hue at stroke level */ 220 GP_BRUSH_USE_HUE_AT_STROKE = (1 << 0), 221 /* Brush use random Saturation at stroke level */ 222 GP_BRUSH_USE_SAT_AT_STROKE = (1 << 1), 223 /* Brush use random Value at stroke level */ 224 GP_BRUSH_USE_VAL_AT_STROKE = (1 << 2), 225 /* Brush use random Pressure at stroke level */ 226 GP_BRUSH_USE_PRESS_AT_STROKE = (1 << 3), 227 /* Brush use random Strength at stroke level */ 228 GP_BRUSH_USE_STRENGTH_AT_STROKE = (1 << 4), 229 /* Brush use random UV at stroke level */ 230 GP_BRUSH_USE_UV_AT_STROKE = (1 << 5), 231 /* Brush use Hue random pressure */ 232 GP_BRUSH_USE_HUE_RAND_PRESS = (1 << 6), 233 /* Brush use Saturation random pressure */ 234 GP_BRUSH_USE_SAT_RAND_PRESS = (1 << 7), 235 /* Brush use Value random pressure */ 236 GP_BRUSH_USE_VAL_RAND_PRESS = (1 << 8), 237 /* Brush use Pressure random pressure */ 238 GP_BRUSH_USE_PRESSURE_RAND_PRESS = (1 << 9), 239 /* Brush use Strength random pressure */ 240 GP_BRUSH_USE_STRENGTH_RAND_PRESS = (1 << 10), 241 /* Brush use UV random pressure */ 242 GP_BRUSH_USE_UV_RAND_PRESS = (1 << 11), 243 } eGPDbrush_Flag2; 244 245 /* BrushGpencilSettings->gp_fill_draw_mode */ 246 typedef enum eGP_FillDrawModes { 247 GP_FILL_DMODE_BOTH = 0, 248 GP_FILL_DMODE_STROKE = 1, 249 GP_FILL_DMODE_CONTROL = 2, 250 } eGP_FillDrawModes; 251 252 /* BrushGpencilSettings->fill_layer_mode */ 253 typedef enum eGP_FillLayerModes { 254 GP_FILL_GPLMODE_VISIBLE = 0, 255 GP_FILL_GPLMODE_ACTIVE = 1, 256 GP_FILL_GPLMODE_ALL_ABOVE = 2, 257 GP_FILL_GPLMODE_ALL_BELOW = 3, 258 GP_FILL_GPLMODE_ABOVE = 4, 259 GP_FILL_GPLMODE_BELOW = 5, 260 } eGP_FillLayerModes; 261 262 /* BrushGpencilSettings->gp_eraser_mode */ 263 typedef enum eGP_BrushEraserMode { 264 GP_BRUSH_ERASER_SOFT = 0, 265 GP_BRUSH_ERASER_HARD = 1, 266 GP_BRUSH_ERASER_STROKE = 2, 267 } eGP_BrushEraserMode; 268 269 /* BrushGpencilSettings->brush_draw_mode */ 270 typedef enum eGP_BrushMode { 271 GP_BRUSH_MODE_ACTIVE = 0, 272 GP_BRUSH_MODE_MATERIAL = 1, 273 GP_BRUSH_MODE_VERTEXCOLOR = 2, 274 } eGP_BrushMode; 275 276 /* BrushGpencilSettings default brush icons */ 277 typedef enum eGP_BrushIcons { 278 GP_BRUSH_ICON_PENCIL = 1, 279 GP_BRUSH_ICON_PEN = 2, 280 GP_BRUSH_ICON_INK = 3, 281 GP_BRUSH_ICON_INKNOISE = 4, 282 GP_BRUSH_ICON_BLOCK = 5, 283 GP_BRUSH_ICON_MARKER = 6, 284 GP_BRUSH_ICON_FILL = 7, 285 GP_BRUSH_ICON_ERASE_SOFT = 8, 286 GP_BRUSH_ICON_ERASE_HARD = 9, 287 GP_BRUSH_ICON_ERASE_STROKE = 10, 288 GP_BRUSH_ICON_AIRBRUSH = 11, 289 GP_BRUSH_ICON_CHISEL = 12, 290 GP_BRUSH_ICON_TINT = 13, 291 GP_BRUSH_ICON_VERTEX_DRAW = 14, 292 GP_BRUSH_ICON_VERTEX_BLUR = 15, 293 GP_BRUSH_ICON_VERTEX_AVERAGE = 16, 294 GP_BRUSH_ICON_VERTEX_SMEAR = 17, 295 GP_BRUSH_ICON_VERTEX_REPLACE = 18, 296 GP_BRUSH_ICON_GPBRUSH_SMOOTH = 19, 297 GP_BRUSH_ICON_GPBRUSH_THICKNESS = 20, 298 GP_BRUSH_ICON_GPBRUSH_STRENGTH = 21, 299 GP_BRUSH_ICON_GPBRUSH_RANDOMIZE = 22, 300 GP_BRUSH_ICON_GPBRUSH_GRAB = 23, 301 GP_BRUSH_ICON_GPBRUSH_PUSH = 24, 302 GP_BRUSH_ICON_GPBRUSH_TWIST = 25, 303 GP_BRUSH_ICON_GPBRUSH_PINCH = 26, 304 GP_BRUSH_ICON_GPBRUSH_CLONE = 27, 305 GP_BRUSH_ICON_GPBRUSH_WEIGHT = 28, 306 } eGP_BrushIcons; 307 308 typedef enum eBrushCurvePreset { 309 BRUSH_CURVE_CUSTOM = 0, 310 BRUSH_CURVE_SMOOTH = 1, 311 BRUSH_CURVE_SPHERE = 2, 312 BRUSH_CURVE_ROOT = 3, 313 BRUSH_CURVE_SHARP = 4, 314 BRUSH_CURVE_LIN = 5, 315 BRUSH_CURVE_POW4 = 6, 316 BRUSH_CURVE_INVSQUARE = 7, 317 BRUSH_CURVE_CONSTANT = 8, 318 BRUSH_CURVE_SMOOTHER = 9, 319 } eBrushCurvePreset; 320 321 typedef enum eBrushDeformTarget { 322 BRUSH_DEFORM_TARGET_GEOMETRY = 0, 323 BRUSH_DEFORM_TARGET_CLOTH_SIM = 1, 324 } eBrushDeformTarget; 325 326 typedef enum eBrushElasticDeformType { 327 BRUSH_ELASTIC_DEFORM_GRAB = 0, 328 BRUSH_ELASTIC_DEFORM_GRAB_BISCALE = 1, 329 BRUSH_ELASTIC_DEFORM_GRAB_TRISCALE = 2, 330 BRUSH_ELASTIC_DEFORM_SCALE = 3, 331 BRUSH_ELASTIC_DEFORM_TWIST = 4, 332 } eBrushElasticDeformType; 333 334 typedef enum eBrushClothDeformType { 335 BRUSH_CLOTH_DEFORM_DRAG = 0, 336 BRUSH_CLOTH_DEFORM_PUSH = 1, 337 BRUSH_CLOTH_DEFORM_GRAB = 2, 338 BRUSH_CLOTH_DEFORM_PINCH_POINT = 3, 339 BRUSH_CLOTH_DEFORM_PINCH_PERPENDICULAR = 4, 340 BRUSH_CLOTH_DEFORM_INFLATE = 5, 341 BRUSH_CLOTH_DEFORM_EXPAND = 6, 342 BRUSH_CLOTH_DEFORM_SNAKE_HOOK = 7, 343 } eBrushClothDeformType; 344 345 typedef enum eBrushSmoothDeformType { 346 BRUSH_SMOOTH_DEFORM_LAPLACIAN = 0, 347 BRUSH_SMOOTH_DEFORM_SURFACE = 1, 348 } eBrushSmoothDeformType; 349 350 typedef enum eBrushClothForceFalloffType { 351 BRUSH_CLOTH_FORCE_FALLOFF_RADIAL = 0, 352 BRUSH_CLOTH_FORCE_FALLOFF_PLANE = 1, 353 } eBrushClothForceFalloffType; 354 355 typedef enum eBrushClothSimulationAreaType { 356 BRUSH_CLOTH_SIMULATION_AREA_LOCAL = 0, 357 BRUSH_CLOTH_SIMULATION_AREA_GLOBAL = 1, 358 BRUSH_CLOTH_SIMULATION_AREA_DYNAMIC = 2, 359 } eBrushClothSimulationAreaType; 360 361 typedef enum eBrushPoseDeformType { 362 BRUSH_POSE_DEFORM_ROTATE_TWIST = 0, 363 BRUSH_POSE_DEFORM_SCALE_TRASLATE = 1, 364 BRUSH_POSE_DEFORM_SQUASH_STRETCH = 2, 365 } eBrushPoseDeformType; 366 367 typedef enum eBrushPoseOriginType { 368 BRUSH_POSE_ORIGIN_TOPOLOGY = 0, 369 BRUSH_POSE_ORIGIN_FACE_SETS = 1, 370 BRUSH_POSE_ORIGIN_FACE_SETS_FK = 2, 371 } eBrushPoseOriginType; 372 373 typedef enum eBrushSmearDeformType { 374 BRUSH_SMEAR_DEFORM_DRAG = 0, 375 BRUSH_SMEAR_DEFORM_PINCH = 1, 376 BRUSH_SMEAR_DEFORM_EXPAND = 2, 377 } eBrushSmearDeformType; 378 379 typedef enum eBrushSlideDeformType { 380 BRUSH_SLIDE_DEFORM_DRAG = 0, 381 BRUSH_SLIDE_DEFORM_PINCH = 1, 382 BRUSH_SLIDE_DEFORM_EXPAND = 2, 383 } eBrushSlideDeformType; 384 385 typedef enum eBrushBoundaryDeformType { 386 BRUSH_BOUNDARY_DEFORM_BEND = 0, 387 BRUSH_BOUNDARY_DEFORM_EXPAND = 1, 388 BRUSH_BOUNDARY_DEFORM_INFLATE = 2, 389 BRUSH_BOUNDARY_DEFORM_GRAB = 3, 390 BRUSH_BOUNDARY_DEFORM_TWIST = 4, 391 BRUSH_BOUNDARY_DEFORM_SMOOTH = 5, 392 } eBrushBushBoundaryDeformType; 393 394 typedef enum eBrushBoundaryFalloffType { 395 BRUSH_BOUNDARY_FALLOFF_CONSTANT = 0, 396 BRUSH_BOUNDARY_FALLOFF_RADIUS = 1, 397 BRUSH_BOUNDARY_FALLOFF_LOOP = 2, 398 BRUSH_BOUNDARY_FALLOFF_LOOP_INVERT = 3, 399 } eBrushBoundaryFalloffType; 400 401 /* Gpencilsettings.Vertex_mode */ 402 typedef enum eGp_Vertex_Mode { 403 /* Affect to Stroke only. */ 404 GPPAINT_MODE_STROKE = 0, 405 /* Affect to Fill only. */ 406 GPPAINT_MODE_FILL = 1, 407 /* Affect to both. */ 408 GPPAINT_MODE_BOTH = 2, 409 } eGp_Vertex_Mode; 410 411 /* sculpt_flag */ 412 typedef enum eGP_Sculpt_Flag { 413 /* invert the effect of the brush */ 414 GP_SCULPT_FLAG_INVERT = (1 << 0), 415 /* smooth brush affects pressure values as well */ 416 GP_SCULPT_FLAG_SMOOTH_PRESSURE = (1 << 2), 417 /* temporary invert action */ 418 GP_SCULPT_FLAG_TMP_INVERT = (1 << 3), 419 } eGP_Sculpt_Flag; 420 421 /* sculpt_mode_flag */ 422 typedef enum eGP_Sculpt_Mode_Flag { 423 /* apply brush to position */ 424 GP_SCULPT_FLAGMODE_APPLY_POSITION = (1 << 0), 425 /* apply brush to strength */ 426 GP_SCULPT_FLAGMODE_APPLY_STRENGTH = (1 << 1), 427 /* apply brush to thickness */ 428 GP_SCULPT_FLAGMODE_APPLY_THICKNESS = (1 << 2), 429 /* apply brush to uv data */ 430 GP_SCULPT_FLAGMODE_APPLY_UV = (1 << 3), 431 } eGP_Sculpt_Mode_Flag; 432 433 typedef enum eAutomasking_flag { 434 BRUSH_AUTOMASKING_TOPOLOGY = (1 << 0), 435 BRUSH_AUTOMASKING_FACE_SETS = (1 << 1), 436 BRUSH_AUTOMASKING_BOUNDARY_EDGES = (1 << 2), 437 BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS = (1 << 3), 438 } eAutomasking_flag; 439 440 typedef enum ePaintBrush_flag { 441 BRUSH_PAINT_HARDNESS_PRESSURE = (1 << 0), 442 BRUSH_PAINT_HARDNESS_PRESSURE_INVERT = (1 << 1), 443 BRUSH_PAINT_FLOW_PRESSURE = (1 << 2), 444 BRUSH_PAINT_FLOW_PRESSURE_INVERT = (1 << 3), 445 BRUSH_PAINT_WET_MIX_PRESSURE = (1 << 4), 446 BRUSH_PAINT_WET_MIX_PRESSURE_INVERT = (1 << 5), 447 BRUSH_PAINT_WET_PERSISTENCE_PRESSURE = (1 << 6), 448 BRUSH_PAINT_WET_PERSISTENCE_PRESSURE_INVERT = (1 << 7), 449 BRUSH_PAINT_DENSITY_PRESSURE = (1 << 8), 450 BRUSH_PAINT_DENSITY_PRESSURE_INVERT = (1 << 9), 451 } ePaintBrush_flag; 452 453 typedef struct Brush { 454 ID id; 455 456 struct BrushClone clone; 457 /** Falloff curve. */ 458 struct CurveMapping *curve; 459 struct MTex mtex; 460 struct MTex mask_mtex; 461 462 struct Brush *toggle_brush; 463 464 struct ImBuf *icon_imbuf; 465 PreviewImage *preview; 466 /** Color gradient. */ 467 struct ColorBand *gradient; 468 struct PaintCurve *paint_curve; 469 470 /** 1024 = FILE_MAX. */ 471 char icon_filepath[1024]; 472 473 float normal_weight; 474 /** Rake actual data (not texture), used for sculpt. */ 475 float rake_factor; 476 477 /** Blend mode. */ 478 short blend; 479 /** #eObjectMode: to see if the brush is compatible, use for display only. */ 480 short ob_mode; 481 /** Brush weight. */ 482 float weight; 483 /** Brush diameter. */ 484 int size; 485 /** General purpose flags. */ 486 int flag; 487 int flag2; 488 int sampling_flag; 489 490 /** Pressure influence for mask. */ 491 int mask_pressure; 492 /** Jitter the position of the brush. */ 493 float jitter; 494 /** Absolute jitter in pixels. */ 495 int jitter_absolute; 496 int overlay_flags; 497 /** Spacing of paint operations. */ 498 int spacing; 499 /** Turning radius (in pixels) for smooth stroke. */ 500 int smooth_stroke_radius; 501 /** Higher values limit fast changes in the stroke direction. */ 502 float smooth_stroke_factor; 503 /** Paint operations / second (airbrush). */ 504 float rate; 505 506 /** Color. */ 507 float rgb[3]; 508 /** Opacity. */ 509 float alpha; 510 /** Hardness */ 511 float hardness; 512 /** Flow */ 513 float flow; 514 /** Wet Mix */ 515 float wet_mix; 516 float wet_persistence; 517 /** Density */ 518 float density; 519 int paint_flags; 520 521 /** Tip Shape */ 522 /* Factor that controls the shape of the brush tip by rounding the corners of a square. */ 523 /* 0.0 value produces a square, 1.0 produces a circle. */ 524 float tip_roundness; 525 float tip_scale_x; 526 527 /** Background color. */ 528 float secondary_rgb[3]; 529 530 /** Rate */ 531 float dash_ratio; 532 int dash_samples; 533 534 /** The direction of movement for sculpt vertices. */ 535 int sculpt_plane; 536 537 /** Offset for plane brushes (clay, flatten, fill, scrape). */ 538 float plane_offset; 539 540 int gradient_spacing; 541 /** Source for stroke color gradient application. */ 542 char gradient_stroke_mode; 543 /** Source for fill tool color gradient application. */ 544 char gradient_fill_mode; 545 546 char _pad0[5]; 547 548 /** Projection shape (sphere, circle). */ 549 char falloff_shape; 550 float falloff_angle; 551 552 /** Active sculpt tool. */ 553 char sculpt_tool; 554 /** Active sculpt tool. */ 555 char uv_sculpt_tool; 556 /** Active vertex paint. */ 557 char vertexpaint_tool; 558 /** Active weight paint. */ 559 char weightpaint_tool; 560 /** Active image paint tool. */ 561 char imagepaint_tool; 562 /** Enum eBrushMaskTool, only used if sculpt_tool is SCULPT_TOOL_MASK. */ 563 char mask_tool; 564 /** Active grease pencil tool. */ 565 char gpencil_tool; 566 /** Active grease pencil vertex tool. */ 567 char gpencil_vertex_tool; 568 /** Active grease pencil sculpt tool. */ 569 char gpencil_sculpt_tool; 570 /** Active grease pencil weight tool. */ 571 char gpencil_weight_tool; 572 char _pad1[6]; 573 574 float autosmooth_factor; 575 576 float tilt_strength_factor; 577 578 float topology_rake_factor; 579 580 float crease_pinch_factor; 581 582 float normal_radius_factor; 583 float area_radius_factor; 584 585 float plane_trim; 586 /** Affectable height of brush (layer height for layer tool, i.e.). */ 587 float height; 588 589 float texture_sample_bias; 590 591 int curve_preset; 592 593 /* Maximun distance to search fake neighbors from a vertex. */ 594 float disconnected_distance_max; 595 596 int deform_target; 597 598 /* automasking */ 599 int automasking_flags; 600 int automasking_boundary_edges_propagation_steps; 601 602 int elastic_deform_type; 603 float elastic_deform_volume_preservation; 604 605 /* pose */ 606 int pose_deform_type; 607 float pose_offset; 608 int pose_smooth_iterations; 609 int pose_ik_segments; 610 int pose_origin_type; 611 612 /* boundary */ 613 int boundary_deform_type; 614 int boundary_falloff_type; 615 float boundary_offset; 616 617 /* cloth */ 618 int cloth_deform_type; 619 int cloth_force_falloff_type; 620 int cloth_simulation_area_type; 621 622 float cloth_mass; 623 float cloth_damping; 624 625 float cloth_sim_limit; 626 float cloth_sim_falloff; 627 628 float cloth_constraint_softbody_strength; 629 630 /* smooth */ 631 int smooth_deform_type; 632 float surface_smooth_shape_preservation; 633 float surface_smooth_current_vertex; 634 int surface_smooth_iterations; 635 636 /* multiplane scrape */ 637 float multiplane_scrape_angle; 638 639 /* smear */ 640 int smear_deform_type; 641 642 /* slide/relax */ 643 int slide_deform_type; 644 645 /* overlay */ 646 int texture_overlay_alpha; 647 int mask_overlay_alpha; 648 int cursor_overlay_alpha; 649 650 float unprojected_radius; 651 652 /* soften/sharpen */ 653 float sharp_threshold; 654 int blur_kernel_radius; 655 int blur_mode; 656 657 /* fill tool */ 658 float fill_threshold; 659 660 float add_col[4]; 661 float sub_col[4]; 662 663 float stencil_pos[2]; 664 float stencil_dimension[2]; 665 666 float mask_stencil_pos[2]; 667 float mask_stencil_dimension[2]; 668 669 struct BrushGpencilSettings *gpencil_settings; 670 671 } Brush; 672 673 /* Struct to hold palette colors for sorting. */ 674 typedef struct tPaletteColorHSV { 675 float rgb[3]; 676 float value; 677 float h; 678 float s; 679 float v; 680 } tPaletteColorHSV; 681 682 typedef struct PaletteColor { 683 struct PaletteColor *next, *prev; 684 /* two values, one to store rgb, other to store values for sculpt/weight */ 685 float rgb[3]; 686 float value; 687 } PaletteColor; 688 689 typedef struct Palette { 690 ID id; 691 692 /** Pointer to individual colors. */ 693 ListBase colors; 694 695 int active_color; 696 char _pad[4]; 697 } Palette; 698 699 typedef struct PaintCurvePoint { 700 /** Bezier handle. */ 701 BezTriple bez; 702 /** Pressure on that point. */ 703 float pressure; 704 } PaintCurvePoint; 705 706 typedef struct PaintCurve { 707 ID id; 708 /** Points of curve. */ 709 PaintCurvePoint *points; 710 int tot_points; 711 /** Index where next point will be added. */ 712 int add_index; 713 } PaintCurve; 714 715 /* Brush.gradient_source */ 716 typedef enum eBrushGradientSourceStroke { 717 BRUSH_GRADIENT_PRESSURE = 0, /* gradient from pressure */ 718 BRUSH_GRADIENT_SPACING_REPEAT = 1, /* gradient from spacing */ 719 BRUSH_GRADIENT_SPACING_CLAMP = 2, /* gradient from spacing */ 720 } eBrushGradientSourceStroke; 721 722 typedef enum eBrushGradientSourceFill { 723 BRUSH_GRADIENT_LINEAR = 0, /* gradient from pressure */ 724 BRUSH_GRADIENT_RADIAL = 1, /* gradient from spacing */ 725 } eBrushGradientSourceFill; 726 727 /* Brush.flag */ 728 typedef enum eBrushFlags { 729 BRUSH_AIRBRUSH = (1 << 0), 730 BRUSH_INVERT_TO_SCRAPE_FILL = (1 << 1), 731 BRUSH_ALPHA_PRESSURE = (1 << 2), 732 BRUSH_SIZE_PRESSURE = (1 << 3), 733 BRUSH_JITTER_PRESSURE = (1 << 4), 734 BRUSH_SPACING_PRESSURE = (1 << 5), 735 BRUSH_ORIGINAL_PLANE = (1 << 6), 736 BRUSH_GRAB_ACTIVE_VERTEX = (1 << 7), 737 BRUSH_ANCHORED = (1 << 8), 738 BRUSH_DIR_IN = (1 << 9), 739 BRUSH_SPACE = (1 << 10), 740 BRUSH_SMOOTH_STROKE = (1 << 11), 741 BRUSH_PERSISTENT = (1 << 12), 742 BRUSH_ACCUMULATE = (1 << 13), 743 BRUSH_LOCK_ALPHA = (1 << 14), 744 BRUSH_ORIGINAL_NORMAL = (1 << 15), 745 BRUSH_OFFSET_PRESSURE = (1 << 16), 746 BRUSH_SCENE_SPACING = (1 << 17), 747 BRUSH_SPACE_ATTEN = (1 << 18), 748 BRUSH_ADAPTIVE_SPACE = (1 << 19), 749 BRUSH_LOCK_SIZE = (1 << 20), 750 BRUSH_USE_GRADIENT = (1 << 21), 751 BRUSH_EDGE_TO_EDGE = (1 << 22), 752 BRUSH_DRAG_DOT = (1 << 23), 753 BRUSH_INVERSE_SMOOTH_PRESSURE = (1 << 24), 754 BRUSH_FRONTFACE_FALLOFF = (1 << 25), 755 BRUSH_PLANE_TRIM = (1 << 26), 756 BRUSH_FRONTFACE = (1 << 27), 757 BRUSH_CUSTOM_ICON = (1 << 28), 758 BRUSH_LINE = (1 << 29), 759 BRUSH_ABSOLUTE_JITTER = (1 << 30), 760 BRUSH_CURVE = (1u << 31), 761 } eBrushFlags; 762 763 /* Brush.sampling_flag */ 764 typedef enum eBrushSamplingFlags { 765 BRUSH_PAINT_ANTIALIASING = (1 << 0), 766 } eBrushSamplingFlags; 767 768 /* Brush.flag2 */ 769 typedef enum eBrushFlags2 { 770 BRUSH_MULTIPLANE_SCRAPE_DYNAMIC = (1 << 0), 771 BRUSH_MULTIPLANE_SCRAPE_PLANES_PREVIEW = (1 << 1), 772 BRUSH_POSE_IK_ANCHORED = (1 << 2), 773 BRUSH_USE_CONNECTED_ONLY = (1 << 3), 774 BRUSH_CLOTH_PIN_SIMULATION_BOUNDARY = (1 << 4), 775 BRUSH_POSE_USE_LOCK_ROTATION = (1 << 5), 776 BRUSH_CLOTH_USE_COLLISION = (1 << 6), 777 BRUSH_AREA_RADIUS_PRESSURE = (1 << 7), 778 } eBrushFlags2; 779 780 typedef enum { 781 BRUSH_MASK_PRESSURE_RAMP = (1 << 1), 782 BRUSH_MASK_PRESSURE_CUTOFF = (1 << 2), 783 } BrushMaskPressureFlags; 784 785 /* Brush.overlay_flags */ 786 typedef enum eOverlayFlags { 787 BRUSH_OVERLAY_CURSOR = (1), 788 BRUSH_OVERLAY_PRIMARY = (1 << 1), 789 BRUSH_OVERLAY_SECONDARY = (1 << 2), 790 BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE = (1 << 3), 791 BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE = (1 << 4), 792 BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE = (1 << 5), 793 } eOverlayFlags; 794 795 #define BRUSH_OVERLAY_OVERRIDE_MASK \ 796 (BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE | BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE | \ 797 BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE) 798 799 /* Brush.sculpt_tool */ 800 typedef enum eBrushSculptTool { 801 SCULPT_TOOL_DRAW = 1, 802 SCULPT_TOOL_SMOOTH = 2, 803 SCULPT_TOOL_PINCH = 3, 804 SCULPT_TOOL_INFLATE = 4, 805 SCULPT_TOOL_GRAB = 5, 806 SCULPT_TOOL_LAYER = 6, 807 SCULPT_TOOL_FLATTEN = 7, 808 SCULPT_TOOL_CLAY = 8, 809 SCULPT_TOOL_FILL = 9, 810 SCULPT_TOOL_SCRAPE = 10, 811 SCULPT_TOOL_NUDGE = 11, 812 SCULPT_TOOL_THUMB = 12, 813 SCULPT_TOOL_SNAKE_HOOK = 13, 814 SCULPT_TOOL_ROTATE = 14, 815 SCULPT_TOOL_SIMPLIFY = 15, 816 SCULPT_TOOL_CREASE = 16, 817 SCULPT_TOOL_BLOB = 17, 818 SCULPT_TOOL_CLAY_STRIPS = 18, 819 SCULPT_TOOL_MASK = 19, 820 SCULPT_TOOL_DRAW_SHARP = 20, 821 SCULPT_TOOL_ELASTIC_DEFORM = 21, 822 SCULPT_TOOL_POSE = 22, 823 SCULPT_TOOL_MULTIPLANE_SCRAPE = 23, 824 SCULPT_TOOL_SLIDE_RELAX = 24, 825 SCULPT_TOOL_CLAY_THUMB = 25, 826 SCULPT_TOOL_CLOTH = 26, 827 SCULPT_TOOL_DRAW_FACE_SETS = 27, 828 SCULPT_TOOL_PAINT = 28, 829 SCULPT_TOOL_SMEAR = 29, 830 SCULPT_TOOL_BOUNDARY = 30, 831 SCULPT_TOOL_DISPLACEMENT_ERASER = 31, 832 } eBrushSculptTool; 833 834 /* Brush.uv_sculpt_tool */ 835 typedef enum eBrushUVSculptTool { 836 UV_SCULPT_TOOL_GRAB = 0, 837 UV_SCULPT_TOOL_RELAX = 1, 838 UV_SCULPT_TOOL_PINCH = 2, 839 } eBrushUVSculptTool; 840 841 /** When #BRUSH_ACCUMULATE is used */ 842 #define SCULPT_TOOL_HAS_ACCUMULATE(t) \ 843 ELEM(t, \ 844 SCULPT_TOOL_DRAW, \ 845 SCULPT_TOOL_DRAW_SHARP, \ 846 SCULPT_TOOL_SLIDE_RELAX, \ 847 SCULPT_TOOL_CREASE, \ 848 SCULPT_TOOL_BLOB, \ 849 SCULPT_TOOL_INFLATE, \ 850 SCULPT_TOOL_CLAY, \ 851 SCULPT_TOOL_CLAY_STRIPS, \ 852 SCULPT_TOOL_CLAY_THUMB, \ 853 SCULPT_TOOL_ROTATE, \ 854 SCULPT_TOOL_SCRAPE, \ 855 SCULPT_TOOL_FLATTEN) 856 857 #define SCULPT_TOOL_HAS_NORMAL_WEIGHT(t) \ 858 ELEM(t, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_ELASTIC_DEFORM) 859 860 #define SCULPT_TOOL_HAS_RAKE(t) ELEM(t, SCULPT_TOOL_SNAKE_HOOK) 861 862 #define SCULPT_TOOL_HAS_DYNTOPO(t) \ 863 (ELEM(t, /* These brushes, as currently coded, cannot support dynamic topology */ \ 864 SCULPT_TOOL_GRAB, \ 865 SCULPT_TOOL_ROTATE, \ 866 SCULPT_TOOL_CLOTH, \ 867 SCULPT_TOOL_THUMB, \ 868 SCULPT_TOOL_LAYER, \ 869 SCULPT_TOOL_DISPLACEMENT_ERASER, \ 870 SCULPT_TOOL_DRAW_SHARP, \ 871 SCULPT_TOOL_SLIDE_RELAX, \ 872 SCULPT_TOOL_ELASTIC_DEFORM, \ 873 SCULPT_TOOL_BOUNDARY, \ 874 SCULPT_TOOL_POSE, \ 875 SCULPT_TOOL_DRAW_FACE_SETS, \ 876 SCULPT_TOOL_PAINT, \ 877 SCULPT_TOOL_SMEAR, \ 878 \ 879 /* These brushes could handle dynamic topology, \ \ 880 * but user feedback indicates it's better not to */ \ 881 SCULPT_TOOL_SMOOTH, \ 882 SCULPT_TOOL_MASK) == 0) 883 884 #define SCULPT_TOOL_HAS_TOPOLOGY_RAKE(t) \ 885 (ELEM(t, /* These brushes, as currently coded, cannot support topology rake. */ \ 886 SCULPT_TOOL_GRAB, \ 887 SCULPT_TOOL_ROTATE, \ 888 SCULPT_TOOL_THUMB, \ 889 SCULPT_TOOL_DRAW_SHARP, \ 890 SCULPT_TOOL_DISPLACEMENT_ERASER, \ 891 SCULPT_TOOL_SLIDE_RELAX, \ 892 SCULPT_TOOL_MASK) == 0) 893 894 /* ImagePaintSettings.tool */ 895 typedef enum eBrushImagePaintTool { 896 PAINT_TOOL_DRAW = 0, 897 PAINT_TOOL_SOFTEN = 1, 898 PAINT_TOOL_SMEAR = 2, 899 PAINT_TOOL_CLONE = 3, 900 PAINT_TOOL_FILL = 4, 901 PAINT_TOOL_MASK = 5, 902 } eBrushImagePaintTool; 903 904 typedef enum eBrushVertexPaintTool { 905 VPAINT_TOOL_DRAW = 0, 906 VPAINT_TOOL_BLUR = 1, 907 VPAINT_TOOL_AVERAGE = 2, 908 VPAINT_TOOL_SMEAR = 3, 909 } eBrushVertexPaintTool; 910 911 typedef enum eBrushWeightPaintTool { 912 WPAINT_TOOL_DRAW = 0, 913 WPAINT_TOOL_BLUR = 1, 914 WPAINT_TOOL_AVERAGE = 2, 915 WPAINT_TOOL_SMEAR = 3, 916 } eBrushWeightPaintTool; 917 918 /* BrushGpencilSettings->brush type */ 919 typedef enum eBrushGPaintTool { 920 GPAINT_TOOL_DRAW = 0, 921 GPAINT_TOOL_FILL = 1, 922 GPAINT_TOOL_ERASE = 2, 923 GPAINT_TOOL_TINT = 3, 924 } eBrushGPaintTool; 925 926 /* BrushGpencilSettings->brush type */ 927 typedef enum eBrushGPVertexTool { 928 GPVERTEX_TOOL_DRAW = 0, 929 GPVERTEX_TOOL_BLUR = 1, 930 GPVERTEX_TOOL_AVERAGE = 2, 931 GPVERTEX_TOOL_TINT = 3, 932 GPVERTEX_TOOL_SMEAR = 4, 933 GPVERTEX_TOOL_REPLACE = 5, 934 } eBrushGPVertexTool; 935 936 /* BrushGpencilSettings->brush type */ 937 typedef enum eBrushGPSculptTool { 938 GPSCULPT_TOOL_SMOOTH = 0, 939 GPSCULPT_TOOL_THICKNESS = 1, 940 GPSCULPT_TOOL_STRENGTH = 2, 941 GPSCULPT_TOOL_GRAB = 3, 942 GPSCULPT_TOOL_PUSH = 4, 943 GPSCULPT_TOOL_TWIST = 5, 944 GPSCULPT_TOOL_PINCH = 6, 945 GPSCULPT_TOOL_RANDOMIZE = 7, 946 GPSCULPT_TOOL_CLONE = 8, 947 } eBrushGPSculptTool; 948 949 /* BrushGpencilSettings->brush type */ 950 typedef enum eBrushGPWeightTool { 951 GPWEIGHT_TOOL_DRAW = 0, 952 } eBrushGPWeightTool; 953 954 /* direction that the brush displaces along */ 955 enum { 956 SCULPT_DISP_DIR_AREA = 0, 957 SCULPT_DISP_DIR_VIEW = 1, 958 SCULPT_DISP_DIR_X = 2, 959 SCULPT_DISP_DIR_Y = 3, 960 SCULPT_DISP_DIR_Z = 4, 961 }; 962 963 typedef enum { 964 BRUSH_MASK_DRAW = 0, 965 BRUSH_MASK_SMOOTH = 1, 966 } BrushMaskTool; 967 968 /* blur kernel types, Brush.blur_mode */ 969 typedef enum eBlurKernelType { 970 KERNEL_GAUSSIAN = 0, 971 KERNEL_BOX = 1, 972 } eBlurKernelType; 973 974 /* Brush.falloff_shape */ 975 enum { 976 PAINT_FALLOFF_SHAPE_SPHERE = 0, 977 PAINT_FALLOFF_SHAPE_TUBE = 1, 978 }; 979 980 #define MAX_BRUSH_PIXEL_RADIUS 500 981 #define GP_MAX_BRUSH_PIXEL_RADIUS 1000 982