Blender  V3.3
Classes
paint_vertex.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_array_utils.h"
#include "BLI_color.hh"
#include "BLI_color_mix.hh"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BLI_task.hh"
#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 "RNA_prototypes.h"
#include "BKE_attribute.h"
#include "BKE_brush.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_deform.h"
#include "BKE_editmesh.h"
#include "BKE_layer.h"
#include "BKE_lib_id.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_image.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< BlendType >
 
struct  WPaintAverageAccum
 
struct  NormalAnglePrecalc
 
struct  WeightPaintGroupData
 
struct  WeightPaintInfo
 
struct  WPaintData
 
struct  VPaintDataBase
 
struct  VPaintData< Color, Traits, domain >
 

Functions

Internal Utilities
static uint color2uint (ColorPaint4b c)
 
static bool isZero (ColorPaint4f c)
 
static bool isZero (ColorPaint4b c)
 
template<typename Color = ColorPaint4f>
static ColorPaint4f toFloat (const Color &c)
 
template<typename Color = ColorPaint4f>
static Color fromFloat (const ColorPaint4f &c)
 
static int get_vcol_elements (Mesh *me, size_t *r_elem_size)
 
static void view_angle_limits_init (NormalAnglePrecalc *a, float angle, bool do_mask_normal)
 
static float view_angle_limits_apply_falloff (const 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 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)
 
template<typename Color , typename Traits , eAttrDomain domain>
static Color vpaint_get_current_col (Scene *scene, VPaint *vp, bool secondary)
 
uint vpaint_get_current_color (Scene *scene, VPaint *vp, bool secondary)
 
template<typename Color , typename Traits >
static Color vpaint_blend (const VPaint *vp, Color color_curr, Color color_orig, Color color_paint, const typename Traits::ValueType alpha, const typename Traits::BlendType brush_alpha_value)
 
static float wpaint_blend (const VPaint *wp, float weight, const float alpha, float paintval, const float UNUSED(brush_alpha_value), const bool do_flip)
 
static void paint_and_tex_color_alpha_intern (VPaint *vp, const ViewContext *vc, const float co[3], float r_rgba[4])
 
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 vwpaint_init_stroke (Depsgraph *depsgraph, Object *ob)
 
static void vertex_paint_init_stroke (Scene *scene, Depsgraph *depsgraph, Object *ob)
 
static void vertex_paint_init_session_data (const ToolSettings *ts, Object *ob)
 
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 (bContext *C, Depsgraph *depsgraph)
 
void ED_object_wpaintmode_enter_ex (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void ED_object_wpaintmode_enter (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 (bContext *C)
 
void ED_object_wpaintmode_exit_ex (Object *ob)
 
void ED_object_wpaintmode_exit (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 smooth_brush_toggle_on (const bContext *C, Paint *paint, StrokeCache *cache)
 
static void smooth_brush_toggle_off (const bContext *C, Paint *paint, StrokeCache *cache)
 
static void vwpaint_update_cache_invariants (bContext *C, VPaint *vp, SculptSession *ss, wmOperator *op, const float mval[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 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, 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, 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, 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, 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, WPaintData *wpd, WeightPaintInfo *wpi)
 
static void wpaint_stroke_update_step (bContext *C, wmOperator *UNUSED(op), PaintStroke *stroke, PointerRNA *itemptr)
 
static void wpaint_stroke_done (const bContext *C, 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)
 
static int wpaint_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
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
template<typename Color , typename Traits , eAttrDomain domain>
static voidvpaint_init_vpaint (bContext *C, wmOperator *op, Scene *scene, Depsgraph *depsgraph, VPaint *vp, Object *ob, Mesh *me, const Brush *brush)
 
static bool vpaint_stroke_test_start (bContext *C, wmOperator *op, const float mouse[2])
 
template<class Color = ColorPaint4b, typename Traits = ByteTraits>
static void do_vpaint_brush_blur_loops (bContext *C, Sculpt *UNUSED(sd), VPaint *vp, VPaintData< Color, Traits, ATTR_DOMAIN_CORNER > *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode, Color *lcol)
 
template<class Color = ColorPaint4b, typename Traits = ByteTraits>
static void do_vpaint_brush_blur_verts (bContext *C, Sculpt *UNUSED(sd), VPaint *vp, VPaintData< Color, Traits, ATTR_DOMAIN_POINT > *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode, Color *lcol)
 
template<typename Color = ColorPaint4b, typename Traits , eAttrDomain domain>
static void do_vpaint_brush_smear (bContext *C, Sculpt *UNUSED(sd), VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode, Color *lcol)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void calculate_average_color (VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, const Brush *brush, Color *lcol, PBVHNode **nodes, int totnode)
 
template<typename Color , typename Traits , eAttrDomain domain>
static float paint_and_tex_color_alpha (VPaint *vp, VPaintData< Color, Traits, domain > *vpd, const float v_co[3], Color *r_color)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_draw (bContext *C, Sculpt *UNUSED(sd), VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode, Color *lcol)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_blur (bContext *C, Sculpt *sd, VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, PBVHNode **nodes, int totnode, Color *lcol)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_paint_leaves (bContext *C, Sculpt *sd, VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, Color *lcol, PBVHNode **nodes, int totnode)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_paint (bContext *C, Sculpt *sd, VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, Brush *brush, const char symm, const int axis, const int i, const float angle)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_radial_symmetry (bContext *C, Sculpt *sd, VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob, Mesh *me, Brush *brush, const char symm, const int axis)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_symmetrical_brush_actions (bContext *C, Sculpt *sd, VPaint *vp, VPaintData< Color, Traits, domain > *vpd, Object *ob)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_stroke_update_step_intern (bContext *C, PaintStroke *stroke, PointerRNA *itemptr)
 
static void vpaint_stroke_update_step (bContext *C, wmOperator *UNUSED(op), PaintStroke *stroke, PointerRNA *itemptr)
 
template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_free_vpaintdata (Object *UNUSED(ob), void *_vpd)
 
static void vpaint_stroke_done (const bContext *C, 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)
 
static int vpaint_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
void PAINT_OT_vertex_paint (wmOperatorType *ot)
 
Set Vertex Colors Operator
template<typename Color , typename Traits , eAttrDomain domain>
static bool vertex_color_set (Object *ob, ColorPaint4f paintcol_in, CustomDataLayer *layer)
 
static bool paint_object_attributes_active_color_fill_ex (Object *ob, ColorPaint4f fill_color, bool only_selected=true)
 
bool BKE_object_attributes_active_color_fill (Object *ob, const float fill_color[4], bool only_selected)
 
static int vertex_color_set_exec (bContext *C, wmOperator *UNUSED(op))
 
void PAINT_OT_vertex_color_set (wmOperatorType *ot)
 

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.cc.

Function Documentation

◆ BKE_object_attributes_active_color_fill()

bool BKE_object_attributes_active_color_fill ( struct Object ob,
const float  fill_color[4],
bool  only_selected 
)

Fills the object's active color attribute layer with the fill color.

Parameters
[in]obThe object.
[in]fill_colorThe fill color.
[in]only_selectedLimit the fill to selected faces or vertices.
Returns
#true if successful.

Definition at line 4167 of file paint_vertex.cc.

References paint_object_attributes_active_color_fill_ex().

Referenced by blender::ed::geometry::geometry_color_attribute_add_exec(), and proj_paint_color_attribute_create().

◆ 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()

template<typename Color , typename Traits , eAttrDomain domain>
static void calculate_average_color ( VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
const Brush brush,
Color lcol,
PBVHNode **  nodes,
int  totnode 
)
static

◆ calculate_average_weight()

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

◆ color2uint()

static uint color2uint ( ColorPaint4b  c)
static

Definition at line 83 of file paint_vertex.cc.

References Freestyle::c.

Referenced by vpaint_get_current_color().

◆ defweight_prev_init()

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

◆ do_vpaint_brush_blur_loops()

template<class Color = ColorPaint4b, typename Traits = ByteTraits>
static void do_vpaint_brush_blur_loops ( bContext C,
Sculpt UNUSEDsd,
VPaint vp,
VPaintData< Color, Traits, ATTR_DOMAIN_CORNER > *  vpd,
Object ob,
Mesh me,
PBVHNode **  nodes,
int  totnode,
Color lcol 
)
static

◆ do_vpaint_brush_blur_verts()

template<class Color = ColorPaint4b, typename Traits = ByteTraits>
static void do_vpaint_brush_blur_verts ( bContext C,
Sculpt UNUSEDsd,
VPaint vp,
VPaintData< Color, Traits, ATTR_DOMAIN_POINT > *  vpd,
Object ob,
Mesh me,
PBVHNode **  nodes,
int  totnode,
Color lcol 
)
static

◆ do_vpaint_brush_smear()

template<typename Color = ColorPaint4b, typename Traits , eAttrDomain domain>
static void do_vpaint_brush_smear ( bContext C,
Sculpt UNUSEDsd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
PBVHNode **  nodes,
int  totnode,
Color lcol 
)
static

Definition at line 3223 of file paint_vertex.cc.

References ATTR_DOMAIN_POINT, BKE_brush_curve_strength(), BKE_pbvh_type(), BKE_pbvh_vertex_iter_begin, BKE_pbvh_vertex_iter_end, BLI_assert, StrokeCache::brush, BRUSH_FRONTFACE, BRUSH_FRONTFACE_FALLOFF, brush_strength(), StrokeCache::bstrength, C, SculptSession::cache, PBVHVertexIter::co, MVert::co, Color, VPaintData< Color, Traits, domain >::color_curr, VPaintData< Color, Traits, domain >::color_prev, MeshElemMap::count, CTX_data_scene(), SculptBrushTest::dist, dot_v3v3(), Mesh::editflag, Brush::falloff_shape, Brush::flag, MVert::flag, MPoly::flag, PBVHVertexIter::g, get_brush_alpha_data(), PBVHVertexIter::grid_indices, PBVHVertexIter::gridsize, PBVHVertexIter::i, MeshElemMap::indices, StrokeCache::is_last_valid, isZero(), StrokeCache::last_location, StrokeCache::location, MPoly::loopstart, ME_EDIT_PAINT_FACE_SEL, ME_EDIT_PAINT_VERT_SEL, ME_FACE_SEL, Mesh::mloop, SculptSession::mode, Mesh::mpoly, Mesh::mvert, PBVHVertexIter::no, VPaintData< Color, Traits, domain >::normal_angle_precalc, normalize_v3(), blender::threading::parallel_for(), SculptSession::pbvh, PBVH_GRIDS, PBVH_ITER_UNIQUE, StrokeCache::prev_colors_vpaint, project_plane_v3_v3v3(), StrokeCache::radius, scene, Object::sculpt, SCULPT_brush_frontface_normal_from_falloff_shape(), SCULPT_brush_test_init_with_falloff_shape(), SELECT, VPaintData< Color, Traits, domain >::smear, sqrtf, sub_v3_v3v3(), MPoly::totloop, UNUSED_VARS_NDEBUG, MLoop::v, PBVHVertexIter::vert_indices, SculptVertexPaintGeomMap::vert_to_loop, SculptVertexPaintGeomMap::vert_to_poly, view_angle_limits_apply_falloff(), StrokeCache::view_normal, SculptSession::vpaint, and vwpaint_use_normal().

◆ 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 634 of file paint_vertex.cc.

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 1898 of file paint_vertex.cc.

References data, and wpaint_get_active_weight().

Referenced by precompute_weight_values().

◆ ED_object_vpaintmode_enter()

void ED_object_vpaintmode_enter ( 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 ( bContext C)

Definition at line 1426 of file paint_vertex.cc.

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 ( 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 ( bContext C)

Definition at line 1436 of file paint_vertex.cc.

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

◆ fromFloat()

template<typename Color = ColorPaint4f>
static Color fromFloat ( const ColorPaint4f c)
static

Definition at line 108 of file paint_vertex.cc.

References Freestyle::c, and Color.

◆ 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

◆ get_vcol_elements()

static int get_vcol_elements ( Mesh me,
size_t *  r_elem_size 
)
static

◆ isZero() [1/2]

static bool isZero ( ColorPaint4b  c)
static

Definition at line 93 of file paint_vertex.cc.

References Freestyle::c.

◆ isZero() [2/2]

static bool isZero ( ColorPaint4f  c)
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_and_tex_color_alpha()

template<typename Color , typename Traits , eAttrDomain domain>
static float paint_and_tex_color_alpha ( VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
const float  v_co[3],
Color r_color 
)
static

◆ paint_and_tex_color_alpha_intern()

static void paint_and_tex_color_alpha_intern ( VPaint vp,
const ViewContext vc,
const float  co[3],
float  r_rgba[4] 
)
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_object_attributes_active_color_fill_ex()

static bool paint_object_attributes_active_color_fill_ex ( Object ob,
ColorPaint4f  fill_color,
bool  only_selected = true 
)
static

◆ PAINT_OT_vertex_color_set()

void PAINT_OT_vertex_color_set ( wmOperatorType ot)

◆ 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,
WPaintData wpd,
WeightPaintInfo wpi,
Mesh me 
)
static

◆ smooth_brush_toggle_off()

static void smooth_brush_toggle_off ( const bContext C,
Paint paint,
StrokeCache cache 
)
static

◆ smooth_brush_toggle_on()

static void smooth_brush_toggle_on ( const bContext C,
Paint paint,
StrokeCache cache 
)
static

◆ toFloat()

template<typename Color = ColorPaint4f>
static ColorPaint4f toFloat ( const Color c)
static

Definition at line 98 of file paint_vertex.cc.

References Freestyle::c.

Referenced by paint_and_tex_color_alpha().

◆ vertex_color_set()

template<typename Color , typename Traits , eAttrDomain domain>
static bool vertex_color_set ( Object ob,
ColorPaint4f  paintcol_in,
CustomDataLayer layer 
)
static

◆ vertex_color_set_exec()

static int vertex_color_set_exec ( bContext C,
wmOperator UNUSEDop 
)
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 ( Scene scene,
Depsgraph depsgraph,
Object ob 
)
static

◆ vertex_paint_mode_poll()

bool vertex_paint_mode_poll ( struct bContext C)

◆ vertex_paint_poll()

bool vertex_paint_poll ( bContext C)

Definition at line 269 of file paint_vertex.cc.

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 274 of file paint_vertex.cc.

References C, and vertex_paint_poll_ex().

Referenced by sample_color_poll().

◆ view_angle_limits_apply_falloff()

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

◆ view_angle_limits_init()

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

Definition at line 161 of file paint_vertex.cc.

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

Referenced by vpaint_init_vpaint(), and wpaint_stroke_test_start().

◆ vpaint_blend()

template<typename Color , typename Traits >
static Color vpaint_blend ( const VPaint vp,
Color  color_curr,
Color  color_orig,
Color  color_paint,
const typename Traits::ValueType  alpha,
const typename Traits::BlendType  brush_alpha_value 
)
static

◆ vpaint_cancel()

static void vpaint_cancel ( bContext C,
wmOperator op 
)
static

◆ vpaint_do_blur()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_blur ( bContext C,
Sculpt sd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
PBVHNode **  nodes,
int  totnode,
Color lcol 
)
static

Definition at line 3650 of file paint_vertex.cc.

References ATTR_DOMAIN_POINT, and C.

◆ vpaint_do_draw()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_draw ( bContext C,
Sculpt UNUSEDsd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
PBVHNode **  nodes,
int  totnode,
Color lcol 
)
static

◆ vpaint_do_paint()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_paint ( bContext C,
Sculpt sd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
Brush brush,
const char  symm,
const int  axis,
const int  i,
const float  angle 
)
static

◆ vpaint_do_radial_symmetry()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_radial_symmetry ( bContext C,
Sculpt sd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
Brush brush,
const char  symm,
const int  axis 
)
static

Definition at line 3737 of file paint_vertex.cc.

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

◆ vpaint_do_symmetrical_brush_actions()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_do_symmetrical_brush_actions ( bContext C,
Sculpt sd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob 
)
static

◆ vpaint_exec()

static int vpaint_exec ( bContext C,
wmOperator op 
)
static

◆ vpaint_free_vpaintdata()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_free_vpaintdata ( Object UNUSEDob,
void _vpd 
)
static

◆ vpaint_get_current_col()

template<typename Color , typename Traits , eAttrDomain domain>
static Color vpaint_get_current_col ( Scene scene,
VPaint vp,
bool  secondary 
)
static

◆ vpaint_get_current_color()

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

Definition at line 328 of file paint_vertex.cc.

References col, color2uint(), and scene.

◆ vpaint_init_vpaint()

template<typename Color , typename Traits , eAttrDomain domain>
static void* vpaint_init_vpaint ( bContext C,
wmOperator op,
Scene scene,
Depsgraph depsgraph,
VPaint vp,
Object ob,
Mesh me,
const Brush brush 
)
static

◆ vpaint_invoke()

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

◆ vpaint_modal()

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

Definition at line 4005 of file paint_vertex.cc.

References C, wmOperator::customdata, and paint_stroke_modal().

Referenced by PAINT_OT_vertex_paint().

◆ vpaint_mode_toggle_exec()

static int vpaint_mode_toggle_exec ( bContext C,
wmOperator op 
)
static

◆ vpaint_paint_leaves()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_paint_leaves ( bContext C,
Sculpt sd,
VPaint vp,
VPaintData< Color, Traits, domain > *  vpd,
Object ob,
Mesh me,
Color lcol,
PBVHNode **  nodes,
int  totnode 
)
static

◆ vpaint_stroke_done()

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

◆ vpaint_stroke_test_start()

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

◆ vpaint_stroke_update_step()

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

◆ vpaint_stroke_update_step_intern()

template<typename Color , typename Traits , eAttrDomain domain>
static void vpaint_stroke_update_step_intern ( bContext C,
PaintStroke stroke,
PointerRNA itemptr 
)
static

◆ vwpaint_init_stroke()

static void vwpaint_init_stroke ( Depsgraph depsgraph,
Object ob 
)
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,
VPaint vp,
SculptSession ss,
wmOperator op,
const float  mval[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 304 of file paint_vertex.cc.

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 309 of file paint_vertex.cc.

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 bool  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 461 of file paint_vertex.cc.

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,
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,
WPaintData wpd,
WeightPaintInfo wpi,
Mesh me,
Brush brush,
const char  symm,
const int  axis 
)
static

Definition at line 2400 of file paint_vertex.cc.

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,
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_modal()

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

Definition at line 2678 of file paint_vertex.cc.

References C, wmOperator::customdata, and paint_stroke_modal().

Referenced by PAINT_OT_weight_paint().

◆ 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,
WPaintData wpd,
WeightPaintInfo wpi,
Mesh me,
PBVHNode **  nodes,
int  totnode 
)
static

◆ wpaint_stroke_done()

static void wpaint_stroke_done ( const bContext C,
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 1709 of file paint_vertex.cc.

References WPaintVGroupIndex::active, WPaintData::active, 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, 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, WPaintData::normal_angle_precalc, VPaint::paint, paint_stroke_set_mode_data(), WPaintData::precomputed_weight, wmOperator::reports, RPT_WARNING, scene, Scene::toolsettings, Mesh::totvert, WPaintData::vc, Mesh::vertex_group_names, vertex_paint_init_session_data(), WPaintData::vgroup_locked, WPaintData::vgroup_unlocked, WPaintData::vgroup_validmap, view_angle_limits_init(), vwpaint_init_stroke(), vwpaint_update_cache_invariants(), Brush::weightpaint_tool, ToolSettings::wpaint, WPAINT_ENSURE_MIRROR, 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,
wmOperator UNUSEDop,
PaintStroke stroke,
PointerRNA itemptr 
)
static

Definition at line 2471 of file paint_vertex.cc.

References WeightPaintInfo::active, WPaintData::active, 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(), WeightPaintGroupData::index, StrokeCache::invert, WeightPaintInfo::is_normalized, WeightPaintInfo::lock_flags, WPaintData::lock_flags, WeightPaintInfo::mirror, WPaintData::mirror, mul_m4_m4m4(), mul_v3_m4v3(), NC_OBJECT, ND_DRAW, 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