Blender  V3.3
Classes | Typedefs | Enumerations | Functions | Variables
paint_mask.c File Reference
#include "MEM_guardedalloc.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_vec_types.h"
#include "BLI_alloca.h"
#include "BLI_bitmap_draw_2d.h"
#include "BLI_lasso_2d.h"
#include "BLI_math_geom.h"
#include "BLI_math_matrix.h"
#include "BLI_polyfill_2d.h"
#include "BLI_rect.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_context.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"
#include "BKE_multires.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_subsurf.h"
#include "DEG_depsgraph.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_view3d.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "tools/bmesh_boolean.h"
#include "paint_intern.h"
#include "sculpt_intern.h"
#include <stdlib.h>

Go to the source code of this file.

Classes

struct  MaskTaskData
 
struct  LassoGestureData
 
struct  LineGestureData
 
struct  SculptGestureContext
 
struct  SculptGestureOperation
 
struct  SculptGestureFaceSetOperation
 
struct  SculptGestureMaskOperation
 
struct  SculptGestureTrimOperation
 
struct  SculptGestureProjectOperation
 

Typedefs

typedef struct MaskTaskData MaskTaskData
 
typedef enum eSculptGestureShapeType eMaskGesturesShapeType
 
typedef struct LassoGestureData LassoGestureData
 
typedef struct LineGestureData LineGestureData
 
typedef struct SculptGestureContext SculptGestureContext
 
typedef struct SculptGestureOperation SculptGestureOperation
 
typedef struct SculptGestureFaceSetOperation SculptGestureFaceSetOperation
 
typedef struct SculptGestureMaskOperation SculptGestureMaskOperation
 
typedef enum eSculptTrimOperationType eSculptTrimOperationType
 
typedef enum eSculptTrimOrientationType eSculptTrimOrientationType
 
typedef struct SculptGestureTrimOperation SculptGestureTrimOperation
 
typedef struct SculptGestureProjectOperation SculptGestureProjectOperation
 

Enumerations

enum  eSculptGestureShapeType { SCULPT_GESTURE_SHAPE_BOX , SCULPT_GESTURE_SHAPE_LASSO , SCULPT_GESTURE_SHAPE_LINE }
 
enum  eSculptTrimOperationType { SCULPT_GESTURE_TRIM_INTERSECT , SCULPT_GESTURE_TRIM_DIFFERENCE , SCULPT_GESTURE_TRIM_UNION , SCULPT_GESTURE_TRIM_JOIN }
 
enum  eSculptTrimOrientationType { SCULPT_GESTURE_TRIM_ORIENTATION_VIEW , SCULPT_GESTURE_TRIM_ORIENTATION_SURFACE }
 

Functions

static void mask_flood_fill_set_elem (float *elem, PaintMaskFloodMode mode, float value)
 
static void mask_flood_fill_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static int mask_flood_fill_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_mask_flood_fill (struct wmOperatorType *ot)
 
static void sculpt_gesture_operator_properties (wmOperatorType *ot)
 
static void sculpt_gesture_context_init_common (bContext *C, wmOperator *op, SculptGestureContext *sgcontext)
 
static void sculpt_gesture_lasso_px_cb (int x, int x_end, int y, void *user_data)
 
static SculptGestureContextsculpt_gesture_init_from_lasso (bContext *C, wmOperator *op)
 
static SculptGestureContextsculpt_gesture_init_from_box (bContext *C, wmOperator *op)
 
static void sculpt_gesture_line_plane_from_tri (float *r_plane, SculptGestureContext *sgcontext, const bool flip, const float p1[3], const float p2[3], const float p3[3])
 
static void sculpt_gesture_line_calculate_plane_points (SculptGestureContext *sgcontext, float line_points[2][2], float r_plane_points[4][3], float r_offset_plane_points[2][3])
 
static SculptGestureContextsculpt_gesture_init_from_line (bContext *C, wmOperator *op)
 
static void sculpt_gesture_context_free (SculptGestureContext *sgcontext)
 
static void flip_plane (float out[4], const float in[4], const char symm)
 
static void sculpt_gesture_flip_for_symmetry_pass (SculptGestureContext *sgcontext, const ePaintSymmetryFlags symmpass)
 
static void sculpt_gesture_update_effected_nodes_by_line_plane (SculptGestureContext *sgcontext)
 
static void sculpt_gesture_update_effected_nodes_by_clip_planes (SculptGestureContext *sgcontext)
 
static void sculpt_gesture_update_effected_nodes (SculptGestureContext *sgcontext)
 
static bool sculpt_gesture_is_effected_lasso (SculptGestureContext *sgcontext, const float co[3])
 
static bool sculpt_gesture_is_vertex_effected (SculptGestureContext *sgcontext, PBVHVertexIter *vd)
 
static void sculpt_gesture_apply (bContext *C, SculptGestureContext *sgcontext)
 
static void sculpt_gesture_face_set_begin (bContext *C, SculptGestureContext *sgcontext)
 
static void face_set_gesture_apply_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_gesture_face_set_apply_for_symmetry_pass (bContext *UNUSED(C), SculptGestureContext *sgcontext)
 
static void sculpt_gesture_face_set_end (bContext *UNUSED(C), SculptGestureContext *sgcontext)
 
static void sculpt_gesture_init_face_set_properties (SculptGestureContext *sgcontext, wmOperator *UNUSED(op))
 
static void sculpt_gesture_mask_begin (bContext *C, SculptGestureContext *sgcontext)
 
static void mask_gesture_apply_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_gesture_mask_apply_for_symmetry_pass (bContext *UNUSED(C), SculptGestureContext *sgcontext)
 
static void sculpt_gesture_mask_end (bContext *C, SculptGestureContext *sgcontext)
 
static void sculpt_gesture_init_mask_properties (SculptGestureContext *sgcontext, wmOperator *op)
 
static void paint_mask_gesture_operator_properties (wmOperatorType *ot)
 
static void sculpt_gesture_trim_normals_update (SculptGestureContext *sgcontext)
 
static void sculpt_gesture_trim_shape_origin_normal_get (SculptGestureContext *sgcontext, float *r_origin, float *r_normal)
 
static void sculpt_gesture_trim_calculate_depth (SculptGestureContext *sgcontext)
 
static void sculpt_gesture_trim_geometry_generate (SculptGestureContext *sgcontext)
 
static void sculpt_gesture_trim_geometry_free (SculptGestureContext *sgcontext)
 
static int bm_face_isect_pair (BMFace *f, void *UNUSED(user_data))
 
static void sculpt_gesture_apply_trim (SculptGestureContext *sgcontext)
 
static void sculpt_gesture_trim_begin (bContext *C, SculptGestureContext *sgcontext)
 
static void sculpt_gesture_trim_apply_for_symmetry_pass (bContext *UNUSED(C), SculptGestureContext *sgcontext)
 
static void sculpt_gesture_trim_end (bContext *UNUSED(C), SculptGestureContext *sgcontext)
 
static void sculpt_gesture_init_trim_properties (SculptGestureContext *sgcontext, wmOperator *op)
 
static void sculpt_trim_gesture_operator_properties (wmOperatorType *ot)
 
static void sculpt_gesture_project_begin (bContext *C, SculptGestureContext *sgcontext)
 
static void project_line_gesture_apply_task_cb (void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_gesture_project_apply_for_symmetry_pass (bContext *UNUSED(C), SculptGestureContext *sgcontext)
 
static void sculpt_gesture_project_end (bContext *C, SculptGestureContext *sgcontext)
 
static void sculpt_gesture_init_project_properties (SculptGestureContext *sgcontext, wmOperator *UNUSED(op))
 
static int paint_mask_gesture_box_exec (bContext *C, wmOperator *op)
 
static int paint_mask_gesture_lasso_exec (bContext *C, wmOperator *op)
 
static int paint_mask_gesture_line_exec (bContext *C, wmOperator *op)
 
static int face_set_gesture_box_exec (bContext *C, wmOperator *op)
 
static int face_set_gesture_lasso_exec (bContext *C, wmOperator *op)
 
static int sculpt_trim_gesture_box_exec (bContext *C, wmOperator *op)
 
static int sculpt_trim_gesture_box_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int sculpt_trim_gesture_lasso_exec (bContext *C, wmOperator *op)
 
static int sculpt_trim_gesture_lasso_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int project_gesture_line_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_mask_lasso_gesture (wmOperatorType *ot)
 
void PAINT_OT_mask_box_gesture (wmOperatorType *ot)
 
void PAINT_OT_mask_line_gesture (wmOperatorType *ot)
 
void SCULPT_OT_face_set_lasso_gesture (wmOperatorType *ot)
 
void SCULPT_OT_face_set_box_gesture (wmOperatorType *ot)
 
void SCULPT_OT_trim_lasso_gesture (wmOperatorType *ot)
 
void SCULPT_OT_trim_box_gesture (wmOperatorType *ot)
 
void SCULPT_OT_project_line_gesture (wmOperatorType *ot)
 

Variables

static const EnumPropertyItem mode_items []
 
static EnumPropertyItem prop_trim_operation_types []
 
static EnumPropertyItem prop_trim_orientation_types []
 

Typedef Documentation

◆ eMaskGesturesShapeType

◆ eSculptTrimOperationType

◆ eSculptTrimOrientationType

◆ LassoGestureData

◆ LineGestureData

◆ MaskTaskData

typedef struct MaskTaskData MaskTaskData

◆ SculptGestureContext

◆ SculptGestureFaceSetOperation

◆ SculptGestureMaskOperation

◆ SculptGestureOperation

◆ SculptGestureProjectOperation

◆ SculptGestureTrimOperation

Enumeration Type Documentation

◆ eSculptGestureShapeType

Enumerator
SCULPT_GESTURE_SHAPE_BOX 
SCULPT_GESTURE_SHAPE_LASSO 
SCULPT_GESTURE_SHAPE_LINE 

Definition at line 216 of file paint_mask.c.

◆ eSculptTrimOperationType

Enumerator
SCULPT_GESTURE_TRIM_INTERSECT 
SCULPT_GESTURE_TRIM_DIFFERENCE 
SCULPT_GESTURE_TRIM_UNION 
SCULPT_GESTURE_TRIM_JOIN 

Definition at line 892 of file paint_mask.c.

◆ eSculptTrimOrientationType

Enumerator
SCULPT_GESTURE_TRIM_ORIENTATION_VIEW 
SCULPT_GESTURE_TRIM_ORIENTATION_SURFACE 

Definition at line 916 of file paint_mask.c.

Function Documentation

◆ bm_face_isect_pair()

static int bm_face_isect_pair ( BMFace f,
void UNUSEDuser_data 
)
static

Definition at line 1219 of file paint_mask.c.

References BM_ELEM_DRAW, and BM_elem_flag_test.

Referenced by sculpt_gesture_apply_trim().

◆ face_set_gesture_apply_task_cb()

static void face_set_gesture_apply_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ face_set_gesture_box_exec()

static int face_set_gesture_box_exec ( bContext C,
wmOperator op 
)
static

◆ face_set_gesture_lasso_exec()

static int face_set_gesture_lasso_exec ( bContext C,
wmOperator op 
)
static

◆ flip_plane()

static void flip_plane ( float  out[4],
const float  in[4],
const char  symm 
)
static

◆ mask_flood_fill_exec()

static int mask_flood_fill_exec ( bContext C,
wmOperator op 
)
static

◆ mask_flood_fill_set_elem()

static void mask_flood_fill_set_elem ( float elem,
PaintMaskFloodMode  mode,
float  value 
)
static

◆ mask_flood_fill_task_cb()

static void mask_flood_fill_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ mask_gesture_apply_task_cb()

static void mask_gesture_apply_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ paint_mask_gesture_box_exec()

static int paint_mask_gesture_box_exec ( bContext C,
wmOperator op 
)
static

◆ paint_mask_gesture_lasso_exec()

static int paint_mask_gesture_lasso_exec ( bContext C,
wmOperator op 
)
static

◆ paint_mask_gesture_line_exec()

static int paint_mask_gesture_line_exec ( bContext C,
wmOperator op 
)
static

◆ paint_mask_gesture_operator_properties()

static void paint_mask_gesture_operator_properties ( wmOperatorType ot)
static

◆ PAINT_OT_mask_box_gesture()

void PAINT_OT_mask_box_gesture ( wmOperatorType ot)

◆ PAINT_OT_mask_flood_fill()

void PAINT_OT_mask_flood_fill ( struct wmOperatorType ot)

◆ PAINT_OT_mask_lasso_gesture()

void PAINT_OT_mask_lasso_gesture ( wmOperatorType ot)

◆ PAINT_OT_mask_line_gesture()

void PAINT_OT_mask_line_gesture ( wmOperatorType ot)

◆ project_gesture_line_exec()

static int project_gesture_line_exec ( bContext C,
wmOperator op 
)
static

◆ project_line_gesture_apply_task_cb()

static void project_line_gesture_apply_task_cb ( void *__restrict  userdata,
const int  i,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ sculpt_gesture_apply()

static void sculpt_gesture_apply ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_apply_trim()

static void sculpt_gesture_apply_trim ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_context_free()

static void sculpt_gesture_context_free ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_context_init_common()

static void sculpt_gesture_context_init_common ( bContext C,
wmOperator op,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_face_set_apply_for_symmetry_pass()

static void sculpt_gesture_face_set_apply_for_symmetry_pass ( bContext UNUSEDC,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_face_set_begin()

static void sculpt_gesture_face_set_begin ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_face_set_end()

static void sculpt_gesture_face_set_end ( bContext UNUSEDC,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_flip_for_symmetry_pass()

static void sculpt_gesture_flip_for_symmetry_pass ( SculptGestureContext sgcontext,
const ePaintSymmetryFlags  symmpass 
)
static

◆ sculpt_gesture_init_face_set_properties()

static void sculpt_gesture_init_face_set_properties ( SculptGestureContext sgcontext,
wmOperator UNUSEDop 
)
static

◆ sculpt_gesture_init_from_box()

static SculptGestureContext* sculpt_gesture_init_from_box ( bContext C,
wmOperator op 
)
static

◆ sculpt_gesture_init_from_lasso()

static SculptGestureContext* sculpt_gesture_init_from_lasso ( bContext C,
wmOperator op 
)
static

◆ sculpt_gesture_init_from_line()

static SculptGestureContext* sculpt_gesture_init_from_line ( bContext C,
wmOperator op 
)
static

◆ sculpt_gesture_init_mask_properties()

static void sculpt_gesture_init_mask_properties ( SculptGestureContext sgcontext,
wmOperator op 
)
static

◆ sculpt_gesture_init_project_properties()

static void sculpt_gesture_init_project_properties ( SculptGestureContext sgcontext,
wmOperator UNUSEDop 
)
static

◆ sculpt_gesture_init_trim_properties()

static void sculpt_gesture_init_trim_properties ( SculptGestureContext sgcontext,
wmOperator op 
)
static

◆ sculpt_gesture_is_effected_lasso()

static bool sculpt_gesture_is_effected_lasso ( SculptGestureContext sgcontext,
const float  co[3] 
)
static

◆ sculpt_gesture_is_vertex_effected()

static bool sculpt_gesture_is_vertex_effected ( SculptGestureContext sgcontext,
PBVHVertexIter vd 
)
static

◆ sculpt_gesture_lasso_px_cb()

static void sculpt_gesture_lasso_px_cb ( int  x,
int  x_end,
int  y,
void user_data 
)
static

◆ sculpt_gesture_line_calculate_plane_points()

static void sculpt_gesture_line_calculate_plane_points ( SculptGestureContext sgcontext,
float  line_points[2][2],
float  r_plane_points[4][3],
float  r_offset_plane_points[2][3] 
)
static

◆ sculpt_gesture_line_plane_from_tri()

static void sculpt_gesture_line_plane_from_tri ( float r_plane,
SculptGestureContext sgcontext,
const bool  flip,
const float  p1[3],
const float  p2[3],
const float  p3[3] 
)
static

◆ sculpt_gesture_mask_apply_for_symmetry_pass()

static void sculpt_gesture_mask_apply_for_symmetry_pass ( bContext UNUSEDC,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_mask_begin()

static void sculpt_gesture_mask_begin ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_mask_end()

static void sculpt_gesture_mask_end ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_operator_properties()

static void sculpt_gesture_operator_properties ( wmOperatorType ot)
static

◆ sculpt_gesture_project_apply_for_symmetry_pass()

static void sculpt_gesture_project_apply_for_symmetry_pass ( bContext UNUSEDC,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_project_begin()

static void sculpt_gesture_project_begin ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_project_end()

static void sculpt_gesture_project_end ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_trim_apply_for_symmetry_pass()

static void sculpt_gesture_trim_apply_for_symmetry_pass ( bContext UNUSEDC,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_trim_begin()

static void sculpt_gesture_trim_begin ( bContext C,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_trim_calculate_depth()

static void sculpt_gesture_trim_calculate_depth ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_trim_end()

static void sculpt_gesture_trim_end ( bContext UNUSEDC,
SculptGestureContext sgcontext 
)
static

◆ sculpt_gesture_trim_geometry_free()

static void sculpt_gesture_trim_geometry_free ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_trim_geometry_generate()

static void sculpt_gesture_trim_geometry_generate ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_trim_normals_update()

static void sculpt_gesture_trim_normals_update ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_trim_shape_origin_normal_get()

static void sculpt_gesture_trim_shape_origin_normal_get ( SculptGestureContext sgcontext,
float r_origin,
float r_normal 
)
static

◆ sculpt_gesture_update_effected_nodes()

static void sculpt_gesture_update_effected_nodes ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_update_effected_nodes_by_clip_planes()

static void sculpt_gesture_update_effected_nodes_by_clip_planes ( SculptGestureContext sgcontext)
static

◆ sculpt_gesture_update_effected_nodes_by_line_plane()

static void sculpt_gesture_update_effected_nodes_by_line_plane ( SculptGestureContext sgcontext)
static

◆ SCULPT_OT_face_set_box_gesture()

void SCULPT_OT_face_set_box_gesture ( wmOperatorType ot)

◆ SCULPT_OT_face_set_lasso_gesture()

void SCULPT_OT_face_set_lasso_gesture ( wmOperatorType ot)

◆ SCULPT_OT_project_line_gesture()

void SCULPT_OT_project_line_gesture ( wmOperatorType ot)

◆ SCULPT_OT_trim_box_gesture()

void SCULPT_OT_trim_box_gesture ( wmOperatorType ot)

◆ SCULPT_OT_trim_lasso_gesture()

void SCULPT_OT_trim_lasso_gesture ( wmOperatorType ot)

◆ sculpt_trim_gesture_box_exec()

static int sculpt_trim_gesture_box_exec ( bContext C,
wmOperator op 
)
static

◆ sculpt_trim_gesture_box_invoke()

static int sculpt_trim_gesture_box_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ sculpt_trim_gesture_lasso_exec()

static int sculpt_trim_gesture_lasso_exec ( bContext C,
wmOperator op 
)
static

◆ sculpt_trim_gesture_lasso_invoke()

static int sculpt_trim_gesture_lasso_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ sculpt_trim_gesture_operator_properties()

static void sculpt_trim_gesture_operator_properties ( wmOperatorType ot)
static

Variable Documentation

◆ mode_items

const EnumPropertyItem mode_items[]
static

◆ prop_trim_operation_types

EnumPropertyItem prop_trim_operation_types[]
static
Initial value:
= {
"DIFFERENCE",
0,
"Difference",
"Use a difference boolean operation"},
{SCULPT_GESTURE_TRIM_UNION, "UNION", 0, "Union", "Use a union boolean operation"},
"JOIN",
0,
"Join",
"Join the new mesh as separate geometry, without performing any boolean operation"},
{0, NULL, 0, NULL, NULL},
}
@ SCULPT_GESTURE_TRIM_UNION
Definition: paint_mask.c:895
@ SCULPT_GESTURE_TRIM_DIFFERENCE
Definition: paint_mask.c:894
@ SCULPT_GESTURE_TRIM_JOIN
Definition: paint_mask.c:896

Definition at line 901 of file paint_mask.c.

Referenced by sculpt_trim_gesture_operator_properties().

◆ prop_trim_orientation_types

EnumPropertyItem prop_trim_orientation_types[]
static
Initial value:
= {
"VIEW",
0,
"View",
"Use the view to orientate the trimming shape"},
"SURFACE",
0,
"Surface",
"Use the surface normal to orientate the trimming shape"},
{0, NULL, 0, NULL, NULL},
}
@ SCULPT_GESTURE_TRIM_ORIENTATION_SURFACE
Definition: paint_mask.c:918
@ SCULPT_GESTURE_TRIM_ORIENTATION_VIEW
Definition: paint_mask.c:917

Definition at line 920 of file paint_mask.c.

Referenced by sculpt_trim_gesture_operator_properties().