Blender V5.0
paint.cc File Reference
#include <cstdlib>
#include <cstring>
#include <optional>
#include "MEM_guardedalloc.h"
#include "DNA_asset_types.h"
#include "DNA_brush_types.h"
#include "DNA_defaults.h"
#include "DNA_key_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_enums.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
#include "DNA_workspace_types.h"
#include "BLI_hash.h"
#include "BLI_listbase.h"
#include "BLI_math_color.h"
#include "BLI_math_matrix.hh"
#include "BLI_math_vector.h"
#include "BLI_noise.hh"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BLI_vector.hh"
#include "BLT_translation.hh"
#include "BKE_asset.hh"
#include "BKE_asset_edit.hh"
#include "BKE_attribute.hh"
#include "BKE_brush.hh"
#include "BKE_ccg.hh"
#include "BKE_colortools.hh"
#include "BKE_context.hh"
#include "BKE_crazyspace.hh"
#include "BKE_deform.hh"
#include "BKE_idtype.hh"
#include "BKE_image.hh"
#include "BKE_key.hh"
#include "BKE_layer.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_material.hh"
#include "BKE_mesh.hh"
#include "BKE_mesh_runtime.hh"
#include "BKE_modifier.hh"
#include "BKE_multires.hh"
#include "BKE_object.hh"
#include "BKE_paint.hh"
#include "BKE_paint_bvh.hh"
#include "BKE_paint_types.hh"
#include "BKE_scene.hh"
#include "BKE_subdiv_ccg.hh"
#include "DEG_depsgraph.hh"
#include "DEG_depsgraph_query.hh"
#include "RNA_enum_types.hh"
#include "BLO_read_write.hh"
#include "IMB_colormanagement.hh"
#include "bmesh.hh"

Go to the source code of this file.

Namespaces

namespace  blender
namespace  blender::bke
namespace  blender::bke::object

Macros

#define DNA_DEPRECATED_ALLOW
#define GOLDEN_RATIO_CONJUGATE   0.618033988749895f

Typedefs

using float3

Enumerations

enum class  AttrDomain

Functions

static void palette_init_data (ID *id)
static void palette_copy_data (Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
static void palette_free_data (ID *id)
static void palette_foreach_working_space_color (ID *id, const IDTypeForeachColorFunctionCallback &fn)
static void palette_blend_write (BlendWriter *writer, ID *id, const void *id_address)
static void palette_blend_read_data (BlendDataReader *reader, ID *id)
static void palette_undo_preserve (BlendLibReader *, ID *id_new, ID *id_old)
static void paint_curve_copy_data (Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
static void paint_curve_free_data (ID *id)
static void paint_curve_blend_write (BlendWriter *writer, ID *id, const void *id_address)
static void paint_curve_blend_read_data (BlendDataReader *reader, ID *id)
void BKE_paint_invalidate_overlay_tex (Scene *scene, ViewLayer *view_layer, const Tex *tex)
void BKE_paint_invalidate_cursor_overlay (Scene *scene, ViewLayer *view_layer, CurveMapping *curve)
void BKE_paint_invalidate_overlay_all ()
ePaintOverlayControlFlags BKE_paint_get_overlay_flags ()
void BKE_paint_set_overlay_override (eOverlayFlags flags)
void BKE_paint_reset_overlay_invalid (ePaintOverlayControlFlags flag)
bool BKE_paint_ensure_from_paintmode (Scene *sce, PaintMode mode)
PaintBKE_paint_get_active_from_paintmode (Scene *sce, PaintMode mode)
const EnumPropertyItemBKE_paint_get_tool_enum_from_paintmode (const PaintMode mode)
PaintBKE_paint_get_active (Scene *sce, ViewLayer *view_layer)
PaintBKE_paint_get_active_from_context (const bContext *C)
PaintMode BKE_paintmode_get_active_from_context (const bContext *C)
PaintMode BKE_paintmode_get_from_tool (const bToolRef *tref)
bool BKE_paint_use_unified_color (const Paint *paint)
static bool paint_brush_update_from_asset_reference (Main *bmain, Paint *paint)
BrushBKE_paint_brush (Paint *paint)
const BrushBKE_paint_brush_for_read (const Paint *paint)
bool BKE_paint_can_use_brush (const Paint *paint, const Brush *brush)
static AssetWeakReferenceasset_reference_create_from_brush (Brush *brush)
bool BKE_paint_brush_set (Main *bmain, Paint *paint, const AssetWeakReference &brush_asset_reference)
bool BKE_paint_brush_set (Paint *paint, Brush *brush)
static const char * paint_brush_essentials_asset_file_name_from_paint_mode (const PaintMode paint_mode)
static AssetWeakReferencepaint_brush_asset_reference_ptr_from_essentials (const char *name, const PaintMode paint_mode)
static std::optional< AssetWeakReferencepaint_brush_asset_reference_from_essentials (const char *name, const PaintMode paint_mode)
BrushBKE_paint_brush_from_essentials (Main *bmain, const PaintMode paint_mode, const char *name)
static void paint_brush_set_essentials_reference (Paint *paint, const char *name)
static void paint_eraser_brush_set_essentials_reference (Paint *paint, const char *name)
static void paint_brush_default_essentials_name_get (const PaintMode paint_mode, std::optional< int > brush_type, blender::StringRefNull *r_name, blender::StringRefNull *r_eraser_name=nullptr)
std::optional< AssetWeakReferenceBKE_paint_brush_type_default_reference (const PaintMode paint_mode, std::optional< int > brush_type)
static void paint_brush_set_default_reference (Paint *paint, const bool do_regular=true, const bool do_eraser=true)
void BKE_paint_brushes_set_default_references (ToolSettings *ts)
bool BKE_paint_brush_set_default (Main *bmain, Paint *paint)
bool BKE_paint_brush_set_essentials (Main *bmain, Paint *paint, const char *name)
void BKE_paint_previous_asset_reference_set (Paint *paint, AssetWeakReference &&asset_weak_reference)
void BKE_paint_previous_asset_reference_clear (Paint *paint)
void BKE_paint_brushes_validate (Main *bmain, Paint *paint)
static bool paint_eraser_brush_set_from_asset_reference (Main *bmain, Paint *paint)
BrushBKE_paint_eraser_brush (Paint *paint)
const BrushBKE_paint_eraser_brush_for_read (const Paint *paint)
bool BKE_paint_eraser_brush_set (Paint *paint, Brush *brush)
BrushBKE_paint_eraser_brush_from_essentials (Main *bmain, const PaintMode paint_mode, const char *name)
bool BKE_paint_eraser_brush_set_default (Main *bmain, Paint *paint)
bool BKE_paint_eraser_brush_set_essentials (Main *bmain, Paint *paint, const char *name)
static void paint_runtime_init (const ToolSettings *ts, Paint *paint)
uint BKE_paint_get_brush_type_offset_from_paintmode (const PaintMode mode)
std::optional< int > BKE_paint_get_brush_type_from_obmode (const Brush *brush, const eObjectMode ob_mode)
std::optional< int > BKE_paint_get_brush_type_from_paintmode (const Brush *brush, const PaintMode mode)
PaintCurveBKE_paint_curve_add (Main *bmain, const char *name)
PaletteBKE_paint_palette (Paint *paint)
void BKE_paint_palette_set (Paint *paint, Palette *palette)
void BKE_paint_curve_clamp_endpoint_add_index (PaintCurve *pc, const int add_index)
void BKE_palette_color_remove (Palette *palette, PaletteColor *color)
void BKE_palette_clear (Palette *palette)
void BKE_palette_color_set (PaletteColor *color, const float rgb[3])
void BKE_palette_color_sync_legacy (PaletteColor *color)
PaletteBKE_palette_add (Main *bmain, const char *name)
PaletteColorBKE_palette_color_add (Palette *palette)
bool BKE_palette_is_empty (const Palette *palette)
static int palettecolor_compare_hsv (const void *a1, const void *a2)
void BKE_palette_sort_hsv (tPaletteColorHSV *color_array, const int totcol)
static int palettecolor_compare_svh (const void *a1, const void *a2)
void BKE_palette_sort_svh (tPaletteColorHSV *color_array, const int totcol)
static int palettecolor_compare_vhs (const void *a1, const void *a2)
void BKE_palette_sort_vhs (tPaletteColorHSV *color_array, const int totcol)
static int palettecolor_compare_luminance (const void *a1, const void *a2)
void BKE_palette_sort_luminance (tPaletteColorHSV *color_array, const int totcol)
bool BKE_palette_from_hash (Main *bmain, GHash *color_table, const char *name)
bool BKE_paint_select_face_test (const Object *ob)
bool BKE_paint_select_vert_test (const Object *ob)
bool BKE_paint_select_grease_pencil_test (const Object *ob)
bool BKE_paint_select_elem_test (const Object *ob)
bool BKE_paint_always_hide_test (const Object *ob)
void BKE_paint_cavity_curve_preset (Paint *paint, int preset)
eObjectMode BKE_paint_object_mode_from_paintmode (const PaintMode mode)
static void paint_init_data (Paint &paint)
bool BKE_paint_ensure (ToolSettings *ts, Paint **r_paint)
void BKE_paint_brushes_ensure (Main *bmain, Paint *paint)
void BKE_paint_init (Main *bmain, Scene *sce, PaintMode mode, const bool ensure_brushes)
void BKE_paint_free (Paint *paint)
void BKE_paint_copy (const Paint *src, Paint *dst, const int flag)
void BKE_paint_settings_foreach_mode (ToolSettings *ts, blender::FunctionRef< void(Paint *paint)> fn)
void BKE_paint_stroke_get_average (const Paint *paint, const Object *ob, float stroke[3])
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)
void BKE_paint_blend_write (BlendWriter *writer, Paint *paint)
void BKE_paint_blend_read_data (BlendDataReader *reader, const Scene *scene, Paint *paint)
bool paint_is_grid_face_hidden (const blender::BoundedBitSpan grid_hidden, const int gridsize, const int x, const int y)
bool paint_is_bmesh_face_hidden (const BMFace *f)
float paint_grid_paint_mask (const GridPaintMask *gpm, uint level, uint x, uint y)
static float paint_rake_rotation_spacing (const Paint &, const Brush &brush)
void paint_update_brush_rake_rotation (Paint &paint, const Brush &brush, float rotation)
static bool paint_rake_rotation_active (const MTex &mtex)
static bool paint_rake_rotation_active (const Brush &brush, PaintMode paint_mode)
bool paint_calculate_rake_rotation (Paint &paint, const Brush &brush, const float mouse_pos[2], const PaintMode paint_mode, bool stroke_has_started)
void BKE_sculptsession_free_deformMats (SculptSession *ss)
void BKE_sculptsession_free_vwpaint_data (SculptSession *ss)
static void sculptsession_bm_to_me_update_data_only (Object *ob)
void BKE_sculptsession_bm_to_me (Object *ob)
void BKE_sculptsession_free_pbvh (Object &object)
void BKE_sculptsession_bm_to_me_for_render (Object *object)
void BKE_sculptsession_free (Object *ob)
static MultiresModifierDatasculpt_multires_modifier_get (const Scene *scene, Object *ob, const bool auto_create_mdisps)
MultiresModifierDataBKE_sculpt_multires_active (const Scene *scene, Object *ob)
static bool sculpt_modifiers_active (const Scene *scene, const Sculpt *sd, Object *ob)
static void sculpt_update_object (Depsgraph *depsgraph, Object *ob, Object *ob_eval, bool is_paint_tool)
void BKE_sculpt_update_object_before_eval (Object *ob_eval)
void BKE_sculpt_update_object_after_eval (Depsgraph *depsgraph, Object *ob_eval)
void BKE_sculpt_color_layer_create_if_needed (Object *object)
void BKE_sculpt_update_object_for_edit (Depsgraph *depsgraph, Object *ob_orig, bool is_paint_tool)
void BKE_sculpt_mask_layers_ensure (Depsgraph *depsgraph, Main *bmain, Object *ob, MultiresModifierData *mmd)
void BKE_sculpt_cavity_curves_ensure (Sculpt *sd)
void BKE_sculpt_toolsettings_data_ensure (Main *bmain, Scene *scene)
static bool check_sculpt_object_deformed (Object *object, const bool for_construction)
void BKE_sculpt_sync_face_visibility_to_grids (const Mesh &mesh, SubdivCCG &subdiv_ccg)
static std::unique_ptr< pbvh::Treeblender::bke::build_pbvh_for_dynamic_topology (Object *ob)
static std::unique_ptr< pbvh::Treeblender::bke::build_pbvh_from_regular_mesh (Object *ob, const Mesh *me_eval_deform)
static std::unique_ptr< pbvh::Treeblender::bke::build_pbvh_from_ccg (Object *ob, SubdivCCG &subdiv_ccg)
pbvh::Treeblender::bke::object::pbvh_ensure (Depsgraph &depsgraph, Object &object)
const pbvh::Treeblender::bke::object::pbvh_get (const Object &object)
pbvh::Treeblender::bke::object::pbvh_get (Object &object)
bool BKE_object_sculpt_use_dyntopo (const Object *object)
bool BKE_sculptsession_use_pbvh_draw (const Object *ob, const RegionView3D *rv3d)
void BKE_paint_face_set_overlay_color_get (const int face_set, const int seed, uchar r_color[4])

Variables

IDTypeInfo IDType_ID_PAL
IDTypeInfo IDType_ID_PC
static ePaintOverlayControlFlags overlay_flags = (ePaintOverlayControlFlags)0

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 10 of file paint.cc.

◆ GOLDEN_RATIO_CONJUGATE

#define GOLDEN_RATIO_CONJUGATE   0.618033988749895f

Definition at line 3091 of file paint.cc.

Referenced by BKE_paint_face_set_overlay_color_get().

Typedef Documentation

◆ float3

Definition at line 619 of file BLI_math_vector_types.hh.

Enumeration Type Documentation

◆ AttrDomain

enum class blender::bke::AttrDomain : int8_t
strong

Definition at line 63 of file BKE_attribute.hh.

Function Documentation

◆ asset_reference_create_from_brush()

AssetWeakReference * asset_reference_create_from_brush ( Brush * brush)
static

Definition at line 663 of file paint.cc.

References blender::bke::asset_edit_weak_reference_from_id(), and Brush::id.

Referenced by BKE_paint_brush_set().

◆ BKE_object_sculpt_use_dyntopo()

bool BKE_object_sculpt_use_dyntopo ( const Object * object)

Definition at line 3063 of file paint.cc.

◆ BKE_paint_always_hide_test()

bool BKE_paint_always_hide_test ( const Object * ob)

Checks if face/vertex hiding is always applied in the current mode. Returns true in vertex/weight paint.

Definition at line 1671 of file paint.cc.

References Object::data, Object::mode, OB_MESH, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_PAINT, and Object::type.

Referenced by face_vert_reveal_poll().

◆ BKE_paint_blend_read_data()

◆ BKE_paint_blend_write()

◆ BKE_paint_brush()

Brush * BKE_paint_brush ( Paint * paint)

Definition at line 645 of file paint.cc.

References Paint::brush.

Referenced by BKE_paint_brushes_validate(), BKE_paint_invalidate_cursor_overlay(), BKE_paint_invalidate_overlay_tex(), blender::ed::sculpt_paint::brush_asset_delete_exec(), blender::ed::sculpt_paint::brush_asset_delete_invoke(), blender::ed::sculpt_paint::brush_asset_delete_poll(), blender::ed::sculpt_paint::brush_asset_edit_metadata_exec(), blender::ed::sculpt_paint::brush_asset_edit_metadata_poll(), blender::ed::sculpt_paint::brush_asset_load_preview_exec(), blender::ed::sculpt_paint::brush_asset_revert_exec(), blender::ed::sculpt_paint::brush_asset_revert_poll(), blender::ed::sculpt_paint::brush_asset_save_as_exec(), blender::ed::sculpt_paint::brush_asset_save_as_poll(), blender::ed::sculpt_paint::brush_asset_save_exec(), blender::ed::sculpt_paint::brush_asset_save_poll(), brush_colors_flip_exec(), blender::ed::sculpt_paint::brush_exit_tex(), brush_scale_size_exec(), blender::ed::sculpt_paint::brush_tool_get(), buttons_context_path_brush(), buttons_texture_users_from_context(), blender::ed::sculpt_paint::trim::calculate_depth(), blender::ed::transform::calculateCenterActive(), blender::ed::transform::createTransPaintCurveVerts(), blender::ed::sculpt_paint::dyntopo::dyntopo_detail_size_edit_invoke(), ED_paint_proj_mesh_data_check(), ED_space_image_paint_curve(), blender::ed::sculpt_paint::greasepencil::EraseOperationExecutor::execute(), blender::ui::greasepencil::eyedropper_set_brush_color(), blender::ed::transform::flushTransPaintCurve(), blender::ed::sculpt_paint::GreasePencilFillOpData::from_context(), blender::ed::sculpt_paint::greasepencil::WeightPaintOperation::get_brush_settings(), blender::ed::sculpt_paint::grease_pencil_apply_fill(), blender::ed::sculpt_paint::grease_pencil_fill_init(), blender::ed::sculpt_paint::grease_pencil_fill_invoke(), blender::ed::greasepencil::grease_pencil_primitive_invoke(), blender::ed::greasepencil::grease_pencil_vertex_paint_set_exec(), image_paint_brush(), blender::ed::sculpt_paint::greasepencil::GreasePencilStrokeOperationCommon::init_stroke(), blender::ed::transform::initTransInfo(), is_brush_related_tool(), blender::ed::greasepencil::keymap_grease_pencil_brush_stroke_poll(), blender::ed::greasepencil::keymap_grease_pencil_fill_tool_poll(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_invoke(), blender::ed::sculpt_paint::new_selection_paint_operation(), blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::GrabOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::TintOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::PaintOperation::on_stroke_done(), blender::ed::sculpt_paint::greasepencil::PinchOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::PushOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::RandomizeOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::SmoothOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::StrengthOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::ThicknessOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::TwistOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexAverageOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexBlurOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexPaintOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexReplaceOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexSmearOperation::on_stroke_extended(), over_mesh(), paint_2d_new_stroke(), blender::ed::sculpt_paint::paint_cursor_context_init(), blender::ed::sculpt_paint::paint_cursor_update_pixel_radius(), paint_curve_poll(), blender::ed::sculpt_paint::paint_line_strokes_spacing(), paint_proj_new_stroke(), paint_sample_color(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_done(), blender::ed::sculpt_paint::paint_stroke_modal(), blender::ed::sculpt_paint::paint_stroke_new(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_update_step(), paint_weight_gradient_exec(), paintcurve_delete_point_exec(), paintcurve_new_exec(), paintcurve_point_add(), paintcurve_point_select(), paintcurve_slide_invoke(), paintcurve_undosys_poll(), paintcurve_undosys_step_encode(), blender::ed::greasepencil::paintmode_toggle_exec(), blender::ed::sculpt_paint::greasepencil::PaintOperationExecutor::PaintOperationExecutor(), project_state_init(), sample_color_exec(), blender::ed::sculpt_paint::sample_color_invoke(), sample_color_invoke(), sample_color_modal(), blender::ed::sculpt_paint::sculpt_brush_stroke_invoke(), blender::ed::sculpt_paint::sculpt_update_cache_invariants(), blender::ed::sculpt_paint::sculpt_update_cache_variants(), blender::ed::sculpt_paint::smooth_brush_toggle_off(), blender::ed::sculpt_paint::vwpaint::smooth_brush_toggle_off(), blender::ed::sculpt_paint::smooth_brush_toggle_on(), blender::ed::sculpt_paint::vwpaint::smooth_brush_toggle_on(), stencil_control_invoke(), stencil_control_poll(), stencil_fit_image_aspect_exec(), stencil_reset_transform_exec(), blender::ed::sculpt_paint::stroke_done(), blender::ed::sculpt_paint::stroke_get_location_bvh(), blender::ed::sculpt_paint::stroke_get_location_bvh_ex(), blender::ed::sculpt_paint::stroke_test_start(), blender::ed::greasepencil::stroke_trim_execute(), texture_get_from_context(), blender::ed::sculpt_paint::image::ops::paint::texture_paint_init(), blender::ed::sculpt_paint::greasepencil::PaintOperation::toggle_fill_guides_brush_on(), blender::ed::greasepencil::toggle_weight_tool_direction_exec(), blender::ed::greasepencil::toggle_weight_tool_direction_poll(), ui_do_but_COLOR(), blender::ed::sculpt_paint::vwpaint::update_cache_invariants(), blender::ed::sculpt_paint::vwpaint::update_cache_variants(), vertex_paint_poll_ex(), vpaint_stroke_test_start(), vpaint_stroke_update_step(), weight_paint_poll_ex(), weight_paint_set_exec(), blender::ed::greasepencil::weight_sample_invoke(), weight_sample_invoke(), wpaint_do_symmetrical_brush_actions(), wpaint_stroke_test_start(), and wpaint_stroke_update_step().

◆ BKE_paint_brush_for_read()

const Brush * BKE_paint_brush_for_read ( const Paint * paint)

Definition at line 650 of file paint.cc.

References Paint::brush.

Referenced by blender::draw::overlay::MeshUVs::begin_sync(), brush_init_tex(), brush_strength(), brush_stroke_init(), blender::ed::sculpt_paint::vwpaint::brush_use_accumulate(), blender::ed::sculpt_paint::filter::cache_init(), blender::ed::sculpt_paint::expand::cache_initial_config_set(), blender::ed::sculpt_paint::calc_sculpt_normal(), blender::ed::sculpt_paint::cloth::cloth_brush_apply_brush_forces(), blender::ed::sculpt_paint::cursor_geometry_info_update(), blender::ed::sculpt_paint::brushes::do_bmesh_topology_rake_brush(), blender::ed::sculpt_paint::boundary::do_boundary_brush(), blender::ed::sculpt_paint::brushes::do_clay_brush(), blender::ed::sculpt_paint::brushes::do_clay_strips_brush(), blender::ed::sculpt_paint::brushes::do_clay_thumb_brush(), blender::ed::sculpt_paint::cloth::do_cloth_brush(), blender::ed::sculpt_paint::brushes::do_displacement_eraser_brush(), blender::ed::sculpt_paint::brushes::do_displacement_smear_brush(), blender::ed::sculpt_paint::brushes::do_draw_brush(), blender::ed::sculpt_paint::brushes::do_draw_face_sets_brush(), blender::ed::sculpt_paint::brushes::do_draw_sharp_brush(), blender::ed::sculpt_paint::brushes::do_draw_vector_displacement_brush(), blender::ed::sculpt_paint::brushes::do_elastic_deform_brush(), blender::ed::sculpt_paint::brushes::do_enhance_details_brush(), blender::ed::sculpt_paint::brushes::do_grab_brush(), blender::ed::sculpt_paint::brushes::do_inflate_brush(), blender::ed::sculpt_paint::brushes::do_layer_brush(), blender::ed::sculpt_paint::brushes::do_mask_brush(), blender::ed::sculpt_paint::brushes::do_multiplane_scrape_brush(), blender::ed::sculpt_paint::color::do_paint_brush(), blender::ed::sculpt_paint::brushes::do_pinch_brush(), blender::ed::sculpt_paint::brushes::do_plane_brush(), blender::ed::sculpt_paint::pose::do_pose_brush(), blender::ed::sculpt_paint::brushes::do_relax_face_sets_brush(), blender::ed::sculpt_paint::brushes::do_rotate_brush(), blender::ed::sculpt_paint::cloth::do_simulation_step(), blender::ed::sculpt_paint::color::do_smear_brush(), blender::ed::sculpt_paint::brushes::do_smooth_brush(), blender::ed::sculpt_paint::brushes::do_smooth_mask_brush(), blender::ed::sculpt_paint::brushes::do_snake_hook_brush(), blender::ed::sculpt_paint::brushes::do_surface_smooth_brush(), blender::ed::sculpt_paint::do_symmetrical_brush_actions(), blender::ed::sculpt_paint::brushes::do_thumb_brush(), blender::ed::sculpt_paint::brushes::do_topology_relax_brush(), blender::ed::sculpt_paint::brushes::do_topology_slide_brush(), blender::ed::sculpt_paint::cloth::ensure_nodes_constraints(), blender::ed::sculpt_paint::AddOperationExecutor::execute(), blender::ed::sculpt_paint::CombOperationExecutor::execute(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::execute(), blender::ed::sculpt_paint::DeleteOperationExecutor::execute(), blender::ed::sculpt_paint::DensityAddOperationExecutor::execute(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::execute(), blender::ed::sculpt_paint::PinchOperationExecutor::execute(), blender::ed::sculpt_paint::PuffOperationExecutor::execute(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::execute(), blender::ed::sculpt_paint::SlideOperationExecutor::execute(), blender::ed::sculpt_paint::SmoothOperationExecutor::execute(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::execute(), blender::ed::sculpt_paint::auto_mask::fill_topology_automasking_factors_bmesh(), blender::ed::sculpt_paint::auto_mask::fill_topology_automasking_factors_grids(), blender::ed::sculpt_paint::auto_mask::fill_topology_automasking_factors_mesh(), blender::ed::sculpt_paint::get_stroke_operation(), blender::ed::sculpt_paint::grease_pencil_brush_stroke_invoke(), blender::ed::greasepencil::grease_pencil_draw_operator_invoke(), blender::ed::sculpt_paint::grease_pencil_sculpt_paint_invoke(), blender::ed::sculpt_paint::grease_pencil_vertex_brush_stroke_invoke(), blender::ed::sculpt_paint::grease_pencil_weight_brush_stroke_invoke(), image_paint_brush_uses_canvas(), blender::ed::sculpt_paint::auto_mask::init_face_sets_masking(), blender::ed::sculpt_paint::mask::mask_from_boundary_exec(), blender::ed::sculpt_paint::mask::mask_from_cavity_exec(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_poll(), blender::ed::sculpt_paint::new_grow_shrink_operation(), blender::ed::sculpt_paint::new_pinch_operation(), blender::ed::sculpt_paint::brushes::offset_positions(), paint_and_tex_color_alpha_intern(), blender::ed::sculpt_paint::paint_brush_stroke_add_step(), blender::ed::sculpt_paint::paint_draw_smooth_cursor(), blender::ed::sculpt_paint::image::ops::paint::paint_exec(), blender::ed::sculpt_paint::paint_space_stroke(), blender::ed::sculpt_paint::paint_space_stroke_spacing(), palette_color_add_exec(), blender::ed::sculpt_paint::undo::restore_from_undo_step(), restore_from_undo_step_if_necessary(), blender::ed::sculpt_paint::dyntopo::sample_detail_dyntopo(), blender::ed::sculpt_paint::sculpt_brush_stroke_cancel(), sculpt_brush_type_name(), blender::ed::sculpt_paint::cloth::sculpt_cloth_ensure_constraints_in_simulation_area(), blender::ed::sculpt_paint::sculpt_curves_stroke_invoke(), SCULPT_do_paint_brush_image(), blender::ed::sculpt_paint::sculpt_fix_noise_tear(), blender::ed::sculpt_paint::sculpt_update_cache_invariants(), blender::ed::sculpt_paint::start_brush_operation(), stroke_undo_begin(), blender::ed::sculpt_paint::stroke_update_step(), update_brush_local_mat(), blender::ed::sculpt_paint::update_modal_transform(), blender::ed::sculpt_paint::update_sculpt_normal(), blender::ed::sculpt_paint::use_add_density_mode(), blender::ed::sculpt_paint::vwpaint::use_normal(), vpaint_blend(), vpaint_do_symmetrical_brush_actions(), vpaint_get_current_col(), wpaint_blend(), and wpaint_stroke_test_start().

◆ BKE_paint_brush_from_essentials()

Brush * BKE_paint_brush_from_essentials ( Main * bmain,
const PaintMode paint_mode,
const char * name )

◆ BKE_paint_brush_set() [1/2]

bool BKE_paint_brush_set ( Main * bmain,
Paint * paint,
const AssetWeakReference & brush_asset_reference )

Version of BKE_paint_brush_set() that takes an asset reference instead of a brush, importing the brush if necessary.

Returns
False if unable to set the brush to the provided asset reference. True otherwise.

Definition at line 674 of file paint.cc.

References blender::bke::asset_edit_id_from_weak_reference(), blender::bke::asset_edit_id_is_editable(), blender::bke::asset_edit_weak_reference_from_id(), BKE_paint_can_use_brush(), BLI_assert, Paint::brush, Paint::brush_asset_reference, Brush::id, ID_BR, ID_IS_LINKED, and Main::is_locked_for_linking.

Referenced by BKE_paint_brushes_validate().

◆ BKE_paint_brush_set() [2/2]

bool BKE_paint_brush_set ( Paint * paint,
Brush * brush )

Activates brush for painting, and updates Paint.brush_asset_reference so the brush can be restored after file read. No change is done if #BKE_paint_brush_poll() returns false.

Returns
True on success. If brush is already active, this is considered a success (the brush asset reference will still be updated).
Note
WM_toolsystem_activate_brush_and_tool() might be the preferable way to change the active brush. It also lets the tool-system decide if the active tool should be changed given the type of brush, and it updates the "last used brush" for the previous tool. BKE_paint_brush_set() should only be called to force a brush to be active, circumventing the tool system.

Definition at line 710 of file paint.cc.

References asset_reference_create_from_brush(), BKE_paint_can_use_brush(), BKE_paint_invalidate_overlay_all(), Paint::brush, and Paint::brush_asset_reference.

Referenced by blender::ed::sculpt_paint::brush_asset_revert_exec(), blender::ed::sculpt_paint::smooth_brush_toggle_off(), blender::ed::sculpt_paint::vwpaint::smooth_brush_toggle_off(), blender::ed::sculpt_paint::smooth_brush_toggle_on(), blender::ed::sculpt_paint::vwpaint::smooth_brush_toggle_on(), blender::ed::sculpt_paint::greasepencil::PaintOperation::toggle_fill_guides_brush_off(), blender::ed::sculpt_paint::greasepencil::PaintOperation::toggle_fill_guides_brush_on(), toolsystem_brush_activate_from_toolref_for_object_paint(), and WM_toolsystem_activate_brush_and_tool().

◆ BKE_paint_brush_set_default()

◆ BKE_paint_brush_set_essentials()

bool BKE_paint_brush_set_essentials ( Main * bmain,
Paint * paint,
const char * name )

◆ BKE_paint_brush_type_default_reference()

std::optional< AssetWeakReference > BKE_paint_brush_type_default_reference ( const PaintMode paint_mode,
std::optional< int > brush_type )

◆ BKE_paint_brushes_ensure()

void BKE_paint_brushes_ensure ( Main * bmain,
Paint * paint )

Make sure the active brush asset is available as active brush, importing it if necessary. If there is no user set active brush, the default one is used/imported from the essentials asset library.

It's good to avoid this until the user actually shows intentions to use brushes, to avoid unused brushes in files. E.g. use this when entering a paint mode, but not for versioning.

Also handles the active eraser brush asset.

Definition at line 1823 of file paint.cc.

References BKE_paint_brush_set_default(), BKE_paint_eraser_brush_set_default(), Paint::brush, Paint::brush_asset_reference, Paint::eraser_brush, Paint::eraser_brush_asset_reference, paint_brush_update_from_asset_reference(), and paint_eraser_brush_set_from_asset_reference().

Referenced by BKE_paint_init(), BKE_sculpt_toolsettings_data_ensure(), blender::ed::sculpt_paint::curves_sculptmode_enter(), blender::ed::greasepencil::paintmode_toggle_exec(), blender::ed::greasepencil::sculptmode_toggle_exec(), and blender::ed::greasepencil::vertexmode_toggle_exec().

◆ BKE_paint_brushes_set_default_references()

◆ BKE_paint_brushes_validate()

◆ BKE_paint_can_use_brush()

bool BKE_paint_can_use_brush ( const Paint * paint,
const Brush * brush )

Check if brush brush may be set/activated for paint. Passing null for brush will return true.

Definition at line 655 of file paint.cc.

References Brush::ob_mode, and Paint::runtime.

Referenced by BKE_paint_brush_set(), BKE_paint_brush_set(), and WM_toolsystem_activate_brush_and_tool().

◆ BKE_paint_cavity_curve_preset()

◆ BKE_paint_copy()

void BKE_paint_copy ( const Paint * src,
Paint * dst,
int flag )

◆ BKE_paint_curve_add()

PaintCurve * BKE_paint_curve_add ( Main * bmain,
const char * name )

Definition at line 1369 of file paint.cc.

References BKE_id_new(), and name.

Referenced by paintcurve_for_brush_add().

◆ BKE_paint_curve_clamp_endpoint_add_index()

void BKE_paint_curve_clamp_endpoint_add_index ( PaintCurve * pc,
const int add_index )

◆ BKE_paint_ensure()

◆ BKE_paint_ensure_from_paintmode()

◆ BKE_paint_eraser_brush()

◆ BKE_paint_eraser_brush_for_read()

const Brush * BKE_paint_eraser_brush_for_read ( const Paint * paint)

Definition at line 1177 of file paint.cc.

References Paint::eraser_brush.

◆ BKE_paint_eraser_brush_from_essentials()

Brush * BKE_paint_eraser_brush_from_essentials ( Main * bmain,
const PaintMode paint_mode,
const char * name )

◆ BKE_paint_eraser_brush_set()

bool BKE_paint_eraser_brush_set ( Paint * paint,
Brush * brush )

◆ BKE_paint_eraser_brush_set_default()

bool BKE_paint_eraser_brush_set_default ( Main * bmain,
Paint * paint )

◆ BKE_paint_eraser_brush_set_essentials()

bool BKE_paint_eraser_brush_set_essentials ( Main * bmain,
Paint * paint,
const char * name )

◆ BKE_paint_face_set_overlay_color_get()

◆ BKE_paint_free()

◆ BKE_paint_get_active()

◆ BKE_paint_get_active_from_context()

Paint * BKE_paint_get_active_from_context ( const bContext * C)

Definition at line 476 of file paint.cc.

References BKE_paint_get_active(), BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), C, CTX_data_scene(), CTX_data_view_layer(), CTX_wm_space_image(), ToolSettings::imapaint, Object::mode, SpaceImage::mode, OB_MODE_EDIT, ImagePaintSettings::paint, SI_MODE_PAINT, and Scene::toolsettings.

Referenced by blender::ed::sculpt_paint::brush_asset_activate_exec(), blender::ed::sculpt_paint::brush_asset_delete_exec(), blender::ed::sculpt_paint::brush_asset_delete_invoke(), blender::ed::sculpt_paint::brush_asset_delete_poll(), blender::ed::sculpt_paint::brush_asset_edit_metadata_exec(), blender::ed::sculpt_paint::brush_asset_edit_metadata_invoke(), blender::ed::sculpt_paint::brush_asset_edit_metadata_poll(), blender::ed::sculpt_paint::brush_asset_load_preview_exec(), blender::ed::sculpt_paint::brush_asset_revert_exec(), blender::ed::sculpt_paint::brush_asset_revert_poll(), blender::ed::sculpt_paint::brush_asset_save_as_exec(), blender::ed::sculpt_paint::brush_asset_save_as_invoke(), blender::ed::sculpt_paint::brush_asset_save_as_poll(), blender::ed::sculpt_paint::brush_asset_save_exec(), blender::ed::sculpt_paint::brush_asset_save_poll(), brush_colors_flip_exec(), brush_scale_size_exec(), blender::ed::sculpt_paint::brush_tool_get(), buttons_texture_users_from_context(), blender::ed::sculpt_paint::expand::cache_initial_config_set(), blender::ed::sculpt_paint::min_distance_edit::calculate_points_per_side(), blender::ed::sculpt_paint::face_set::change_visibility_exec(), blender::ed::transform::createTransPaintCurveVerts(), blender::ed::sculpt_paint::cursor_geometry_info_update(), blender::ed::transform::flushTransPaintCurve(), blender::ed::sculpt_paint::greasepencil::WeightPaintOperation::get_brush_settings(), blender::ed::sculpt_paint::get_stroke_operation(), blender::ed::sculpt_paint::grease_pencil_brush_stroke_invoke(), blender::ed::greasepencil::grease_pencil_draw_operator_invoke(), blender::ed::sculpt_paint::grease_pencil_sculpt_paint_invoke(), blender::ed::sculpt_paint::grease_pencil_vertex_brush_stroke_invoke(), blender::ed::greasepencil::grease_pencil_vertex_paint_set_exec(), blender::ed::sculpt_paint::grease_pencil_weight_brush_stroke_invoke(), image_paint_brush_uses_canvas(), blender::ed::sculpt_paint::greasepencil::GreasePencilStrokeOperationCommon::init_stroke(), blender::ed::transform::initTransInfo(), is_brush_related_tool(), blender::ed::sculpt_paint::load_tex(), blender::ed::sculpt_paint::load_tex_cursor(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_draw(), blender::ed::object::object_transfer_mode_invoke(), blender::ed::sculpt_paint::greasepencil::EraseOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::GrabOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::TintOperation::on_stroke_begin(), blender::ed::sculpt_paint::greasepencil::PinchOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::PushOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::RandomizeOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::SmoothOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::StrengthOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::ThicknessOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::TwistOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexAverageOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexBlurOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexPaintOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexReplaceOperation::on_stroke_extended(), blender::ed::sculpt_paint::greasepencil::VertexSmearOperation::on_stroke_extended(), paint_2d_bucket_fill(), paint_2d_new_stroke(), blender::ed::sculpt_paint::paint_brush_stroke_add_step(), blender::ed::sculpt_paint::paint_cursor_context_init(), paint_curve_poll(), blender::ed::sculpt_paint::paint_draw_smooth_cursor(), blender::ed::sculpt_paint::image::ops::paint::paint_exec(), blender::ed::sculpt_paint::paint_line_strokes_spacing(), paint_proj_new_stroke(), paint_sample_color(), blender::ed::sculpt_paint::paint_space_stroke(), blender::ed::sculpt_paint::paint_space_stroke_spacing(), blender::ed::sculpt_paint::paint_stroke_curve_end(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_done(), blender::ed::sculpt_paint::paint_stroke_modal(), blender::ed::sculpt_paint::paint_stroke_new(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_update_step(), paintcurve_delete_point_exec(), paintcurve_new_exec(), paintcurve_point_add(), paintcurve_point_select(), paintcurve_slide_invoke(), paintcurve_undosys_poll(), paintcurve_undosys_step_encode(), palette_color_add_exec(), palette_color_delete_exec(), palette_color_move_exec(), palette_join_exec(), palette_new_exec(), palette_poll(), palette_sort_exec(), project_state_init(), sample_color_exec(), sample_color_invoke(), sample_color_modal(), blender::draw::sculpt_batches_get_ex(), blender::ed::sculpt_paint::sculpt_update_cache_variants(), blender::ed::sculpt_paint::set_pivot_position_exec(), stencil_control_invoke(), stencil_control_poll(), stencil_fit_image_aspect_exec(), stencil_reset_transform_exec(), blender::ed::sculpt_paint::stroke_get_location_bvh(), blender::ed::sculpt_paint::stroke_get_location_bvh_ex(), blender::ed::greasepencil::stroke_trim_execute(), blender::ed::sculpt_paint::greasepencil::PaintOperation::toggle_fill_guides_brush_off(), blender::ed::sculpt_paint::greasepencil::PaintOperation::toggle_fill_guides_brush_on(), blender::ed::greasepencil::toggle_weight_tool_direction_exec(), blender::ed::greasepencil::toggle_weight_tool_direction_poll(), ui_do_but_COLOR(), view3d_orbit_calc_center(), and blender::ed::sculpt_paint::visit_active_library_catalogs_catalog_for_search_fn().

◆ BKE_paint_get_active_from_paintmode()

◆ BKE_paint_get_brush_type_from_obmode()

◆ BKE_paint_get_brush_type_from_paintmode()

◆ BKE_paint_get_brush_type_offset_from_paintmode()

uint BKE_paint_get_brush_type_offset_from_paintmode ( const PaintMode mode)

◆ BKE_paint_get_overlay_flags()

◆ BKE_paint_get_tool_enum_from_paintmode()

◆ BKE_paint_init()

◆ BKE_paint_invalidate_cursor_overlay()

void BKE_paint_invalidate_cursor_overlay ( Scene * scene,
ViewLayer * view_layer,
CurveMapping * curve )

◆ BKE_paint_invalidate_overlay_all()

◆ BKE_paint_invalidate_overlay_tex()

void BKE_paint_invalidate_overlay_tex ( Scene * scene,
ViewLayer * view_layer,
const Tex * tex )

◆ BKE_paint_object_mode_from_paintmode()

◆ BKE_paint_palette()

Palette * BKE_paint_palette ( Paint * paint)

Definition at line 1375 of file paint.cc.

References Paint::palette.

Referenced by paint_sample_color().

◆ BKE_paint_palette_set()

void BKE_paint_palette_set ( Paint * paint,
Palette * palette )

◆ BKE_paint_previous_asset_reference_clear()

void BKE_paint_previous_asset_reference_clear ( Paint * paint)

◆ BKE_paint_previous_asset_reference_set()

void BKE_paint_previous_asset_reference_set ( Paint * paint,
AssetWeakReference && asset_weak_reference )

Definition at line 1111 of file paint.cc.

References Paint::runtime.

Referenced by blender::ed::sculpt_paint::brush_asset_activate_exec().

◆ BKE_paint_randomize_color()

◆ BKE_paint_reset_overlay_invalid()

void BKE_paint_reset_overlay_invalid ( ePaintOverlayControlFlags flag)

◆ BKE_paint_select_elem_test()

bool BKE_paint_select_elem_test ( const Object * ob)

used to check if selection is possible (when we don't care if its face or vert)

Definition at line 1665 of file paint.cc.

References BKE_paint_select_face_test(), BKE_paint_select_grease_pencil_test(), and BKE_paint_select_vert_test().

Referenced by face_vert_reveal_poll(), mask_paint_poll(), view3d_circle_select_exec(), view3d_select_exec(), and view3d_selectable_data().

◆ BKE_paint_select_face_test()

◆ BKE_paint_select_grease_pencil_test()

bool BKE_paint_select_grease_pencil_test ( const Object * ob)

◆ BKE_paint_select_vert_test()

bool BKE_paint_select_vert_test ( const Object * ob)

◆ BKE_paint_set_overlay_override()

◆ BKE_paint_settings_foreach_mode()

◆ BKE_paint_stroke_get_average()

◆ BKE_paint_use_unified_color()

◆ BKE_paintmode_get_active_from_context()

PaintMode BKE_paintmode_get_active_from_context ( const bContext * C)

Definition at line 505 of file paint.cc.

References BKE_view_layer_active_object_get(), BKE_view_layer_synced_ensure(), C, CTX_data_scene(), CTX_data_view_layer(), CTX_wm_space_image(), GPencil, Invalid, Object::mode, SpaceImage::mode, OB_GREASE_PENCIL, OB_MODE_EDIT, OB_MODE_PAINT_GREASE_PENCIL, OB_MODE_SCULPT, OB_MODE_SCULPT_CURVES, OB_MODE_SCULPT_GREASE_PENCIL, OB_MODE_TEXTURE_PAINT, OB_MODE_VERTEX_GREASE_PENCIL, OB_MODE_VERTEX_PAINT, OB_MODE_WEIGHT_GREASE_PENCIL, OB_MODE_WEIGHT_PAINT, Sculpt, SculptCurves, SculptGPencil, SI_MODE_PAINT, Texture2D, Texture3D, Object::type, Vertex, VertexGPencil, Weight, and WeightGPencil.

Referenced by brush_type_matches_active_tool(), blender::ed::sculpt_paint::get_stroke_operation(), blender::ed::sculpt_paint::grease_pencil_brush_stroke_invoke(), image_undosys_step_encode(), blender::ed::sculpt_paint::paint_brush_stroke_add_step(), blender::ed::sculpt_paint::paint_cursor_context_init(), blender::ed::sculpt_paint::paint_draw_smooth_cursor(), blender::ed::sculpt_paint::image::ops::paint::paint_exec(), blender::ed::sculpt_paint::paint_line_strokes_spacing(), blender::ed::sculpt_paint::paint_space_stroke(), blender::ed::sculpt_paint::paint_space_stroke_spacing(), blender::ed::sculpt_paint::paint_stroke_curve_end(), blender::ed::sculpt_paint::paint_stroke_exec(), blender::ed::sculpt_paint::paint_stroke_modal(), blender::ed::sculpt_paint::paint_stroke_new(), paintcurve_cursor_invoke(), paintcurve_draw_exec(), palette_color_add_exec(), sample_color_exec(), sample_color_invoke(), sample_color_modal(), stencil_control_poll(), ui_apply_but_undo(), blender::ed::sculpt_paint::vwpaint::update_cache_variants(), blender::ed::sculpt_paint::undo::use_multires_mesh(), and WM_toolsystem_activate_brush_and_tool().

◆ BKE_paintmode_get_from_tool()

◆ BKE_palette_add()

Palette * BKE_palette_add ( Main * bmain,
const char * name )

◆ BKE_palette_clear()

void BKE_palette_clear ( Palette * palette)

Definition at line 1410 of file paint.cc.

References Palette::active_color, BLI_freelistN(), and Palette::colors.

◆ BKE_palette_color_add()

◆ BKE_palette_color_remove()

void BKE_palette_color_remove ( Palette * palette,
PaletteColor * color )

Remove color from palette. Must be certain color is inside the palette!

Definition at line 1394 of file paint.cc.

References Palette::active_color, BLI_listbase_count_at_most(), BLI_listbase_is_empty(), BLI_remlink(), Palette::colors, and MEM_freeN().

Referenced by palette_color_delete_exec(), palette_join_exec(), palette_sort_exec(), and ui_do_but_COLOR().

◆ BKE_palette_color_set()

void BKE_palette_color_set ( PaletteColor * color,
const float rgb[3] )

◆ BKE_palette_color_sync_legacy()

void BKE_palette_color_sync_legacy ( PaletteColor * color)

◆ BKE_palette_from_hash()

◆ BKE_palette_is_empty()

bool BKE_palette_is_empty ( const Palette * palette)

Definition at line 1440 of file paint.cc.

References BLI_listbase_is_empty(), and Palette::colors.

◆ BKE_palette_sort_hsv()

void BKE_palette_sort_hsv ( tPaletteColorHSV * color_array,
const int totcol )

Definition at line 1477 of file paint.cc.

References palettecolor_compare_hsv().

Referenced by BKE_palette_from_hash(), and palette_sort_exec().

◆ BKE_palette_sort_luminance()

void BKE_palette_sort_luminance ( tPaletteColorHSV * color_array,
const int totcol )

Definition at line 1574 of file paint.cc.

References palettecolor_compare_luminance().

Referenced by palette_sort_exec().

◆ BKE_palette_sort_svh()

void BKE_palette_sort_svh ( tPaletteColorHSV * color_array,
const int totcol )

Definition at line 1514 of file paint.cc.

References palettecolor_compare_svh().

Referenced by palette_sort_exec().

◆ BKE_palette_sort_vhs()

void BKE_palette_sort_vhs ( tPaletteColorHSV * color_array,
const int totcol )

Definition at line 1551 of file paint.cc.

References palettecolor_compare_vhs().

Referenced by palette_sort_exec().

◆ BKE_sculpt_cavity_curves_ensure()

void BKE_sculpt_cavity_curves_ensure ( Sculpt * sd)

◆ BKE_sculpt_color_layer_create_if_needed()

◆ BKE_sculpt_mask_layers_ensure()

void BKE_sculpt_mask_layers_ensure ( Depsgraph * depsgraph,
Main * bmain,
Object * ob,
MultiresModifierData * mmd )

Ensures a mask layer exists. If depsgraph and bmain are non-null, a mask doesn't exist and the object has a multi-resolution modifier then the scene depsgraph will be evaluated to update the runtime subdivision data.

Note
always call before BKE_sculpt_update_object_for_edit.

Definition at line 2806 of file paint.cc.

References blender::bke::MutableAttributeAccessor::add(), BKE_scene_graph_evaluated_ensure(), CCG_grid_size(), CD_GRID_PAINT_MASK, CD_SET_DEFAULT, CustomData_add_layer(), CustomData_has_layer(), GridPaintMask::data, Object::data, DEG_id_tag_update(), depsgraph, blender::bke::mesh::face_corner_next(), blender::bke::mesh::face_corner_prev(), faces, float, i, Object::id, ID_RECALC_GEOMETRY, GridPaintMask::level, blender::bke::AttributeAccessor::lookup(), mask(), max_ii(), MEM_calloc_arrayN(), next, blender::bke::Point, MultiresModifierData::sculptlvl, IndexRange::size(), and blender::Span< T >::slice().

Referenced by blender::ed::sculpt_paint::mask::fill_mask_grids(), blender::ed::sculpt_paint::mask::init_mask_grids(), blender::ed::sculpt_paint::mask::init_operation(), blender::ed::sculpt_paint::mask::invert_mask_grids(), blender::ed::sculpt_paint::mask::mask_from_boundary_exec(), blender::ed::sculpt_paint::mask::mask_from_cavity_exec(), blender::ed::object::modifier_add(), blender::ed::object::multires_subdivide_exec(), blender::ed::sculpt_paint::sculpt_brush_stroke_invoke(), blender::ed::sculpt_paint::expand::sculpt_expand_invoke(), and blender::ed::sculpt_paint::mask::sculpt_mask_filter_exec().

◆ BKE_sculpt_multires_active()

◆ BKE_sculpt_sync_face_visibility_to_grids()

◆ BKE_sculpt_toolsettings_data_ensure()

◆ BKE_sculpt_update_object_after_eval()

void BKE_sculpt_update_object_after_eval ( Depsgraph * depsgraph,
Object * ob_eval )

Definition at line 2764 of file paint.cc.

References DEG_get_original(), depsgraph, and sculpt_update_object().

Referenced by blender::bke::mesh_build_data().

◆ BKE_sculpt_update_object_before_eval()

◆ BKE_sculpt_update_object_for_edit()

void BKE_sculpt_update_object_for_edit ( Depsgraph * depsgraph,
Object * ob_orig,
bool is_paint_tool )
Warning
Expects a fully evaluated depsgraph.

Definition at line 2797 of file paint.cc.

References BLI_assert, DEG_get_evaluated(), DEG_get_original(), depsgraph, and sculpt_update_object().

Referenced by blender::ed::sculpt_paint::undo::bmesh_restore(), brush_stroke_init(), blender::ed::sculpt_paint::face_set::change_visibility_exec(), blender::ed::sculpt_paint::face_set::create_op_exec(), blender::ed::sculpt_paint::face_set::edit_op_init(), blender::ed::sculpt_paint::face_set::edit_op_invoke(), blender::ed::sculpt_paint::geometry_preview_lines_update(), blender::ed::sculpt_paint::face_set::gesture_begin(), blender::ed::sculpt_paint::mask::gesture_begin(), blender::ed::sculpt_paint::project::gesture_begin(), blender::ed::sculpt_paint::face_set::init_op_exec(), blender::ed::sculpt_paint::init_sculpt_mode_session(), blender::ed::sculpt_paint::vwpaint::init_session(), blender::ed::sculpt_paint::vwpaint::init_stroke(), blender::ed::sculpt_paint::init_transform(), blender::ed::sculpt_paint::mask::mask_by_color(), blender::ed::sculpt_paint::mask::mask_flood_fill_exec(), blender::ed::sculpt_paint::mask::mask_from_boundary_exec(), blender::ed::sculpt_paint::mask::mask_from_cavity_exec(), blender::ed::sculpt_paint::paint_cursor_draw_3d_view_brush_cursor_inactive(), blender::ed::sculpt_paint::paint_cursor_preview_boundary_data_update(), blender::ed::sculpt_paint::undo::restore_active_shape_key(), blender::ed::sculpt_paint::undo::restore_list(), blender::ed::sculpt_paint::sample_color_invoke(), blender::ed::sculpt_paint::dyntopo::sample_detail_voxel(), blender::ed::sculpt_paint::cloth::sculpt_cloth_filter_invoke(), blender::ed::sculpt_paint::cloth::sculpt_cloth_filter_modal(), blender::ed::sculpt_paint::color::sculpt_color_filter_init(), blender::ed::sculpt_paint::expand::sculpt_expand_invoke(), blender::ed::sculpt_paint::expand::sculpt_expand_modal(), blender::ed::sculpt_paint::mask::sculpt_mask_filter_exec(), blender::ed::sculpt_paint::mask::sculpt_mask_init_exec(), blender::ed::sculpt_paint::filter::sculpt_mesh_filter_modal(), blender::ed::sculpt_paint::filter::sculpt_mesh_filter_start(), SCULPT_stroke_modifiers_check(), blender::ed::sculpt_paint::set_persistent_base_exec(), blender::ed::sculpt_paint::set_pivot_position_exec(), transform_active_color(), blender::ed::sculpt_paint::update_modal_transform(), and vertex_color_set_exec().

◆ BKE_sculptsession_bm_to_me()

◆ BKE_sculptsession_bm_to_me_for_render()

void BKE_sculptsession_bm_to_me_for_render ( Object * object)

◆ BKE_sculptsession_free()

◆ BKE_sculptsession_free_deformMats()

◆ BKE_sculptsession_free_pbvh()

◆ BKE_sculptsession_free_vwpaint_data()

◆ BKE_sculptsession_use_pbvh_draw()

◆ check_sculpt_object_deformed()

bool check_sculpt_object_deformed ( Object * object,
const bool for_construction )
static

Definition at line 2931 of file paint.cc.

References OB_SHAPE_LOCK.

Referenced by blender::bke::build_pbvh_from_regular_mesh().

◆ paint_brush_asset_reference_from_essentials()

◆ paint_brush_asset_reference_ptr_from_essentials()

◆ paint_brush_default_essentials_name_get()

void paint_brush_default_essentials_name_get ( const PaintMode paint_mode,
std::optional< int > brush_type,
blender::StringRefNull * r_name,
blender::StringRefNull * r_eraser_name = nullptr )
static

◆ paint_brush_essentials_asset_file_name_from_paint_mode()

const char * paint_brush_essentials_asset_file_name_from_paint_mode ( const PaintMode paint_mode)
static

◆ paint_brush_set_default_reference()

◆ paint_brush_set_essentials_reference()

void paint_brush_set_essentials_reference ( Paint * paint,
const char * name )
static

◆ paint_brush_update_from_asset_reference()

bool paint_brush_update_from_asset_reference ( Main * bmain,
Paint * paint )
static

◆ paint_calculate_rake_rotation()

◆ paint_curve_blend_read_data()

void paint_curve_blend_read_data ( BlendDataReader * reader,
ID * id )
static

Definition at line 220 of file paint.cc.

References BLO_read_struct_array, PaintCurve::points, and PaintCurve::tot_points.

◆ paint_curve_blend_write()

void paint_curve_blend_write ( BlendWriter * writer,
ID * id,
const void * id_address )
static

◆ paint_curve_copy_data()

void paint_curve_copy_data ( Main * ,
std::optional< Library * > ,
ID * id_dst,
const ID * id_src,
const int  )
static

Definition at line 187 of file paint.cc.

References MEM_dupallocN(), PaintCurve::points, and PaintCurve::tot_points.

◆ paint_curve_free_data()

void paint_curve_free_data ( ID * id)
static

Definition at line 202 of file paint.cc.

References MEM_SAFE_FREE, PaintCurve::points, and PaintCurve::tot_points.

◆ paint_eraser_brush_set_essentials_reference()

void paint_eraser_brush_set_essentials_reference ( Paint * paint,
const char * name )
static

◆ paint_eraser_brush_set_from_asset_reference()

◆ paint_grid_paint_mask()

float paint_grid_paint_mask ( const GridPaintMask * gpm,
uint level,
uint x,
uint y )

◆ paint_init_data()

◆ paint_is_bmesh_face_hidden()

bool paint_is_bmesh_face_hidden ( const BMFace * f)

Return true if all vertices in the face are visible, false otherwise.

Definition at line 2140 of file paint.cc.

References BM_elem_flag_test, BM_ELEM_HIDDEN, BM_FACE_FIRST_LOOP, BMLoop::next, and BMLoop::v.

Referenced by blender::ed::sculpt_paint::hide::partialvis_update_bmesh_faces().

◆ paint_is_grid_face_hidden()

◆ paint_rake_rotation_active() [1/2]

bool paint_rake_rotation_active ( const Brush & brush,
PaintMode paint_mode )
static

◆ paint_rake_rotation_active() [2/2]

bool paint_rake_rotation_active ( const MTex & mtex)
static

◆ paint_rake_rotation_spacing()

float paint_rake_rotation_spacing ( const Paint & ,
const Brush & brush )
static

Definition at line 2164 of file paint.cc.

References Brush::sculpt_brush_type, and SCULPT_BRUSH_TYPE_CLAY_STRIPS.

Referenced by paint_calculate_rake_rotation().

◆ paint_runtime_init()

◆ paint_update_brush_rake_rotation()

◆ palette_blend_read_data()

void palette_blend_read_data ( BlendDataReader * reader,
ID * id )
static

Definition at line 139 of file paint.cc.

References BLO_read_struct_list, and Palette::colors.

◆ palette_blend_write()

void palette_blend_write ( BlendWriter * writer,
ID * id,
const void * id_address )
static

◆ palette_copy_data()

void palette_copy_data ( Main * ,
std::optional< Library * > ,
ID * id_dst,
const ID * id_src,
const int  )
static

Definition at line 99 of file paint.cc.

References BLI_duplicatelist(), and Palette::colors.

◆ palette_foreach_working_space_color()

void palette_foreach_working_space_color ( ID * id,
const IDTypeForeachColorFunctionCallback & fn )
static

◆ palette_free_data()

void palette_free_data ( ID * id)
static

Definition at line 111 of file paint.cc.

References BLI_freelistN(), and Palette::colors.

◆ palette_init_data()

void palette_init_data ( ID * id)
static

Definition at line 89 of file paint.cc.

References BLI_assert, Palette::id, id_fake_user_set(), and MEMCMP_STRUCT_AFTER_IS_ZERO.

◆ palette_undo_preserve()

void palette_undo_preserve ( BlendLibReader * ,
ID * id_new,
ID * id_old )
static

Definition at line 145 of file paint.cc.

References BKE_lib_id_swap(), ID::properties, and ID::system_properties.

◆ palettecolor_compare_hsv()

int palettecolor_compare_hsv ( const void * a1,
const void * a2 )
static

Definition at line 1445 of file paint.cc.

References tPaletteColorHSV::h, tPaletteColorHSV::s, and tPaletteColorHSV::v.

Referenced by BKE_palette_sort_hsv().

◆ palettecolor_compare_luminance()

int palettecolor_compare_luminance ( const void * a1,
const void * a2 )
static

Definition at line 1556 of file paint.cc.

References tPaletteColorHSV::rgb.

Referenced by BKE_palette_sort_luminance().

◆ palettecolor_compare_svh()

int palettecolor_compare_svh ( const void * a1,
const void * a2 )
static

Definition at line 1482 of file paint.cc.

References tPaletteColorHSV::h, tPaletteColorHSV::s, and tPaletteColorHSV::v.

Referenced by BKE_palette_sort_svh().

◆ palettecolor_compare_vhs()

int palettecolor_compare_vhs ( const void * a1,
const void * a2 )
static

Definition at line 1519 of file paint.cc.

References tPaletteColorHSV::h, tPaletteColorHSV::s, and tPaletteColorHSV::v.

Referenced by BKE_palette_sort_vhs().

◆ sculpt_modifiers_active()

◆ sculpt_multires_modifier_get()

◆ sculpt_update_object()

◆ sculptsession_bm_to_me_update_data_only()

void sculptsession_bm_to_me_update_data_only ( Object * ob)
static

Write out the sculpt dynamic-topology BMesh to the Mesh.

Definition at line 2262 of file paint.cc.

References SculptSession::bm, BM_mesh_bm_to_me(), Object::data, params, and Object::sculpt.

Referenced by BKE_sculptsession_bm_to_me(), and BKE_sculptsession_bm_to_me_for_render().

Variable Documentation

◆ IDType_ID_PAL

IDTypeInfo IDType_ID_PAL
Initial value:
= {
Palette::id_type,
0,
sizeof(Palette),
"Palette",
N_("palettes"),
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
}
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition BKE_idtype.hh:49
#define BLT_I18NCONTEXT_ID_PALETTE
@ INDEX_ID_PAL
Definition DNA_ID.h:1344
#define FILTER_ID_PAL
Definition DNA_ID.h:1215
static void palette_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
Definition paint.cc:118
static void palette_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
Definition paint.cc:99
static void palette_free_data(ID *id)
Definition paint.cc:111
static void palette_undo_preserve(BlendLibReader *, ID *id_new, ID *id_old)
Definition paint.cc:145
static void palette_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition paint.cc:129
static void palette_init_data(ID *id)
Definition paint.cc:89
static void palette_blend_read_data(BlendDataReader *reader, ID *id)
Definition paint.cc:139
#define N_(msgid)

Definition at line 156 of file paint.cc.

◆ IDType_ID_PC

IDTypeInfo IDType_ID_PC
Initial value:
= {
PaintCurve::id_type,
0,
sizeof(PaintCurve),
"PaintCurve",
N_("paint_curves"),
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
}
#define BLT_I18NCONTEXT_ID_PAINTCURVE
@ INDEX_ID_PC
Definition DNA_ID.h:1345
#define FILTER_ID_PC
Definition DNA_ID.h:1216
static void paint_curve_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int)
Definition paint.cc:187
static void paint_curve_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition paint.cc:210
static void paint_curve_free_data(ID *id)
Definition paint.cc:202
static void paint_curve_blend_read_data(BlendDataReader *reader, ID *id)
Definition paint.cc:220

Definition at line 226 of file paint.cc.

◆ overlay_flags