95 return c.
r == 0.0f && c.
g == 0.0f && c.
b == 0.0f && c.
a == 0.0f;
100 return c.
r == 0 && c.
g == 0 && c.
b == 0 && c.
a == 0;
105 if constexpr (std::is_same_v<Color, ColorPaint4b>) {
115 if constexpr (std::is_same_v<Color, ColorPaint4b>) {
139 if (do_mask_normal) {
161 if (angle_cos <= a->angle__cos) {
165 if (angle_cos < a->angle_inner__cos) {
174 const float angle_cos,
215 ss.
cache = MEM_new<StrokeCache>(__func__);
226 ob.
sculpt = MEM_new<SculptSession>(__func__);
260 initial_value.
flag = 1;
310 ob.
mode |= mode_flag;
360 ob.
mode &= ~mode_flag;
440 float view_dir[3] = {0.0f, 0.0f, 1.0f};
445 cache = MEM_new<StrokeCache>(__func__);
480 cache->
brush = brush;
555 float *r_brush_size_pressure,
556 float *r_brush_alpha_value,
557 float *r_brush_alpha_pressure)
587 CLOG_WARN(&
LOG,
"Switching to the blur (smooth) brush not possible, corresponding brush not");
661template<
typename Color,
typename Traits>
666 const typename Traits::ValueType alpha,
667 const typename Traits::BlendType brush_alpha_value)
669 using Value =
typename Traits::ValueType;
684 cp = (Value *)&color_blend;
685 ct = (Value *)&color_test;
686 co = (Value *)&color_orig;
688 for (a = 0; a < 4; a++) {
693 else if (cp[a] > co[a]) {
701 else if (cp[a] > ct[a]) {
711 cp = (Value *)&color_blend;
712 cc = (Value *)&color_curr;
726template<
typename Color,
typename Traits>
731 Color brush_mark_color,
732 float brush_mark_alpha,
741 if (
isZero(prev_vertex_colors[index])) {
742 prev_vertex_colors[index] = vertex_colors[index];
747 if (
isZero(stroke_buffer[index])) {
748 stroke_buffer[index] = vertex_colors[index];
749 stroke_buffer[index].a = 0;
754 stroke_buffer[index],
755 stroke_buffer[index].a);
758 vertex_colors[index],
759 prev_vertex_colors[index],
760 stroke_buffer[index],
766 vertex_colors[index],
792 const float co_ss_3d[3] = {co_ss[0], co_ss[1], 0.0f};
855 const bool is_mode_set = (ob.
mode & mode_flag) != 0;
894 ot->name =
"Vertex Paint Mode";
895 ot->idname =
"PAINT_OT_vertex_paint_toggle";
896 ot->description =
"Toggle the vertex paint mode in 3D view";
928template<
typename Func>
992 std::unique_ptr<VPaintData> vpd = std::make_unique<VPaintData>();
995 vpd->domain = domain;
1009 const GVArray attribute = *
mesh.attributes().lookup(
mesh.active_color_attribute, domain);
1010 vpd->smear.color_prev =
GArray(attribute.
type(), attribute.
size());
1011 attribute.
materialize(vpd->smear.color_prev.data());
1013 vpd->smear.color_curr = vpd->smear.color_prev;
1017 if (vpd->is_texbrush) {
1020 depsgraph, scene, ob, vpd->vert_positions, vpd->vert_normals);
1025 if (vpd->prev_colors.is_empty()) {
1026 const GVArray attribute = *
mesh.attributes().lookup(
mesh.active_color_attribute);
1031 if (vpd->stroke_buffer.is_empty()) {
1032 const GVArray attribute = *
mesh.attributes().lookup(
mesh.active_color_attribute);
1038 vpd->prev_colors = {};
1039 vpd->stroke_buffer = {};
1058 if (
mesh ==
nullptr ||
mesh->faces_num == 0) {
1064 const std::optional<bke::AttributeMetaData> meta_data =
mesh->attributes().lookup_meta_data(
1065 mesh->active_color_attribute);
1071 C, op, scene,
depsgraph, vp, ob, *
mesh, meta_data->domain, meta_data->data_type, brush);
1089 for (
const int i :
verts.index_range()) {
1090 if (!select_vert[
verts[
i]]) {
1112 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1114 scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1147 LocalData &tls = all_tls.
local();
1149 tls.factors.resize(
verts.size());
1153 if (!select_vert.is_empty()) {
1157 tls.distances.resize(
verts.size());
1164 for (
const int i :
verts.index_range()) {
1165 const int vert =
verts[
i];
1166 if (factors[
i] == 0.0f) {
1171 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1179 const float brush_fade = factors[
i];
1182 using T = decltype(dummy);
1184 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1185 using Traits = blender::color::Traits<Color>;
1186 using Blend = typename Traits::BlendType;
1187 MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
1188 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1190 Color color_final(0, 0, 0, 0);
1192 int total_hit_loops = 0;
1193 Blend blend[4] = {0};
1195 for (
const int face : vert_to_face[vert]) {
1196 if (!select_poly.
is_empty() && !select_poly[face]) {
1199 total_hit_loops +=
faces[face].size();
1200 for (
const int corner :
faces[face]) {
1211 if (total_hit_loops == 0) {
1218 color_final.r = Traits::round(
sqrtf(Traits::divide_round(
blend[0], total_hit_loops)));
1219 color_final.g = Traits::round(
sqrtf(Traits::divide_round(
blend[1], total_hit_loops)));
1220 color_final.b = Traits::round(
sqrtf(Traits::divide_round(
blend[2], total_hit_loops)));
1221 color_final.a = Traits::round(
sqrtf(Traits::divide_round(
blend[3], total_hit_loops)));
1225 for (
const int face : vert_to_face[vert]) {
1227 faces[face], corner_verts, vert);
1228 if (!select_poly.
is_empty() && !select_poly[face]) {
1231 Color color_orig(0, 0, 0, 0);
1233 if (!previous_color.is_empty()) {
1235 if (
isZero(previous_color[corner])) {
1236 previous_color[corner] = colors[corner];
1238 color_orig = previous_color[corner];
1240 const float final_alpha = Traits::range * brush_fade *
brush_strength *
1241 brush_alpha_pressure;
1245 vp, colors[corner], color_orig, *
col, final_alpha, Traits::range *
brush_strength);
1268 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1270 scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1303 LocalData &tls = all_tls.
local();
1305 tls.factors.resize(
verts.size());
1309 if (!select_vert.is_empty()) {
1313 tls.distances.resize(
verts.size());
1320 for (
const int i :
verts.index_range()) {
1321 const int vert =
verts[
i];
1322 if (factors[
i] == 0.0f) {
1327 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1334 const float brush_fade = factors[
i];
1338 using T = decltype(dummy);
1340 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1341 using Traits = blender::color::Traits<Color>;
1342 using Blend = typename Traits::BlendType;
1343 MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
1344 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1345 Color color_final(0, 0, 0, 0);
1347 int total_hit_loops = 0;
1348 Blend blend[4] = {0};
1350 for (
const int face : vert_to_face[vert]) {
1351 if (!select_poly.
is_empty() && !select_poly[face]) {
1354 total_hit_loops +=
faces[face].size();
1355 for (
const int vert : corner_verts.
slice(
faces[face])) {
1366 if (total_hit_loops == 0) {
1370 color_final.r = Traits::round(
sqrtf(Traits::divide_round(
blend[0], total_hit_loops)));
1371 color_final.g = Traits::round(
sqrtf(Traits::divide_round(
blend[1], total_hit_loops)));
1372 color_final.b = Traits::round(
sqrtf(Traits::divide_round(
blend[2], total_hit_loops)));
1373 color_final.a = Traits::round(
sqrtf(Traits::divide_round(
blend[3], total_hit_loops)));
1375 Color color_orig(0, 0, 0, 0);
1377 if (!previous_color.is_empty()) {
1379 if (
isZero(previous_color[vert])) {
1380 previous_color[vert] = colors[vert];
1382 color_orig = previous_color[vert];
1384 const float final_alpha = Traits::range * brush_fade *
brush_strength *
1385 brush_alpha_pressure;
1421 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1424 scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1462 LocalData &tls = all_tls.
local();
1464 tls.factors.resize(
verts.size());
1468 if (!select_vert.is_empty()) {
1472 tls.distances.resize(
verts.size());
1479 for (
const int i :
verts.index_range()) {
1480 const int vert =
verts[
i];
1481 if (factors[
i] == 0.0f) {
1488 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1495 const float brush_fade = factors[
i];
1497 bool do_color =
false;
1500 float stroke_dot_max = 0.0f;
1505 using T = decltype(dummy);
1507 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1508 using Traits = blender::color::Traits<Color>;
1509 MutableSpan<Color> color_curr = g_color_curr.typed<T>().template cast<Color>();
1510 MutableSpan<Color> color_prev_smear = g_color_prev_smear.typed<T>().template cast<Color>();
1511 MutableSpan<Color> color_prev = g_color_prev.typed<T>().template cast<Color>();
1512 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1514 Color color_final(0, 0, 0, 0);
1516 for (const int face : vert_to_face[vert]) {
1517 if (!select_poly.is_empty() && !select_poly[face]) {
1520 for (const int corner : faces[face]) {
1521 const int v_other_index = corner_verts[corner];
1522 if (v_other_index == vert) {
1529 sub_v3_v3v3(other_dir, vert_positions[vert], vert_positions[v_other_index]);
1530 project_plane_v3_v3v3(other_dir, other_dir, cache.view_normal_symm);
1532 normalize_v3(other_dir);
1534 const float stroke_dot = dot_v3v3(other_dir, brush_dir);
1537 if (vpd.domain == AttrDomain::Point) {
1538 elem_index = v_other_index;
1541 elem_index = corner;
1544 if (stroke_dot > stroke_dot_max) {
1545 stroke_dot_max = stroke_dot;
1546 color_final = color_prev_smear[elem_index];
1556 const float final_alpha = Traits::range * brush_fade *
brush_strength *
1557 brush_alpha_pressure;
1561 for (
const int face : vert_to_face[vert]) {
1570 if (!select_poly.
is_empty() && !select_poly[face]) {
1575 Color color_orig(0, 0, 0, 0);
1577 if (!color_prev.is_empty()) {
1579 if (
isZero(color_prev[elem_index])) {
1580 color_prev[elem_index] = colors[elem_index];
1582 color_orig = color_prev[elem_index];
1593 color_curr[elem_index] = colors[elem_index];
1604 const GSpan attribute,
1632 using T = decltype(dummy);
1634 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1635 using Traits = blender::color::Traits<Color>;
1636 using Blend = typename Traits::BlendType;
1637 const Span<Color> colors = attribute.typed<T>().template cast<Color>();
1639 Array<VPaintAverageAccum<Blend>> accum(nodes.size(), {0, {0, 0, 0}});
1642 LocalData &tls = all_tls.
local();
1645 tls.factors.resize(
verts.size());
1649 if (!select_vert.is_empty()) {
1653 tls.distances.resize(
verts.size());
1660 for (
const int i :
verts.index_range()) {
1661 const int vert =
verts[
i];
1662 if (factors[
i] == 0.0f) {
1666 accum2.
len += vert_to_face[vert].
size();
1668 for (
const int face : vert_to_face[vert]) {
1678 const Color &
col = colors[elem_index];
1686 Blend accum_len = 0;
1687 Blend accum_value[3] = {0};
1691 accum_len += accum[
i].len;
1692 accum_value[0] += accum[
i].value[0];
1693 accum_value[1] += accum[
i].value[1];
1694 accum_value[2] += accum[
i].value[2];
1696 if (accum_len != 0) {
1697 blend.r = Traits::round(
sqrtf(Traits::divide_round(accum_value[0], accum_len)));
1698 blend.g = Traits::round(
sqrtf(Traits::divide_round(accum_value[1], accum_len)));
1699 blend.b = Traits::round(
sqrtf(Traits::divide_round(accum_value[2], accum_len)));
1700 blend.a = Traits::range;
1707template<
typename Color>
1710 const float v_co[3],
1731 const std::optional<BrushColorJitterSettings> color_jitter_settings =
1733 if (color_jitter_settings) {
1758 float brush_size_pressure, brush_alpha_value, brush_alpha_pressure;
1760 scene, ss, brush, &brush_size_pressure, &brush_alpha_value, &brush_alpha_pressure);
1797 LocalData &tls = all_tls.
local();
1799 tls.factors.resize(
verts.size());
1803 if (!select_vert.is_empty()) {
1807 tls.distances.resize(
verts.size());
1814 for (
const int i :
verts.index_range()) {
1815 const int vert =
verts[
i];
1816 if (factors[
i] == 0.0f) {
1823 const float angle_cos = use_normal ?
dot_v3v3(sculpt_normal_frontface, vert_normals[vert]) :
1830 const float brush_fade = factors[
i];
1833 using T = decltype(dummy);
1835 std::conditional_t<std::is_same_v<T, ColorGeometry4f>, ColorPaint4f, ColorPaint4b>;
1836 using Traits = blender::color::Traits<Color>;
1837 MutableSpan<Color> colors = attribute.typed<T>().template cast<Color>();
1838 MutableSpan<Color> previous_color = g_previous_color.typed<T>().template cast<Color>();
1839 MutableSpan<Color> stroke_buffer = g_stroke_buffer.typed<T>().template cast<Color>();
1841 Color color_final = fromFloat<Color>(
1842 ColorPaint4f(brush_color[0], brush_color[1], brush_color[2], 1.0));
1845 float tex_alpha = 1.0;
1846 if (vpd.is_texbrush) {
1854 float3 position = vpd.vert_positions[vert];
1855 if (cache.radial_symmetry_pass) {
1856 position = blender::math::transform_point(cache.symm_rot_mat_inv, position);
1858 const float3 symm_point = blender::ed::sculpt_paint::symmetry_flip(
1859 position, cache.mirror_symmetry_pass);
1861 tex_alpha = paint_and_tex_color_alpha<Color>(vp, vpd, symm_point, &color_final);
1864 const float final_alpha = Traits::frange * brush_fade *
brush_strength * tex_alpha *
1865 brush_alpha_pressure;
1868 colors[vert] = vpaint_blend_stroke<Color, Traits>(vp,
1879 for (const int face : vert_to_face[vert]) {
1880 const int corner = bke::mesh::face_find_corner_from_vert(
1881 faces[face], corner_verts, vert);
1882 if (!select_poly.is_empty() && !select_poly[face]) {
1885 colors[corner] = vpaint_blend_stroke<Color, Traits>(vp,
1965 mesh.active_color_attribute);
2020 for (
i = 1;
i <= symm;
i++) {
2170 ot->name =
"Vertex Paint";
2171 ot->idname =
"PAINT_OT_vertex_paint";
2172 ot->description =
"Paint a stroke in the active color attribute layer";
2185 "override_location",
2187 "Override Location",
2188 "Override the given `location` array by recalculating object space positions from the "
2189 "provided `mouse_event` positions");
2205 const int cd_offset,
2206 const bool use_vert_sel)
2230 const bool use_vert_sel,
2231 const bool use_face_sel,
2232 const bool affect_alpha)
2247 for (
const int i :
faces.index_range()) {
2248 if (!select_poly.
is_empty() && !select_poly[
i]) {
2251 for (
const int corner :
faces[
i]) {
2252 const int vert = corner_verts[corner];
2253 if (!select_vert.
is_empty() && !select_vert[vert]) {
2257 data[data_index].r = value.r;
2258 data[data_index].g = value.g;
2259 data[data_index].b = value.b;
2261 data[data_index].a = value.a;
2272 const bool use_vert_sel,
2273 const bool use_face_sel,
2274 const bool affect_alpha)
2319 bool only_selected =
true,
2320 bool affect_alpha =
true)
2330 *
mesh, fill_color,
mesh->active_color_attribute, use_vert_sel, use_face_sel, affect_alpha);
2379 ot->name =
"Set Vertex Colors";
2380 ot->idname =
"PAINT_OT_vertex_color_set";
2381 ot->description =
"Fill the active vertex color layer with the current paint color";
2392 "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)
int BKE_brush_size_get(const Scene *scene, const Brush *brush)
void BKE_brush_unprojected_radius_set(Scene *scene, Brush *brush, float unprojected_radius)
void BKE_brush_size_set(Scene *scene, Brush *brush, int size)
float BKE_brush_sample_tex_3d(const Scene *scene, const Brush *br, const MTex *mtex, const float point[3], float rgba[4], int thread, ImagePool *pool)
const float * BKE_brush_secondary_color_get(const Scene *scene, const Paint *paint, const Brush *brush)
bool BKE_brush_use_size_pressure(const Brush *brush)
const std::optional< BrushColorJitterSettings > BKE_brush_color_jitter_get_settings(const Scene *scene, const Paint *paint, const Brush *brush)
float BKE_brush_alpha_get(const Scene *scene, const Brush *brush)
const float * BKE_brush_color_get(const Scene *scene, 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)
const uchar PAINT_CURSOR_WEIGHT_PAINT[3]
blender::float3 seed_hsv_jitter()
const Brush * BKE_paint_brush_for_read(const Paint *paint)
Paint * BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode)
void BKE_paint_init(Main *bmain, Scene *sce, PaintMode mode, const uchar col[3], bool ensure_brushes=true)
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)
const uchar PAINT_CURSOR_VERTEX_PAINT[3]
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)
@ 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)
BLI_INLINE void IMB_colormanagement_srgb_to_scene_linear_v3(float scene_linear[3], const float srgb[3])
Read Guarded memory(de)allocation.
for(;discarded_id_iter !=nullptr;discarded_id_iter=static_cast< ID * >(discarded_id_iter->next))
#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
ColorSceneLinearByteEncoded4b< Alpha > encode() 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
#define ID_IS_EDITABLE(_id)
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 Color BLI_mix_colors(const IMB_BlendMode tool, const Color a, const Color b, const typename Traits::BlendType alpha)
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)
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)
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)
void init_session_data(const ToolSettings &ts, Object &ob)
bool test_brush_angle_falloff(const Brush &brush, const NormalAnglePrecalc &normal_angle_precalc, const float angle_cos, float *brush_strength)
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 smooth_brush_toggle_off(const bContext *C, Paint *paint, StrokeCache *cache)
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)
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 init_session(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob, eObjectMode object_mode)
void last_stroke_update(Scene &scene, const float location[3])
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)
bool paint_supports_dynamic_size(const Brush &br, PaintMode mode)
void ensure_valid_pivot(const Object &ob, Scene &scene)
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 void to_static_color_type(const eCustomDataType type, const Func &func)
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 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)
static ColorPaint4f vpaint_get_current_col(Scene &scene, VPaint &vp, bool secondary)
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)
static blender::float3 get_brush_color(const Scene *scene, const Brush *brush, const Paint *paint, const StrokeCache &cache, const ColorPaint4f &paint_color)
void ED_object_vpaintmode_exit_ex(Object &ob)
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 eCustomDataType type, const Brush &brush)
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 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 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 UnifiedPaintSettings &ups, const PaintModeSettings &)
struct CurveMapping * curve
ObjectRuntimeHandle * runtime
struct SculptSession * sculpt
struct Paint_Runtime runtime
struct ToolSettings * toolsettings
blender::ed::sculpt_paint::StrokeCache * cache
blender::Array< MDeformVert > dvert_prev
struct SculptSession::@277147341176372332050050347244236340077143206264 mode
struct SculptSession::@277147341176372332050050347244236340077143206264::@267002172247257132177045334232116313020165177372 wpaint
float average_stroke_accum[3]
int average_stroke_counter
Span< float3 > vert_positions
Span< float3 > vert_normals
VertProjHandle * vp_handle
struct VPaintData::@256174170253011351272116003037302224310107061335 smear
NormalAnglePrecalc normal_angle_precalc
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_)