10#define DNA_DEPRECATED_ALLOW
96 Palette *palette = id_cast<Palette *>(
id);
105 std::optional<Library *> ,
110 Palette *palette_dst = id_cast<Palette *>(id_dst);
111 const Palette *palette_src = id_cast<const Palette *>(id_src);
118 Palette *palette = id_cast<Palette *>(
id);
120 palette->
colors.free_no_destruct();
126 Palette *palette = id_cast<Palette *>(
id);
136 Palette *palette = id_cast<Palette *>(
id);
146 Palette *palette = id_cast<Palette *>(
id);
162 .id_code = Palette::id_type,
164 .dependencies_id_types = 0,
166 .struct_size =
sizeof(
Palette),
168 .name_plural =
N_(
"palettes"),
171 .asset_type_info =
nullptr,
176 .make_local =
nullptr,
177 .foreach_id =
nullptr,
178 .foreach_cache =
nullptr,
179 .foreach_path =
nullptr,
181 .foreach_asset_weak_reference =
nullptr,
182 .owner_pointer_get =
nullptr,
186 .blend_read_after_liblink =
nullptr,
190 .lib_override_apply_post =
nullptr,
194 std::optional<Library *> ,
199 PaintCurve *paint_curve_dst = id_cast<PaintCurve *>(id_dst);
200 const PaintCurve *paint_curve_src = id_cast<const PaintCurve *>(id_src);
204 MEM_dupalloc(paint_curve_src->
points));
210 PaintCurve *paint_curve = id_cast<PaintCurve *>(
id);
212 MEM_SAFE_DELETE(paint_curve->
points);
233 .id_code = PaintCurve::id_type,
235 .dependencies_id_types = 0,
238 .name =
"PaintCurve",
239 .name_plural =
N_(
"paint_curves"),
242 .asset_type_info =
nullptr,
244 .init_data =
nullptr,
247 .make_local =
nullptr,
248 .foreach_id =
nullptr,
249 .foreach_cache =
nullptr,
250 .foreach_path =
nullptr,
251 .foreach_working_space_color =
nullptr,
252 .foreach_asset_weak_reference =
nullptr,
253 .owner_pointer_get =
nullptr,
257 .blend_read_after_liblink =
nullptr,
259 .blend_read_undo_preserve =
nullptr,
261 .lib_override_apply_post =
nullptr,
264namespace bke::paint {
269 const Brush *br = BKE_paint_brush_for_read(&paint);
274 if (br->mtex.tex == tex) {
275 paint.runtime->overlay_flags |= eOverlayControlFlags::InvalidTexturePrimary;
277 if (br->mask_mtex.tex == tex) {
278 paint.runtime->overlay_flags |= eOverlayControlFlags::InvalidTextureSecondary;
286 const Brush *br = BKE_paint_brush_for_read(&paint);
287 if (br && br->curve_distance_falloff == curve) {
288 paint.runtime->overlay_flags |= eOverlayControlFlags::InvalidCurve;
305 [&](
Paint &
paint) { invalidate_overlay_all(paint); });
310 return paint.runtime->overlay_flags;
333 paint.runtime->overlay_flags &= ~(flag);
352 paint.runtime->primary_snap = std::make_unique<TexSnapshot>();
353 paint.runtime->secondary_snap = std::make_unique<TexSnapshot>();
354 paint.runtime->cursor_snap = std::make_unique<CursorSnapshot>();
364 Paint **paint_ptr =
nullptr;
367 Paint *paint_tmp =
nullptr;
371 paint_ptr =
reinterpret_cast<Paint **
>(&ts->
sculpt);
374 paint_ptr =
reinterpret_cast<Paint **
>(&ts->
vpaint);
377 paint_ptr =
reinterpret_cast<Paint **
>(&ts->
wpaint);
382 paint_ptr = &paint_tmp;
474 if (sce && view_layer) {
480 switch (actob->
mode) {
517 if (sce && view_layer) {
523 if (sima !=
nullptr) {
547 if (sce && view_layer) {
552 if (sima !=
nullptr) {
563 switch (obact->
mode) {
601 switch (tref->
mode) {
629 switch (tref->
mode) {
649 if (
paint->brush !=
nullptr) {
652 if (
paint->brush_asset_reference ==
nullptr) {
662 if (
brush ==
nullptr || (
paint->runtime->ob_mode &
brush->ob_mode) == 0) {
663 MEM_delete(
paint->brush_asset_reference);
664 paint->brush_asset_reference =
nullptr;
684 if (
paint ==
nullptr) {
695 return MEM_new<AssetWeakReference>(__func__, *weak_ref);
725 MEM_delete(
paint->brush_asset_reference);
726 paint->brush_asset_reference =
nullptr;
727 if (
brush !=
nullptr) {
729 paint->brush_asset_reference = MEM_new<AssetWeakReference>(__func__, brush_asset_reference);
745 MEM_delete(
paint->brush_asset_reference);
746 paint->brush_asset_reference =
nullptr;
747 if (
brush !=
nullptr) {
759 switch (asset_category) {
761 return "essentials_brushes-mesh_sculpt.blend";
763 return "essentials_brushes-mesh_vertex.blend";
765 return "essentials_brushes-mesh_weight.blend";
767 return "essentials_brushes-mesh_texture.blend";
769 return "essentials_brushes-gp_draw.blend";
771 return "essentials_brushes-gp_sculpt.blend";
773 return "essentials_brushes-gp_weight.blend";
775 return "essentials_brushes-gp_vertex.blend";
777 return "essentials_brushes-curve_sculpt.blend";
788 if (!essentials_file_name) {
796 "brushes/%s/Brush/%s", essentials_file_name, name);
805 if (!essentials_file_name) {
813 "brushes/%s/Brush/%s", essentials_file_name, name);
822 name, asset_category);
827 return reinterpret_cast<Brush *
>(
834 MEM_delete(
paint->brush_asset_reference);
838 name,
paint->runtime->asset_category);
839 paint->brush =
nullptr;
843 std::optional<int> brush_type,
846 const char *name =
"";
848 switch (asset_category) {
857 name =
"Face Set Paint";
866 name =
"Erase Multires Displacement";
869 name =
"Smear Multires Displacement";
965 name =
"Eraser Hard";
1057 if (!
paint->runtime || !
paint->runtime->initialized) {
1067 if (do_regular && !name.
is_empty()) {
1116 if (!
paint->runtime->previous_active_brush_reference) {
1117 paint->runtime->previous_active_brush_reference = MEM_new<AssetWeakReference>(__func__);
1119 *
paint->runtime->previous_active_brush_reference = asset_weak_reference;
1124 MEM_SAFE_DELETE(
paint->runtime->previous_active_brush_reference);
1136 foreach_reference(
paint.brush_asset_reference);
1137 if (
paint.runtime) {
1138 foreach_reference(
paint.runtime->previous_active_brush_reference);
1141 foreach_reference(
paint.tool_brush_bindings.main_brush_asset_reference);
1143 paint.tool_brush_bindings.active_brush_per_brush_type)
1162 if (!
paint->runtime) {
1163 paint->runtime = MEM_new<bke::PaintRuntime>(__func__);
1206 paint->runtime->primary_snap = std::make_unique<bke::paint::TexSnapshot>();
1207 paint->runtime->secondary_snap = std::make_unique<bke::paint::TexSnapshot>();
1208 paint->runtime->cursor_snap = std::make_unique<bke::paint::CursorSnapshot>();
1209 paint->runtime->initialized =
true;
1218 return brush->image_brush_type;
1220 return brush->sculpt_brush_type;
1222 return brush->vertex_brush_type;
1224 return brush->weight_brush_type;
1226 return brush->gpencil_brush_type;
1228 return brush->gpencil_vertex_brush_type;
1230 return brush->gpencil_sculpt_brush_type;
1232 return brush->gpencil_weight_brush_type;
1234 return brush->curves_sculpt_brush_type;
1246 return brush->image_brush_type;
1248 return brush->sculpt_brush_type;
1250 return brush->vertex_brush_type;
1252 return brush->weight_brush_type;
1254 return brush->gpencil_brush_type;
1256 return brush->gpencil_vertex_brush_type;
1258 return brush->gpencil_sculpt_brush_type;
1260 return brush->gpencil_weight_brush_type;
1262 return brush->curves_sculpt_brush_type;
1284 paint->palette = palette;
1312 palette->
colors.free_no_destruct();
1342 return ((ob !=
nullptr) && (ob->
type ==
OB_MESH) && (ob->
data !=
nullptr) &&
1349 return ((ob !=
nullptr) && (ob->
type ==
OB_MESH) && (ob->
data !=
nullptr) &&
1356 if (ob ==
nullptr || ob->
data ==
nullptr) {
1374 return ((ob !=
nullptr) && (ob->
type ==
OB_MESH) && (ob->
data !=
nullptr) &&
1383 if (!
paint->cavity_curve) {
1386 cumap =
paint->cavity_curve;
1420 paint.unified_paint_settings.size = default_ups.
size;
1423 paint.unified_paint_settings.alpha = default_ups.
alpha;
1424 paint.unified_paint_settings.weight = default_ups.
weight;
1425 paint.unified_paint_settings.flag = default_ups.
flag;
1426 if (!
paint.unified_paint_settings.curve_rand_hue) {
1429 if (!
paint.unified_paint_settings.curve_rand_saturation) {
1432 if (!
paint.unified_paint_settings.curve_rand_value) {
1443 if (!(*r_paint)->runtime) {
1444 (*r_paint)->runtime = MEM_new<bke::PaintRuntime>(__func__);
1446 if (!(*r_paint)->runtime->initialized && *r_paint ==
reinterpret_cast<Paint *
>(&ts->
imapaint))
1473 if ((
reinterpret_cast<VPaint **
>(r_paint) == &ts->
vpaint) ||
1481 else if (
reinterpret_cast<Sculpt **
>(r_paint) == &ts->
sculpt) {
1529 if (
paint->brush_asset_reference) {
1533 if (!
paint->brush) {
1540 if (!
paint.mesh_automasking_settings) {
1541 paint.mesh_automasking_settings = MEM_new<MeshAutomaskingSettings>(__func__);
1552 if (ensure_brushes) {
1556 if (!
paint->cavity_curve) {
1568 MEM_delete(
paint->brush_asset_reference);
1569 MEM_delete(
paint->tool_brush_bindings.main_brush_asset_reference);
1572 paint->tool_brush_bindings.active_brush_per_brush_type.items_mutable())
1574 MEM_delete(brush_ref.name);
1575 MEM_delete(brush_ref.brush_asset_reference);
1576 MEM_delete(&brush_ref);
1583 if (
paint->mesh_automasking_settings) {
1586 MEM_delete(
paint->mesh_automasking_settings);
1589 MEM_SAFE_DELETE(
paint->runtime);
1634 dst->
runtime = MEM_new<bke::PaintRuntime>(__func__);
1674namespace bke::paint {
1683 return ob->object_to_world().location();
1702 const float3 &initial_hsv_jitter,
1704 const float pressure,
1707 constexpr float noise_scale = 1 / 20.0f;
1710 initial_hsv_jitter[0] :
1715 initial_hsv_jitter[1] :
1720 initial_hsv_jitter[2] :
1724 float hue_jitter_scale = color_jitter.
hue;
1728 float sat_jitter_scale = color_jitter.
saturation;
1732 float val_jitter_scale = color_jitter.
value;
1742 if (hsv[0] > 1.0f) {
1745 else if (hsv[0] < 0.0f) {
1754 return random_color;
1759 if (
paint->cavity_curve) {
1762 if (
paint->brush_asset_reference) {
1782 if (
paint->unified_paint_settings.curve_rand_hue) {
1786 if (
paint->unified_paint_settings.curve_rand_saturation) {
1790 if (
paint->unified_paint_settings.curve_rand_value) {
1794 if (
paint->mesh_automasking_settings) {
1810 if (
paint->cavity_curve) {
1818 if (
paint->brush_asset_reference) {
1862 if (
paint->mesh_automasking_settings) {
1878 paint->runtime = MEM_new<bke::PaintRuntime>(__func__);
1904 }
while ((l_iter = l_iter->
next) != l_first);
1909namespace bke::paint {
1912 switch (paint_mode) {
1941 switch (paint_mode) {
1975 return gpm->
data[(
y * factor) * gridsize + (
x * factor)];
1988 return std::max(rotation_spacing, 20.0f);
1990 else if (is_first_dab) {
1992 return std::min(rotation_spacing, 4.0f);
1995 return rotation_spacing;
2025 const float mouse_pos[2],
2139SculptSession::SculptSession() =
default;
2154 return active_vert_;
2159 return last_active_vert_;
2164 if (std::holds_alternative<int>(active_vert_)) {
2165 return std::get<int>(active_vert_);
2167 if (std::holds_alternative<BMVert *>(active_vert_)) {
2168 BMVert *bm_vert = std::get<BMVert *>(active_vert_);
2177 if (std::holds_alternative<int>(last_active_vert_)) {
2178 return std::get<int>(last_active_vert_);
2180 if (std::holds_alternative<BMVert *>(last_active_vert_)) {
2181 BMVert *bm_vert = std::get<BMVert *>(last_active_vert_);
2190 if (std::holds_alternative<int>(active_vert_)) {
2192 return this->
subdiv_ccg->positions[std::get<int>(active_vert_)];
2195 return positions[std::get<int>(active_vert_)];
2197 if (std::holds_alternative<BMVert *>(active_vert_)) {
2198 BMVert *bm_vert = std::get<BMVert *>(active_vert_);
2203 return float3(std::numeric_limits<float>::infinity());
2208 if (persist_last_active) {
2209 if (!std::holds_alternative<std::monostate>(active_vert_)) {
2210 last_active_vert_ = active_vert_;
2214 last_active_vert_ = {};
2223 active_vert_ = vert;
2230 return std::nullopt;
2234 this->subdiv_ccg->grid_size !=
persistent.grid_size)
2236 return std::nullopt;
2246 const bool auto_create_mdisps)
2255 bool need_mdisps =
false;
2258 if (!auto_create_mdisps) {
2382 if (mesh_eval ==
nullptr) {
2399 bool used_me_eval =
false;
2418 used_me_eval =
true;
2425 if (ss.
deform_cos.is_empty() && !used_me_eval) {
2448 if (is_paint_tool) {
2504 pbvh->tag_positions_changed(node_mask);
2529 if (!orig_me->attributes_for_write().add(
2567 int gridarea = gridsize * gridsize;
2572 for (
int i = 0; i <
mesh->corners_num; i++) {
2587 for (
const int vert : corner_verts.
slice(face)) {
2588 avg += mask_span[vert];
2593 for (
const int corner : face) {
2595 const int vert = corner_verts[corner];
2600 gpm->
data[1] = (mask_span[vert] + mask_span[next]) * 0.5f;
2601 gpm->
data[2] = (mask_span[vert] + mask_span[prev]) * 0.5f;
2602 gpm->
data[3] = mask_span[vert];
2619 bool deformed =
false;
2624 deformed |=
object->runtime->sculpt_session->deform_modifiers_active;
2626 if (for_construction) {
2627 deformed |=
object->runtime->sculpt_session->shapekey_active !=
nullptr;
2633 deformed |=
object->runtime->sculpt_session->shapekey_active &&
2657 for (const int i : range) {
2658 const bool face_hidden = hide_poly_span[i];
2659 for (const int corner : faces[i]) {
2660 grid_hidden[corner].set_all(face_hidden);
2678 const Mesh *me_eval_deform)
2684 if (is_deformed && me_eval_deform !=
nullptr) {
2708 BLI_assert(
object.runtime->sculpt_session !=
nullptr);
2711 if (ss.
bm !=
nullptr) {
2717 Mesh *mesh_eval = id_cast<Mesh *>(object_eval->
data);
2732 if (!
object.runtime->sculpt_session) {
2735 return object.runtime->sculpt_session->pbvh.get();
2741 if (!
object.runtime->sculpt_session) {
2744 return object.runtime->sculpt_session->pbvh.get();
2751 return object->runtime->sculpt_session &&
object->runtime->sculpt_session->bm;
2767 const bool external_engine = rv3d && rv3d->
view_render !=
nullptr;
2777 return !external_engine;
2785#define GOLDEN_RATIO_CONJUGATE 0.618033988749895f
2790 random_mod_hue = random_mod_hue -
floorf(random_mod_hue);
2794 0.6f + (random_mod_sat * 0.25f),
2795 1.0f - (random_mod_val * 0.35f),
Generic geometry attributes built on CustomData.
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
A BVH for high poly meshes.
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_PALETTE
#define BLT_I18NCONTEXT_ID_PAINTCURVE
#define ID_IS_LINKED(_id)
#define BRUSH_OVERLAY_OVERRIDE_MASK
Object is a sort of wrapper for general info.
#define USER_EXPERIMENTAL_TEST(userdef, member)
Read Blender memory allocation and freeing.
#define PRF_scope(category)
#define GOLDEN_RATIO_CONJUGATE
#define BLI_assert_unreachable()
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
#define BM_FACE_FIRST_LOOP(p)
#define BM_elem_index_get(ele)
#define BM_elem_flag_test(ele, hflag)
static AttributeOwner from_id(ID *id)
constexpr int64_t size() const
constexpr Span slice(int64_t start, int64_t size) const
constexpr const char * c_str() const
T get_internal_single() const
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
GAttributeReader lookup(const StringRef name) const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
static Tree from_bmesh(BMesh &bm)
static Tree from_grids(const Mesh &base_mesh, const SubdivCCG &subdiv_ccg)
static Tree from_mesh(const Mesh &mesh)
constexpr bool is_empty() const
IndexRange index_range() const
float distance(float, float) RET
bool implements_3d_texture_paint(const Brush &brush)
int face_corner_prev(const IndexRange face, const int corner)
int face_corner_next(const IndexRange face, const int corner)
pbvh::Tree & pbvh_ensure(Depsgraph &depsgraph, Object &object)
pbvh::Tree * pbvh_get(Object &object)
void stroke_track_location(Paint &paint, float3 location)
bool supports_symmetry_tiling(PaintMode paint_mode, const Brush &brush)
void set_overlay_brush_override(Paint &paint, eOverlayFlags flag)
void stroke_set_location(Paint &paint, float3 location)
void invalidate_overlay_all(Scene &scene)
float3 stroke_get_average(const Paint *paint, const Object *ob)
void reset_overlay_flag(Paint &paint, eOverlayControlFlags flag)
bool supports_scene_size(PaintMode paint_mode, const Brush &brush)
void invalidate_overlay_tex(Scene &scene, const Tex *tex)
void invalidate_cursor_overlay(Scene &scene, CurveMapping *curve)
eOverlayControlFlags get_overlay_flags(const Paint &paint)
void cursor_reinitialize_textures(Paint &paint)
void update_normals(const Depsgraph &depsgraph, Object &object_orig, Tree &pbvh)
IndexMask all_leaf_nodes(const Tree &pbvh, IndexMaskMemory &memory)
void update_normals_from_eval(Object &object_eval, Tree &pbvh)
Span< float3 > vert_positions_eval(const Depsgraph &depsgraph, const Object &object_orig)
ID * asset_edit_id_from_weak_reference(Main &global_main, ID_Type id_type, const AssetWeakReference &weak_ref)
static std::unique_ptr< pbvh::Tree > build_pbvh_from_regular_mesh(Object *ob, const Mesh *me_eval_deform)
std::optional< AssetWeakReference > asset_edit_weak_reference_from_id(const ID &id)
static std::unique_ptr< pbvh::Tree > build_pbvh_from_ccg(Object *ob, SubdivCCG &subdiv_ccg)
static std::unique_ptr< pbvh::Tree > build_pbvh_for_dynamic_topology(Object *ob)
bool asset_edit_id_is_editable(const ID &id)
void shallow_swap(T &a, T &b)
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
CartesianBasis invert(const CartesianBasis &basis)
T interpolate(const T &a, const T &b, const FactorT &t)
float perlin(float position)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
void WM_main_add_notifier(uint type, void *reference)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BKE_sculptsession_free(Object *ob)
static void paint_curve_blend_write(BlendWriter *writer, ID *id, const void *id_address)
static bool paint_brush_update_from_asset_reference(Main *bmain, Paint *paint)
static void palette_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
void BKE_palette_color_set(PaletteColor *color, const float rgb[3])
CurveMapping * BKE_curvemapping_copy(const CurveMapping *cumap)
const EnumPropertyItem rna_enum_brush_gpencil_weight_types_items[]
eObjectMode BKE_paint_object_mode_from_paintmode(PaintMode mode)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
void linearrgb_to_srgb_v3_v3(float srgb[3], const float linear[3])
void BKE_id_attributes_default_color_set(struct ID *id, std::optional< StringRef > name)
void BKE_pbvh_mark_rebuild_pixels(bke::pbvh::Tree &pbvh)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
@ GPWEIGHT_BRUSH_TYPE_SMEAR
@ GPWEIGHT_BRUSH_TYPE_DRAW
@ GPWEIGHT_BRUSH_TYPE_BLUR
@ GPWEIGHT_BRUSH_TYPE_AVERAGE
bool BKE_object_sculpt_use_dyntopo(const Object *object)
std::variant< std::monostate, int, BMVert * > ActiveVert
MultiresModifierData * BKE_sculpt_multires_active(const Scene *scene, Object *ob)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BKE_paint_brushes_set_default_references(ToolSettings *ts)
static AssetWeakReference * paint_brush_asset_reference_ptr_from_essentials(const char *name, const bke::paint::AssetCategory asset_category)
static void palette_undo_preserve(BlendLibReader *, ID *id_new, ID *id_old)
bool BKE_paint_brush_set_default(Main *bmain, Paint *paint)
void hsv_to_rgb(float h, float s, float v, float *r_r, float *r_g, float *r_b)
static std::optional< AssetWeakReference > paint_brush_asset_reference_from_essentials(const char *name, const bke::paint::AssetCategory asset_category)
std::optional< AssetWeakReference > BKE_paint_brush_type_default_reference(bke::paint::AssetCategory asset_category, std::optional< int > brush_type)
void BKE_sculpt_sync_face_visibility_to_grids(const Mesh &mesh, SubdivCCG &subdiv_ccg)
bool BKE_paint_calculate_rake_rotation(Paint &paint, const Brush &brush, const float mouse_pos[2], PaintMode paint_mode, bool in_stroke, bool is_first_dab)
static bool sculpt_modifiers_active(const Scene *scene, const Sculpt *sd, Object *ob)
MINLINE int square_i(int a)
void BKE_paint_settings_foreach_mode(ToolSettings *ts, FunctionRef< void(Paint &paint)> fn)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
static void paint_curve_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void BKE_paint_previous_asset_reference_clear(Paint *paint)
@ BRUSH_COLOR_JITTER_USE_SAT_RAND_PRESS
@ BRUSH_COLOR_JITTER_USE_HUE_AT_STROKE
@ BRUSH_COLOR_JITTER_USE_VAL_AT_STROKE
@ BRUSH_COLOR_JITTER_USE_HUE_RAND_PRESS
@ BRUSH_COLOR_JITTER_USE_SAT_AT_STROKE
@ BRUSH_COLOR_JITTER_USE_VAL_RAND_PRESS
KeyBlock * BKE_keyblock_from_object(Object *ob)
void BKE_sculptsession_update_before_eval(Object *ob_eval)
void rgb_to_hsv_v(const float rgb[3], float r_hsv[3])
static void paint_brush_set_default_reference(Paint *paint, const bool do_regular=true)
@ WPAINT_BRUSH_TYPE_AVERAGE
@ WPAINT_BRUSH_TYPE_SMEAR
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
void BKE_curvemapping_blend_write(BlendWriter *writer, const CurveMapping *cumap)
void BKE_pbvh_vert_coords_apply(bke::pbvh::Tree &pbvh, Span< float3 > vert_positions)
const EnumPropertyItem rna_enum_brush_gpencil_types_items[]
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
static void palette_blend_write(BlendWriter *writer, ID *id, const void *id_address)
int CCG_grid_factor(int low_level, int high_level)
MINLINE int max_ii(int a, int b)
void BM_log_free(BMLog *log)
int BKE_sculpt_get_grid_num_faces(const Object &object)
void BKE_mesh_tessface_clear(Mesh *mesh)
void BKE_sculptsession_bm_to_me(Object *ob)
void BKE_paint_copy(const Paint *src, Paint *dst, int flag)
std::string BKE_attribute_calc_unique_name(const AttributeOwner &owner, StringRef name)
void BKE_paint_mesh_automasking_settings_ensure(Paint &paint)
void BKE_curvemapping_free(CurveMapping *cumap)
void id_fake_user_set(ID *id)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
@ ASSET_LIBRARY_ESSENTIALS
void BKE_sculptsession_free_pbvh(Object &object)
bool BKE_paint_is_grid_face_hidden(BoundedBitSpan grid_hidden, int gridsize, int x, int y)
@ CTX_MODE_VERTEX_GREASE_PENCIL
@ CTX_MODE_VERTEX_GPENCIL_LEGACY
@ CTX_MODE_WEIGHT_GPENCIL_LEGACY
@ CTX_MODE_PAINT_GREASE_PENCIL
@ CTX_MODE_PAINT_GPENCIL_LEGACY
@ CTX_MODE_SCULPT_GREASE_PENCIL
@ CTX_MODE_SCULPT_GPENCIL_LEGACY
@ CTX_MODE_WEIGHT_GREASE_PENCIL
@ LIB_ID_CREATE_NO_USER_REFCOUNT
BLI_INLINE float BLI_hash_int_01(unsigned int k)
ViewLayer * CTX_data_view_layer(const bContext *C)
BitGroupVector & BKE_subdiv_ccg_grid_hidden_ensure(SubdivCCG &subdiv_ccg)
void BKE_sculpt_mask_layers_ensure(Depsgraph *depsgraph, Main *bmain, Object *ob, MultiresModifierData *mmd)
void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain)
static void palette_free_data(ID *id)
static void paint_curve_blend_read_data(BlendDataReader *reader, ID *id)
CCGKey BKE_subdiv_ccg_key_top_level(const SubdivCCG &subdiv_ccg)
void BKE_subdiv_ccg_grid_hidden_free(SubdivCCG &subdiv_ccg)
@ SCULPT_BRUSH_TYPE_SIMPLIFY
@ SCULPT_BRUSH_TYPE_CLAY_STRIPS
@ SCULPT_BRUSH_TYPE_DRAW_FACE_SETS
@ SCULPT_BRUSH_TYPE_PAINT
@ SCULPT_BRUSH_TYPE_DISPLACEMENT_ERASER
@ SCULPT_BRUSH_TYPE_DISPLACEMENT_SMEAR
@ GPSCULPT_BRUSH_TYPE_CLONE
static void paint_brush_default_essentials_name_get(const bke::paint::AssetCategory asset_category, std::optional< int > brush_type, StringRefNull *r_name)
std::optional< int > BKE_paint_get_brush_type_from_paintmode(const Brush *brush, PaintMode mode)
const EnumPropertyItem rna_enum_brush_image_brush_type_items[]
void BKE_curvemapping_init(CurveMapping *cumap)
PaintCurve * BKE_paint_curve_add(Main *bmain, const char *name)
const EnumPropertyItem rna_enum_brush_gpencil_vertex_types_items[]
@ GPAINT_BRUSH_TYPE_ERASE
void BKE_curvemapping_blend_read(BlendDataReader *reader, CurveMapping *cumap)
void BKE_palette_color_sync_legacy(PaletteColor *color)
static void paint_runtime_init(const ToolSettings *ts, Paint *paint)
Brush * BKE_paint_brush_from_essentials(Main *bmain, bke::paint::AssetCategory asset_category, const char *name)
VecBase< float, 2 > float2
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void DEG_id_tag_update(ID *id, unsigned int flags)
void hsv_to_rgb_v(const float hsv[3], float r_rgb[3])
@ OB_MODE_VERTEX_GREASE_PENCIL
@ OB_MODE_SCULPT_GREASE_PENCIL
@ OB_MODE_WEIGHT_GREASE_PENCIL
@ OB_MODE_PAINT_GREASE_PENCIL
BMesh const char void * data
void BKE_sculptsession_update_after_eval(Depsgraph *depsgraph, Object *ob_eval)
Mesh * BKE_mesh_from_object(Object *ob)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
bool BKE_paint_select_elem_test(const Object *ob)
void BKE_curvemap_reset(CurveMap *cuma, const rctf *clipr, int preset, CurveMapSlopeType slope)
void BKE_paint_blend_read_data(BlendDataReader *reader, const Scene *scene, Paint *paint)
void BKE_paint_brushes_ensure(Main *bmain, Paint *paint)
Palette * BKE_paint_palette(Paint *paint)
void BKE_paint_init(Main *bmain, Scene *sce, PaintMode mode, bool ensure_brushes=true)
ModifierData * BKE_modifiers_get_virtual_modifierlist(const Object *ob, VirtualModifierData *data)
void BKE_curvemapping_changed(CurveMapping *cumap, bool rem_doubles)
int BKE_sculpt_get_grid_num_verts(const Object &object)
PaintMode BKE_paintmode_get_from_tool(const bToolRef *tref)
const EnumPropertyItem rna_enum_brush_sculpt_brush_type_items[]
@ IMAGE_PAINT_BRUSH_TYPE_SOFTEN
@ IMAGE_PAINT_BRUSH_TYPE_SMEAR
@ IMAGE_PAINT_BRUSH_TYPE_DRAW
@ IMAGE_PAINT_BRUSH_TYPE_FILL
@ IMAGE_PAINT_BRUSH_TYPE_MASK
@ IMAGE_PAINT_BRUSH_TYPE_CLONE
static AssetWeakReference * asset_reference_create_from_brush(Brush *brush)
CurveMapping * BKE_sculpt_default_cavity_curve()
bool BKE_view_layer_synced_ensure(const Main &bmain, const Scene *scene, ViewLayer *view_layer)
const EnumPropertyItem rna_enum_brush_vertex_brush_type_items[]
void BKE_paint_foreach_asset_weak_reference(Paint &paint, FunctionRef< void(AssetWeakReference &weak_ref)> fn)
bool BKE_paint_always_hide_test(const Object *ob)
static const char * paint_brush_essentials_asset_file_name_from_asset_category(const bke::paint::AssetCategory asset_category)
void BKE_asset_weak_reference_write(BlendWriter *writer, const AssetWeakReference *weak_ref)
static bool paint_rake_rotation_active(const MTex &mtex)
@ CURVES_SCULPT_BRUSH_TYPE_ADD
@ CURVES_SCULPT_BRUSH_TYPE_DENSITY
@ CURVES_SCULPT_BRUSH_TYPE_DELETE
@ CURVES_SCULPT_BRUSH_TYPE_SELECTION_PAINT
bool BKE_paint_brush_set(Paint *paint, Brush *brush)
void BKE_paint_cavity_curve_preset(Paint *paint, int preset)
void BKE_paint_update_brush_rake_rotation(Paint &paint, const Brush &brush, float rotation)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
bool BKE_paint_select_face_test(const Object *ob)
void BKE_paint_previous_asset_reference_set(Paint *paint, AssetWeakReference &&asset_weak_reference)
void BKE_image_pool_free(ImagePool *pool)
MatBase< float, 3, 3 > float3x3
Mesh * BKE_object_get_evaluated_mesh_unchecked(const Object *object)
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
float BKE_paint_grid_paint_mask(const GridPaintMask *gpm, uint level, uint x, uint y)
void BKE_sculpt_color_layer_create_if_needed(Object *object)
static MultiresModifierData * sculpt_multires_modifier_get(const Scene *scene, Object *ob, const bool auto_create_mdisps)
void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, int add_index)
int CCG_grid_xy_to_index(const int grid_size, const int x, const int y)
void BLO_read_array_and_validate_size(BlendDataReader *reader, T **ptr_p, SizeT *array_size, const int elems=1)
PaletteColor * BKE_palette_color_add(Palette *palette)
void BKE_sculptsession_free_deformMats(SculptSession *ss)
const Brush * BKE_paint_brush_for_read(const Paint *paint)
SpaceImage * CTX_wm_space_image(const bContext *C)
const EnumPropertyItem * BKE_paint_get_tool_enum_from_paintmode(PaintMode mode)
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
void BKE_lib_id_swap(Main *bmain, ID *id_a, ID *id_b, const bool do_self_remap, const int self_remap_flags)
@ GPVERTEX_BRUSH_TYPE_REPLACE
@ GPVERTEX_BRUSH_TYPE_BLUR
@ GPVERTEX_BRUSH_TYPE_AVERAGE
@ GPVERTEX_BRUSH_TYPE_TINT
@ GPVERTEX_BRUSH_TYPE_SMEAR
@ GPVERTEX_BRUSH_TYPE_DRAW
void BM_data_layer_ensure_named(BMesh *bm, CustomData *data, int type, const StringRef name)
static void palette_init_data(ID *id)
T * DEG_get_original(T *id)
bool BKE_sculptsession_use_pbvh_draw(const Object *ob, const RegionView3D *rv3d)
bool BKE_paint_can_use_brush(const Paint *paint, const Brush *brush)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
const EnumPropertyItem rna_enum_brush_weight_brush_type_items[]
Main * CTX_data_main(const bContext *C)
static void paint_init_data(Paint &paint)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
void BKE_paint_free(Paint *paint)
static void palette_blend_read_data(BlendDataReader *reader, ID *id)
Paint * BKE_paint_get_active_from_context(const bContext *C)
void BKE_paint_face_set_overlay_color_get(int face_set, int seed, uchar r_color[4])
bool BKE_brush_has_cube_tip(const Brush *brush, PaintMode paint_mode)
void GPU_texture_free(gpu::Texture *texture)
Paint * BKE_paint_get_active_from_paintmode(Scene *sce, PaintMode mode)
void BKE_asset_weak_reference_read(BlendDataReader *reader, AssetWeakReference *weak_ref)
void BKE_id_attributes_active_color_set(struct ID *id, std::optional< StringRef > name)
bool BKE_paint_is_bmesh_face_hidden(const BMFace *f)
@ ID_RECALC_GEOMETRY_ALL_MODES
Scene * DEG_get_input_scene(const Depsgraph *graph)
@ eMultiresModifierFlag_UseSculptBaseMesh
int CCG_grid_size(const int level)
std::optional< int > BKE_paint_get_brush_type_from_obmode(const Brush *brush, eObjectMode ob_mode)
void BKE_sculptsession_update_for_edit(Depsgraph *depsgraph, Object *ob_orig, bool is_paint_tool)
CurveMapping * BKE_paint_default_curve()
Brush * BKE_paint_brush(Paint *paint)
void BKE_texpaint_slots_refresh_object(Scene *scene, Object *ob)
Scene * CTX_data_scene(const bContext *C)
bool BKE_paint_select_grease_pencil_test(const Object *ob)
Mesh * BKE_object_get_original_mesh(const Object *object)
void BKE_palette_clear(Palette *palette)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
bool BKE_paint_ensure_from_paintmode(Scene *sce, PaintMode mode)
VecBase< float, 3 > float3
static void paint_brush_set_essentials_reference(Paint *paint, const char *name)
bool BKE_paint_select_vert_test(const Object *ob)
@ BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE
@ BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE
@ BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE
bool BKE_paint_ensure(ToolSettings *ts, Paint **r_paint)
bool BKE_paint_brush_set_essentials(Main *bmain, Paint *paint, const char *name)
void BKE_paint_brushes_validate(Main *bmain, Paint *paint)
bool BKE_modifier_is_enabled(const Scene *scene, ModifierData *md, int required_mode)
static void sculptsession_bm_to_me_update_data_only(Object *ob)
float3 BKE_paint_randomize_color(const BrushColorJitterSettings &color_jitter, const float3 &initial_hsv_jitter, const float distance, const float pressure, const float3 &color)
std::string BKE_paint_canvas_key_get(ImagePaintSettings &settings, Object *ob)
static void paint_curve_free_data(ID *id)
const ModifierTypeInfo * BKE_modifier_get_info(ModifierType type)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
static void sculptsession_update(Depsgraph *depsgraph, Object *ob, Object *ob_eval, bool is_paint_tool)
float BKE_curvemapping_evaluateF(const CurveMapping *cumap, int cur, float value)
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_paint_palette_set(Paint *paint, Palette *palette)
static float paint_rake_rotation_spacing(const Paint &, const Brush &brush, bool in_stroke, bool is_first_dab)
void BKE_crazyspace_build_sculpt(Depsgraph *depsgraph, Scene *scene, Object *ob, Array< float3x3, 0 > &deformmats, Array< float3, 0 > &deformcos)
Paint * BKE_paint_get_active(const Main &bmain, Scene *sce, ViewLayer *view_layer)
const EnumPropertyItem rna_enum_brush_gpencil_sculpt_types_items[]
static bool check_sculpt_object_deformed(Object *object, const bool for_construction)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
static void palette_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
MINLINE void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4])
const Mesh * BKE_object_get_mesh_deform_eval(const Object *object)
void BKE_paint_blend_write(BlendWriter *writer, Paint *paint)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
Palette * BKE_palette_add(Main *bmain, const char *name)
@ CUMA_EXTEND_EXTRAPOLATE
bool BKE_id_attributes_color_find(const struct ID *id, StringRef name)
@ VPAINT_BRUSH_TYPE_SMEAR
@ VPAINT_BRUSH_TYPE_AVERAGE
const EnumPropertyItem rna_enum_brush_curves_sculpt_brush_type_items[]
@ IDTYPE_FLAGS_NO_ANIMDATA
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const char * asset_library_identifier
const char * relative_asset_identifier
eAssetLibraryType asset_library_type
void write_string(const char *data)
void write_id_struct(const void *id_address, const T *id, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct_list(const ListBaseT< T > *list, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
void write_struct_array(const int64_t array_size, const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
CurveMapping * curve_sat_jitter
CurveMapping * curve_val_jitter
CurveMapping * curve_hue_jitter
eCurveMappingPreset preset
IDProperty * system_properties
eMTex_BrushAngleMode brush_angle_mode
bool is_locked_for_linking
struct CurveMapping * cavity_curve_op
struct CurveMapping * cavity_curve
bke::MeshRuntime * runtime
char * active_color_attribute
struct ModifierData * next
MultiresModifierFlag flags
struct AssetWeakReference * brush_asset_reference
bke::ObjectRuntime * runtime
eObject_ShapeFlag shapeflag
struct CurveMapping * cavity_curve
struct UnifiedPaintSettings unified_paint_settings
bke::PaintRuntime * runtime
ToolSystemBrushBindings tool_brush_bindings
struct AssetWeakReference * brush_asset_reference
struct MeshAutomaskingSettings * mesh_automasking_settings
ListBaseT< PaletteColor > colors
struct ViewRender * view_render
struct ToolSettings * toolsettings
Array< int > fake_neighbor_index
std::unique_ptr< SculptBoundaryInfoCache > boundary_info_cache
ed::sculpt_paint::StrokeCache * cache
std::optional< std::string > last_paint_canvas_key
std::optional< int > active_face_index
Array< int > vert_to_edge_offsets
ActiveVert last_active_vert() const
Array< int > vert_to_edge_indices
int last_active_vert_index() const
KeyBlock * shapekey_active
void clear_active_elements(bool persist_last_active)
Array< float3, 0 > deform_cos
GroupedSpan< int > vert_to_edge_map
Array< int > edge_to_face_offsets
std::unique_ptr< SculptTopologyIslandCache > topology_island_cache
void set_active_vert(ActiveVert vert)
SculptFakeNeighbors fake_neighbors
float3 active_vert_position(const Depsgraph &depsgraph, const Object &object) const
std::optional< int > active_grid_index
std::optional< PersistentMultiresData > persistent_multires_data()
ed::sculpt_paint::filter::Cache * filter_cache
Array< float3x3, 0 > deform_imats
Array< int > edge_to_face_indices
MultiresModifierData * multires_modifier
ActiveVert active_vert() const
SharedCache< Vector< float3 > > vert_normals_deform
struct blender::SculptSession::@037313230252170341305206315164127110104334247060 persistent
GroupedSpan< int > edge_to_face_map
ed::sculpt_paint::expand::Cache * expand_cache
Array< int > preview_verts
std::unique_ptr< bke::pbvh::Tree > pbvh
SharedCache< Vector< float3 > > face_normals_deform
int active_vert_index() const
bool deform_modifiers_active
eUnifiedPaintSettingsFlags flag
struct CurveMapping * curve_rand_saturation
struct CurveMapping * curve_rand_value
struct CurveMapping * curve_rand_hue
std::unique_ptr< SubdivCCG > subdiv_ccg
SculptSession * sculpt_session
paint::AssetCategory asset_category
std::unique_ptr< paint::TexSnapshot > primary_snap
std::unique_ptr< paint::TexSnapshot > secondary_snap
float3 average_stroke_accum
std::unique_ptr< paint::CursorSnapshot > cursor_snap
int average_stroke_counter
gpu::Texture * overlay_texture
gpu::Texture * overlay_texture