76using namespace blender::ed::sculpt_paint;
198 if (dv_prev->
flag == 1) {
209 const float paint_factor,
218 paintval = 1.0f - paintval;
239 CLAMP(weight, 0.0f, 1.0f);
242 constexpr float threshold = 0.0001f;
243 return weight < threshold ? 0.0f : weight;
248 if (newval < oldval) {
249 return std::min(newval, curval);
251 if (newval > oldval) {
252 return std::max(newval, curval);
258 float weight,
float old_weight,
float locked_weight,
float free_weight,
bool auto_normalize)
262 if (auto_normalize || free_weight <= 0.0f) {
264 weight *= (1.0f - locked_weight);
272 if (old_weight >= free_weight) {
276 else if (weight < 1.0f) {
277 weight = weight * (free_weight - old_weight) / (1 - weight);
290 const int defbase_tot,
291 const bool *vgroup_validmap)
293 float sum = 0.0f, fac;
297 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
298 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
304 if ((tot == 0) || (sum == 1.0f)) {
311 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
312 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
321 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
322 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
334 const int defbase_tot,
335 const bool *vgroup_validmap,
336 const bool *lock_flags)
338 float sum = 0.0f, fac;
339 float sum_unlock = 0.0f;
340 float lock_weight = 0.0f;
344 if (lock_flags ==
nullptr) {
349 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
350 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
353 if (lock_flags[dw->
def_nr]) {
354 lock_weight += dw->
weight;
374 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
375 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
376 if (lock_flags[dw->
def_nr] ==
false) {
382 return (lock_weight == 1.0f);
384 if (sum_unlock != 0.0f) {
385 fac = (1.0f - lock_weight) / sum_unlock;
387 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
388 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
389 if (lock_flags[dw->
def_nr] ==
false) {
399 fac = (1.0f - lock_weight) / tot;
401 CLAMP(fac, 0.0f, 1.0f);
403 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
404 if (dw->
def_nr < defbase_tot && vgroup_validmap[dw->
def_nr]) {
405 if (lock_flags[dw->
def_nr] ==
false) {
420 const int defbase_tot,
421 const bool *vgroup_validmap,
422 const bool *lock_flags,
423 const bool *lock_with_active)
428 dvert, defbase_tot, vgroup_validmap, lock_with_active);
445static bool has_unselected_unlocked_bone_group(
int defbase_tot,
448 const bool *lock_flags,
449 const bool *vgroup_validmap)
452 if (defbase_tot == selected) {
455 for (i = 0; i < defbase_tot; i++) {
456 if (vgroup_validmap[i] && !defbase_sel[i] && !lock_flags[i]) {
464 const int defbase_tot,
465 const bool *defbase_sel,
471 float change = *change_p;
474 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
475 if (dw->
def_nr < defbase_tot && defbase_sel[dw->
def_nr]) {
477 val = dw->
weight * change;
479 change = 1.0f / dw->
weight;
489 const int defbase_tot,
491 const bool *defbase_sel)
500 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
501 if (dw->
def_nr < defbase_tot && defbase_sel[dw->
def_nr]) {
503 val = dw->
weight * change;
517 const int defbase_tot,
519 const bool *defbase_sel)
524 for (i = dvert->
totweight, dw = dvert->
dw; i != 0; i--, dw++) {
525 if (dw->
def_nr < defbase_tot && defbase_sel[dw->
def_nr]) {
541 float automasking_factor)
548 float weight_prev, weight_cur;
549 float dw_rel_locked = 0.0f, dw_rel_free = 1.0f;
565 index_mirr = vgroup_mirr = -1;
569 index_mirr = vgroup_mirr = -1;
579 CLAMP(dw_rel_locked, 0.0f, 1.0f);
585 restrict_to_existing =
true;
590 if (restrict_to_existing) {
601 if (index_mirr != -1) {
602 dv_mirr = &wpi.
dvert[index_mirr];
606 if (dw_mirr ==
nullptr) {
607 index_mirr = vgroup_mirr = -1;
612 if (
index != index_mirr) {
618 int dw_offset = int(dw - dv_mirr->
dw);
622 if (totweight_prev != dv_mirr->
totweight) {
623 dw = &dv_mirr->
dw[dw_offset];
643 if (index_mirr != -1) {
655 weight_prev = weight_cur;
663 wp, weight_prev, alpha, paintweight, automasking_factor, wpi.
do_flip);
669 if (index_mirr ==
index) {
683 CLAMP(weight, 0.0f, 1.0f);
691 if (index_mirr != -1) {
711 if (index_mirr != -1) {
714 if (
index != index_mirr) {
748 float additional_factor)
757 float curw, curw_real, oldw, neww, change, curw_mirr, change_mirr;
758 float dw_rel_free, dw_rel_locked;
765 dv_mirr = &wpi.
dvert[index_mirr];
785 CLAMP(dw_rel_locked, 0.0f, 1.0f);
793 if (index_mirr != -1) {
817 change = neww / curw_real;
822 if (dv_mirr !=
nullptr) {
826 if (curw_mirr == 0.0f) {
832 float orig = change_mirr = curw_real * change / curw_mirr;
840 change *= change_mirr / orig;
851 if (dv_mirr !=
nullptr) {
859 if (dv_mirr !=
nullptr) {
878 float automasking_factor = 1.0f)
882 wp, ob, wpd, wpi,
index, final_alpha, paintweight, automasking_factor);
886 wp, ob, wpd, wpi,
index, final_alpha, paintweight, automasking_factor);
907 void redraw(
bool final)
override;
910 void done(
bool is_cancel,
bool stroke_started)
override;
931 initial_value.
flag = 1;
943 int defbase_tot, defbase_tot_sel;
964 if (vgroup_index.
mirror != -1) {
975 defbase_tot =
mesh.vertex_group_names.count();
984 &ob, defbase_tot, defbase_sel, defbase_sel, &defbase_tot_sel);
987 for (i = 0; i < defbase_tot; i++) {
988 if (defbase_sel[i]) {
992 MEM_delete(defbase_sel);
999 std::unique_ptr<WPaintData> wpd = std::make_unique<WPaintData>();
1004 wpd->active.index = vgroup_index.
active;
1005 wpd->mirror.index = vgroup_index.
mirror;
1008 wpd->defbase_tot = defbase_tot;
1009 wpd->defbase_sel = defbase_sel;
1010 wpd->defbase_tot_sel = defbase_tot_sel > 1 ? defbase_tot_sel : 1;
1011 wpd->do_multipaint = (ts.
multipaint && defbase_tot_sel > 1);
1024 wpd->lock_flags, wpd->vgroup_validmap, wpd->active.index) &&
1026 defbase_tot, wpd->lock_flags, defbase_sel, defbase_tot_sel)))
1028 wpd->do_lock_relative =
true;
1031 if (wpd->do_lock_relative || (ts.
auto_normalize && wpd->lock_flags && !wpd->do_multipaint)) {
1032 bool *unlocked = MEM_dupalloc(wpd->vgroup_validmap);
1034 if (wpd->lock_flags) {
1037 wpd->defbase_tot, wpd->lock_flags, wpd->vgroup_validmap, locked, unlocked);
1038 wpd->vgroup_locked = locked;
1041 wpd->vgroup_unlocked = unlocked;
1047 if (wpd->lock_flags) {
1051 memcpy(tmpflags, wpd->defbase_sel,
sizeof(*tmpflags) * wpd->defbase_tot);
1053 wpd->active.lock = tmpflags;
1058 tmpflags = wpd->lock_flags ? MEM_dupalloc(wpd->lock_flags) :
1060 tmpflags[wpd->active.index] =
true;
1061 wpd->active.lock = tmpflags;
1063 tmpflags = wpd->lock_flags ? MEM_dupalloc(wpd->lock_flags) :
1065 tmpflags[(wpd->mirror.index != -1) ? wpd->mirror.index : wpd->active.index] =
true;
1066 wpd->mirror.lock = tmpflags;
1107 CLAMP(weight, 0.0f, 1.0f);
1119 for (const int i : range) {
1120 const MDeformVert &dv = wpi.dvert[i];
1121 wpd.precomputed_weight[i] = wpaint_get_active_weight(dv, wpi);
1125 wpd.precomputed_weight_ready =
true;
1153 if (!select_vert[verts[i]]) {
1173 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1175 ss, vp.
paint,
brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1181 ss,
brush.falloff_shape);
1190 if (use_vert_sel || use_face_sel) {
1200 if (!select_vert.is_empty()) {
1211 depsgraph, ob, cache.automasking.get(),
nodes[i], verts, factors);
1214 const int vert = verts[i];
1215 if (factors[i] == 0.0f) {
1220 int total_hit_loops = 0;
1221 float weight_final = 0.0f;
1222 for (
const int face : vert_to_face[vert]) {
1223 total_hit_loops += faces[face].
size();
1224 for (
const int vert : corner_verts.
slice(faces[face])) {
1229 if (total_hit_loops == 0) {
1233 float brush_strength = cache.bstrength;
1234 const float angle_cos = use_normal ?
1235 dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1241 const float final_alpha = factors[i] * brush_strength * brush_alpha_pressure;
1252 weight_final /= total_hit_loops;
1278 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1280 ss, vp.
paint,
brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1299 if (use_vert_sel || use_face_sel) {
1304 ss,
brush.falloff_shape);
1312 if (!select_vert.is_empty()) {
1326 const int vert = verts[i];
1327 if (factors[i] == 0.0f) {
1332 const float angle_cos = use_normal ?
1333 dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1339 bool do_color =
false;
1342 float stroke_dot_max = 0.0f;
1346 float weight_final = 0.0;
1347 for (
const int face : vert_to_face[vert]) {
1348 for (
const int vert_other : corner_verts.
slice(faces[face])) {
1349 if (vert_other == vert) {
1355 sub_v3_v3v3(other_dir, vert_positions[vert], vert_positions[vert_other]);
1360 const float stroke_dot =
dot_v3v3(other_dir, brush_dir);
1362 if (stroke_dot > stroke_dot_max) {
1363 stroke_dot_max = stroke_dot;
1371 const float final_alpha = factors[i] * brush_strength * brush_alpha_pressure;
1386 const float strength,
1395 const float paintweight = strength;
1396 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1398 ss, vp.
paint,
brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1404 ss,
brush.falloff_shape);
1411 if (use_vert_sel || use_face_sel) {
1421 if (!select_vert.is_empty()) {
1432 if (cache.automasking) {
1434 automask_factors.
fill(1.0f);
1436 depsgraph, ob, *cache.automasking,
nodes[i], verts, automask_factors);
1441 const int vert = verts[i];
1442 if (factors[i] == 0.0f) {
1445 float brush_strength = cache.bstrength;
1446 const float angle_cos = use_normal ?
1447 dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1452 const float final_alpha = factors[i] * brush_strength * brush_alpha_pressure;
1463 const float automask_factor = automask_factors.
is_empty() ? 1.0f : automask_factors[i];
1487 ss,
brush.falloff_shape);
1494 if (use_vert_sel || use_face_sel) {
1503 node_mask.slice(range).foreach_index([&](const int i) {
1504 const Span<int> verts = nodes[i].verts();
1505 Array<float, bke::pbvh::MESH_LEAF_LIMIT> factors(verts.size());
1506 fill_factor_from_hide(hide_vert, verts, factors);
1507 filter_region_clip_factors(ss, vert_positions, verts, factors);
1508 if (!select_vert.is_empty()) {
1509 filter_factors_with_selection(select_vert, verts, factors);
1512 Array<float, bke::pbvh::MESH_LEAF_LIMIT> distances(verts.size());
1513 calc_brush_distances(
1514 ss, vert_positions, verts, eBrushFalloffShape(brush.falloff_shape), distances);
1515 filter_distances_with_radius(cache.radius, distances, factors);
1516 calc_brush_strength_factors(cache, brush, distances, factors);
1518 auto_mask::calc_vert_factors(
1519 depsgraph, ob, cache.automasking.get(), nodes[i], verts, factors);
1521 for (const int i : verts.index_range()) {
1522 const int vert = verts[i];
1523 if (factors[i] == 0.0f) {
1526 const float angle_cos = use_normal ?
1527 dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1529 if (angle_cos <= 0.0f) {
1532 const MDeformVert &dv = wpi.dvert[vert];
1534 accum.value += wpaint_get_active_weight(dv, wpi);
1684 const bool is_mode_set = (ob.
mode & mode_flag) != 0;
1726 ot->
name =
"Weight Paint Mode";
1727 ot->
idname =
"PAINT_OT_weight_paint_toggle";
1728 ot->
description =
"Toggle weight paint mode in 3D view";
1783 if (wpd ==
nullptr) {
1796 wpi.
dvert =
mesh.deform_verts_for_write();
1883 if (!
G.background) {
1916 stroke->
exec(
C, op);
1937 ot->
name =
"Weight Paint";
1938 ot->
idname =
"PAINT_OT_weight_paint";
1939 ot->
description =
"Paint a stroke in the current vertex group's weights";
1951 "override_location",
1953 "Override Location",
1954 "Override the given \"location\" array by recalculating object space positions from the "
1955 "provided \"mouse_event\" positions");
Generic array manipulation API.
#define BLI_array_binary_or(arr, arr_a, arr_b, arr_len)
#define ME_USING_MIRROR_X_VERTEX_GROUPS(_me)
Object is a sort of wrapper for general info.
#define OPERATOR_RETVAL_CHECK(ret)
Read Blender memory allocation and freeing.
Array(Allocator allocator={}) noexcept
void fill(const T &value) const
void reinitialize(const int64_t new_size)
constexpr IndexRange()=default
constexpr int64_t size() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
GAttributeReader lookup(const StringRef name) const
IndexMask slice(IndexRange range) const
IndexRange index_range() const
void foreach_index(Fn &&fn, Mode mode=exec_mode::serial) const
pbvh::Tree * pbvh_get(Object &object)
void stroke_track_location(Paint &paint, float3 location)
Span< float3 > vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
bool vgroup_sync_from_pose(Object *ob)
void posemode_set_for_weight_paint(bContext *C, Main *bmain, Object *ob, bool is_mode_set)
bool mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
Cache & stroke_cache_ensure(const Depsgraph &depsgraph, const Paint &paint, const Brush *brush, Object &ob)
bool is_enabled(const Paint &paint, const Object &object, const Brush *br)
void calc_vert_factors(const Depsgraph &depsgraph, const Object &object, const Cache &automasking, const bke::pbvh::MeshNode &node, Span< int > verts, MutableSpan< float > factors)
void update_cache_variants(Depsgraph &depsgraph, ViewContext &vc, VPaint &vp, const PaintMode paint_mode, Object &ob, Base &base, const PaintStroke::StrokeStep &stroke_step)
bool use_normal(const VPaint &vp)
void update_cache_invariants(VPaint &vp, SculptSession &ss, wmOperator *op, const float mval[2])
void update_sculpt_normal(const Depsgraph &depsgraph, const Object &ob, const VPaint &vp, const Brush &brush, const IndexMask node_mask)
bool brush_use_accumulate_ex(const Brush &brush, const eObjectMode ob_mode)
void get_brush_alpha_data(const SculptSession &ss, const Paint &paint, const Brush &brush, float *r_brush_size_pressure, float *r_brush_alpha_value, float *r_brush_alpha_pressure)
bool brush_use_accumulate(const VPaint &vp)
bool mode_toggle_poll_test(bContext *C)
void smooth_brush_toggle_off(Paint *paint, StrokeCache *cache)
bool test_brush_angle_falloff(const Brush &brush, const float angle_cos)
void init_stroke(const wmOperator &op, Main &main, Paint &paint, Depsgraph &depsgraph, Object &ob)
void mode_exit_generic(Scene &scene, Object &ob, const eObjectMode mode_flag)
IndexMask gather_brush_nodes(const Object &ob, const Brush &brush, IndexMaskMemory &memory, FunctionRef< bool(const bke::pbvh::Node &)> node_ignore_fn)
void mode_enter_generic(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob, const eObjectMode mode_flag)
void calc_brush_strength_factors(const StrokeCache &cache, const Brush &brush, Span< float > distances, MutableSpan< float > factors)
void filter_distances_with_radius(float radius, Span< float > distances, MutableSpan< float > factors)
void filter_region_clip_factors(const SculptSession &ss, Span< float3 > vert_positions, Span< int > verts, MutableSpan< float > factors)
bool stroke_is_first_brush_step_of_symmetry_pass(const StrokeCache &cache)
void do_symmetrical_brush_actions(const Depsgraph &depsgraph, const Scene &scene, const Paint &paint, Object &object, const BrushActionFn action_fn, PaintModeData *paint_mode_data)
void scale_factors(MutableSpan< float > factors, float strength)
std::optional< float3 > stroke_get_location_bvh(Depsgraph &depsgraph, ViewContext &vc, const Sculpt &sd, const Brush *brush, const float mval[2], const bool force_original)
void calc_brush_distances(const SculptSession &ss, Span< float3 > vert_positions, Span< int > vert, eBrushFalloffShape falloff_shape, MutableSpan< float > r_distances)
const float * brush_frontface_normal_from_falloff_shape(const SculptSession &ss, char falloff_shape)
void fill_factor_from_hide(Span< bool > hide_vert, Span< int > verts, MutableSpan< float > r_factors)
void cache_calc_brushdata_symm(StrokeCache &cache, const ePaintSymmetryFlags symm, const char axis, const float angle)
T safe_divide(const T &a, const T &b)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
static wmOperatorStatus wpaint_exec(bContext *C, wmOperator *op)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static void init_session_data(const VPaint &wpaint, Object &ob, WPaintData &wpd)
void ED_mesh_mirror_topo_table_end(Object *ob)
ScrArea * CTX_wm_area(const bContext *C)
static void multipaint_apply_change(MDeformVert *dvert, const int defbase_tot, float change, const bool *defbase_sel)
static void filter_factors_with_selection(const Span< bool > select_vert, const Span< int > verts, const MutableSpan< float > factors)
static wmOperatorStatus wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
@ VP_FLAG_VGROUP_RESTRICT
bool ED_wpaint_ensure_data(bContext *C, ReportList *reports, eWPaintFlag flag, WPaintVGroupIndex *vgroup_index)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BKE_object_defgroup_mirror_selection(struct Object *ob, int defbase_tot, const bool *selection, bool *dg_flags_sel, int *r_dg_flags_sel_tot)
bool weight_paint_poll(bContext *C)
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
static void parallel_nodes_loop_with_mirror_check(const Mesh &mesh, const IndexMask &node_mask, FunctionRef< void(IndexRange)> fn)
bool * BKE_object_defgroup_validmap_get(struct Object *ob, int defbase_tot)
void ED_mesh_mirror_spatial_table_end(Object *ob)
void ED_object_wpaintmode_exit(bContext *C)
void BKE_defvert_array_free_elems(MDeformVert *dvert, int totvert)
static void do_wpaint_brush_smear(const Depsgraph &depsgraph, Object &ob, const Brush &brush, VPaint &vp, WPaintData &wpd, const WeightPaintInfo &wpi, Mesh &mesh, const IndexMask &node_mask)
@ WPAINT_BRUSH_TYPE_AVERAGE
@ WPAINT_BRUSH_TYPE_SMEAR
static void precompute_weight_values(Object &ob, const Brush &brush, WPaintData &wpd, WeightPaintInfo &wpi, Mesh &mesh)
int mesh_get_x_mirror_vert(Object *ob, Mesh *mesh_eval, int index, bool use_topology)
void view3d_operator_needs_gpu(const bContext *C)
static void wpaint_paint_leaves(const Depsgraph &depsgraph, Object &ob, VPaint &vp, WPaintData &wpd, WeightPaintInfo &wpi, Mesh &mesh, const IndexMask &node_mask)
void BKE_object_defgroup_split_locked_validmap(int defbase_tot, const bool *locked, const bool *deform, bool *r_locked, bool *r_unlocked)
void PAINT_OT_weight_paint(wmOperatorType *ot)
static float wpaint_undo_lock_relative(float weight, float old_weight, float locked_weight, float free_weight, bool auto_normalize)
void ED_region_tag_redraw(ARegion *region)
Base * CTX_data_active_base(const bContext *C)
static void do_wpaint_brush_draw(const Depsgraph &depsgraph, Object &ob, const Brush &brush, VPaint &vp, WPaintData &wpd, const WeightPaintInfo &wpi, Mesh &mesh, const float strength, const IndexMask &node_mask)
bool * BKE_object_defgroup_selected_get(struct Object *ob, int defbase_tot, int *r_dg_flags_sel_tot)
float BKE_defvert_find_weight(const MDeformVert *dvert, int defgroup)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static wmOperatorStatus wpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void wpaint_do_paint(const Depsgraph &depsgraph, const Scene &scene, const Brush &brush, Object &ob, PaintModeData *mode_data)
static float wpaint_clamp_monotonic(float oldval, float curval, float newval)
VecBase< float, 2 > float2
@ ME_EDIT_MIRROR_VERTEX_GROUPS
bool weight_paint_mode_region_view3d_poll(bContext *C)
float BKE_defvert_lock_relative_weight(float weight, const MDeformVert *dv, int defbase_num, const bool *defbase_locked, const bool *defbase_unlocked)
float BKE_defvert_calc_lock_relative_weight(float weight, float locked_weight, float unlocked_weight)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Mesh * BKE_mesh_from_object(Object *ob)
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
static void do_weight_paint_vertex_single(const VPaint &wp, Object &ob, WPaintData &wpd, const WeightPaintInfo &wpi, const uint index, float alpha, float paintweight, float automasking_factor)
void WM_toolsystem_update_from_context_view3d(bContext *C)
MDeformWeight * BKE_defvert_ensure_index(MDeformVert *dv, int defgroup)
void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
ToolSettings * CTX_data_tool_settings(const bContext *C)
bool weight_paint_poll_ignore_tool(bContext *C)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
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 wmOperatorStatus wpaint_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void do_weight_paint_vertex_multi(const VPaint &wp, Object &ob, WPaintData &wpd, const WeightPaintInfo &wpi, const uint index, float alpha, float paintweight, float additional_factor)
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
@ BRUSH_AUTOMASKING_CAVITY_ALL
void paint_stroke_operator_properties(wmOperatorType *ot)
static float wpaint_blend(const VPaint &wp, float weight, const float alpha, float paintval, const float paint_factor, const bool do_flip)
static void do_wpaint_brush_blur(const Depsgraph &depsgraph, Object &ob, const Brush &brush, VPaint &vp, WPaintData &wpd, const WeightPaintInfo &wpi, Mesh &mesh, const IndexMask &node_mask)
bool * BKE_object_defgroup_lock_flags_get(struct Object *ob, int defbase_tot)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
MINLINE float normalize_v3(float n[3])
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
bool BKE_object_defgroup_check_lock_relative_multi(int defbase_tot, const bool *lock_flags, const bool *selected, int sel_tot)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
Depsgraph * CTX_data_depsgraph_on_load(const bContext *C)
Main * CTX_data_main(const bContext *C)
bool WM_toolsystem_active_tool_is_brush(const bContext *C)
static void multipaint_clamp_change(MDeformVert *dvert, const int defbase_tot, const bool *defbase_sel, float *change_p)
float BKE_defvert_total_selected_weight(const MDeformVert *dv, int defbase_num, const bool *defbase_sel)
float ED_wpaint_blend_tool(const int tool, const float weight, const float paintval, const float alpha)
void BKE_defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
bool BKE_pbvh_node_fully_hidden_get(const bke::pbvh::Node &node)
bool ED_operator_region_view3d_active(bContext *C)
static bool weight_paint_poll_ex(bContext *C, bool check_tool)
static bool do_weight_paint_normalize_all_locked(MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap, const bool *lock_flags)
Brush * BKE_paint_brush(Paint *paint)
static bool multipaint_verify_change(MDeformVert *dvert, const int defbase_tot, float change, const bool *defbase_sel)
static MDeformVert * defweight_prev_init(MDeformVert *dvert_prev, MDeformVert *dvert_curr, int index)
Scene * CTX_data_scene(const bContext *C)
static float calculate_average_weight(const Depsgraph &depsgraph, Object &ob, const Mesh &mesh, const Brush &brush, const VPaint &vp, WeightPaintInfo &wpi, const IndexMask &node_mask)
float BKE_brush_weight_get(const Paint *paint, const Brush *brush)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
bool BKE_object_defgroup_check_lock_relative(const bool *lock_flags, const bool *validmap, int index)
static float wpaint_get_active_weight(const MDeformVert &dv, const WeightPaintInfo &wpi)
@ BKE_MESH_BATCH_DIRTY_ALL
static void do_weight_paint_vertex(const VPaint &wp, Object &ob, WPaintData &wpd, const WeightPaintInfo &wpi, const uint index, float final_alpha, float paintweight, float automasking_factor=1.0f)
Object * CTX_data_active_object(const bContext *C)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ARegion * CTX_wm_region(const bContext *C)
bool weight_paint_mode_poll(bContext *C)
float BKE_brush_alpha_get(const Paint *paint, const Brush *brush)
void ED_object_wpaintmode_enter_ex(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob)
void ED_object_wpaintmode_exit_ex(Scene &scene, Object &ob)
MDeformWeight * BKE_defvert_find_index(const MDeformVert *dv, int defgroup)
static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
float BKE_defvert_multipaint_collective_weight(const MDeformVert *dv, int defbase_num, const bool *defbase_sel, int defbase_sel_num, bool is_normalized)
static void init_session_data(Object &ob)
int BKE_object_defgroup_active_index_get(const Object *ob)
void ED_object_wpaintmode_enter(bContext *C, Depsgraph &depsgraph)
eBrushWeightPaintType weight_brush_type
bke::ObjectRuntime * runtime
ListBaseT< struct ParticleSystem > particlesystem
struct ToolSettings * toolsettings
ed::sculpt_paint::StrokeCache * cache
Array< MDeformVert > dvert_prev
bool precomputed_weight_ready
float * precomputed_weight
Array< float > alpha_weight
const bool * vgroup_unlocked
WeightPaintGroupData active
const bool * vgroup_locked
const bool * vgroup_validmap
WeightPaintGroupData mirror
const bool * vgroup_validmap
const bool * vgroup_locked
WeightPaintGroupData active
MutableSpan< MDeformVert > dvert
const bool * vgroup_unlocked
WeightPaintGroupData mirror
WeightPaintStroke(bContext *C, wmOperator *op, const wmEvent *event)
bool test_start(wmOperator *op, float2 mouse) override
void redraw(bool final) override
ToolSettings * tool_settings_
bool test_cancel() override
void done(bool is_cancel, bool stroke_started) override
std::optional< float3 > get_location(float2 mouse, bool force_original) override
void update_step(wmOperator *op, const StrokeStep &stroke_step) override
SculptSession * sculpt_session
wmOperatorStatus modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus exec(bContext *C, wmOperator *op)
std::unique_ptr< PaintModeData > mode_data_
StrokeToggleSettings toggle_settings
float base_brush_strength
std::unique_ptr< auto_mask::Cache > automasking
float3 last_location_symm
ePaintSymmetryFlags mirror_symmetry_pass
void calc_cavity_factor(const Depsgraph &depsgraph, const Object &object, const IndexMask &node_mask)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)