Blender  V2.93
Classes
paint_vertex.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_array_utils.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_task.h"
#include "DNA_brush_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "RNA_access.h"
#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_layer.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_object_deform.h"
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_subsurf.h"
#include "DEG_depsgraph.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "ED_armature.h"
#include "ED_mesh.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_view3d.h"
#include "IMB_imbuf.h"
#include "BKE_ccg.h"
#include "bmesh.h"
#include "paint_intern.h"
#include "sculpt_intern.h"

Go to the source code of this file.

Classes

struct  VPaintAverageAccum
 
struct  WPaintAverageAccum
 
struct  NormalAnglePrecalc
 
struct  WeightPaintGroupData
 
struct  WeightPaintInfo
 
struct  WPaintData
 
struct  VPaintData
 

Functions

Enter Vertex/Weight Paint Mode
static void ed_vwpaintmode_enter_generic (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, const eObjectMode mode_flag)
 
void ED_object_vpaintmode_enter_ex (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void ED_object_vpaintmode_enter (struct bContext *C, Depsgraph *depsgraph)
 
void ED_object_wpaintmode_enter_ex (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void ED_object_wpaintmode_enter (struct bContext *C, Depsgraph *depsgraph)
 
Exit Vertex/Weight Paint Mode
static void ed_vwpaintmode_exit_generic (Object *ob, const eObjectMode mode_flag)
 
void ED_object_vpaintmode_exit_ex (Object *ob)
 
void ED_object_vpaintmode_exit (struct bContext *C)
 
void ED_object_wpaintmode_exit_ex (Object *ob)
 
void ED_object_wpaintmode_exit (struct bContext *C)
 
Toggle Weight Paint Operator
static int wpaint_mode_toggle_exec (bContext *C, wmOperator *op)
 
static bool paint_mode_toggle_poll_test (bContext *C)
 
void PAINT_OT_weight_paint_toggle (wmOperatorType *ot)
 
Weight Paint Operator
static void vwpaint_update_cache_invariants (bContext *C, const VPaint *vp, SculptSession *ss, wmOperator *op, const float mouse[2])
 
static void vwpaint_update_cache_variants (bContext *C, VPaint *vp, Object *ob, PointerRNA *ptr)
 
static bool wpaint_stroke_test_start (bContext *C, wmOperator *op, const float mouse[2])
 
static float dot_vf3vs3 (const float brushNormal[3], const short vertexNormal[3])
 
static void get_brush_alpha_data (const Scene *scene, const SculptSession *ss, const Brush *brush, float *r_brush_size_pressure, float *r_brush_alpha_value, float *r_brush_alpha_pressure)
 
static float wpaint_get_active_weight (const MDeformVert *dv, const WeightPaintInfo *wpi)
 
static void do_wpaint_precompute_weight_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void precompute_weight_values (bContext *C, Object *ob, Brush *brush, struct WPaintData *wpd, WeightPaintInfo *wpi, Mesh *me)
 
static void do_wpaint_brush_blur_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void do_wpaint_brush_smear_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void do_wpaint_brush_draw_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void do_wpaint_brush_calc_average_weight_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void calculate_average_weight (SculptThreadedTaskData *data, PBVHNode **UNUSED(nodes), int totnode)
 
static void wpaint_paint_leaves (bContext *C, Object *ob, Sculpt *sd, VPaint *vp, struct WPaintData *wpd, WeightPaintInfo *wpi, Mesh *me, PBVHNode **nodes, int totnode)
 
static PBVHNode ** vwpaint_pbvh_gather_generic (Object *ob, VPaint *wp, Sculpt *sd, Brush *brush, int *r_totnode)
 
static void wpaint_do_paint (bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi, Mesh *me, Brush *brush, const char symm, const int axis, const int i, const float angle)
 
static void wpaint_do_radial_symmetry (bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi, Mesh *me, Brush *brush, const char symm, const int axis)
 
static void wpaint_do_symmetrical_brush_actions (bContext *C, Object *ob, VPaint *wp, Sculpt *sd, struct WPaintData *wpd, WeightPaintInfo *wpi)
 
static void wpaint_stroke_update_step (bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
 
static void wpaint_stroke_done (const bContext *C, struct PaintStroke *stroke)
 
static int wpaint_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int wpaint_exec (bContext *C, wmOperator *op)
 
static void wpaint_cancel (bContext *C, wmOperator *op)
 
void PAINT_OT_weight_paint (wmOperatorType *ot)
 
Toggle Vertex Paint Operator
static int vpaint_mode_toggle_exec (bContext *C, wmOperator *op)
 
void PAINT_OT_vertex_paint_toggle (wmOperatorType *ot)
 
Vertex Paint Operator
static bool vpaint_stroke_test_start (bContext *C, struct wmOperator *op, const float mouse[2])
 
static void do_vpaint_brush_calc_average_color_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static float tex_color_alpha_ubyte (SculptThreadedTaskData *data, const float v_co[3], uint *r_color)
 
static void do_vpaint_brush_draw_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void do_vpaint_brush_blur_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void do_vpaint_brush_smear_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void calculate_average_color (SculptThreadedTaskData *data, PBVHNode **UNUSED(nodes), int totnode)
 
static void vpaint_paint_leaves (bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode)
 
static void vpaint_do_paint (bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob, Mesh *me, Brush *brush, const char symm, const int axis, const int i, const float angle)
 
static void vpaint_do_radial_symmetry (bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob, Mesh *me, Brush *brush, const char symm, const int axis)
 
static void vpaint_do_symmetrical_brush_actions (bContext *C, Sculpt *sd, VPaint *vp, struct VPaintData *vpd, Object *ob)
 
static void vpaint_stroke_update_step (bContext *C, struct PaintStroke *stroke, PointerRNA *itemptr)
 
static void vpaint_stroke_done (const bContext *C, struct PaintStroke *stroke)
 
static int vpaint_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int vpaint_exec (bContext *C, wmOperator *op)
 
static void vpaint_cancel (bContext *C, wmOperator *op)
 
void PAINT_OT_vertex_paint (wmOperatorType *ot)
 

Internal Utilities

typedef struct WeightPaintInfo WeightPaintInfo
 
static void view_angle_limits_init (struct NormalAnglePrecalc *a, float angle, bool do_mask_normal)
 
static float view_angle_limits_apply_falloff (const struct NormalAnglePrecalc *a, float angle_cos, float *mask_p)
 
static bool vwpaint_use_normal (const VPaint *vp)
 
static bool brush_use_accumulate_ex (const Brush *brush, const int ob_mode)
 
static bool brush_use_accumulate (const VPaint *vp)
 
static MDeformVertdefweight_prev_init (MDeformVert *dvert_prev, MDeformVert *dvert_curr, int index)
 
static bool vertex_paint_use_fast_update_check (Object *ob)
 
static void paint_last_stroke_update (Scene *scene, const float location[3])
 
bool vertex_paint_mode_poll (bContext *C)
 
static bool vertex_paint_poll_ex (bContext *C, bool check_tool)
 
bool vertex_paint_poll (bContext *C)
 
bool vertex_paint_poll_ignore_tool (bContext *C)
 
bool weight_paint_mode_poll (bContext *C)
 
static bool weight_paint_poll_ex (bContext *C, bool check_tool)
 
bool weight_paint_poll (bContext *C)
 
bool weight_paint_poll_ignore_tool (bContext *C)
 
uint vpaint_get_current_col (Scene *scene, VPaint *vp, bool secondary)
 
static uint vpaint_blend (const VPaint *vp, uint color_curr, uint color_orig, uint color_paint, const int alpha_i, const int brush_alpha_value_i)
 
static void tex_color_alpha (VPaint *vp, const ViewContext *vc, const float co[3], float r_rgba[4])
 
static float wpaint_blend (const VPaint *wp, float weight, const float alpha, float paintval, const float UNUSED(brush_alpha_value), const short do_flip)
 
static float wpaint_clamp_monotonic (float oldval, float curval, float newval)
 
static float wpaint_undo_lock_relative (float weight, float old_weight, float locked_weight, float free_weight, bool auto_normalize)
 
static void do_weight_paint_normalize_all (MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap)
 
static bool do_weight_paint_normalize_all_locked (MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap, const bool *lock_flags)
 
static void do_weight_paint_normalize_all_locked_try_active (MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap, const bool *lock_flags, const bool *lock_with_active)
 
static void multipaint_clamp_change (MDeformVert *dvert, const int defbase_tot, const bool *defbase_sel, float *change_p)
 
static bool multipaint_verify_change (MDeformVert *dvert, const int defbase_tot, float change, const bool *defbase_sel)
 
static void multipaint_apply_change (MDeformVert *dvert, const int defbase_tot, float change, const bool *defbase_sel)
 
static void do_weight_paint_vertex_single (const VPaint *wp, Object *ob, const WeightPaintInfo *wpi, const uint index, float alpha, float paintweight)
 
static void do_weight_paint_vertex_multi (const VPaint *wp, Object *ob, const WeightPaintInfo *wpi, const uint index, float alpha, float paintweight)
 
static void do_weight_paint_vertex (const VPaint *wp, Object *ob, const WeightPaintInfo *wpi, const uint index, float alpha, float paintweight)
 
static void vertex_paint_init_session (Depsgraph *depsgraph, Scene *scene, Object *ob, eObjectMode object_mode)
 
static void vertex_paint_init_stroke (Depsgraph *depsgraph, Object *ob)
 
static void vertex_paint_init_session_data (const ToolSettings *ts, Object *ob)
 

Detailed Description

Used for vertex color & weight paint and mode switching.

Note
This file is already big, use paint_vertex_color_ops.c & paint_vertex_weight_ops.c for general purpose operators.

Definition in file paint_vertex.c.

Typedef Documentation

◆ WeightPaintInfo

Function Documentation

◆ brush_use_accumulate()

static bool brush_use_accumulate ( const VPaint vp)
static

◆ brush_use_accumulate_ex()

static bool brush_use_accumulate_ex ( const Brush brush,
const int  ob_mode 
)
static

◆ calculate_average_color()

static void calculate_average_color ( SculptThreadedTaskData data,
PBVHNode **  UNUSEDnodes,
int  totnode 
)
static

◆ calculate_average_weight()

static void calculate_average_weight ( SculptThreadedTaskData data,
PBVHNode **  UNUSEDnodes,
int  totnode 
)
static

◆ defweight_prev_init()

static MDeformVert* defweight_prev_init ( MDeformVert dvert_prev,
MDeformVert dvert_curr,
int  index 
)
static

◆ do_vpaint_brush_blur_task_cb_ex()

static void do_vpaint_brush_blur_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_vpaint_brush_calc_average_color_cb_ex()

static void do_vpaint_brush_calc_average_color_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_vpaint_brush_draw_task_cb_ex()

static void do_vpaint_brush_draw_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_vpaint_brush_smear_task_cb_ex()

static void do_vpaint_brush_smear_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_weight_paint_normalize_all()

static void do_weight_paint_normalize_all ( MDeformVert dvert,
const int  defbase_tot,
const bool *  vgroup_validmap 
)
static

◆ do_weight_paint_normalize_all_locked()

static bool do_weight_paint_normalize_all_locked ( MDeformVert dvert,
const int  defbase_tot,
const bool *  vgroup_validmap,
const bool *  lock_flags 
)
static

◆ do_weight_paint_normalize_all_locked_try_active()

static void do_weight_paint_normalize_all_locked_try_active ( MDeformVert dvert,
const int  defbase_tot,
const bool *  vgroup_validmap,
const bool *  lock_flags,
const bool *  lock_with_active 
)
static
Note
same as function above except it does a second pass without active group if normalize fails with it.

Locks prevented the first pass from full completion, so remove restriction on active group; e.g:

  • With 1.0 weight painted into active: nonzero locked weight; first pass zeroed out unlocked weight; scale 1 down to fit.
  • With 0.0 weight painted into active: no unlocked groups; first pass did nothing; increase 0 to fit.

Definition at line 574 of file paint_vertex.c.

References do_weight_paint_normalize_all_locked().

Referenced by do_weight_paint_vertex_multi(), and do_weight_paint_vertex_single().

◆ do_weight_paint_vertex()

static void do_weight_paint_vertex ( const VPaint wp,
Object ob,
const WeightPaintInfo wpi,
const uint  index,
float  alpha,
float  paintweight 
)
static

◆ do_weight_paint_vertex_multi()

static void do_weight_paint_vertex_multi ( const VPaint wp,
Object ob,
const WeightPaintInfo wpi,
const uint  index,
float  alpha,
float  paintweight 
)
static

◆ do_weight_paint_vertex_single()

static void do_weight_paint_vertex_single ( const VPaint wp,
Object ob,
const WeightPaintInfo wpi,
const uint  index,
float  alpha,
float  paintweight 
)
static

◆ do_wpaint_brush_blur_task_cb_ex()

static void do_wpaint_brush_blur_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_wpaint_brush_calc_average_weight_cb_ex()

static void do_wpaint_brush_calc_average_weight_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_wpaint_brush_draw_task_cb_ex()

static void do_wpaint_brush_draw_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_wpaint_brush_smear_task_cb_ex()

static void do_wpaint_brush_smear_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_wpaint_precompute_weight_cb_ex()

static void do_wpaint_precompute_weight_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

Definition at line 1782 of file paint_vertex.c.

References data, and wpaint_get_active_weight().

Referenced by precompute_weight_values().

◆ dot_vf3vs3()

static float dot_vf3vs3 ( const float  brushNormal[3],
const short  vertexNormal[3] 
)
static

◆ ED_object_vpaintmode_enter()

void ED_object_vpaintmode_enter ( struct bContext C,
Depsgraph depsgraph 
)

◆ ED_object_vpaintmode_enter_ex()

void ED_object_vpaintmode_enter_ex ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob 
)

◆ ED_object_vpaintmode_exit()

void ED_object_vpaintmode_exit ( struct bContext C)

Definition at line 1343 of file paint_vertex.c.

References C, CTX_data_active_object(), and ED_object_vpaintmode_exit_ex().

◆ ED_object_vpaintmode_exit_ex()

void ED_object_vpaintmode_exit_ex ( Object ob)

◆ ED_object_wpaintmode_enter()

void ED_object_wpaintmode_enter ( struct bContext C,
Depsgraph depsgraph 
)

◆ ED_object_wpaintmode_enter_ex()

void ED_object_wpaintmode_enter_ex ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob 
)

◆ ED_object_wpaintmode_exit()

void ED_object_wpaintmode_exit ( struct bContext C)

Definition at line 1353 of file paint_vertex.c.

References C, CTX_data_active_object(), and ED_object_wpaintmode_exit_ex().

◆ ED_object_wpaintmode_exit_ex()

void ED_object_wpaintmode_exit_ex ( Object ob)

◆ ed_vwpaintmode_enter_generic()

static void ed_vwpaintmode_enter_generic ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob,
const eObjectMode  mode_flag 
)
static

◆ ed_vwpaintmode_exit_generic()

static void ed_vwpaintmode_exit_generic ( Object ob,
const eObjectMode  mode_flag 
)
static

◆ get_brush_alpha_data()

static void get_brush_alpha_data ( const Scene scene,
const SculptSession ss,
const Brush brush,
float r_brush_size_pressure,
float r_brush_alpha_value,
float r_brush_alpha_pressure 
)
static

◆ multipaint_apply_change()

static void multipaint_apply_change ( MDeformVert dvert,
const int  defbase_tot,
float  change,
const bool *  defbase_sel 
)
static

◆ multipaint_clamp_change()

static void multipaint_clamp_change ( MDeformVert dvert,
const int  defbase_tot,
const bool *  defbase_sel,
float change_p 
)
static

◆ multipaint_verify_change()

static bool multipaint_verify_change ( MDeformVert dvert,
const int  defbase_tot,
float  change,
const bool *  defbase_sel 
)
static

◆ paint_last_stroke_update()

static void paint_last_stroke_update ( Scene scene,
const float  location[3] 
)
static

◆ paint_mode_toggle_poll_test()

static bool paint_mode_toggle_poll_test ( bContext C)
static

◆ PAINT_OT_vertex_paint()

void PAINT_OT_vertex_paint ( wmOperatorType ot)

◆ PAINT_OT_vertex_paint_toggle()

void PAINT_OT_vertex_paint_toggle ( wmOperatorType ot)

◆ PAINT_OT_weight_paint()

void PAINT_OT_weight_paint ( wmOperatorType ot)

◆ PAINT_OT_weight_paint_toggle()

void PAINT_OT_weight_paint_toggle ( wmOperatorType ot)

◆ precompute_weight_values()

static void precompute_weight_values ( bContext C,
Object ob,
Brush brush,
struct WPaintData wpd,
WeightPaintInfo wpi,
Mesh me 
)
static

◆ tex_color_alpha()

static void tex_color_alpha ( VPaint vp,
const ViewContext vc,
const float  co[3],
float  r_rgba[4] 
)
static

◆ tex_color_alpha_ubyte()

static float tex_color_alpha_ubyte ( SculptThreadedTaskData data,
const float  v_co[3],
uint r_color 
)
static

◆ vertex_paint_init_session()

static void vertex_paint_init_session ( Depsgraph depsgraph,
Scene scene,
Object ob,
eObjectMode  object_mode 
)
static

◆ vertex_paint_init_session_data()

static void vertex_paint_init_session_data ( const ToolSettings ts,
Object ob 
)
static

◆ vertex_paint_init_stroke()

static void vertex_paint_init_stroke ( Depsgraph depsgraph,
Object ob 
)
static

◆ vertex_paint_mode_poll()

bool vertex_paint_mode_poll ( bContext C)

◆ vertex_paint_poll()

bool vertex_paint_poll ( bContext C)

Definition at line 228 of file paint_vertex.c.

References C, and vertex_paint_poll_ex().

Referenced by ed_vwpaintmode_enter_generic(), and PAINT_OT_vertex_paint().

◆ vertex_paint_poll_ex()

static bool vertex_paint_poll_ex ( bContext C,
bool  check_tool 
)
static

◆ vertex_paint_poll_ignore_tool()

bool vertex_paint_poll_ignore_tool ( bContext C)

Definition at line 233 of file paint_vertex.c.

References C, and vertex_paint_poll_ex().

Referenced by sample_color_poll().

◆ vertex_paint_use_fast_update_check()

static bool vertex_paint_use_fast_update_check ( Object ob)
static

◆ view_angle_limits_apply_falloff()

static float view_angle_limits_apply_falloff ( const struct NormalAnglePrecalc a,
float  angle_cos,
float mask_p 
)
static

◆ view_angle_limits_init()

static void view_angle_limits_init ( struct NormalAnglePrecalc a,
float  angle,
bool  do_mask_normal 
)
static

Definition at line 108 of file paint_vertex.c.

References Freestyle::a, angle(), cosf, float(), M_PI_2, and RAD2DEGF.

Referenced by vpaint_stroke_test_start(), and wpaint_stroke_test_start().

◆ vpaint_blend()

static uint vpaint_blend ( const VPaint vp,
uint  color_curr,
uint  color_orig,
uint  color_paint,
const int  alpha_i,
const int  brush_alpha_value_i 
)
static

◆ vpaint_cancel()

static void vpaint_cancel ( bContext C,
wmOperator op 
)
static

◆ vpaint_do_paint()

static void vpaint_do_paint ( bContext C,
Sculpt sd,
VPaint vp,
struct VPaintData vpd,
Object ob,
Mesh me,
Brush brush,
const char  symm,
const int  axis,
const int  i,
const float  angle 
)
static

◆ vpaint_do_radial_symmetry()

static void vpaint_do_radial_symmetry ( bContext C,
Sculpt sd,
VPaint vp,
struct VPaintData vpd,
Object ob,
Mesh me,
Brush brush,
const char  symm,
const int  axis 
)
static

Definition at line 3313 of file paint_vertex.c.

References angle(), C, M_PI, VPaint::radial_symm, and vpaint_do_paint().

Referenced by vpaint_do_symmetrical_brush_actions().

◆ vpaint_do_symmetrical_brush_actions()

static void vpaint_do_symmetrical_brush_actions ( bContext C,
Sculpt sd,
VPaint vp,
struct VPaintData vpd,
Object ob 
)
static

◆ vpaint_exec()

static int vpaint_exec ( bContext C,
wmOperator op 
)
static

◆ vpaint_get_current_col()

uint vpaint_get_current_col ( Scene scene,
VPaint vp,
bool  secondary 
)

◆ vpaint_invoke()

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

◆ vpaint_mode_toggle_exec()

static int vpaint_mode_toggle_exec ( bContext C,
wmOperator op 
)
static

◆ vpaint_paint_leaves()

static void vpaint_paint_leaves ( bContext C,
Sculpt sd,
VPaint vp,
struct VPaintData vpd,
Object ob,
Mesh me,
PBVHNode **  nodes,
int  totnode 
)
static

◆ vpaint_stroke_done()

static void vpaint_stroke_done ( const bContext C,
struct PaintStroke stroke 
)
static

◆ vpaint_stroke_test_start()

static bool vpaint_stroke_test_start ( bContext C,
struct wmOperator op,
const float  mouse[2] 
)
static

◆ vpaint_stroke_update_step()

static void vpaint_stroke_update_step ( bContext C,
struct PaintStroke stroke,
PointerRNA itemptr 
)
static

◆ vwpaint_pbvh_gather_generic()

static PBVHNode** vwpaint_pbvh_gather_generic ( Object ob,
VPaint wp,
Sculpt sd,
Brush brush,
int *  r_totnode 
)
static

◆ vwpaint_update_cache_invariants()

static void vwpaint_update_cache_invariants ( bContext C,
const VPaint vp,
SculptSession ss,
wmOperator op,
const float  mouse[2] 
)
static

◆ vwpaint_update_cache_variants()

static void vwpaint_update_cache_variants ( bContext C,
VPaint vp,
Object ob,
PointerRNA ptr 
)
static

◆ vwpaint_use_normal()

static bool vwpaint_use_normal ( const VPaint vp)
static

◆ weight_paint_mode_poll()

bool weight_paint_mode_poll ( bContext C)

◆ weight_paint_poll()

bool weight_paint_poll ( bContext C)

Definition at line 263 of file paint_vertex.c.

References C, and weight_paint_poll_ex().

Referenced by ed_vwpaintmode_enter_generic(), and PAINT_OT_weight_paint().

◆ weight_paint_poll_ex()

static bool weight_paint_poll_ex ( bContext C,
bool  check_tool 
)
static

◆ weight_paint_poll_ignore_tool()

bool weight_paint_poll_ignore_tool ( bContext C)

Definition at line 268 of file paint_vertex.c.

References C, and weight_paint_poll_ex().

Referenced by PAINT_OT_weight_gradient().

◆ wpaint_blend()

static float wpaint_blend ( const VPaint wp,
float  weight,
const float  alpha,
float  paintval,
const float   UNUSEDbrush_alpha_value,
const short  do_flip 
)
static

◆ wpaint_cancel()

static void wpaint_cancel ( bContext C,
wmOperator op 
)
static

◆ wpaint_clamp_monotonic()

static float wpaint_clamp_monotonic ( float  oldval,
float  curval,
float  newval 
)
static

Definition at line 401 of file paint_vertex.c.

References MAX2, and MIN2.

Referenced by do_weight_paint_vertex_multi(), and do_weight_paint_vertex_single().

◆ wpaint_do_paint()

static void wpaint_do_paint ( bContext C,
Object ob,
VPaint wp,
Sculpt sd,
struct WPaintData wpd,
WeightPaintInfo wpi,
Mesh me,
Brush brush,
const char  symm,
const int  axis,
const int  i,
const float  angle 
)
static

◆ wpaint_do_radial_symmetry()

static void wpaint_do_radial_symmetry ( bContext C,
Object ob,
VPaint wp,
Sculpt sd,
struct WPaintData wpd,
WeightPaintInfo wpi,
Mesh me,
Brush brush,
const char  symm,
const int  axis 
)
static

Definition at line 2287 of file paint_vertex.c.

References angle(), C, M_PI, VPaint::radial_symm, and wpaint_do_paint().

Referenced by wpaint_do_symmetrical_brush_actions().

◆ wpaint_do_symmetrical_brush_actions()

static void wpaint_do_symmetrical_brush_actions ( bContext C,
Object ob,
VPaint wp,
Sculpt sd,
struct WPaintData wpd,
WeightPaintInfo wpi 
)
static

◆ wpaint_exec()

static int wpaint_exec ( bContext C,
wmOperator op 
)
static

◆ wpaint_get_active_weight()

static float wpaint_get_active_weight ( const MDeformVert dv,
const WeightPaintInfo wpi 
)
static

◆ wpaint_invoke()

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

◆ wpaint_mode_toggle_exec()

static int wpaint_mode_toggle_exec ( bContext C,
wmOperator op 
)
static

◆ wpaint_paint_leaves()

static void wpaint_paint_leaves ( bContext C,
Object ob,
Sculpt sd,
VPaint vp,
struct WPaintData wpd,
WeightPaintInfo wpi,
Mesh me,
PBVHNode **  nodes,
int  totnode 
)
static

◆ wpaint_stroke_done()

static void wpaint_stroke_done ( const bContext C,
struct PaintStroke stroke 
)
static

◆ wpaint_stroke_test_start()

static bool wpaint_stroke_test_start ( bContext C,
wmOperator op,
const float  mouse[2] 
)
static

Definition at line 1587 of file paint_vertex.c.

References WPaintVGroupIndex::active, ToolSettings::auto_normalize, BKE_mesh_from_object(), BKE_object_defgroup_check_lock_relative(), BKE_object_defgroup_check_lock_relative_multi(), BKE_object_defgroup_lock_flags_get(), BKE_object_defgroup_mirror_selection(), BKE_object_defgroup_selected_get(), BKE_object_defgroup_split_locked_validmap(), BKE_object_defgroup_validmap_get(), BKE_report(), BLI_array_binary_or, BLI_findlink(), BLI_listbase_count(), Paint::brush, BRUSH_FRONTFACE_FALLOFF, C, CTX_data_active_object(), CTX_data_ensure_evaluated_depsgraph(), CTX_data_scene(), CTX_data_tool_settings(), wmOperator::customdata, Object::defbase, WPaintData::defbase_sel, WPaintData::defbase_tot, WPaintData::defbase_tot_sel, depsgraph, DG_LOCK_WEIGHT, WPaintData::do_lock_relative, WPaintData::do_multipaint, ED_view3d_viewcontext_init(), ED_wpaint_ensure_data(), ELEM, Brush::falloff_angle, Brush::flag, MDeformVert::flag, bDeformGroup::flag, WeightPaintGroupData::index, WeightPaintGroupData::lock, WPaintData::lock_flags, ME_USING_MIRROR_X_VERTEX_GROUPS, MEM_callocN, MEM_dupallocN, MEM_freeN, MEM_mallocN, WPaintVGroupIndex::mirror, WPaintData::mirror, SculptSession::mode, ToolSettings::multipaint, WPaintData::normal_angle_precalc, NULL, VPaint::paint, paint_stroke_set_mode_data(), WPaintData::precomputed_weight, wmOperator::reports, RPT_WARNING, scene, Object::sculpt, Scene::toolsettings, Mesh::totvert, WPaintData::vc, vertex_paint_init_session_data(), vertex_paint_init_stroke(), WPaintData::vgroup_locked, WPaintData::vgroup_unlocked, WPaintData::vgroup_validmap, view_angle_limits_init(), vwpaint_update_cache_invariants(), Brush::weightpaint_tool, SculptSession::wpaint, ToolSettings::wpaint, WPAINT_ENSURE_MIRROR, ToolSettings::wpaint_lock_relative, WPAINT_TOOL_BLUR, and WPAINT_TOOL_SMEAR.

Referenced by wpaint_exec(), and wpaint_invoke().

◆ wpaint_stroke_update_step()

static void wpaint_stroke_update_step ( bContext C,
struct PaintStroke stroke,
PointerRNA itemptr 
)
static

Definition at line 2358 of file paint_vertex.c.

References ToolSettings::auto_normalize, BKE_brush_alpha_get(), BKE_mesh_batch_cache_dirty_tag(), BKE_MESH_BATCH_DIRTY_ALL, BKE_paint_brush(), BLI_rcti_is_empty(), BLI_rcti_union(), WeightPaintInfo::brush_alpha_value, C, SculptSession::cache, CTX_data_active_object(), CTX_data_scene(), CTX_data_tool_settings(), CTX_wm_region(), CTX_wm_region_view3d(), StrokeCache::current_r, Object::data, WeightPaintInfo::defbase_sel, WPaintData::defbase_sel, WeightPaintInfo::defbase_tot, WPaintData::defbase_tot, WeightPaintInfo::defbase_tot_sel, WPaintData::defbase_tot_sel, WeightPaintInfo::defbase_tot_unsel, DEG_id_tag_update(), WeightPaintInfo::do_auto_normalize, WeightPaintInfo::do_flip, WeightPaintInfo::do_lock_relative, WPaintData::do_lock_relative, WeightPaintInfo::do_multipaint, WPaintData::do_multipaint, ED_region_tag_redraw(), ED_region_tag_redraw_partial(), ED_view3d_init_mats_rv3d(), WeightPaintInfo::is_normalized, WeightPaintInfo::lock_flags, WPaintData::lock_flags, WeightPaintInfo::mirror, WPaintData::mirror, mul_m4_m4m4(), mul_v3_m4v3(), NC_OBJECT, ND_DRAW, NULL, ViewContext::obact, Object::obmat, VPaint::paint, paint_last_stroke_update(), paint_stroke_mode_data(), RegionView3D::persmat, precompute_weight_values(), WPaintData::precomputed_weight, StrokeCache::previous_r, r, ViewContext::region, RNA_boolean_get(), ViewContext::rv3d, scene, Object::sculpt, ToolSettings::sculpt, SCULPT_get_redraw_rect(), swap_m4m4(), StrokeCache::true_location, WPaintData::vc, WeightPaintInfo::vgroup_locked, WPaintData::vgroup_locked, WeightPaintInfo::vgroup_unlocked, WPaintData::vgroup_unlocked, WeightPaintInfo::vgroup_validmap, WPaintData::vgroup_validmap, view3d_operator_needs_opengl(), vwpaint_update_cache_variants(), ARegion::winrct, WM_event_add_notifier(), ToolSettings::wpaint, wpaint_do_symmetrical_brush_actions(), rcti::xmin, and rcti::ymin.

Referenced by wpaint_exec(), and wpaint_invoke().

◆ wpaint_undo_lock_relative()

static float wpaint_undo_lock_relative ( float  weight,
float  old_weight,
float  locked_weight,
float  free_weight,
bool  auto_normalize 
)
static