90 return c.
r == 0.0f && c.
g == 0.0f && c.
b == 0.0f && c.
a == 0.0f;
95 return c.
r == 0 && c.
g == 0 && c.
b == 0 && c.
a == 0;
100 if constexpr (std::is_same_v<Color, ColorPaint4b>) {
110 if constexpr (std::is_same_v<Color, ColorPaint4b>) {
134 if (do_mask_normal) {
156 if (angle_cos <= a->angle__cos) {
160 if (angle_cos < a->angle_inner__cos) {
169 const float angle_cos,
210 ss.
cache = MEM_new<StrokeCache>(__func__);
225 ob.
sculpt = MEM_new<SculptSession>(__func__);
259 initial_value.
flag = 1;
309 ob.
mode |= mode_flag;
361 ob.
mode &= ~mode_flag;
439 float view_dir[3] = {0.0f, 0.0f, 1.0f};
444 cache = MEM_new<StrokeCache>(__func__);
479 cache->
brush = brush;
555 float *r_brush_size_pressure,
556 float *r_brush_alpha_value,
557 float *r_brush_alpha_pressure)
592 CLOG_WARN(&
LOG,
"Switching to the blur (smooth) brush not possible, corresponding brush not");
666template<
typename Color,
typename Traits>
671 const typename Traits::ValueType alpha,
672 const typename Traits::BlendType brush_alpha_value)
674 using Value =
typename Traits::ValueType;
689 cp = (Value *)&color_blend;
690 ct = (Value *)&color_test;
691 co = (Value *)&color_orig;
693 for (a = 0; a < 4; a++) {
698 else if (cp[a] > co[a]) {
706 else if (cp[a] > ct[a]) {
716 cp = (Value *)&color_blend;
717 cc = (Value *)&color_curr;
731template<
typename Color,
typename Traits>
736 Color brush_mark_color,
737 float brush_mark_alpha,
746 if (
isZero(prev_vertex_colors[index])) {
747 prev_vertex_colors[index] = vertex_colors[index];
752 if (
isZero(stroke_buffer[index])) {
753 stroke_buffer[index] = vertex_colors[index];
754 stroke_buffer[index].a = 0;
759 stroke_buffer[index],
760 stroke_buffer[index].a);
763 vertex_colors[index],
764 prev_vertex_colors[index],
765 stroke_buffer[index],
771 vertex_colors[index],
797 const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f};
860 const bool is_mode_set = (ob.
mode & mode_flag) != 0;
899 ot->name =
"Vertex Paint Mode";
900 ot->idname =
"PAINT_OT_vertex_paint_toggle";
901 ot->description =
"Toggle the vertex paint mode in 3D view";
933template<
typename Func>
997 std::unique_ptr<VPaintData> vpd = std::make_unique<VPaintData>();
1000 vpd->domain = domain;
1014 const GVArray attribute = *
mesh.attributes().lookup(
mesh.active_color_attribute, domain);
1015 vpd->smear.color_prev =
GArray(attribute.
type(), attribute.
size());
1016 attribute.
materialize(vpd->smear.color_prev.data());
1018 vpd->smear.color_curr = vpd->smear.color_prev;
1022 if (vpd->is_texbrush) {
1025 depsgraph, scene, ob, vpd->vert_positions, vpd->vert_normals);
1030 if (vpd->prev_colors.is_empty()) {
1031 const GVArray attribute = *
mesh.attributes().lookup(
mesh.active_color_attribute);
1036 if (vpd->stroke_buffer.is_empty()) {
1037 const GVArray attribute = *
mesh.attributes().lookup(
mesh.active_color_attribute);
1043 vpd->prev_colors = {};
1044 vpd->stroke_buffer = {};
1063 if (
mesh ==
nullptr ||
mesh->faces_num == 0) {
1069 const std::optional<bke::AttributeMetaData> meta_data =
mesh->attributes().lookup_meta_data(
1070 mesh->active_color_attribute);
1076 C, op, scene,
depsgraph, vp, ob, *
mesh, meta_data->domain, meta_data->data_type, brush);
1094 for (
const int i :
verts.index_range()) {
1095 if (!select_vert[
verts[
i]]) {
1116 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1118 ss, vp.
paint, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1151 LocalData &tls = all_tls.
local();
1153 tls.factors.resize(
verts.size());
1157 if (!select_vert.is_empty()) {
1161 tls.distances.resize(
verts.size());
1168 for (
const int i :
verts.index_range()) {
1169 const int vert =
verts[
i];
1170 if (factors[
i] == 0.0f) {
1175 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1183 const float brush_fade = factors[
i];
1186 using T = decltype(dummy);
1188 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1189 using Traits = blender::color::Traits<Color>;
1190 using Blend = typename Traits::BlendType;
1191 MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
1192 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1194 Color color_final(0, 0, 0, 0);
1196 int total_hit_loops = 0;
1197 Blend blend[4] = {0};
1199 for (
const int face : vert_to_face[vert]) {
1200 if (!select_poly.
is_empty() && !select_poly[face]) {
1203 total_hit_loops +=
faces[face].size();
1204 for (
const int corner :
faces[face]) {
1215 if (total_hit_loops == 0) {
1222 color_final.r = Traits::round(
sqrtf(Traits::divide_round(
blend[0], total_hit_loops)));
1223 color_final.g = Traits::round(
sqrtf(Traits::divide_round(
blend[1], total_hit_loops)));
1224 color_final.b = Traits::round(
sqrtf(Traits::divide_round(
blend[2], total_hit_loops)));
1225 color_final.a = Traits::round(
sqrtf(Traits::divide_round(
blend[3], total_hit_loops)));
1229 for (
const int face : vert_to_face[vert]) {
1231 faces[face], corner_verts, vert);
1232 if (!select_poly.
is_empty() && !select_poly[face]) {
1235 Color color_orig(0, 0, 0, 0);
1237 if (!previous_color.is_empty()) {
1239 if (
isZero(previous_color[corner])) {
1240 previous_color[corner] = colors[corner];
1242 color_orig = previous_color[corner];
1244 const float final_alpha = Traits::range * brush_fade *
brush_strength *
1245 brush_alpha_pressure;
1249 vp, colors[corner], color_orig, *
col, final_alpha, Traits::range *
brush_strength);
1271 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1273 ss, vp.
paint, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1306 LocalData &tls = all_tls.
local();
1308 tls.factors.resize(
verts.size());
1312 if (!select_vert.is_empty()) {
1316 tls.distances.resize(
verts.size());
1323 for (
const int i :
verts.index_range()) {
1324 const int vert =
verts[
i];
1325 if (factors[
i] == 0.0f) {
1330 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1337 const float brush_fade = factors[
i];
1341 using T = decltype(dummy);
1343 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1344 using Traits = blender::color::Traits<Color>;
1345 using Blend = typename Traits::BlendType;
1346 MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
1347 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1348 Color color_final(0, 0, 0, 0);
1350 int total_hit_loops = 0;
1351 Blend blend[4] = {0};
1353 for (
const int face : vert_to_face[vert]) {
1354 if (!select_poly.
is_empty() && !select_poly[face]) {
1357 total_hit_loops +=
faces[face].size();
1358 for (
const int vert : corner_verts.
slice(
faces[face])) {
1369 if (total_hit_loops == 0) {
1373 color_final.r = Traits::round(
sqrtf(Traits::divide_round(
blend[0], total_hit_loops)));
1374 color_final.g = Traits::round(
sqrtf(Traits::divide_round(
blend[1], total_hit_loops)));
1375 color_final.b = Traits::round(
sqrtf(Traits::divide_round(
blend[2], total_hit_loops)));
1376 color_final.a = Traits::round(
sqrtf(Traits::divide_round(
blend[3], total_hit_loops)));
1378 Color color_orig(0, 0, 0, 0);
1380 if (!previous_color.is_empty()) {
1382 if (
isZero(previous_color[vert])) {
1383 previous_color[vert] = colors[vert];
1385 color_orig = previous_color[vert];
1387 const float final_alpha = Traits::range * brush_fade *
brush_strength *
1388 brush_alpha_pressure;
1423 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1426 ss, vp.
paint, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1464 LocalData &tls = all_tls.
local();
1466 tls.factors.resize(
verts.size());
1470 if (!select_vert.is_empty()) {
1474 tls.distances.resize(
verts.size());
1481 for (
const int i :
verts.index_range()) {
1482 const int vert =
verts[
i];
1483 if (factors[
i] == 0.0f) {
1490 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1497 const float brush_fade = factors[
i];
1499 bool do_color =
false;
1502 float stroke_dot_max = 0.0f;
1507 using T = decltype(dummy);
1509 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1510 using Traits = blender::color::Traits<Color>;
1511 MutableSpan<Color> color_curr = g_color_curr.typed<T>().template cast<Color>();
1512 MutableSpan<Color> color_prev_smear = g_color_prev_smear.typed<T>().template cast<Color>();
1513 MutableSpan<Color> color_prev = g_color_prev.typed<T>().template cast<Color>();
1514 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1516 Color color_final(0, 0, 0, 0);
1518 for (const int face : vert_to_face[vert]) {
1519 if (!select_poly.is_empty() && !select_poly[face]) {
1522 for (const int corner : faces[face]) {
1523 const int v_other_index = corner_verts[corner];
1524 if (v_other_index == vert) {
1531 sub_v3_v3v3(other_dir, vert_positions[vert], vert_positions[v_other_index]);
1532 project_plane_v3_v3v3(other_dir, other_dir, cache.view_normal_symm);
1534 normalize_v3(other_dir);
1536 const float stroke_dot = dot_v3v3(other_dir, brush_dir);
1539 if (vpd.domain == AttrDomain::Point) {
1540 elem_index = v_other_index;
1543 elem_index = corner;
1546 if (stroke_dot > stroke_dot_max) {
1547 stroke_dot_max = stroke_dot;
1548 color_final = color_prev_smear[elem_index];
1558 const float final_alpha = Traits::range * brush_fade *
brush_strength *
1559 brush_alpha_pressure;
1563 for (
const int face : vert_to_face[vert]) {
1572 if (!select_poly.
is_empty() && !select_poly[face]) {
1577 Color color_orig(0, 0, 0, 0);
1579 if (!color_prev.is_empty()) {
1581 if (
isZero(color_prev[elem_index])) {
1582 color_prev[elem_index] = colors[elem_index];
1584 color_orig = color_prev[elem_index];
1595 color_curr[elem_index] = colors[elem_index];
1606 const GSpan attribute,
1634 using T = decltype(dummy);
1636 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1637 using Traits = blender::color::Traits<Color>;
1638 using Blend = typename Traits::BlendType;
1639 const Span<Color> colors = attribute.typed<T>().template cast<Color>();
1641 Array<VPaintAverageAccum<Blend>> accum(nodes.size(), {0, {0, 0, 0}});
1644 LocalData &tls = all_tls.
local();
1647 tls.factors.resize(
verts.size());
1651 if (!select_vert.is_empty()) {
1655 tls.distances.resize(
verts.size());
1662 for (
const int i :
verts.index_range()) {
1663 const int vert =
verts[
i];
1664 if (factors[
i] == 0.0f) {
1668 accum2.
len += vert_to_face[vert].
size();
1670 for (
const int face : vert_to_face[vert]) {
1680 const Color &
col = colors[elem_index];
1688 Blend accum_len = 0;
1689 Blend accum_value[3] = {0};
1693 accum_len += accum[
i].len;
1694 accum_value[0] += accum[
i].value[0];
1695 accum_value[1] += accum[
i].value[1];
1696 accum_value[2] += accum[
i].value[2];
1698 if (accum_len != 0) {
1699 blend.r = Traits::round(
sqrtf(Traits::divide_round(accum_value[0], accum_len)));
1700 blend.g = Traits::round(
sqrtf(Traits::divide_round(accum_value[1], accum_len)));
1701 blend.b = Traits::round(
sqrtf(Traits::divide_round(accum_value[2], accum_len)));
1702 blend.a = Traits::range;
1709template<
typename Color>
1712 const float v_co[3],
1732 const std::optional<BrushColorJitterSettings> color_jitter_settings =
1734 if (color_jitter_settings) {
1758 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1760 ss, vp.
paint, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1796 LocalData &tls = all_tls.
local();
1798 tls.factors.resize(
verts.size());
1802 if (!select_vert.is_empty()) {
1806 tls.distances.resize(
verts.size());
1813 for (
const int i :
verts.index_range()) {
1814 const int vert =
verts[
i];
1815 if (factors[
i] == 0.0f) {
1822 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1829 const float brush_fade = factors[
i];
1832 using T = decltype(dummy);
1834 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1835 using Traits = blender::color::Traits<Color>;
1836 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1837 MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
1838 MutableSpan<Color> stroke_buffer = g_stroke_buffer.typed<T>().template cast<Color>();
1840 Color color_final = fromFloat<Color>(
1841 ColorPaint4f(brush_color[0], brush_color[1], brush_color[2], 1.0));
1844 float tex_alpha = 1.0;
1845 if (vpd.is_texbrush) {
1853 float3 position = vpd.vert_positions[vert];
1854 if (cache.radial_symmetry_pass) {
1855 position = blender::math::transform_point(cache.symm_rot_mat_inv, position);
1857 const float3 symm_point = blender::ed::sculpt_paint::symmetry_flip(
1858 position, cache.mirror_symmetry_pass);
1860 tex_alpha = paint_and_tex_color_alpha<Color>(vp, vpd, symm_point, &color_final);
1863 const float final_alpha = Traits::frange * brush_fade *
brush_strength * tex_alpha *
1864 brush_alpha_pressure;
1867 colors[vert] = vpaint_blend_stroke<Color, Traits>(vp,
1878 for (const int face : vert_to_face[vert]) {
1879 const int corner = bke::mesh::face_find_corner_from_vert(
1880 faces[face], corner_verts, vert);
1881 if (!select_poly.is_empty() && !select_poly[face]) {
1884 colors[corner] = vpaint_blend_stroke<Color, Traits>(vp,
1964 mesh.active_color_attribute);
1989 for (
int i = 1;
i <
mesh.radial_symmetry[axis -
'X'];
i++) {
1990 const float angle = (2.0 *
M_PI) *
i /
mesh.radial_symmetry[axis -
'X'];
2019 for (
i = 1;
i <= symm;
i++) {
2168 ot->name =
"Vertex Paint";
2169 ot->idname =
"PAINT_OT_vertex_paint";
2170 ot->description =
"Paint a stroke in the active color attribute layer";
2183 "override_location",
2185 "Override Location",
2186 "Override the given \"location\" array by recalculating object space positions from the "
2187 "provided \"mouse_event\" positions");
2203 const int cd_offset,
2204 const bool use_vert_sel)
2228 const bool use_vert_sel,
2229 const bool use_face_sel,
2230 const bool affect_alpha)
2245 for (
const int i :
faces.index_range()) {
2246 if (!select_poly.
is_empty() && !select_poly[
i]) {
2249 for (
const int corner :
faces[
i]) {
2250 const int vert = corner_verts[corner];
2251 if (!select_vert.
is_empty() && !select_vert[vert]) {
2255 data[data_index].r = value.r;
2256 data[data_index].g = value.g;
2257 data[data_index].b = value.b;
2259 data[data_index].a = value.a;
2270 const bool use_vert_sel,
2271 const bool use_face_sel,
2272 const bool affect_alpha)
2317 bool only_selected =
true,
2318 bool affect_alpha =
true)
2328 *
mesh, fill_color,
mesh->active_color_attribute, use_vert_sel, use_face_sel, affect_alpha);
2377 ot->name =
"Set Vertex Colors";
2378 ot->idname =
"PAINT_OT_vertex_color_set";
2379 ot->description =
"Fill the active vertex color layer with the current paint color";
2390 "Set color completely opaque instead of reusing existing alpha");
blender::bke::AttrDomain BKE_attribute_domain(const AttributeOwner &owner, const struct CustomDataLayer *layer)
const struct CustomDataLayer * BKE_id_attributes_color_find(const struct ID *id, blender::StringRef name)
bool BKE_color_attribute_supported(const struct Mesh &mesh, blender::StringRef name)
bool BKE_brush_use_alpha_pressure(const Brush *brush)
float BKE_brush_alpha_get(const Paint *paint, const Brush *brush)
float BKE_brush_sample_tex_3d(const Paint *paint, const Brush *br, const MTex *mtex, const float point[3], float rgba[4], int thread, ImagePool *pool)
const float * BKE_brush_color_get(const Paint *paint, const Brush *brush)
const float * BKE_brush_secondary_color_get(const Paint *paint, const Brush *brush)
std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Paint *paint, const Brush *brush)
bool BKE_brush_use_size_pressure(const Brush *brush)
float BKE_brush_radius_get(const Paint *paint, const Brush *brush)
void BKE_brush_size_set(Paint *paint, Brush *brush, int size)
void BKE_brush_unprojected_size_set(Paint *paint, Brush *brush, float unprojected_size)
int BKE_brush_size_get(const Paint *paint, const Brush *brush)
const MTex * BKE_brush_mask_texture_get(const Brush *brush, eObjectMode object_mode)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ToolSettings * CTX_data_tool_settings(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
Depsgraph * CTX_data_depsgraph_on_load(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode)
void BKE_mesh_tessface_clear(Mesh *mesh)
@ BKE_MESH_BATCH_DIRTY_ALL
Mesh * BKE_mesh_from_object(Object *ob)
General operations, lookup, etc. for blender objects.
void BKE_object_free_derived_caches(Object *ob)
bool BKE_paint_brush_set_essentials(Main *bmain, Paint *paint, const char *name)
blender::float3 BKE_paint_randomize_color(const BrushColorJitterSettings &color_jitter, const blender::float3 &initial_hsv_jitter, const float distance, const float pressure, const blender::float3 &color)
bool BKE_paint_brush_set(Paint *paint, Brush *brush)
void BKE_sculptsession_free(Object *ob)
blender::float3 seed_hsv_jitter()
const Brush * BKE_paint_brush_for_read(const Paint *paint)
void BKE_paint_init(Main *bmain, Scene *sce, PaintMode mode, bool ensure_brushes=true)
Paint * BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode)
void BKE_sculpt_update_object_for_edit(Depsgraph *depsgraph, Object *ob_orig, bool is_paint_tool)
bool BKE_paint_ensure(ToolSettings *ts, Paint **r_paint)
Brush * BKE_paint_brush(Paint *paint)
void BKE_sculpt_toolsettings_data_ensure(Main *bmain, Scene *scene)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
void BKE_paint_brushes_validate(Main *bmain, Paint *paint)
#define BLI_assert_unreachable()
struct DistRayAABB_Precalc dist_squared_ray_to_aabb_v3_precalc(const float ray_origin[3], const float ray_direction[3])
void mul_m3_v3(const float M[3][3], float r[3])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void swap_m4m4(float m1[4][4], float m2[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v4(float r[4])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void zero_v2(float r[2])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
#define CLOG_WARN(clg_ref,...)
void DEG_id_tag_update(ID *id, unsigned int flags)
#define ID_IS_EDITABLE(_id)
@ WPAINT_BRUSH_TYPE_SMEAR
@ BRUSH_FRONTFACE_FALLOFF
@ VPAINT_BRUSH_TYPE_AVERAGE
@ VPAINT_BRUSH_TYPE_SMEAR
@ PAINT_FALLOFF_SHAPE_SPHERE
Object is a sort of wrapper for general info.
#define OPERATOR_RETVAL_CHECK(ret)
void ED_paint_cursor_start(Paint *paint, bool(*poll)(bContext *C))
bool ED_mesh_color_ensure(Mesh *mesh, const char *name)
void ED_mesh_mirror_topo_table_end(Object *ob)
void ED_mesh_mirror_spatial_table_end(Object *ob)
void ED_region_tag_redraw(ARegion *region)
@ V3D_PROJ_TEST_CLIP_NEAR
eV3DProjStatus ED_view3d_project_float_object(const ARegion *region, const float co[3], float r_co[2], eV3DProjTest flag)
void ED_view3d_init_mats_rv3d(const Object *ob, RegionView3D *rv3d)
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMLoop * l
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE bool isZero() const
static AttributeOwner from_id(ID *id)
void value_initialize_n(void *ptr, int64_t n) const
const CPPType & type() const
MutableSpan< T > typed() const
const CPPType & type() const
void materialize(void *dst) const
constexpr int64_t size() const
constexpr bool is_empty() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr bool is_empty() const
GAttributeReader lookup(const StringRef attribute_id) const
void tag_attribute_changed(const IndexMask &node_mask, StringRef attribute_name)
void foreach_index(Fn &&fn) const
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
int face_find_corner_from_vert(const IndexRange face, const Span< int > corner_verts, const int vert)
pbvh::Tree * pbvh_get(Object &object)
IndexMask search_nodes(const Tree &pbvh, IndexMaskMemory &memory, FunctionRef< bool(const Node &)> filter_fn)
IndexMask all_leaf_nodes(const Tree &pbvh, IndexMaskMemory &memory)
Span< float3 > vert_normals_eval(const Depsgraph &depsgraph, const Object &object_orig)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
void mesh_select_vert_flush(Mesh &mesh)
void mesh_select_face_flush(Mesh &mesh)
BLI_INLINE ColorSceneLinear4f< Alpha > decode(const ColorSceneLinearByteEncoded4b< Alpha > &color)
BLI_INLINE Color BLI_mix_colors(const IMB_BlendMode tool, const Color a, const Color b, const typename Traits::BlendType alpha)
BLI_INLINE ColorSceneLinearByteEncoded4b< Alpha > encode(const ColorSceneLinear4f< Alpha > &color)
bool vgroup_sync_from_pose(Object *ob)
bool mode_compat_set(bContext *C, Object *ob, eObjectMode mode, ReportList *reports)
float view_angle_limits_apply_falloff(const NormalAnglePrecalc *a, float angle_cos, float *mask_p)
bool brush_use_accumulate_ex(const Brush &brush, eObjectMode ob_mode)
void view_angle_limits_init(NormalAnglePrecalc *a, float angle, bool do_mask_normal)
bool use_normal(const VPaint &vp)
void smooth_brush_toggle_on(const bContext *C, Paint *paint, StrokeCache *cache)
void mode_exit_generic(Object &ob, eObjectMode mode_flag)
bool test_brush_angle_falloff(const Brush &brush, const NormalAnglePrecalc &normal_angle_precalc, float angle_cos, float *brush_strength)
void init_session_data(const ToolSettings &ts, Object &ob)
void mode_enter_generic(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob, eObjectMode mode_flag)
void update_cache_invariants(bContext *C, VPaint &vp, SculptSession &ss, wmOperator *op, const float mval[2])
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)
void init_session(Main &bmain, Depsgraph &depsgraph, Scene &scene, Paint &paint, Object &ob, eObjectMode object_mode)
bool brush_use_accumulate(const VPaint &vp)
void init_stroke(Depsgraph &depsgraph, Object &ob)
void update_cache_variants(bContext *C, VPaint &vp, Object &ob, PointerRNA *ptr)
void last_stroke_update(const float location[3], Paint &paint)
IndexMask pbvh_gather_generic(const Depsgraph &depsgraph, const Object &ob, const VPaint &wp, const Brush &brush, IndexMaskMemory &memory)
bool mode_toggle_poll_test(bContext *C)
void smooth_brush_toggle_off(Paint *paint, StrokeCache *cache)
bool stroke_get_location_bvh(bContext *C, float out[3], const float mval[2], const bool force_original)
bool node_in_sphere(const bke::pbvh::Node &node, const float3 &location, const float radius_sq, const bool original)
bool node_in_cylinder(const DistRayAABB_Precalc &ray_dist_precalc, const bke::pbvh::Node &node, const float radius_sq, const bool original)
void calc_brush_strength_factors(const StrokeCache &cache, const Brush &brush, Span< float > distances, MutableSpan< float > factors)
wmOperatorStatus paint_stroke_exec(bContext *C, wmOperator *op, PaintStroke *stroke)
void filter_distances_with_radius(float radius, Span< float > distances, MutableSpan< float > factors)
static bool fill_active_color(Object &ob, ColorPaint4f fill_color, bool only_selected=true, bool affect_alpha=true)
static void fill_mesh_face_or_corner_attribute(Mesh &mesh, const T &value, const AttrDomain domain, const MutableSpan< T > data, const bool use_vert_sel, const bool use_face_sel, const bool affect_alpha)
static void fill_mesh_color(Mesh &mesh, const ColorPaint4f &color, const StringRef attribute_name, const bool use_vert_sel, const bool use_face_sel, const bool affect_alpha)
void filter_region_clip_factors(const SculptSession &ss, Span< float3 > vert_positions, Span< int > verts, MutableSpan< float > factors)
void paint_stroke_cancel(bContext *C, wmOperator *op, PaintStroke *stroke)
void ensure_valid_pivot(const Object &ob, Paint &paint)
bool paint_supports_dynamic_size(const Brush &br, PaintMode mode)
wmOperatorStatus paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintStroke **stroke_p)
void calc_brush_distances(const SculptSession &ss, Span< float3 > vert_positions, Span< int > vert, eBrushFalloffShape falloff_shape, MutableSpan< float > r_distances)
std::optional< float3 > calc_area_normal(const Depsgraph &depsgraph, const Brush &brush, const Object &ob, const IndexMask &node_mask)
ViewContext * paint_stroke_view_context(PaintStroke *stroke)
static void fill_bm_face_or_corner_attribute(BMesh &bm, const T &value, const AttrDomain domain, const int cd_offset, const bool use_vert_sel)
void * paint_stroke_mode_data(PaintStroke *stroke)
float paint_stroke_distance_get(PaintStroke *stroke)
bool object_active_color_fill(Object &ob, const float fill_color[4], bool only_selected)
void paint_stroke_free(bContext *C, wmOperator *op, PaintStroke *stroke)
PaintStroke * paint_stroke_new(bContext *C, wmOperator *op, StrokeGetLocation get_location, StrokeTestStart test_start, StrokeUpdateStep update_step, StrokeRedraw redraw, StrokeDone done, int event_type)
void fill_factor_from_hide(Span< bool > hide_vert, Span< int > verts, MutableSpan< float > r_factors)
void paint_stroke_set_mode_data(PaintStroke *stroke, std::unique_ptr< PaintModeData > mode_data)
bool is_symmetry_iteration_valid(const char i, const char symm)
ColorSceneLinearByteEncoded4b< eAlpha::Straight > ColorPaint4b
ColorSceneLinear4f< eAlpha::Straight > ColorPaint4f
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
void paint_cursor_delete_textures()
VertProjHandle * ED_vpaint_proj_handle_create(Depsgraph &depsgraph, Scene &scene, Object &ob, blender::Span< blender::float3 > &r_vert_positions, blender::Span< blender::float3 > &r_vert_normals)
bool weight_paint_poll(bContext *C)
float paint_calc_object_space_radius(const ViewContext &vc, const blender::float3 ¢er, float pixel_radius)
bool vertex_paint_mode_poll(bContext *C)
void ED_vpaint_proj_handle_free(VertProjHandle *vp_handle)
void paint_stroke_operator_properties(wmOperatorType *ot)
bool vertex_paint_poll(bContext *C)
static ColorPaint4f vpaint_get_current_col(VPaint &vp, bool secondary)
static float paint_and_tex_color_alpha(const VPaint &vp, VPaintData &vpd, const float v_co[3], Color *r_color)
void PAINT_OT_vertex_color_set(wmOperatorType *ot)
static void calculate_average_color(VPaintData &vpd, Object &ob, Mesh &mesh, const Brush &brush, const GSpan attribute, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask)
static wmOperatorStatus vpaint_exec(bContext *C, wmOperator *op)
static void to_static_color_type(const bke::AttrType type, const Func &func)
static bool vpaint_stroke_test_start(bContext *C, wmOperator *op, const float mouse[2])
void PAINT_OT_vertex_paint(wmOperatorType *ot)
static bool vertex_paint_poll_ex(bContext *C, bool check_tool)
static void do_vpaint_brush_blur_loops(const bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask, GMutableSpan attribute)
static void filter_factors_with_selection(const Span< bool > select_vert, const Span< int > verts, const MutableSpan< float > factors)
static void vpaint_stroke_done(const bContext *C, PaintStroke *stroke)
static void do_vpaint_brush_blur_verts(const bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask, GMutableSpan attribute)
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 Color vpaint_blend_stroke(const VPaint &vp, MutableSpan< Color > prev_vertex_colors, MutableSpan< Color > vertex_colors, MutableSpan< Color > stroke_buffer, Color brush_mark_color, float brush_mark_alpha, float brush_strength, int index)
bool vertex_paint_poll_ignore_tool(bContext *C)
void ED_object_vpaintmode_enter(bContext *C, Depsgraph &depsgraph)
static wmOperatorStatus vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
static ColorPaint4f toFloat(const Color &c)
static void vpaint_do_blur(const bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask, GMutableSpan attribute)
static void vpaint_do_symmetrical_brush_actions(bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob)
void ED_object_vpaintmode_exit(bContext *C)
static void vpaint_do_draw(const bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask, GMutableSpan attribute)
bool vertex_paint_mode_poll(bContext *C)
void ED_object_vpaintmode_exit_ex(Object &ob)
void ED_object_vpaintmode_enter_ex(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob)
static void do_vpaint_brush_smear(const bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask, GMutableSpan attribute)
static void vertex_paint_init_stroke(Depsgraph &depsgraph, Object &ob)
static void vpaint_do_radial_symmetry(bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Brush &brush, const ePaintSymmetryFlags symm, const int axis)
static std::unique_ptr< VPaintData > vpaint_init_vpaint(bContext *C, wmOperator *op, Scene &scene, Depsgraph &depsgraph, VPaint &vp, Object &ob, Mesh &mesh, const AttrDomain domain, const bke::AttrType type, const Brush &brush)
static void vpaint_paint_leaves(bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, GMutableSpan attribute, const Span< bke::pbvh::MeshNode > nodes, const IndexMask &node_mask)
static wmOperatorStatus vpaint_modal(bContext *C, wmOperator *op, const wmEvent *event)
static blender::float3 get_brush_color(const Paint *paint, const Brush *brush, const StrokeCache &cache, const ColorPaint4f &paint_color)
static wmOperatorStatus vertex_color_set_exec(bContext *C, wmOperator *op)
static Color fromFloat(const ColorPaint4f &c)
void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
static void vpaint_stroke_update_step(bContext *C, wmOperator *, PaintStroke *stroke, PointerRNA *itemptr)
static void vpaint_do_paint(bContext *C, const VPaint &vp, VPaintData &vpd, Object &ob, Mesh &mesh, const Brush &brush, const ePaintSymmetryFlags symm, const int axis, const int i, const float angle)
static void vpaint_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus vpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool vertex_paint_poll(bContext *C)
static void paint_and_tex_color_alpha_intern(const VPaint &vp, const ViewContext *vc, const float co[3], float r_rgba[4])
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
ePaintSymmetryFlags SCULPT_mesh_symmetry_xyz_get(const Object &object)
const float * SCULPT_brush_frontface_normal_from_falloff_shape(const SculptSession &ss, char falloff_shape)
void SCULPT_cache_calc_brushdata_symm(blender::ed::sculpt_paint::StrokeCache &cache, const ePaintSymmetryFlags symm, const char axis, const float angle)
static float brush_strength(const Sculpt &sd, const blender::ed::sculpt_paint::StrokeCache &cache, const float feather, const PaintModeSettings &)
struct CurveMapping * curve_distance_falloff
struct CurveMapping * curve_size
struct CurveMapping * curve_strength
ObjectRuntimeHandle * runtime
struct SculptSession * sculpt
PaintRuntimeHandle * runtime
struct ToolSettings * toolsettings
blender::ed::sculpt_paint::StrokeCache * cache
blender::Array< MDeformVert > dvert_prev
struct SculptSession::@362240011116215270333121305340144315201335267314::@377352350121204263020240366015362210376116055117 wpaint
struct SculptSession::@362240011116215270333121305340144315201335267314 mode
Span< float3 > vert_positions
Span< float3 > vert_normals
VertProjHandle * vp_handle
struct VPaintData::@051050346210221040071306373266116077075360370265 smear
NormalAnglePrecalc normal_angle_precalc
blender::float3 average_stroke_accum
int average_stroke_counter
float3 sculpt_normal_symm
float3 last_location_symm
ePaintSymmetryFlags mirror_symmetry_pass
std::optional< blender::float3 > initial_hsv_jitter
Brush * saved_active_brush
wmOperatorStatus(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)