Blender  V3.3
Macros | Functions | Variables
paint.c File Reference
#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "DNA_brush_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_view3d_types.h"
#include "DNA_workspace_types.h"
#include "BLI_bitmap.h"
#include "BLI_hash.h"
#include "BLI_listbase.h"
#include "BLI_math_vector.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_attribute.h"
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_crazyspace.h"
#include "BKE_deform.h"
#include "BKE_gpencil.h"
#include "BKE_idtype.h"
#include "BKE_image.h"
#include "BKE_key.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_runtime.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_subsurf.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "RNA_enum_types.h"
#include "BLO_read_write.h"
#include "bmesh.h"

Go to the source code of this file.

Macros

#define RAKE_THRESHHOLD   20
 
#define GOLDEN_RATIO_CONJUGATE   0.618033988749895f
 

Functions

static void palette_init_data (ID *id)
 
static void palette_copy_data (Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
 
static void palette_free_data (ID *id)
 
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 *UNUSED(reader), ID *id_new, ID *id_old)
 
static void paint_curve_copy_data (Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
 
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 (void)
 
ePaintOverlayControlFlags BKE_paint_get_overlay_flags (void)
 
void BKE_paint_set_overlay_override (eOverlayFlags flags)
 
void BKE_paint_reset_overlay_invalid (ePaintOverlayControlFlags flag)
 
bool BKE_paint_ensure_from_paintmode (Scene *sce, ePaintMode mode)
 
PaintBKE_paint_get_active_from_paintmode (Scene *sce, ePaintMode mode)
 
const EnumPropertyItemBKE_paint_get_tool_enum_from_paintmode (ePaintMode mode)
 
const char * BKE_paint_get_tool_prop_id_from_paintmode (ePaintMode mode)
 
PaintBKE_paint_get_active (Scene *sce, ViewLayer *view_layer)
 
PaintBKE_paint_get_active_from_context (const bContext *C)
 
ePaintMode BKE_paintmode_get_active_from_context (const bContext *C)
 
ePaintMode BKE_paintmode_get_from_tool (const struct bToolRef *tref)
 
BrushBKE_paint_brush (Paint *p)
 
const BrushBKE_paint_brush_for_read (const Paint *p)
 
void BKE_paint_brush_set (Paint *p, Brush *br)
 
void BKE_paint_runtime_init (const ToolSettings *ts, Paint *paint)
 
uint BKE_paint_get_brush_tool_offset_from_paintmode (const ePaintMode mode)
 
PaintCurveBKE_paint_curve_add (Main *bmain, const char *name)
 
PaletteBKE_paint_palette (Paint *p)
 
void BKE_paint_palette_set (Paint *p, Palette *palette)
 
void BKE_paint_curve_set (Brush *br, PaintCurve *pc)
 
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)
 
PaletteBKE_palette_add (Main *bmain, const char *name)
 
PaletteColorBKE_palette_color_add (Palette *palette)
 
bool BKE_palette_is_empty (const struct Palette *palette)
 
static int palettecolor_compare_hsv (const void *a1, const void *a2)
 
static int palettecolor_compare_svh (const void *a1, const void *a2)
 
static int palettecolor_compare_vhs (const void *a1, const void *a2)
 
static int palettecolor_compare_luminance (const void *a1, const void *a2)
 
void BKE_palette_sort_hsv (tPaletteColorHSV *color_array, const int totcol)
 
void BKE_palette_sort_svh (tPaletteColorHSV *color_array, const int totcol)
 
void BKE_palette_sort_vhs (tPaletteColorHSV *color_array, const int totcol)
 
void BKE_palette_sort_luminance (tPaletteColorHSV *color_array, const int totcol)
 
bool BKE_palette_from_hash (Main *bmain, GHash *color_table, const char *name, const bool linear)
 
bool BKE_paint_select_face_test (Object *ob)
 
bool BKE_paint_select_vert_test (Object *ob)
 
bool BKE_paint_select_elem_test (Object *ob)
 
bool BKE_paint_always_hide_test (Object *ob)
 
void BKE_paint_cavity_curve_preset (Paint *p, int preset)
 
eObjectMode BKE_paint_object_mode_from_paintmode (ePaintMode mode)
 
bool BKE_paint_ensure (ToolSettings *ts, struct Paint **r_paint)
 
void BKE_paint_init (Main *bmain, Scene *sce, ePaintMode mode, const char col[3])
 
void BKE_paint_free (Paint *paint)
 
void BKE_paint_copy (Paint *src, Paint *tar, const int flag)
 
void BKE_paint_stroke_get_average (Scene *scene, Object *ob, float stroke[3])
 
void BKE_paint_blend_write (BlendWriter *writer, Paint *p)
 
void BKE_paint_blend_read_data (BlendDataReader *reader, const Scene *scene, Paint *p)
 
void BKE_paint_blend_read_lib (BlendLibReader *reader, Scene *sce, Paint *p)
 
bool paint_is_face_hidden (const MLoopTri *lt, const MVert *mvert, const MLoop *mloop)
 
bool paint_is_grid_face_hidden (const uint *grid_hidden, int gridsize, int x, int y)
 
bool paint_is_bmesh_face_hidden (BMFace *f)
 
float paint_grid_paint_mask (const GridPaintMask *gpm, uint level, uint x, uint y)
 
void paint_update_brush_rake_rotation (UnifiedPaintSettings *ups, Brush *brush, float rotation)
 
bool paint_calculate_rake_rotation (UnifiedPaintSettings *ups, Brush *brush, const float mouse_pos[2])
 
void BKE_sculptsession_free_deformMats (SculptSession *ss)
 
void BKE_sculptsession_free_vwpaint_data (struct SculptSession *ss)
 
static void sculptsession_bm_to_me_update_data_only (Object *ob, bool reorder)
 
void BKE_sculptsession_bm_to_me (Object *ob, bool reorder)
 
static void sculptsession_free_pbvh (Object *object)
 
void BKE_sculptsession_bm_to_me_for_render (Object *object)
 
void BKE_sculptsession_free (Object *ob)
 
MultiresModifierDataBKE_sculpt_multires_active (const Scene *scene, Object *ob)
 
static bool sculpt_modifiers_active (Scene *scene, Sculpt *sd, Object *ob)
 
static void sculpt_update_object (Depsgraph *depsgraph, Object *ob, Mesh *me_eval, bool need_pmap, bool need_mask, bool is_paint_tool)
 
static void sculpt_face_sets_ensure (Mesh *mesh)
 
void BKE_sculpt_update_object_before_eval (const Scene *scene, Object *ob_eval)
 
void BKE_sculpt_update_object_after_eval (Depsgraph *depsgraph, Object *ob_eval)
 
void BKE_sculpt_color_layer_create_if_needed (struct Object *object)
 
void BKE_sculpt_update_object_for_edit (Depsgraph *depsgraph, Object *ob_orig, bool need_pmap, bool need_mask, bool is_paint_tool)
 
int BKE_sculpt_mask_layers_ensure (Object *ob, MultiresModifierData *mmd)
 
void BKE_sculpt_toolsettings_data_ensure (struct Scene *scene)
 
static bool check_sculpt_object_deformed (Object *object, const bool for_construction)
 
void BKE_sculpt_face_sets_ensure_from_base_mesh_visibility (Mesh *mesh)
 
void BKE_sculpt_sync_face_sets_visibility_to_base_mesh (Mesh *mesh)
 
void BKE_sculpt_sync_face_sets_visibility_to_grids (Mesh *mesh, SubdivCCG *subdiv_ccg)
 
void BKE_sculpt_sync_face_set_visibility (struct Mesh *mesh, struct SubdivCCG *subdiv_ccg)
 
void BKE_sculpt_ensure_orig_mesh_data (Scene *scene, Object *object)
 
static PBVHbuild_pbvh_for_dynamic_topology (Object *ob)
 
static PBVHbuild_pbvh_from_regular_mesh (Object *ob, Mesh *me_eval_deform, bool respect_hide)
 
static PBVHbuild_pbvh_from_ccg (Object *ob, SubdivCCG *subdiv_ccg, bool respect_hide)
 
PBVHBKE_sculpt_object_pbvh_ensure (Depsgraph *depsgraph, Object *ob)
 
void BKE_sculpt_bvh_update_from_ccg (PBVH *pbvh, SubdivCCG *subdiv_ccg)
 
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
 
const char PAINT_CURSOR_SCULPT [3] = {255, 100, 100}
 
const char PAINT_CURSOR_VERTEX_PAINT [3] = {255, 255, 255}
 
const char PAINT_CURSOR_WEIGHT_PAINT [3] = {200, 200, 255}
 
const char PAINT_CURSOR_TEXTURE_PAINT [3] = {255, 255, 255}
 
static ePaintOverlayControlFlags overlay_flags = 0
 

Macro Definition Documentation

◆ GOLDEN_RATIO_CONJUGATE

#define GOLDEN_RATIO_CONJUGATE   0.618033988749895f

Definition at line 2335 of file paint.c.

◆ RAKE_THRESHHOLD

#define RAKE_THRESHHOLD   20

Definition at line 1286 of file paint.c.

Function Documentation

◆ BKE_paint_always_hide_test()

bool BKE_paint_always_hide_test ( struct Object ob)

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

Definition at line 999 of file paint.c.

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

Referenced by face_vert_reveal_poll().

◆ BKE_paint_blend_read_data()

void BKE_paint_blend_read_data ( BlendDataReader reader,
const Scene scene,
Paint p 
)

◆ BKE_paint_blend_read_lib()

void BKE_paint_blend_read_lib ( BlendLibReader reader,
Scene sce,
Paint p 
)

◆ BKE_paint_blend_write()

void BKE_paint_blend_write ( BlendWriter writer,
Paint p 
)

◆ BKE_paint_brush()

Brush* BKE_paint_brush ( Paint p)

Definition at line 607 of file paint.c.

References BKE_paint_brush_for_read().

Referenced by BKE_paint_init(), brush_add_exec(), brush_add_gpencil_exec(), brush_colors_flip_exec(), brush_curve_preset_exec(), brush_curve_preset_poll(), brush_generic_tool_set(), brush_reset_exec(), brush_scale_size_exec(), brush_strength(), buttons_context_path_brush(), buttons_texture_users_from_context(), calc_sculpt_normal(), calc_sculpt_plane(), cloth_brush_apply_brush_foces(), do_gravity(), do_symmetrical_brush_actions(), dyntopo_detail_size_edit_invoke(), ED_paint_proj_mesh_data_check(), ED_sculpt_update_modal_transform(), gpencil_draw_init(), gpencil_fill_invoke(), gpencil_session_init_fill(), gpencil_stroke_from_buffer(), gpencil_stroke_paintmode_poll_with_tool(), gpencil_stroke_sculptmode_poll_with_tool(), gpencil_stroke_vertexmode_poll_with_tool(), gpencil_stroke_weightmode_poll_with_tool(), HC_relaxation_iteration_uv(), image_paint_brush(), laplacian_relaxation_iteration_uv(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_invoke(), blender::ed::sculpt_paint::new_selection_paint_operation(), OVERLAY_edit_uv_cache_init(), OVERLAY_edit_uv_init(), paint_2d_new_stroke(), paint_and_tex_color_alpha_intern(), paint_brush_stroke_add_step(), PAINT_brush_tool_poll(), paint_cursor_context_init(), paint_cursor_update_pixel_radius(), paint_draw_smooth_cursor(), paint_line_strokes_spacing(), paint_mesh_restore_co(), paint_proj_new_stroke(), paint_sample_color(), paint_space_stroke(), paint_space_stroke_spacing(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_done(), paint_stroke_modal(), paint_stroke_new(), blender::ed::sculpt_paint::image::ops::paint::paint_stroke_update_step(), paint_weight_gradient_exec(), project_state_init(), sample_color_exec(), sample_color_invoke(), sample_color_modal(), sample_detail_dyntopo(), SCULPT_bmesh_topology_rake(), sculpt_brush_exit_tex(), sculpt_brush_init_tex(), SCULPT_brush_plane_offset_get(), sculpt_brush_stroke_cancel(), sculpt_brush_stroke_init(), sculpt_brush_stroke_invoke(), SCULPT_calc_area_center(), SCULPT_calc_area_normal(), SCULPT_calc_area_normal_and_center(), SCULPT_calc_brush_plane(), SCULPT_cloth_brush_do_simulation_step(), SCULPT_cloth_brush_ensure_nodes_constraints(), sculpt_cloth_ensure_constraints_in_simulation_area(), sculpt_combine_proxies(), SCULPT_cursor_geometry_info_update(), SCULPT_do_boundary_brush(), SCULPT_do_clay_brush(), SCULPT_do_clay_strips_brush(), SCULPT_do_clay_thumb_brush(), SCULPT_do_cloth_brush(), SCULPT_do_crease_brush(), SCULPT_do_displacement_eraser_brush(), SCULPT_do_displacement_smear_brush(), SCULPT_do_draw_brush(), SCULPT_do_draw_face_sets_brush(), SCULPT_do_draw_sharp_brush(), SCULPT_do_elastic_deform_brush(), SCULPT_do_fill_brush(), SCULPT_do_flatten_brush(), SCULPT_do_grab_brush(), SCULPT_do_inflate_brush(), SCULPT_do_layer_brush(), SCULPT_do_mask_brush(), SCULPT_do_mask_brush_draw(), SCULPT_do_multiplane_scrape_brush(), SCULPT_do_nudge_brush(), SCULPT_do_paint_brush(), SCULPT_do_paint_brush_image(), SCULPT_do_pinch_brush(), SCULPT_do_pose_brush(), SCULPT_do_rotate_brush(), SCULPT_do_scrape_brush(), SCULPT_do_slide_relax_brush(), SCULPT_do_smear_brush(), SCULPT_do_snake_hook_brush(), SCULPT_do_surface_smooth_brush(), SCULPT_do_thumb_brush(), SCULPT_enhance_details_brush(), sculpt_expand_cache_initial_config_set(), sculpt_face_sets_automasking_init(), sculpt_fix_noise_tear(), SCULPT_flush_stroke_deform(), sculpt_gesture_trim_calculate_depth(), sculpt_restore_mesh(), sculpt_sample_color_invoke(), SCULPT_smooth(), sculpt_stroke_done(), SCULPT_stroke_get_location(), sculpt_stroke_test_start(), sculpt_stroke_update_step(), sculpt_tool_name(), SCULPT_topology_automasking_init(), sculpt_update_cache_invariants(), sculpt_update_cache_variants(), smooth_brush_toggle_off(), stencil_control_invoke(), stencil_control_poll(), stencil_fit_image_aspect_exec(), stencil_reset_transform_exec(), texture_get_from_context(), blender::ed::sculpt_paint::image::ops::paint::texture_paint_init(), ui_do_but_COLOR(), update_brush_local_mat(), update_sculpt_normal(), uv_sculpt_stroke_apply(), uv_sculpt_stroke_init(), uv_sculpt_stroke_poll(), vertex_paint_poll_ex(), vpaint_do_symmetrical_brush_actions(), vpaint_stroke_test_start(), vwpaint_update_cache_variants(), weight_paint_poll_ex(), weight_paint_set_exec(), weight_sample_invoke(), wpaint_do_symmetrical_brush_actions(), and wpaint_stroke_update_step().

◆ BKE_paint_brush_for_read()

const Brush* BKE_paint_brush_for_read ( const Paint p)

Definition at line 612 of file paint.c.

References Paint::brush, and NULL.

Referenced by BKE_paint_brush().

◆ BKE_paint_brush_set()

void BKE_paint_brush_set ( Paint p,
Brush br 
)

◆ BKE_paint_cavity_curve_preset()

void BKE_paint_cavity_curve_preset ( Paint p,
int  preset 
)

◆ BKE_paint_copy()

void BKE_paint_copy ( struct Paint src,
struct Paint tar,
int  flag 
)

Called when copying scene settings, so even if 'src' and 'tar' are the same still do a id_us_plus(), rather than if we were copying between 2 existing scenes where a matching value should decrease the existing user count as with #paint_brush_set()

Definition at line 1167 of file paint.c.

References BKE_curvemapping_copy(), PaintToolSlot::brush, Paint::brush, Paint::cavity_curve, id_us_plus(), LIB_ID_CREATE_NO_USER_REFCOUNT, MEM_dupallocN, NULL, Paint::palette, src, Paint::tool_slots, and Paint::tool_slots_len.

Referenced by BKE_toolsettings_copy().

◆ BKE_paint_curve_add()

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

Definition at line 705 of file paint.c.

References BKE_id_new(), and ID_PC.

Referenced by paintcurve_new_exec(), and paintcurve_point_add().

◆ BKE_paint_curve_clamp_endpoint_add_index()

void BKE_paint_curve_clamp_endpoint_add_index ( PaintCurve pc,
const int  add_index 
)

◆ BKE_paint_curve_set()

void BKE_paint_curve_set ( Brush br,
PaintCurve pc 
)

Definition at line 728 of file paint.c.

References id_us_min(), id_us_plus(), and Brush::paint_curve.

◆ BKE_paint_ensure()

bool BKE_paint_ensure ( struct ToolSettings ts,
struct Paint **  r_paint 
)

◆ BKE_paint_ensure_from_paintmode()

bool BKE_paint_ensure_from_paintmode ( Scene sce,
ePaintMode  mode 
)

◆ BKE_paint_face_set_overlay_color_get()

void BKE_paint_face_set_overlay_color_get ( const int  face_set,
const int  seed,
uchar  r_color[4] 
)

◆ BKE_paint_free()

void BKE_paint_free ( Paint paint)

◆ BKE_paint_get_active()

Paint* BKE_paint_get_active ( Scene sce,
ViewLayer view_layer 
)

◆ BKE_paint_get_active_from_context()

Paint* BKE_paint_get_active_from_context ( const bContext C)

◆ BKE_paint_get_active_from_paintmode()

Paint* BKE_paint_get_active_from_paintmode ( Scene sce,
ePaintMode  mode 
)

◆ BKE_paint_get_brush_tool_offset_from_paintmode()

uint BKE_paint_get_brush_tool_offset_from_paintmode ( const ePaintMode  mode)

◆ BKE_paint_get_overlay_flags()

ePaintOverlayControlFlags BKE_paint_get_overlay_flags ( void  )

Definition at line 266 of file paint.c.

References overlay_flags.

Referenced by load_tex(), load_tex_cursor(), and paint_draw_alpha_overlay().

◆ BKE_paint_get_tool_enum_from_paintmode()

const EnumPropertyItem* BKE_paint_get_tool_enum_from_paintmode ( ePaintMode  mode)

◆ BKE_paint_get_tool_prop_id_from_paintmode()

const char* BKE_paint_get_tool_prop_id_from_paintmode ( ePaintMode  mode)

◆ BKE_paint_init()

void BKE_paint_init ( Main bmain,
Scene sce,
ePaintMode  mode,
const char  col[3] 
)

◆ BKE_paint_invalidate_cursor_overlay()

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

◆ BKE_paint_invalidate_overlay_all()

void BKE_paint_invalidate_overlay_all ( void  )

◆ 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()

eObjectMode BKE_paint_object_mode_from_paintmode ( ePaintMode  mode)

◆ BKE_paint_palette()

Palette* BKE_paint_palette ( Paint p)

Definition at line 714 of file paint.c.

References NULL, and Paint::palette.

Referenced by paint_sample_color().

◆ BKE_paint_palette_set()

void BKE_paint_palette_set ( Paint p,
Palette palette 
)

◆ BKE_paint_reset_overlay_invalid()

void BKE_paint_reset_overlay_invalid ( ePaintOverlayControlFlags  flag)

Definition at line 289 of file paint.c.

References overlay_flags.

Referenced by load_tex(), and load_tex_cursor().

◆ BKE_paint_runtime_init()

void BKE_paint_runtime_init ( const ToolSettings ts,
Paint paint 
)

◆ BKE_paint_select_elem_test()

bool BKE_paint_select_elem_test ( struct Object ob)

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

Definition at line 994 of file paint.c.

References BKE_paint_select_face_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()

bool BKE_paint_select_face_test ( struct Object ob)

◆ BKE_paint_select_vert_test()

bool BKE_paint_select_vert_test ( struct Object ob)

◆ BKE_paint_set_overlay_override()

void BKE_paint_set_overlay_override ( eOverlayFlags  flags)

◆ BKE_paint_stroke_get_average()

void BKE_paint_stroke_get_average ( Scene scene,
Object ob,
float  stroke[3] 
)

◆ BKE_paintmode_get_active_from_context()

ePaintMode BKE_paintmode_get_active_from_context ( const bContext C)

◆ BKE_paintmode_get_from_tool()

ePaintMode BKE_paintmode_get_from_tool ( const struct bToolRef tref)

◆ BKE_palette_add()

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

◆ BKE_palette_clear()

void BKE_palette_clear ( Palette palette)

Definition at line 758 of file paint.c.

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

◆ BKE_palette_color_add()

PaletteColor* BKE_palette_color_add ( Palette palette)

◆ BKE_palette_color_remove()

void BKE_palette_color_remove ( struct Palette palette,
struct PaletteColor color 
)

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

Definition at line 742 of file paint.c.

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

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

◆ BKE_palette_from_hash()

bool BKE_palette_from_hash ( Main bmain,
GHash color_table,
const char *  name,
const bool  linear 
)

◆ BKE_palette_is_empty()

bool BKE_palette_is_empty ( const struct Palette palette)

Definition at line 777 of file paint.c.

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 894 of file paint.c.

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 912 of file paint.c.

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 900 of file paint.c.

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 906 of file paint.c.

References palettecolor_compare_vhs().

Referenced by palette_sort_exec().

◆ BKE_sculpt_bvh_update_from_ccg()

void BKE_sculpt_bvh_update_from_ccg ( PBVH pbvh,
SubdivCCG subdiv_ccg 
)

◆ BKE_sculpt_color_layer_create_if_needed()

void BKE_sculpt_color_layer_create_if_needed ( struct Object object)

◆ BKE_sculpt_ensure_orig_mesh_data()

void BKE_sculpt_ensure_orig_mesh_data ( struct Scene scene,
struct Object object 
)

Ensures we do have expected mesh data in original mesh for the sculpt mode.

Note
IDs are expected to be original ones here, and calling code should ensure it updates its depsgraph properly after calling this function if it needs up-to-date evaluated data.

Definition at line 2144 of file paint.c.

References BKE_mesh_from_object(), BKE_mesh_tessface_clear(), BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(), BKE_sculpt_mask_layers_ensure(), BKE_sculpt_multires_active(), BLI_assert, CD_SCULPT_FACE_SETS, CustomData_get_layer(), DEG_id_tag_update(), Object::id, ID_RECALC_GEOMETRY, mesh, Object::mode, NULL, OB_MODE_SCULPT, Mesh::pdata, scene, and Object::sculpt.

Referenced by quadriflow_start_job(), sculpt_init_session(), and voxel_remesh_exec().

◆ BKE_sculpt_face_sets_ensure_from_base_mesh_visibility()

void BKE_sculpt_face_sets_ensure_from_base_mesh_visibility ( struct Mesh mesh)

Ensures that a Face Set data-layers exists. If it does not, it creates one respecting the visibility stored in the vertices of the mesh. If it does, it copies the visibility from the mesh to the Face Sets.

Definition at line 2043 of file paint.c.

References blender::math::abs(), CD_CALLOC, CD_SCULPT_FACE_SETS, CustomData_add_layer(), CustomData_get_layer(), CustomData_has_layer(), Mesh::face_sets_color_default, MPoly::flag, ME_HIDE, mesh, Mesh::mpoly, NULL, Mesh::pdata, and Mesh::totpoly.

Referenced by BKE_sculpt_ensure_orig_mesh_data(), and BKE_sculpt_sync_face_set_visibility().

◆ BKE_sculpt_mask_layers_ensure()

int BKE_sculpt_mask_layers_ensure ( Object ob,
MultiresModifierData mmd 
)

◆ BKE_sculpt_multires_active()

MultiresModifierData* BKE_sculpt_multires_active ( const Scene scene,
Object ob 
)

◆ BKE_sculpt_object_pbvh_ensure()

PBVH* BKE_sculpt_object_pbvh_ensure ( Depsgraph depsgraph,
Object ob 
)

◆ BKE_sculpt_sync_face_set_visibility()

void BKE_sculpt_sync_face_set_visibility ( struct Mesh mesh,
struct SubdivCCG subdiv_ccg 
)

This ensure that all elements in the mesh (both vertices and grids) have their visibility updated according to the face sets.

Definition at line 2137 of file paint.c.

References BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(), BKE_sculpt_sync_face_sets_visibility_to_base_mesh(), BKE_sculpt_sync_face_sets_visibility_to_grids(), and mesh.

Referenced by build_pbvh_from_ccg(), and build_pbvh_from_regular_mesh().

◆ BKE_sculpt_sync_face_sets_visibility_to_base_mesh()

void BKE_sculpt_sync_face_sets_visibility_to_base_mesh ( struct Mesh mesh)

◆ BKE_sculpt_sync_face_sets_visibility_to_grids()

void BKE_sculpt_sync_face_sets_visibility_to_grids ( Mesh mesh,
SubdivCCG subdiv_ccg 
)

◆ BKE_sculpt_toolsettings_data_ensure()

void BKE_sculpt_toolsettings_data_ensure ( struct Scene scene)

◆ BKE_sculpt_update_object_after_eval()

void BKE_sculpt_update_object_after_eval ( Depsgraph depsgraph,
Object ob_eval 
)

◆ BKE_sculpt_update_object_before_eval()

void BKE_sculpt_update_object_before_eval ( const Scene scene,
Object ob_eval 
)

◆ BKE_sculpt_update_object_for_edit()

void BKE_sculpt_update_object_for_edit ( struct Depsgraph depsgraph,
struct Object ob_orig,
bool  need_pmap,
bool  need_mask,
bool  is_paint_tool 
)

◆ BKE_sculptsession_bm_to_me()

void BKE_sculptsession_bm_to_me ( Object ob,
bool  reorder 
)

◆ BKE_sculptsession_bm_to_me_for_render()

void BKE_sculptsession_bm_to_me_for_render ( Object object)

◆ BKE_sculptsession_free()

void BKE_sculptsession_free ( Object ob)

◆ BKE_sculptsession_free_deformMats()

void BKE_sculptsession_free_deformMats ( SculptSession ss)

◆ BKE_sculptsession_free_vwpaint_data()

void BKE_sculptsession_free_vwpaint_data ( struct SculptSession ss)

◆ BKE_sculptsession_use_pbvh_draw()

bool BKE_sculptsession_use_pbvh_draw ( const Object ob,
const RegionView3D rv3d 
)

◆ build_pbvh_for_dynamic_topology()

static PBVH* build_pbvh_for_dynamic_topology ( Object ob)
static

◆ build_pbvh_from_ccg()

static PBVH* build_pbvh_from_ccg ( Object ob,
SubdivCCG subdiv_ccg,
bool  respect_hide 
)
static

◆ build_pbvh_from_regular_mesh()

static PBVH* build_pbvh_from_regular_mesh ( Object ob,
Mesh me_eval_deform,
bool  respect_hide 
)
static

◆ check_sculpt_object_deformed()

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

Definition at line 2019 of file paint.c.

References NULL, and OB_SHAPE_LOCK.

Referenced by build_pbvh_from_regular_mesh().

◆ paint_calculate_rake_rotation()

bool paint_calculate_rake_rotation ( UnifiedPaintSettings ups,
Brush brush,
const float  mouse_pos[2] 
)

◆ paint_curve_blend_read_data()

static void paint_curve_blend_read_data ( BlendDataReader reader,
ID id 
)
static

Definition at line 184 of file paint.c.

References BLO_read_data_address, and PaintCurve::points.

◆ paint_curve_blend_write()

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

◆ paint_curve_copy_data()

static void paint_curve_copy_data ( Main UNUSEDbmain,
ID id_dst,
const ID id_src,
const int   UNUSEDflag 
)
static

Definition at line 153 of file paint.c.

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

◆ paint_curve_free_data()

static void paint_curve_free_data ( ID id)
static

Definition at line 166 of file paint.c.

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

◆ paint_grid_paint_mask()

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

Definition at line 1277 of file paint.c.

References BKE_ccg_factor(), BKE_ccg_gridsize(), GridPaintMask::data, GridPaintMask::level, x, and y.

◆ paint_is_bmesh_face_hidden()

bool paint_is_bmesh_face_hidden ( struct BMFace f)

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

Definition at line 1262 of file paint.c.

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

Referenced by partialvis_update_bmesh_faces().

◆ paint_is_face_hidden()

bool paint_is_face_hidden ( const MLoopTri lt,
const MVert mvert,
const MLoop mloop 
)

Definition at line 1246 of file paint.c.

References MVert::flag, ME_HIDE, MLoopTri::tri, and MLoop::v.

◆ paint_is_grid_face_hidden()

bool paint_is_grid_face_hidden ( const unsigned int *  grid_hidden,
int  gridsize,
int  x,
int  y 
)

Returns non-zero if any of the corners of the grid face whose inner corner is at (x, y) are hidden, zero otherwise.

Definition at line 1253 of file paint.c.

References BLI_BITMAP_TEST, x, and y.

Referenced by BKE_pbvh_count_grid_quads(), gpu_pbvh_grid_fill_index_buffers(), pbvh_grids_node_nearest_to_ray(), and pbvh_grids_node_raycast().

◆ paint_update_brush_rake_rotation()

void paint_update_brush_rake_rotation ( UnifiedPaintSettings ups,
Brush brush,
float  rotation 
)

◆ palette_blend_read_data()

static void palette_blend_read_data ( BlendDataReader reader,
ID id 
)
static

Definition at line 107 of file paint.c.

References BLO_read_list(), and Palette::colors.

◆ palette_blend_write()

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

◆ palette_copy_data()

static void palette_copy_data ( Main UNUSEDbmain,
ID id_dst,
const ID id_src,
const int   UNUSEDflag 
)
static

Definition at line 76 of file paint.c.

References BLI_duplicatelist(), and Palette::colors.

◆ palette_free_data()

static void palette_free_data ( ID id)
static

Definition at line 87 of file paint.c.

References BLI_freelistN(), and Palette::colors.

◆ palette_init_data()

static void palette_init_data ( ID id)
static

Definition at line 66 of file paint.c.

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

◆ palette_undo_preserve()

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

Definition at line 113 of file paint.c.

References BKE_lib_id_swap(), NULL, ID::properties, and SWAP.

◆ palettecolor_compare_hsv()

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

Definition at line 783 of file paint.c.

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

Referenced by BKE_palette_sort_hsv().

◆ palettecolor_compare_luminance()

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

Definition at line 877 of file paint.c.

References tPaletteColorHSV::rgb.

Referenced by BKE_palette_sort_luminance().

◆ palettecolor_compare_svh()

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

Definition at line 815 of file paint.c.

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

Referenced by BKE_palette_sort_svh().

◆ palettecolor_compare_vhs()

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

Definition at line 846 of file paint.c.

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

Referenced by BKE_palette_sort_vhs().

◆ sculpt_face_sets_ensure()

static void sculpt_face_sets_ensure ( Mesh mesh)
static

◆ sculpt_modifiers_active()

static bool sculpt_modifiers_active ( Scene scene,
Sculpt sd,
Object ob 
)
static

◆ sculpt_update_object()

static void sculpt_update_object ( Depsgraph depsgraph,
Object ob,
Mesh me_eval,
bool  need_pmap,
bool  need_mask,
bool  is_paint_tool 
)
static
Parameters
need_maskSo that the evaluated mesh that is returned has mask data.

Definition at line 1617 of file paint.c.

References Freestyle::a, SculptSession::active, ATTR_DOMAIN_NUM, BKE_crazyspace_build_sculpt(), BKE_keyblock_convert_to_vertcos(), BKE_keyblock_from_object(), BKE_mesh_vert_coords_alloc(), BKE_mesh_vert_poly_map_create(), BKE_object_get_original_mesh(), BKE_paint_canvas_key_get(), BKE_pbvh_face_sets_color_set(), BKE_pbvh_face_sets_set(), BKE_pbvh_get_color_layer(), BKE_pbvh_is_deformed(), BKE_pbvh_mark_rebuild_pixels(), BKE_pbvh_pmap_set(), BKE_pbvh_subdiv_cgg_set(), BKE_pbvh_vert_coords_apply(), BKE_sculpt_multires_active(), BKE_sculpt_object_pbvh_ensure(), BKE_sculptsession_free_deformMats(), BKE_texpaint_slots_refresh_object(), BLI_assert, SculptSession::building_vp_handle, CD_GRID_PAINT_MASK, CD_PAINT_MASK, CD_PROP_COLOR, CD_SCULPT_FACE_SETS, CustomData_get_layer(), CustomData_has_layer(), CustomDataLayer::data, SculptSession::deform_cos, SculptSession::deform_imats, SculptSession::deform_modifiers_active, DEG_get_input_scene(), SculptSession::depsgraph, depsgraph, SculptSession::face_sets, Mesh::face_sets_color_default, Mesh::face_sets_color_seed, Sculpt::flags, float(), invert_m3(), SculptSession::last_paint_canvas_key, Mesh::ldata, SculptSession::level, SculptSession::mcol, MEM_freeN, MEM_SAFE_FREE, SculptSession::mloop, Mesh::mloop, Object::mode, SculptSession::modifier, SculptSession::mpoly, Mesh::mpoly, SculptSession::multires, SculptSession::mvert, Mesh::mvert, NULL, OB_MESH, OB_MODE_SCULPT, SculptSession::orig_cos, ToolSettings::paint_mode, SculptSession::pbvh, pbvh_show_face_sets_set(), pbvh_show_mask_set(), Mesh::pdata, SculptSession::pmap, SculptSession::pmap_mem, Mesh::runtime, SculptSession::scene, scene, Object::sculpt, ToolSettings::sculpt, SCULPT_HIDE_FACE_SETS, SCULPT_HIDE_MASK, sculpt_modifiers_active(), MultiresModifierData::sculptlvl, SculptSession::shapekey_active, SculptSession::show_face_sets, SculptSession::show_mask, STREQ, SculptSession::subdiv_ccg, Mesh_Runtime::subdiv_ccg, Scene::toolsettings, SculptSession::totfaces, Mesh::totloop, SculptSession::totpoly, Mesh::totpoly, SculptSession::totvert, Mesh::totvert, CustomDataLayer::type, Object::type, UNUSED_VARS_NDEBUG, SculptSession::vcol, SculptSession::vcol_domain, SculptSession::vcol_type, Mesh::vdata, and SculptSession::vmask.

Referenced by BKE_sculpt_update_object_after_eval(), and BKE_sculpt_update_object_for_edit().

◆ sculptsession_bm_to_me_update_data_only()

static void sculptsession_bm_to_me_update_data_only ( Object ob,
bool  reorder 
)
static

◆ sculptsession_free_pbvh()

static void sculptsession_free_pbvh ( Object object)
static

Variable Documentation

◆ IDType_ID_PAL

IDTypeInfo IDType_ID_PAL
Initial value:
= {
.id_code = ID_PAL,
.id_filter = FILTER_ID_PAL,
.main_listbase_index = INDEX_ID_PAL,
.struct_size = sizeof(Palette),
.name = "Palette",
.name_plural = "palettes",
.translation_context = BLT_I18NCONTEXT_ID_PALETTE,
.asset_type_info = NULL,
.copy_data = palette_copy_data,
.free_data = palette_free_data,
.make_local = NULL,
.foreach_id = NULL,
.foreach_cache = NULL,
.foreach_path = NULL,
.owner_get = NULL,
.blend_write = palette_blend_write,
.blend_read_data = palette_blend_read_data,
.blend_read_lib = NULL,
.blend_read_expand = NULL,
.blend_read_undo_preserve = palette_undo_preserve,
.lib_override_apply_post = NULL,
}
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition: BKE_idtype.h:41
#define BLT_I18NCONTEXT_ID_PALETTE
@ INDEX_ID_PAL
Definition: DNA_ID.h:1044
#define FILTER_ID_PAL
Definition: DNA_ID.h:917
@ ID_PAL
Definition: DNA_ID_enums.h:76
struct Palette Palette
static void init_data(ModifierData *md)
static void palette_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
Definition: paint.c:76
static void palette_undo_preserve(BlendLibReader *UNUSED(reader), ID *id_new, ID *id_old)
Definition: paint.c:113
static void palette_free_data(ID *id)
Definition: paint.c:87
static void palette_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: paint.c:94
static void palette_init_data(ID *id)
Definition: paint.c:66
static void palette_blend_read_data(BlendDataReader *reader, ID *id)
Definition: paint.c:107

Definition at line 123 of file paint.c.

◆ IDType_ID_PC

IDTypeInfo IDType_ID_PC
Initial value:
= {
.id_code = ID_PC,
.id_filter = FILTER_ID_PC,
.main_listbase_index = INDEX_ID_PC,
.struct_size = sizeof(PaintCurve),
.name = "PaintCurve",
.name_plural = "paint_curves",
.translation_context = BLT_I18NCONTEXT_ID_PAINTCURVE,
.asset_type_info = NULL,
.copy_data = paint_curve_copy_data,
.free_data = paint_curve_free_data,
.make_local = NULL,
.foreach_id = NULL,
.foreach_cache = NULL,
.foreach_path = NULL,
.owner_get = NULL,
.blend_write = paint_curve_blend_write,
.blend_read_data = paint_curve_blend_read_data,
.blend_read_lib = NULL,
.blend_read_expand = NULL,
.blend_read_undo_preserve = NULL,
.lib_override_apply_post = NULL,
}
#define BLT_I18NCONTEXT_ID_PAINTCURVE
@ INDEX_ID_PC
Definition: DNA_ID.h:1045
#define FILTER_ID_PC
Definition: DNA_ID.h:918
@ ID_PC
Definition: DNA_ID_enums.h:77
struct PaintCurve PaintCurve
static void paint_curve_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int UNUSED(flag))
Definition: paint.c:153
static void paint_curve_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: paint.c:174
static void paint_curve_free_data(ID *id)
Definition: paint.c:166
static void paint_curve_blend_read_data(BlendDataReader *reader, ID *id)
Definition: paint.c:184

Definition at line 190 of file paint.c.

◆ overlay_flags

ePaintOverlayControlFlags overlay_flags = 0
static

◆ PAINT_CURSOR_SCULPT

const char PAINT_CURSOR_SCULPT[3] = {255, 100, 100}

Definition at line 220 of file paint.c.

Referenced by ED_object_sculptmode_enter_ex().

◆ PAINT_CURSOR_TEXTURE_PAINT

const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255}

Definition at line 223 of file paint.c.

Referenced by ED_object_texture_paint_mode_enter_ex(), and ED_space_image_paint_update().

◆ PAINT_CURSOR_VERTEX_PAINT

const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255}

Definition at line 221 of file paint.c.

Referenced by ed_vwpaintmode_enter_generic().

◆ PAINT_CURSOR_WEIGHT_PAINT

const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255}

Definition at line 222 of file paint.c.

Referenced by ed_vwpaintmode_enter_generic().