Blender  V3.3
Classes | Macros | Functions
sculpt.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_dial_2d.h"
#include "BLI_ghash.h"
#include "BLI_gsqueue.h"
#include "BLI_hash.h"
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_math_color_blend.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "PIL_time.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_attribute.h"
#include "BKE_brush.h"
#include "BKE_ccg.h"
#include "BKE_colortools.h"
#include "BKE_context.h"
#include "BKE_image.h"
#include "BKE_kelvinlet.h"
#include "BKE_key.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_mesh_mirror.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
#include "BKE_node.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_particle.h"
#include "BKE_pbvh.h"
#include "BKE_pointcache.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "BKE_subdiv_ccg.h"
#include "BKE_subsurf.h"
#include "NOD_texture.h"
#include "DEG_depsgraph.h"
#include "IMB_colormanagement.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "ED_object.h"
#include "ED_paint.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_view3d.h"
#include "paint_intern.h"
#include "sculpt_intern.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  NearestVertexTLSData
 
struct  AreaNormalCenterTLSData
 
struct  SculptRaycastData
 
struct  SculptFindNearestToRayData
 
struct  NearestVertexFakeNeighborTLSData
 
struct  SculptTopologyIDFloodFillData
 

Macros

#define PIXEL_INPUT_THRESHHOLD   5
 

Functions

static bool sculpt_tool_has_cube_tip (const char sculpt_tool)
 
Sculpt Flood Fill API

Iterate over connected vertices, starting from one or more initial vertices.

void SCULPT_floodfill_init (SculptSession *ss, SculptFloodFill *flood)
 
void SCULPT_floodfill_add_initial (SculptFloodFill *flood, int index)
 
void SCULPT_floodfill_add_and_skip_initial (SculptFloodFill *flood, int index)
 
void SCULPT_floodfill_add_initial_with_symmetry (Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, int index, float radius)
 
void SCULPT_floodfill_add_active (Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, float radius)
 
void SCULPT_floodfill_execute (SculptSession *ss, SculptFloodFill *flood, bool(*func)(SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata), void *userdata)
 
void SCULPT_floodfill_free (SculptFloodFill *flood)
 
Tool Capabilities

Avoid duplicate checks, internal logic only, share logic with rna_def_sculpt_capabilities where possible.

static bool sculpt_tool_needs_original (const char sculpt_tool)
 
static bool sculpt_tool_is_proxy_used (const char sculpt_tool)
 
static bool sculpt_brush_use_topology_rake (const SculptSession *ss, const Brush *brush)
 
static int sculpt_brush_needs_normal (const SculptSession *ss, const Brush *brush)
 
static bool sculpt_brush_needs_rake_rotation (const Brush *brush)
 
Sculpt Dynamic Topology
bool SCULPT_stroke_is_dynamic_topology (const SculptSession *ss, const Brush *brush)
 
Sculpt Paint Mesh
static void paint_mesh_restore_co_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void paint_mesh_restore_co (Sculpt *sd, Object *ob)
 
static void sculpt_extend_redraw_rect_previous (Object *ob, rcti *rect)
 
bool SCULPT_get_redraw_rect (ARegion *region, RegionView3D *rv3d, Object *ob, rcti *rect)
 
void ED_sculpt_redraw_planes_get (float planes[4][4], ARegion *region, Object *ob)
 
void SCULPT_brush_test_init (SculptSession *ss, SculptBrushTest *test)
 
BLI_INLINE bool sculpt_brush_test_clipping (const SculptBrushTest *test, const float co[3])
 
bool SCULPT_brush_test_sphere (SculptBrushTest *test, const float co[3])
 
bool SCULPT_brush_test_sphere_sq (SculptBrushTest *test, const float co[3])
 
bool SCULPT_brush_test_sphere_fast (const SculptBrushTest *test, const float co[3])
 
bool SCULPT_brush_test_circle_sq (SculptBrushTest *test, const float co[3])
 
bool SCULPT_brush_test_cube (SculptBrushTest *test, const float co[3], const float local[4][4], const float roundness)
 
SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape (SculptSession *ss, SculptBrushTest *test, char falloff_shape)
 
const floatSCULPT_brush_frontface_normal_from_falloff_shape (SculptSession *ss, char falloff_shape)
 
static float frontface (const Brush *br, const float sculpt_normal[3], const float no[3], const float fno[3])
 
static float calc_overlap (StrokeCache *cache, const char symm, const char axis, const float angle)
 
static float calc_radial_symmetry_feather (Sculpt *sd, StrokeCache *cache, const char symm, const char axis)
 
static float calc_symmetry_feather (Sculpt *sd, StrokeCache *cache)
 
Texture painting
static bool sculpt_needs_pbvh_pixels (PaintModeSettings *paint_mode_settings, const Brush *brush, Object *ob)
 
static void sculpt_pbvh_update_pixels (PaintModeSettings *paint_mode_settings, SculptSession *ss, Object *ob)
 
Generic Brush Plane & Symmetry Utilities
ePaintSymmetryAreas SCULPT_get_vertex_symm_area (const float co[3])
 
void SCULPT_flip_v3_by_symm_area (float v[3], const ePaintSymmetryFlags symm, const ePaintSymmetryAreas symmarea, const float pivot[3])
 
void SCULPT_flip_quat_by_symm_area (float quat[4], const ePaintSymmetryFlags symm, const ePaintSymmetryAreas symmarea, const float pivot[3])
 
void SCULPT_calc_brush_plane (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3], float r_area_co[3])
 
int SCULPT_plane_trim (const StrokeCache *cache, const Brush *brush, const float val[3])
 
int SCULPT_plane_point_side (const float co[3], const float plane[4])
 
float SCULPT_brush_plane_offset_get (Sculpt *sd, SculptSession *ss)
 
Sculpt Gravity Brush
static void do_gravity_task_cb_ex (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
 
static void do_gravity (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength)
 

Sculpt PBVH Abstraction API

This is read-only, for writing use PBVH vertex iterators. There vd.index matches the indices used here.

For multi-resolution, the same vertex in multiple grids is counted multiple times, with different index for each grid.

#define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY   256
 
typedef struct NearestVertexTLSData NearestVertexTLSData
 
void SCULPT_vertex_random_access_ensure (SculptSession *ss)
 
int SCULPT_vertex_count_get (SculptSession *ss)
 
const floatSCULPT_vertex_co_get (SculptSession *ss, int index)
 
bool SCULPT_has_loop_colors (const Object *ob)
 
bool SCULPT_has_colors (const SculptSession *ss)
 
void SCULPT_vertex_color_get (const SculptSession *ss, int index, float r_color[4])
 
void SCULPT_vertex_color_set (SculptSession *ss, int index, const float color[4])
 
void SCULPT_vertex_normal_get (SculptSession *ss, int index, float no[3])
 
const floatSCULPT_vertex_persistent_co_get (SculptSession *ss, int index)
 
const floatSCULPT_vertex_co_for_grab_active_get (SculptSession *ss, int index)
 
void SCULPT_vertex_limit_surface_get (SculptSession *ss, int index, float r_co[3])
 
void SCULPT_vertex_persistent_normal_get (SculptSession *ss, int index, float no[3])
 
float SCULPT_vertex_mask_get (SculptSession *ss, int index)
 
int SCULPT_active_vertex_get (SculptSession *ss)
 
const floatSCULPT_active_vertex_co_get (SculptSession *ss)
 
void SCULPT_active_vertex_normal_get (SculptSession *ss, float normal[3])
 
MVertSCULPT_mesh_deformed_mverts_get (SculptSession *ss)
 
floatSCULPT_brush_deform_target_vertex_co_get (SculptSession *ss, const int deform_target, PBVHVertexIter *iter)
 
char SCULPT_mesh_symmetry_xyz_get (Object *object)
 
int SCULPT_active_face_set_get (SculptSession *ss)
 
void SCULPT_vertex_visible_set (SculptSession *ss, int index, bool visible)
 
bool SCULPT_vertex_visible_get (SculptSession *ss, int index)
 
void SCULPT_face_set_visibility_set (SculptSession *ss, int face_set, bool visible)
 
void SCULPT_face_sets_visibility_invert (SculptSession *ss)
 
void SCULPT_face_sets_visibility_all_set (SculptSession *ss, bool visible)
 
bool SCULPT_vertex_any_face_set_visible_get (SculptSession *ss, int index)
 
bool SCULPT_vertex_all_face_sets_visible_get (const SculptSession *ss, int index)
 
void SCULPT_vertex_face_set_set (SculptSession *ss, int index, int face_set)
 
int SCULPT_vertex_face_set_get (SculptSession *ss, int index)
 
bool SCULPT_vertex_has_face_set (SculptSession *ss, int index, int face_set)
 
void SCULPT_visibility_sync_all_face_sets_to_vertices (Object *ob)
 
static void UNUSED_FUNCTION() sculpt_visibility_sync_vertex_to_face_sets (SculptSession *ss, int index)
 
void SCULPT_visibility_sync_all_vertex_to_face_sets (SculptSession *ss)
 
static bool sculpt_check_unique_face_set_in_base_mesh (SculptSession *ss, int index)
 
static bool sculpt_check_unique_face_set_for_edge_in_base_mesh (SculptSession *ss, int v1, int v2)
 
bool SCULPT_vertex_has_unique_face_set (SculptSession *ss, int index)
 
int SCULPT_face_set_next_available_get (SculptSession *ss)
 
static void sculpt_vertex_neighbor_add (SculptVertexNeighborIter *iter, int neighbor_index)
 
static void sculpt_vertex_neighbors_get_bmesh (SculptSession *ss, int index, SculptVertexNeighborIter *iter)
 
static void sculpt_vertex_neighbors_get_faces (SculptSession *ss, int index, SculptVertexNeighborIter *iter)
 
static void sculpt_vertex_neighbors_get_grids (SculptSession *ss, const int index, const bool include_duplicates, SculptVertexNeighborIter *iter)
 
void SCULPT_vertex_neighbors_get (SculptSession *ss, const int index, const bool include_duplicates, SculptVertexNeighborIter *iter)
 
static bool sculpt_check_boundary_vertex_in_base_mesh (const SculptSession *ss, const int index)
 
bool SCULPT_vertex_is_boundary (const SculptSession *ss, const int index)
 
bool SCULPT_stroke_is_main_symmetry_pass (StrokeCache *cache)
 
bool SCULPT_stroke_is_first_brush_step (StrokeCache *cache)
 
bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass (StrokeCache *cache)
 
bool SCULPT_check_vertex_pivot_symmetry (const float vco[3], const float pco[3], const char symm)
 
static void do_nearest_vertex_get_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
 
static void nearest_vertex_get_reduce (const void *__restrict UNUSED(userdata), void *__restrict chunk_join, void *__restrict chunk)
 
int SCULPT_nearest_vertex_get (Sculpt *sd, Object *ob, const float co[3], float max_distance, bool use_original)
 
bool SCULPT_is_symmetry_iteration_valid (char i, char symm)
 
bool SCULPT_is_vertex_inside_brush_radius_symm (const float vertex[3], const float br_co[3], float radius, char symm)
 
void SCULPT_tag_update_overlays (bContext *C)
 

Generic Brush Utilities

#define SCULPT_TILT_SENSITIVITY   0.7f
 
static float brush_strength (const Sculpt *sd, const StrokeCache *cache, const float feather, const UnifiedPaintSettings *ups, const PaintModeSettings *UNUSED(paint_mode_settings))
 
float SCULPT_brush_strength_factor (SculptSession *ss, const Brush *br, const float brush_point[3], const float len, const float vno[3], const float fno[3], const float mask, const int vertex_index, const int thread_id)
 
bool SCULPT_search_sphere_cb (PBVHNode *node, void *data_v)
 
bool SCULPT_search_circle_cb (PBVHNode *node, void *data_v)
 
void SCULPT_clip (Sculpt *sd, SculptSession *ss, float co[3], const float val[3])
 
static PBVHNode ** sculpt_pbvh_gather_cursor_update (Object *ob, Sculpt *sd, bool use_original, int *r_totnode)
 
static PBVHNode ** sculpt_pbvh_gather_generic (Object *ob, Sculpt *sd, const Brush *brush, bool use_original, float radius_scale, int *r_totnode)
 
static void calc_sculpt_normal (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3])
 
static void update_sculpt_normal (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
 
static void calc_local_y (ViewContext *vc, const float center[3], float y[3])
 
static void calc_brush_local_mat (const Brush *brush, Object *ob, float local_mat[4][4])
 
void SCULPT_tilt_apply_to_normal (float r_normal[3], StrokeCache *cache, const float tilt_strength)
 
void SCULPT_tilt_effective_normal_get (const SculptSession *ss, const Brush *brush, float r_no[3])
 
static void update_brush_local_mat (Sculpt *sd, Object *ob)
 

Sculpt Init/Update

enum  StrokeFlags { CLIP_X = 1 , CLIP_Y = 2 , CLIP_Z = 4 }
 
typedef enum StrokeFlags StrokeFlags
 
void SCULPT_orig_vert_data_unode_init (SculptOrigVertData *data, Object *ob, SculptUndoNode *unode)
 
void SCULPT_orig_vert_data_init (SculptOrigVertData *data, Object *ob, PBVHNode *node, SculptUndoType type)
 
void SCULPT_orig_vert_data_update (SculptOrigVertData *orig_data, PBVHVertexIter *iter)
 
static void sculpt_rake_data_update (struct SculptRakeData *srd, const float co[3])
 

Sculpt Brush Utilities

enum  { SCULPT_TOPOLOGY_ID_NONE , SCULPT_TOPOLOGY_ID_DEFAULT }
 
typedef void(* BrushActionFunc) (Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, PaintModeSettings *paint_mode_settings)
 
typedef struct NearestVertexFakeNeighborTLSData NearestVertexFakeNeighborTLSData
 
typedef struct SculptTopologyIDFloodFillData SculptTopologyIDFloodFillData
 
void SCULPT_vertcos_to_key (Object *ob, KeyBlock *kb, const float(*vertCos)[3])
 
static void sculpt_topology_update (Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *UNUSED(ups), PaintModeSettings *UNUSED(paint_mode_settings))
 
static void do_brush_action_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void do_brush_action (Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, PaintModeSettings *paint_mode_settings)
 
static void sculpt_flush_pbvhvert_deform (Object *ob, PBVHVertexIter *vd)
 
static void sculpt_combine_proxies_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_combine_proxies (Sculpt *sd, Object *ob)
 
void SCULPT_combine_transform_proxies (Sculpt *sd, Object *ob)
 
static void sculpt_update_keyblock (Object *ob)
 
static void SCULPT_flush_stroke_deform_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
void SCULPT_flush_stroke_deform (Sculpt *sd, Object *ob, bool is_proxy_used)
 
void SCULPT_cache_calc_brushdata_symm (StrokeCache *cache, const char symm, const char axis, const float angle)
 
static void do_tiled (Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, PaintModeSettings *paint_mode_settings, BrushActionFunc action)
 
static void do_radial_symmetry (Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, PaintModeSettings *paint_mode_settings, BrushActionFunc action, const char symm, const int axis, const float UNUSED(feather))
 
static void sculpt_fix_noise_tear (Sculpt *sd, Object *ob)
 
static void do_symmetrical_brush_actions (Sculpt *sd, Object *ob, BrushActionFunc action, UnifiedPaintSettings *ups, PaintModeSettings *paint_mode_settings)
 
bool SCULPT_mode_poll (bContext *C)
 
bool SCULPT_mode_poll_view3d (bContext *C)
 
bool SCULPT_poll_view3d (bContext *C)
 
bool SCULPT_poll (bContext *C)
 
static const char * sculpt_tool_name (Sculpt *sd)
 
void SCULPT_cache_free (StrokeCache *cache)
 
static void sculpt_init_mirror_clipping (Object *ob, SculptSession *ss)
 
static void smooth_brush_toggle_on (const bContext *C, Paint *paint, StrokeCache *cache)
 
static void smooth_brush_toggle_off (const bContext *C, Paint *paint, StrokeCache *cache)
 
static void sculpt_update_cache_invariants (bContext *C, Sculpt *sd, SculptSession *ss, wmOperator *op, const float mval[2])
 
static float sculpt_brush_dynamic_size_get (Brush *brush, StrokeCache *cache, float initial_size)
 
static bool sculpt_needs_delta_from_anchored_origin (Brush *brush)
 
static bool sculpt_needs_delta_for_tip_orientation (Brush *brush)
 
static void sculpt_update_brush_delta (UnifiedPaintSettings *ups, Object *ob, Brush *brush)
 
static void sculpt_update_cache_paint_variants (StrokeCache *cache, const Brush *brush)
 
static void sculpt_update_cache_variants (bContext *C, Sculpt *sd, Object *ob, PointerRNA *ptr)
 
static bool sculpt_needs_connectivity_info (const Sculpt *sd, const Brush *brush, SculptSession *ss, int stroke_mode)
 
void SCULPT_stroke_modifiers_check (const bContext *C, Object *ob, const Brush *brush)
 
static void sculpt_raycast_cb (PBVHNode *node, void *data_v, float *tmin)
 
static void sculpt_find_nearest_to_ray_cb (PBVHNode *node, void *data_v, float *tmin)
 
float SCULPT_raycast_init (ViewContext *vc, const float mval[2], float ray_start[3], float ray_end[3], float ray_normal[3], bool original)
 
bool SCULPT_cursor_geometry_info_update (bContext *C, SculptCursorGeometryInfo *out, const float mval[2], bool use_sampled_normal)
 
bool SCULPT_stroke_get_location (bContext *C, float out[3], const float mval[2], bool force_original)
 
static void sculpt_brush_init_tex (Sculpt *sd, SculptSession *ss)
 
static void sculpt_brush_stroke_init (bContext *C, wmOperator *op)
 
static void sculpt_restore_mesh (Sculpt *sd, Object *ob)
 
void SCULPT_update_object_bounding_box (Object *ob)
 
void SCULPT_flush_update_step (bContext *C, SculptUpdateType update_flags)
 
void SCULPT_flush_update_done (const bContext *C, Object *ob, SculptUpdateType update_flags)
 
static bool over_mesh (bContext *C, struct wmOperator *UNUSED(op), const float mval[2])
 
bool SCULPT_handles_colors_report (SculptSession *ss, ReportList *reports)
 
static bool sculpt_stroke_test_start (bContext *C, struct wmOperator *op, const float mval[2])
 
static void sculpt_stroke_update_step (bContext *C, wmOperator *UNUSED(op), struct PaintStroke *stroke, PointerRNA *itemptr)
 
static void sculpt_brush_exit_tex (Sculpt *sd)
 
static void sculpt_stroke_done (const bContext *C, struct PaintStroke *UNUSED(stroke))
 
static int sculpt_brush_stroke_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int sculpt_brush_stroke_exec (bContext *C, wmOperator *op)
 
static void sculpt_brush_stroke_cancel (bContext *C, wmOperator *op)
 
static int sculpt_brush_stroke_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
void SCULPT_OT_brush_stroke (wmOperatorType *ot)
 
static int SCULPT_vertex_get_connected_component (SculptSession *ss, int index)
 
static void SCULPT_fake_neighbor_init (SculptSession *ss, const float max_dist)
 
static void SCULPT_fake_neighbor_add (SculptSession *ss, int v_index_a, int v_index_b)
 
static void sculpt_pose_fake_neighbors_free (SculptSession *ss)
 
static void do_fake_neighbor_search_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
 
static void fake_neighbor_search_reduce (const void *__restrict UNUSED(userdata), void *__restrict chunk_join, void *__restrict chunk)
 
static int SCULPT_fake_neighbor_search (Sculpt *sd, Object *ob, const int index, float max_distance)
 
static bool SCULPT_connected_components_floodfill_cb (SculptSession *ss, int from_v, int to_v, bool UNUSED(is_duplicate), void *userdata)
 
void SCULPT_connected_components_ensure (Object *ob)
 
void SCULPT_boundary_info_ensure (Object *object)
 
void SCULPT_fake_neighbors_ensure (Sculpt *sd, Object *ob, const float max_dist)
 
void SCULPT_fake_neighbors_enable (Object *ob)
 
void SCULPT_fake_neighbors_disable (Object *ob)
 
void SCULPT_fake_neighbors_free (Object *ob)
 

Calculate Normal and Center

Calculate geometry surrounding the brush center. (optionally using original coordinates).

Functions are:

Note
These are all very similar, when changing one, check others.
typedef struct AreaNormalCenterTLSData AreaNormalCenterTLSData
 
static void calc_area_normal_and_center_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict tls)
 
static void calc_area_normal_and_center_reduce (const void *__restrict UNUSED(userdata), void *__restrict chunk_join, void *__restrict chunk)
 
void SCULPT_calc_area_center (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_co[3])
 
void SCULPT_calc_area_normal (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3])
 
bool SCULPT_pbvh_calc_area_normal (const Brush *brush, Object *ob, PBVHNode **nodes, int totnode, bool use_threading, float r_area_no[3])
 
void SCULPT_calc_area_normal_and_center (Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float r_area_no[3], float r_area_co[3])
 

Detailed Description

Implements the Sculpt Mode tools.

Definition in file sculpt.c.

Macro Definition Documentation

◆ PIXEL_INPUT_THRESHHOLD

#define PIXEL_INPUT_THRESHHOLD   5

◆ SCULPT_TILT_SENSITIVITY

#define SCULPT_TILT_SENSITIVITY   0.7f

Definition at line 2750 of file sculpt.c.

◆ SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY

#define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY   256

Definition at line 715 of file sculpt.c.

Typedef Documentation

◆ AreaNormalCenterTLSData

◆ BrushActionFunc

typedef void(* BrushActionFunc) (Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups, PaintModeSettings *paint_mode_settings)

Definition at line 3818 of file sculpt.c.

◆ NearestVertexFakeNeighborTLSData

◆ NearestVertexTLSData

◆ SculptTopologyIDFloodFillData

◆ StrokeFlags

typedef enum StrokeFlags StrokeFlags

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SCULPT_TOPOLOGY_ID_NONE 
SCULPT_TOPOLOGY_ID_DEFAULT 

Definition at line 5674 of file sculpt.c.

◆ StrokeFlags

Enumerator
CLIP_X 
CLIP_Y 
CLIP_Z 

Definition at line 1265 of file sculpt.c.

Function Documentation

◆ brush_strength()

static float brush_strength ( const Sculpt sd,
const StrokeCache cache,
const float  feather,
const UnifiedPaintSettings ups,
const PaintModeSettings UNUSEDpaint_mode_settings 
)
static

Return modified brush strength. Includes the direction of the brush, positive values pull vertices, negative values push. Uses tablet pressure and a special multiplier found experimentally to scale the strength factor.

Definition at line 2219 of file sculpt.c.

References BKE_brush_alpha_get(), BKE_brush_use_alpha_pressure(), BKE_paint_brush(), BLI_assert_msg, BRUSH_CLOTH_DEFORM_EXPAND, BRUSH_CLOTH_DEFORM_GRAB, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_DIR_IN, BRUSH_INVERT_TO_SCRAPE_FILL, BRUSH_MASK_DRAW, BRUSH_MASK_SMOOTH, Brush::cloth_deform_type, Brush::flag, invert(), StrokeCache::invert, Brush::mask_tool, UnifiedPaintSettings::overlap_factor, Sculpt::paint, StrokeCache::pen_flip, pow4f(), powf, StrokeCache::pressure, scene, ViewContext::scene, Brush::sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_BOUNDARY, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_CLAY_THUMB, SCULPT_TOOL_CLOTH, SCULPT_TOOL_CREASE, SCULPT_TOOL_DISPLACEMENT_ERASER, SCULPT_TOOL_DISPLACEMENT_SMEAR, SCULPT_TOOL_DRAW, SCULPT_TOOL_DRAW_FACE_SETS, SCULPT_TOOL_DRAW_SHARP, SCULPT_TOOL_ELASTIC_DEFORM, SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_GRAB, SCULPT_TOOL_INFLATE, SCULPT_TOOL_LAYER, SCULPT_TOOL_MASK, SCULPT_TOOL_MULTIPLANE_SCRAPE, SCULPT_TOOL_NUDGE, SCULPT_TOOL_PAINT, SCULPT_TOOL_PINCH, SCULPT_TOOL_POSE, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SCRAPE, SCULPT_TOOL_SLIDE_RELAX, SCULPT_TOOL_SMEAR, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, and StrokeCache::vc.

Referenced by do_symmetrical_brush_actions(), do_vpaint_brush_blur_loops(), do_vpaint_brush_blur_verts(), do_vpaint_brush_smear(), do_wpaint_brush_blur_task_cb_ex(), do_wpaint_brush_draw_task_cb_ex(), do_wpaint_brush_smear_task_cb_ex(), blender::ed::sculpt_paint::paint::image::PaintingKernel< ImageBuffer >::paint(), and vpaint_do_draw().

◆ calc_area_normal_and_center_reduce()

static void calc_area_normal_and_center_reduce ( const void *__restrict   UNUSEDuserdata,
void *__restrict  chunk_join,
void *__restrict  chunk 
)
static

◆ calc_area_normal_and_center_task_cb()

static void calc_area_normal_and_center_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict  tls 
)
static

◆ calc_brush_local_mat()

static void calc_brush_local_mat ( const Brush brush,
Object ob,
float  local_mat[4][4] 
)
static

◆ calc_local_y()

static void calc_local_y ( ViewContext vc,
const float  center[3],
float  y[3] 
)
static

◆ calc_overlap()

static float calc_overlap ( StrokeCache cache,
const char  symm,
const char  axis,
const float  angle 
)
static

◆ calc_radial_symmetry_feather()

static float calc_radial_symmetry_feather ( Sculpt sd,
StrokeCache cache,
const char  symm,
const char  axis 
)
static

Definition at line 1783 of file sculpt.c.

References angle(), calc_overlap(), M_PI, and Sculpt::radial_symm.

Referenced by calc_symmetry_feather().

◆ calc_sculpt_normal()

static void calc_sculpt_normal ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode,
float  r_area_no[3] 
)
static

◆ calc_symmetry_feather()

static float calc_symmetry_feather ( Sculpt sd,
StrokeCache cache 
)
static

◆ do_brush_action()

static void do_brush_action ( Sculpt sd,
Object ob,
Brush brush,
UnifiedPaintSettings ups,
PaintModeSettings paint_mode_settings 
)
static

Definition at line 3245 of file sculpt.c.

References add_v3_v3(), StrokeCache::alt_smooth, StrokeCache::automasking, Brush::autosmooth_factor, UnifiedPaintSettings::average_stroke_accum, UnifiedPaintSettings::average_stroke_counter, BKE_pbvh_ensure_node_loops(), BKE_pbvh_parallel_range_settings(), BKE_pbvh_search_gather(), BKE_pbvh_type(), BLI_assert, BLI_task_parallel_range(), BRUSH_ANCHORED, BRUSH_DEFORM_TARGET_CLOTH_SIM, BRUSH_DIR_IN, BRUSH_INVERSE_SMOOTH_PRESSURE, BRUSH_INVERT_TO_SCRAPE_FILL, MTex::brush_map_mode, BRUSH_ORIGINAL_NORMAL, BRUSH_SMOOTH_DEFORM_LAPLACIAN, BRUSH_SMOOTH_DEFORM_SURFACE, SculptSession::cache, StrokeCache::cloth_sim, copy_v3_v3(), Brush::deform_target, do_brush_action_task_cb(), do_gravity(), ELEM, Brush::falloff_shape, Brush::flag, Sculpt::gravity_factor, invert(), StrokeCache::invert, UnifiedPaintSettings::last_stroke_valid, StrokeCache::location, M_SQRT2, MEM_callocN, MEM_SAFE_FREE, Brush::mtex, MTEX_MAP_MODE_AREA, mul_m4_v3(), NULL, Object::obmat, StrokeCache::original, StrokeCache::paint_face_set, PAINT_FALLOFF_SHAPE_SPHERE, SculptSession::pbvh, PBVH_BMESH, PBVH_FACES, StrokeCache::pen_flip, StrokeCache::pressure, Object::sculpt, SCULPT_active_face_set_get(), SCULPT_automasking_cache_init(), SCULPT_bmesh_topology_rake(), sculpt_brush_needs_normal(), sculpt_brush_use_topology_rake(), SCULPT_cloth_brush_affected_nodes_gather(), SCULPT_cloth_brush_do_simulation_step(), SCULPT_cloth_brush_ensure_nodes_constraints(), SCULPT_cloth_brush_simulation_create(), SCULPT_cloth_brush_simulation_init(), SCULPT_cloth_brush_store_simulation_state(), SCULPT_cloth_sim_activate_nodes(), 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_multiplane_scrape_brush(), SCULPT_do_nudge_brush(), SCULPT_do_paint_brush(), 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_smooth_brush(), SCULPT_do_snake_hook_brush(), SCULPT_do_surface_smooth_brush(), SCULPT_do_thumb_brush(), SCULPT_face_set_next_available_get(), SCULPT_has_loop_colors(), SCULPT_is_automasking_enabled(), sculpt_needs_pbvh_pixels(), sculpt_pbvh_gather_generic(), sculpt_pbvh_update_pixels(), SCULPT_pose_brush_init(), SCULPT_smooth(), SCULPT_stroke_is_first_brush_step(), SCULPT_stroke_is_main_symmetry_pass(), Brush::sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_BOUNDARY, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_CLAY_THUMB, SCULPT_TOOL_CLOTH, SCULPT_TOOL_CREASE, SCULPT_TOOL_DISPLACEMENT_ERASER, SCULPT_TOOL_DISPLACEMENT_SMEAR, SCULPT_TOOL_DRAW, SCULPT_TOOL_DRAW_FACE_SETS, SCULPT_TOOL_DRAW_SHARP, SCULPT_TOOL_ELASTIC_DEFORM, SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_GRAB, sculpt_tool_has_cube_tip(), SCULPT_TOOL_INFLATE, SCULPT_tool_is_paint(), SCULPT_TOOL_LAYER, SCULPT_TOOL_MASK, SCULPT_TOOL_MULTIPLANE_SCRAPE, SCULPT_tool_needs_all_pbvh_nodes(), sculpt_tool_needs_original(), SCULPT_TOOL_NUDGE, SCULPT_TOOL_PAINT, SCULPT_TOOL_PINCH, SCULPT_TOOL_POSE, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SCRAPE, SCULPT_TOOL_SLIDE_RELAX, SCULPT_TOOL_SMEAR, SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_UNDO_FACE_SETS, SCULPT_undo_push_node(), SCULPT_vertex_count_get(), SculptThreadedTaskData::sd, Brush::smooth_deform_type, StrokeCache::supports_gravity, StrokeCache::surface_smooth_laplacian_disp, Brush::topology_rake_factor, StrokeCache::true_location, type, update_brush_local_mat(), and update_sculpt_normal().

Referenced by sculpt_stroke_update_step().

◆ do_brush_action_task_cb()

static void do_brush_action_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ do_fake_neighbor_search_task_cb()

static void do_fake_neighbor_search_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict  tls 
)
static

◆ do_gravity()

static void do_gravity ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode,
float  bstrength 
)
static

◆ do_gravity_task_cb_ex()

static void do_gravity_task_cb_ex ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict  tls 
)
static

◆ do_nearest_vertex_get_task_cb()

static void do_nearest_vertex_get_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict  tls 
)
static

◆ do_radial_symmetry()

static void do_radial_symmetry ( Sculpt sd,
Object ob,
Brush brush,
UnifiedPaintSettings ups,
PaintModeSettings paint_mode_settings,
BrushActionFunc  action,
const char  symm,
const int  axis,
const float   UNUSEDfeather 
)
static

◆ do_symmetrical_brush_actions()

static void do_symmetrical_brush_actions ( Sculpt sd,
Object ob,
BrushActionFunc  action,
UnifiedPaintSettings ups,
PaintModeSettings paint_mode_settings 
)
static

◆ do_tiled()

static void do_tiled ( Sculpt sd,
Object ob,
Brush brush,
UnifiedPaintSettings ups,
PaintModeSettings paint_mode_settings,
BrushActionFunc  action 
)
static

◆ ED_sculpt_redraw_planes_get()

void ED_sculpt_redraw_planes_get ( float  planes[4][4],
ARegion region,
Object ob 
)

◆ fake_neighbor_search_reduce()

static void fake_neighbor_search_reduce ( const void *__restrict   UNUSEDuserdata,
void *__restrict  chunk_join,
void *__restrict  chunk 
)
static

◆ frontface()

static float frontface ( const Brush br,
const float  sculpt_normal[3],
const float  no[3],
const float  fno[3] 
)
static

Definition at line 1713 of file sculpt.c.

References BRUSH_FRONTFACE, blender::math::dot(), dot_v3v3(), and Brush::flag.

Referenced by SCULPT_brush_strength_factor().

◆ nearest_vertex_get_reduce()

static void nearest_vertex_get_reduce ( const void *__restrict   UNUSEDuserdata,
void *__restrict  chunk_join,
void *__restrict  chunk 
)
static

◆ over_mesh()

static bool over_mesh ( bContext C,
struct wmOperator UNUSEDop,
const float  mval[2] 
)
static

Definition at line 5297 of file sculpt.c.

References C, and SCULPT_stroke_get_location().

Referenced by sculpt_brush_stroke_invoke(), and sculpt_stroke_test_start().

◆ paint_mesh_restore_co()

static void paint_mesh_restore_co ( Sculpt sd,
Object ob 
)
static

Disable multi-threading when dynamic-topology is enabled. Otherwise, new entries might be inserted by SCULPT_undo_push_node() into the GHash used internally by BM_log_original_vert_co() by a different thread. See T33787.

Definition at line 1435 of file sculpt.c.

References BKE_paint_brush(), BKE_pbvh_node_color_buffer_free(), BKE_pbvh_parallel_range_settings(), BKE_pbvh_search_gather(), BLI_task_parallel_range(), SculptSession::bm, data, MEM_SAFE_FREE, NULL, Sculpt::paint, paint_mesh_restore_co_task_cb(), SculptSession::pbvh, and Object::sculpt.

Referenced by sculpt_brush_stroke_cancel(), and sculpt_restore_mesh().

◆ paint_mesh_restore_co_task_cb()

static void paint_mesh_restore_co_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ SCULPT_active_face_set_get()

int SCULPT_active_face_set_get ( SculptSession ss)

◆ SCULPT_active_vertex_co_get()

const float* SCULPT_active_vertex_co_get ( SculptSession ss)

◆ SCULPT_active_vertex_get()

int SCULPT_active_vertex_get ( SculptSession ss)

◆ SCULPT_active_vertex_normal_get()

void SCULPT_active_vertex_normal_get ( SculptSession ss,
float  normal[3] 
)

Definition at line 284 of file sculpt.c.

References normal, SCULPT_active_vertex_get(), and SCULPT_vertex_normal_get().

Referenced by sculpt_mask_expand_invoke().

◆ SCULPT_boundary_info_ensure()

void SCULPT_boundary_info_ensure ( Object object)

◆ SCULPT_brush_deform_target_vertex_co_get()

float* SCULPT_brush_deform_target_vertex_co_get ( SculptSession ss,
int  deform_target,
PBVHVertexIter iter 
)

◆ sculpt_brush_dynamic_size_get()

static float sculpt_brush_dynamic_size_get ( Brush brush,
StrokeCache cache,
float  initial_size 
)
static

◆ sculpt_brush_exit_tex()

static void sculpt_brush_exit_tex ( Sculpt sd)
static

◆ SCULPT_brush_frontface_normal_from_falloff_shape()

const float* SCULPT_brush_frontface_normal_from_falloff_shape ( SculptSession ss,
char  falloff_shape 
)

◆ sculpt_brush_init_tex()

static void sculpt_brush_init_tex ( Sculpt sd,
SculptSession ss 
)
static

◆ sculpt_brush_needs_normal()

static int sculpt_brush_needs_normal ( const SculptSession ss,
const Brush brush 
)
static

◆ sculpt_brush_needs_rake_rotation()

static bool sculpt_brush_needs_rake_rotation ( const Brush brush)
static

Definition at line 1254 of file sculpt.c.

References Brush::rake_factor, Brush::sculpt_tool, and SCULPT_TOOL_HAS_RAKE.

Referenced by sculpt_update_brush_delta().

◆ SCULPT_brush_plane_offset_get()

float SCULPT_brush_plane_offset_get ( Sculpt sd,
SculptSession ss 
)

◆ SCULPT_brush_strength_factor()

float SCULPT_brush_strength_factor ( SculptSession ss,
const Brush br,
const float  brush_point[3],
const float  len,
const float  vno[3],
const float  fno[3],
const float  mask,
const int  vertex_index,
const int  thread_id 
)

Definition at line 2370 of file sculpt.c.

References StrokeCache::automasking, BKE_brush_curve_strength(), BKE_brush_sample_tex_3d(), StrokeCache::brush_local_mat, MTex::brush_map_mode, SculptSession::cache, ED_view3d_project_float_v2_m4(), flip_v3_v3(), frontface(), StrokeCache::hardness, len, mask(), StrokeCache::mirror_symmetry_pass, Brush::mtex, MTEX_MAP_MODE_3D, MTEX_MAP_MODE_AREA, mul_m4_v3(), MTex::ofs, StrokeCache::paint_brush, paint_get_tex_pixel(), StrokeCache::plane_offset, point, StrokeCache::projection_mat, StrokeCache::radial_symmetry_pass, StrokeCache::radius, ViewContext::region, usdtokens::rgba(), scene, ViewContext::scene, SCULPT_automasking_factor_get(), MTex::size, sub_v3_v3v3(), StrokeCache::symm_rot_mat_inv, MTex::tex, SculptSession::tex_pool, Brush::texture_sample_bias, blender::threading::enumerable_thread_specific_utils::thread_id, StrokeCache::vc, StrokeCache::view_normal, x, and y.

Referenced by calc_multiplane_scrape_surface_task_cb(), do_clay_brush_task_cb_ex(), do_clay_strips_brush_task_cb_ex(), do_clay_thumb_brush_task_cb_ex(), do_cloth_brush_apply_forces_task_cb_ex(), do_color_smooth_task_cb_exec(), do_crease_brush_task_cb_ex(), do_displacement_eraser_brush_task_cb_ex(), do_displacement_smear_brush_task_cb_ex(), do_draw_brush_task_cb_ex(), do_draw_face_sets_brush_task_cb_ex(), do_draw_sharp_brush_task_cb_ex(), do_enhance_details_brush_task_cb_ex(), do_fill_brush_task_cb_ex(), do_flatten_brush_task_cb_ex(), do_grab_brush_task_cb_ex(), do_gravity_task_cb_ex(), do_inflate_brush_task_cb_ex(), do_layer_brush_task_cb_ex(), do_mask_brush_draw_task_cb_ex(), do_multiplane_scrape_brush_task_cb_ex(), do_nudge_brush_task_cb_ex(), do_paint_brush_task_cb_ex(), do_pinch_brush_task_cb_ex(), do_relax_face_sets_brush_task_cb_ex(), do_rotate_brush_task_cb_ex(), do_scrape_brush_task_cb_ex(), do_smear_brush_task_cb_exec(), do_smooth_brush_task_cb_ex(), do_snake_hook_brush_task_cb_ex(), do_thumb_brush_task_cb_ex(), do_topology_rake_bmesh_task_cb_ex(), do_topology_relax_task_cb_ex(), do_topology_slide_task_cb_ex(), blender::ed::sculpt_paint::paint::image::PaintingKernel< ImageBuffer >::paint(), SCULPT_do_surface_smooth_brush_displace_task_cb_ex(), and SCULPT_do_surface_smooth_brush_laplacian_task_cb_ex().

◆ sculpt_brush_stroke_cancel()

static void sculpt_brush_stroke_cancel ( bContext C,
wmOperator op 
)
static

◆ sculpt_brush_stroke_exec()

static int sculpt_brush_stroke_exec ( bContext C,
wmOperator op 
)
static

◆ sculpt_brush_stroke_init()

static void sculpt_brush_stroke_init ( bContext C,
wmOperator op 
)
static

◆ sculpt_brush_stroke_invoke()

static int sculpt_brush_stroke_invoke ( bContext C,
wmOperator op,
const wmEvent event 
)
static

◆ sculpt_brush_stroke_modal()

static int sculpt_brush_stroke_modal ( bContext C,
wmOperator op,
const wmEvent event 
)
static

Definition at line 5619 of file sculpt.c.

References C, wmOperator::customdata, and paint_stroke_modal().

Referenced by SCULPT_OT_brush_stroke().

◆ SCULPT_brush_test_circle_sq()

bool SCULPT_brush_test_circle_sq ( SculptBrushTest test,
const float  co[3] 
)

◆ sculpt_brush_test_clipping()

BLI_INLINE bool sculpt_brush_test_clipping ( const SculptBrushTest test,
const float  co[3] 
)

◆ SCULPT_brush_test_cube()

bool SCULPT_brush_test_cube ( SculptBrushTest test,
const float  co[3],
const float  local[4][4],
const float  roundness 
)

◆ SCULPT_brush_test_init()

void SCULPT_brush_test_init ( struct SculptSession ss,
SculptBrushTest test 
)

◆ SCULPT_brush_test_init_with_falloff_shape()

SculptBrushTestFn SCULPT_brush_test_init_with_falloff_shape ( SculptSession ss,
SculptBrushTest test,
char  falloff_shape 
)

Initialize a point-in-brush test with a given falloff shape.

Parameters
falloff_shapePAINT_FALLOFF_SHAPE_SPHERE or PAINT_FALLOFF_SHAPE_TUBE.
Returns
The brush falloff function.

Definition at line 1686 of file sculpt.c.

References SculptSession::cache, SculptBrushTest::location, PAINT_FALLOFF_SHAPE_SPHERE, plane_from_point_normal_v3(), SculptBrushTest::plane_view, SCULPT_brush_test_circle_sq(), SCULPT_brush_test_init(), SCULPT_brush_test_sphere_sq(), and StrokeCache::view_normal.

Referenced by calc_area_normal_and_center_task_cb(), calc_clay_surface_task_cb(), calc_multiplane_scrape_surface_task_cb(), calculate_average_color(), do_clay_brush_task_cb_ex(), do_clay_thumb_brush_task_cb_ex(), do_cloth_brush_apply_forces_task_cb_ex(), do_color_smooth_task_cb_exec(), do_crease_brush_task_cb_ex(), do_displacement_eraser_brush_task_cb_ex(), do_displacement_smear_brush_task_cb_ex(), do_draw_brush_task_cb_ex(), do_draw_face_sets_brush_task_cb_ex(), do_draw_sharp_brush_task_cb_ex(), do_enhance_details_brush_task_cb_ex(), do_fill_brush_task_cb_ex(), do_flatten_brush_task_cb_ex(), do_grab_brush_task_cb_ex(), do_gravity_task_cb_ex(), do_inflate_brush_task_cb_ex(), do_layer_brush_task_cb_ex(), do_mask_brush_draw_task_cb_ex(), do_multiplane_scrape_brush_task_cb_ex(), do_nudge_brush_task_cb_ex(), do_paint_brush_task_cb_ex(), do_pinch_brush_task_cb_ex(), do_relax_face_sets_brush_task_cb_ex(), do_rotate_brush_task_cb_ex(), do_sample_wet_paint_task_cb(), do_scrape_brush_task_cb_ex(), do_smear_brush_task_cb_exec(), do_smooth_brush_task_cb_ex(), do_snake_hook_brush_task_cb_ex(), do_thumb_brush_task_cb_ex(), do_topology_rake_bmesh_task_cb_ex(), do_topology_relax_task_cb_ex(), do_topology_slide_task_cb_ex(), do_vpaint_brush_blur_loops(), do_vpaint_brush_blur_verts(), do_vpaint_brush_smear(), do_wpaint_brush_blur_task_cb_ex(), do_wpaint_brush_calc_average_weight_cb_ex(), do_wpaint_brush_draw_task_cb_ex(), do_wpaint_brush_smear_task_cb_ex(), SCULPT_do_surface_smooth_brush_displace_task_cb_ex(), SCULPT_do_surface_smooth_brush_laplacian_task_cb_ex(), and vpaint_do_draw().

◆ SCULPT_brush_test_sphere()

bool SCULPT_brush_test_sphere ( SculptBrushTest test,
const float  co[3] 
)

◆ SCULPT_brush_test_sphere_fast()

bool SCULPT_brush_test_sphere_fast ( const SculptBrushTest test,
const float  co[3] 
)

◆ SCULPT_brush_test_sphere_sq()

bool SCULPT_brush_test_sphere_sq ( SculptBrushTest test,
const float  co[3] 
)

◆ sculpt_brush_use_topology_rake()

static bool sculpt_brush_use_topology_rake ( const SculptSession ss,
const Brush brush 
)
static

◆ SCULPT_cache_calc_brushdata_symm()

void SCULPT_cache_calc_brushdata_symm ( StrokeCache cache,
char  symm,
char  axis,
float  angle 
)

◆ SCULPT_cache_free()

void SCULPT_cache_free ( StrokeCache cache)

◆ SCULPT_calc_area_center()

void SCULPT_calc_area_center ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode,
float  r_area_co[3] 
)

◆ SCULPT_calc_area_normal()

void SCULPT_calc_area_normal ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode,
float  r_area_no[3] 
)

◆ SCULPT_calc_area_normal_and_center()

void SCULPT_calc_area_normal_and_center ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode,
float  r_area_no[3],
float  r_area_co[3] 
)

◆ SCULPT_calc_brush_plane()

void SCULPT_calc_brush_plane ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode,
float  r_area_no[3],
float  r_area_co[3] 
)

◆ sculpt_check_boundary_vertex_in_base_mesh()

static bool sculpt_check_boundary_vertex_in_base_mesh ( const SculptSession ss,
const int  index 
)
static

◆ sculpt_check_unique_face_set_for_edge_in_base_mesh()

static bool sculpt_check_unique_face_set_for_edge_in_base_mesh ( SculptSession ss,
int  v1,
int  v2 
)
static

Checks if the face sets of the adjacent faces to the edge between v1 and v2 in the base mesh are equal.

Definition at line 634 of file sculpt.c.

References blender::math::abs(), MeshElemMap::count, SculptSession::face_sets, MeshElemMap::indices, l, MPoly::loopstart, SculptSession::mloop, SculptSession::mpoly, SculptSession::pmap, MPoly::totloop, MLoop::v, v1, and v2.

Referenced by SCULPT_vertex_has_unique_face_set().

◆ sculpt_check_unique_face_set_in_base_mesh()

static bool sculpt_check_unique_face_set_in_base_mesh ( SculptSession ss,
int  index 
)
static

◆ SCULPT_check_vertex_pivot_symmetry()

bool SCULPT_check_vertex_pivot_symmetry ( const float  vco[3],
const float  pco[3],
const char  symm 
)

◆ SCULPT_clip()

void SCULPT_clip ( Sculpt sd,
SculptSession ss,
float  co[3],
const float  val[3] 
)

◆ sculpt_combine_proxies()

static void sculpt_combine_proxies ( Sculpt sd,
Object ob 
)
static

◆ sculpt_combine_proxies_task_cb()

static void sculpt_combine_proxies_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ SCULPT_combine_transform_proxies()

void SCULPT_combine_transform_proxies ( Sculpt sd,
Object ob 
)

◆ SCULPT_connected_components_ensure()

void SCULPT_connected_components_ensure ( Object ob)

◆ SCULPT_connected_components_floodfill_cb()

static bool SCULPT_connected_components_floodfill_cb ( SculptSession ss,
int  from_v,
int  to_v,
bool   UNUSEDis_duplicate,
void userdata 
)
static

◆ SCULPT_cursor_geometry_info_update()

bool SCULPT_cursor_geometry_info_update ( bContext C,
SculptCursorGeometryInfo out,
const float  mouse[2],
bool  use_sampled_normal 
)

Gets the normal, location and active vertex location of the geometry under the cursor. This also updates the active vertex and cursor related data of the SculptSession using the mouse position

Definition at line 4835 of file sculpt.c.

References SculptRaycastData::active_face_grid_index, SculptSession::active_face_index, SculptSession::active_grid_index, SculptSession::active_vertex_index, SculptRaycastData::active_vertex_index, add_v3_v3(), BKE_brush_size_get(), BKE_brush_unprojected_radius_get(), BKE_brush_use_locked_size(), BKE_paint_brush(), BKE_paint_get_active_from_context(), BKE_pbvh_raycast(), BKE_pbvh_type(), C, copy_m3_m4(), copy_v3_v3(), CTX_data_depsgraph_pointer(), CTX_data_scene(), SculptSession::cursor_location, SculptSession::cursor_normal, SculptSession::cursor_radius, SculptSession::cursor_sampled_normal, SculptSession::cursor_view_normal, depsgraph, SculptRaycastData::depth, ED_view3d_viewcontext_init(), SculptRaycastData::face_normal, SculptRaycastData::hit, Object::imat, invert_m4_m4(), SculptRaycastData::isect_precalc, isect_ray_tri_watertight_v3_precalc(), MEM_SAFE_FREE, mul_m3_v3(), mul_v3_fl(), normalize_v3_v3(), ViewContext::obact, Object::obmat, SculptRaycastData::original, usdtokens::out(), paint_calc_object_space_radius(), SculptSession::pbvh, PBVH_BMESH, PBVH_FACES, PBVH_GRIDS, SculptSession::rv3d, ViewContext::rv3d, scene, Object::sculpt, ToolSettings::sculpt, SCULPT_active_vertex_co_get(), SCULPT_pbvh_calc_area_normal(), sculpt_pbvh_gather_cursor_update(), sculpt_raycast_cb(), SCULPT_raycast_init(), SCULPT_stroke_modifiers_check(), SCULPT_vertex_random_access_ensure(), Scene::toolsettings, SculptSession::v3d, ViewContext::v3d, RegionView3D::viewinv, and zero_v3().

Referenced by ED_sculpt_face_sets_active_update_and_get(), paint_cursor_sculpt_session_update_and_init(), sample_detail_voxel(), sculpt_cloth_filter_invoke(), sculpt_color_filter_invoke(), sculpt_expand_target_vertex_update_and_get(), sculpt_face_set_edit_invoke(), sculpt_face_sets_change_visibility_invoke(), sculpt_mask_by_color_invoke(), sculpt_mask_expand_invoke(), sculpt_mask_expand_modal(), sculpt_mesh_filter_invoke(), sculpt_stroke_test_start(), sculpt_trim_gesture_box_invoke(), and sculpt_trim_gesture_lasso_invoke().

◆ sculpt_extend_redraw_rect_previous()

static void sculpt_extend_redraw_rect_previous ( Object ob,
rcti rect 
)
static

◆ SCULPT_face_set_next_available_get()

int SCULPT_face_set_next_available_get ( SculptSession ss)

◆ SCULPT_face_set_visibility_set()

void SCULPT_face_set_visibility_set ( SculptSession ss,
int  face_set,
bool  visible 
)

◆ SCULPT_face_sets_visibility_all_set()

void SCULPT_face_sets_visibility_all_set ( SculptSession ss,
bool  visible 
)

◆ SCULPT_face_sets_visibility_invert()

void SCULPT_face_sets_visibility_invert ( SculptSession ss)

◆ SCULPT_fake_neighbor_add()

static void SCULPT_fake_neighbor_add ( SculptSession ss,
int  v_index_a,
int  v_index_b 
)
static

◆ SCULPT_fake_neighbor_init()

static void SCULPT_fake_neighbor_init ( SculptSession ss,
const float  max_dist 
)
static

◆ SCULPT_fake_neighbor_search()

static int SCULPT_fake_neighbor_search ( Sculpt sd,
Object ob,
const int  index,
float  max_distance 
)
static

◆ SCULPT_fake_neighbors_disable()

void SCULPT_fake_neighbors_disable ( Object ob)

◆ SCULPT_fake_neighbors_enable()

void SCULPT_fake_neighbors_enable ( Object ob)

◆ SCULPT_fake_neighbors_ensure()

void SCULPT_fake_neighbors_ensure ( Sculpt sd,
Object ob,
const float  max_dist 
)

◆ SCULPT_fake_neighbors_free()

void SCULPT_fake_neighbors_free ( Object ob)

Definition at line 5923 of file sculpt.c.

References Object::sculpt, and sculpt_pose_fake_neighbors_free().

Referenced by SCULPT_flush_update_done().

◆ sculpt_find_nearest_to_ray_cb()

static void sculpt_find_nearest_to_ray_cb ( PBVHNode node,
void data_v,
float tmin 
)
static

◆ sculpt_fix_noise_tear()

static void sculpt_fix_noise_tear ( Sculpt sd,
Object ob 
)
static

Noise texture gives different values for the same input coord; this can tear a multi-resolution mesh during sculpting so do a stitch in this case.

Definition at line 3912 of file sculpt.c.

References SculptSession::active, BKE_paint_brush(), Brush::mtex, SculptSession::multires, multires_stitch_grids(), Sculpt::paint, Object::sculpt, MTex::tex, TEX_NOISE, and Tex::type.

Referenced by sculpt_stroke_update_step().

◆ SCULPT_flip_quat_by_symm_area()

void SCULPT_flip_quat_by_symm_area ( float  quat[4],
const ePaintSymmetryFlags  symm,
const ePaintSymmetryAreas  symmarea,
const float  pivot[3] 
)

Definition at line 2882 of file sculpt.c.

References flip_qt().

Referenced by SCULPT_do_pose_brush(), and sculpt_transform_matrices_init().

◆ SCULPT_flip_v3_by_symm_area()

void SCULPT_flip_v3_by_symm_area ( float  v[3],
const ePaintSymmetryFlags  symm,
const ePaintSymmetryAreas  symmarea,
const float  pivot[3] 
)

◆ SCULPT_floodfill_add_active()

void SCULPT_floodfill_add_active ( Sculpt sd,
Object ob,
SculptSession ss,
SculptFloodFill flood,
float  radius 
)

◆ SCULPT_floodfill_add_and_skip_initial()

void SCULPT_floodfill_add_and_skip_initial ( SculptFloodFill flood,
int  index 
)

◆ SCULPT_floodfill_add_initial()

void SCULPT_floodfill_add_initial ( SculptFloodFill flood,
int  index 
)

◆ SCULPT_floodfill_add_initial_with_symmetry()

void SCULPT_floodfill_add_initial_with_symmetry ( Sculpt sd,
Object ob,
SculptSession ss,
SculptFloodFill flood,
int  index,
float  radius 
)

◆ SCULPT_floodfill_execute()

void SCULPT_floodfill_execute ( SculptSession ss,
SculptFloodFill flood,
bool(*)(SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata)  func,
void userdata 
)

◆ SCULPT_floodfill_free()

void SCULPT_floodfill_free ( SculptFloodFill flood)

◆ SCULPT_floodfill_init()

void SCULPT_floodfill_init ( SculptSession ss,
SculptFloodFill flood 
)

◆ sculpt_flush_pbvhvert_deform()

static void sculpt_flush_pbvhvert_deform ( Object ob,
PBVHVertexIter vd 
)
static

◆ SCULPT_flush_stroke_deform()

void SCULPT_flush_stroke_deform ( struct Sculpt sd,
Object ob,
bool  is_proxy_used 
)

◆ SCULPT_flush_stroke_deform_task_cb()

static void SCULPT_flush_stroke_deform_task_cb ( void *__restrict  userdata,
const int  n,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

◆ SCULPT_flush_update_done()

void SCULPT_flush_update_done ( const bContext C,
Object ob,
SculptUpdateType  update_flags 
)

◆ SCULPT_flush_update_step()

void SCULPT_flush_update_step ( bContext C,
SculptUpdateType  update_flags 
)

◆ SCULPT_get_redraw_rect()

bool SCULPT_get_redraw_rect ( struct ARegion region,
struct RegionView3D rv3d,
Object ob,
rcti rect 
)

Get a screen-space rectangle of the modified area.

Definition at line 1489 of file sculpt.c.

References BKE_pbvh_redraw_BB(), paint_convert_bb_to_rect(), SculptSession::pbvh, and Object::sculpt.

Referenced by SCULPT_flush_update_step(), and wpaint_stroke_update_step().

◆ SCULPT_get_vertex_symm_area()

ePaintSymmetryAreas SCULPT_get_vertex_symm_area ( const float  co[3])

◆ SCULPT_handles_colors_report()

bool SCULPT_handles_colors_report ( struct SculptSession ss,
struct ReportList reports 
)

Returns true if sculpt session can handle color attributes (BKE_pbvh_type(ss->pbvh) == PBVH_FACES). If false an error message will be shown to the user. Operators should return OPERATOR_CANCELLED in this case.

NOTE: Does not check if a color attribute actually exists. Calling code must handle this itself; in most cases a call to BKE_sculpt_color_layer_create_if_needed() is sufficient.

Definition at line 5303 of file sculpt.c.

References BKE_pbvh_type(), BKE_report(), BLI_assert_msg, SculptSession::pbvh, PBVH_BMESH, PBVH_FACES, PBVH_GRIDS, and RPT_ERROR.

Referenced by sculpt_brush_stroke_invoke(), sculpt_color_filter_invoke(), sculpt_mask_by_color_invoke(), and sculpt_sample_color_invoke().

◆ SCULPT_has_colors()

bool SCULPT_has_colors ( const SculptSession ss)

Returns true if a color attribute exists in the current sculpt session.

Definition at line 156 of file sculpt.c.

References SculptSession::mcol, and SculptSession::vcol.

Referenced by sculpt_colors_poll(), SCULPT_do_paint_brush(), SCULPT_do_smear_brush(), and sculpt_sample_color_invoke().

◆ SCULPT_has_loop_colors()

bool SCULPT_has_loop_colors ( const Object ob)

◆ sculpt_init_mirror_clipping()

static void sculpt_init_mirror_clipping ( Object ob,
SculptSession ss 
)
static

◆ SCULPT_is_symmetry_iteration_valid()

bool SCULPT_is_symmetry_iteration_valid ( char  i,
char  symm 
)

◆ SCULPT_is_vertex_inside_brush_radius_symm()

bool SCULPT_is_vertex_inside_brush_radius_symm ( const float  vertex[3],
const float  br_co[3],
float  radius,
char  symm 
)

Checks if a vertex is inside the brush radius from any of its mirrored axis.

Definition at line 1030 of file sculpt.c.

References flip_v3_v3(), len_squared_v3v3(), and SCULPT_is_symmetry_iteration_valid().

Referenced by automask_floodfill_cb().

◆ SCULPT_mesh_deformed_mverts_get()

MVert* SCULPT_mesh_deformed_mverts_get ( SculptSession ss)

◆ SCULPT_mesh_symmetry_xyz_get()

char SCULPT_mesh_symmetry_xyz_get ( Object object)

◆ SCULPT_mode_poll()

bool SCULPT_mode_poll ( bContext C)

◆ SCULPT_mode_poll_view3d()

bool SCULPT_mode_poll_view3d ( bContext C)

◆ SCULPT_nearest_vertex_get()

int SCULPT_nearest_vertex_get ( Sculpt sd,
Object ob,
const float  co[3],
float  max_distance,
bool  use_original 
)

◆ sculpt_needs_connectivity_info()

static bool sculpt_needs_connectivity_info ( const Sculpt sd,
const Brush brush,
SculptSession ss,
int  stroke_mode 
)
static

◆ sculpt_needs_delta_for_tip_orientation()

static bool sculpt_needs_delta_for_tip_orientation ( Brush brush)
static

◆ sculpt_needs_delta_from_anchored_origin()

static bool sculpt_needs_delta_from_anchored_origin ( Brush brush)
static

◆ sculpt_needs_pbvh_pixels()

static bool sculpt_needs_pbvh_pixels ( PaintModeSettings paint_mode_settings,
const Brush brush,
Object ob 
)
static

Definition at line 2788 of file sculpt.c.

References image(), SCULPT_paint_image_canvas_get(), Brush::sculpt_tool, and SCULPT_TOOL_PAINT.

Referenced by do_brush_action().

◆ SCULPT_orig_vert_data_init()

void SCULPT_orig_vert_data_init ( SculptOrigVertData data,
Object ob,
PBVHNode node,
SculptUndoType  type 
)

◆ SCULPT_orig_vert_data_unode_init()

void SCULPT_orig_vert_data_unode_init ( SculptOrigVertData data,
Object ob,
struct SculptUndoNode unode 
)

Initialize a SculptOrigVertData for accessing original vertex data; handles BMesh, Mesh, and multi-resolution.

Definition at line 1271 of file sculpt.c.

References SculptSession::bm, bm, SculptSession::bm_log, data, and Object::sculpt.

Referenced by paint_mesh_restore_co_task_cb(), and SCULPT_orig_vert_data_init().

◆ SCULPT_orig_vert_data_update()

void SCULPT_orig_vert_data_update ( SculptOrigVertData orig_data,
PBVHVertexIter iter 
)

◆ SCULPT_OT_brush_stroke()

void SCULPT_OT_brush_stroke ( wmOperatorType ot)

◆ SCULPT_pbvh_calc_area_normal()

bool SCULPT_pbvh_calc_area_normal ( const Brush brush,
Object ob,
PBVHNode **  nodes,
int  totnode,
bool  use_threading,
float  r_area_no[3] 
)

◆ sculpt_pbvh_gather_cursor_update()

static PBVHNode** sculpt_pbvh_gather_cursor_update ( Object ob,
Sculpt sd,
bool  use_original,
int *  r_totnode 
)
static

◆ sculpt_pbvh_gather_generic()

static PBVHNode** sculpt_pbvh_gather_generic ( Object ob,
Sculpt sd,
const Brush brush,
bool  use_original,
float  radius_scale,
int *  r_totnode 
)
static

◆ sculpt_pbvh_update_pixels()

static void sculpt_pbvh_update_pixels ( PaintModeSettings paint_mode_settings,
SculptSession ss,
Object ob 
)
static

◆ SCULPT_plane_point_side()

int SCULPT_plane_point_side ( const float  co[3],
const float  plane[4] 
)

◆ SCULPT_plane_trim()

int SCULPT_plane_trim ( const StrokeCache cache,
const Brush brush,
const float  val[3] 
)

◆ SCULPT_poll()

bool SCULPT_poll ( struct bContext C)

Checks for a brush, not just sculpt mode.

Definition at line 3973 of file sculpt.c.

References C, PAINT_brush_tool_poll(), and SCULPT_mode_poll().

Referenced by SCULPT_OT_brush_stroke(), and SCULPT_poll_view3d().

◆ SCULPT_poll_view3d()

bool SCULPT_poll_view3d ( bContext C)

Definition at line 3968 of file sculpt.c.

References C, CTX_wm_region_view3d(), and SCULPT_poll().

◆ sculpt_pose_fake_neighbors_free()

static void sculpt_pose_fake_neighbors_free ( SculptSession ss)
static

◆ sculpt_rake_data_update()

static void sculpt_rake_data_update ( struct SculptRakeData srd,
const float  co[3] 
)
static

◆ sculpt_raycast_cb()

static void sculpt_raycast_cb ( PBVHNode node,
void data_v,
float tmin 
)
static

◆ SCULPT_raycast_init()

float SCULPT_raycast_init ( ViewContext vc,
const float  mval[2],
float  ray_start[3],
float  ray_end[3],
float  ray_normal[3],
bool  original 
)

◆ sculpt_restore_mesh()

static void sculpt_restore_mesh ( Sculpt sd,
Object ob 
)
static

◆ SCULPT_search_circle_cb()

bool SCULPT_search_circle_cb ( PBVHNode node,
void data_v 
)

◆ SCULPT_search_sphere_cb()

bool SCULPT_search_sphere_cb ( PBVHNode node,
void data_v 
)

◆ sculpt_stroke_done()

static void sculpt_stroke_done ( const bContext C,
struct PaintStroke UNUSEDstroke 
)
static

◆ SCULPT_stroke_get_location()

bool SCULPT_stroke_get_location ( struct bContext C,
float  out[3],
const float  mouse[2],
bool  force_original 
)

Do a ray-cast in the tree to find the 3d brush location (This allows us to ignore the GL depth buffer) Returns 0 if the ray doesn't hit the mesh, non-zero otherwise.

Definition at line 4964 of file sculpt.c.

References add_v3_v3(), BKE_paint_brush(), BKE_paint_get_active_from_context(), BKE_pbvh_find_nearest_to_ray(), BKE_pbvh_raycast(), BKE_pbvh_type(), SculptSession::bm, BM_mesh_elem_index_ensure(), BM_mesh_elem_table_ensure(), BM_VERT, C, SculptSession::cache, copy_v3_v3(), CTX_data_depsgraph_pointer(), depsgraph, SculptRaycastData::depth, SculptFindNearestToRayData::depth, ED_view3d_viewcontext_init(), ELEM, SculptRaycastData::face_normal, Brush::falloff_shape, SculptRaycastData::hit, SculptFindNearestToRayData::hit, SculptRaycastData::isect_precalc, isect_ray_tri_watertight_v3_precalc(), mul_v3_fl(), ViewContext::obact, SculptRaycastData::original, SculptFindNearestToRayData::original, StrokeCache::original, usdtokens::out(), PAINT_FALLOFF_SHAPE_TUBE, SculptSession::pbvh, PBVH_BMESH, SculptRaycastData::ray_normal, SculptRaycastData::ray_start, Object::sculpt, sculpt_find_nearest_to_ray_cb(), sculpt_raycast_cb(), SCULPT_raycast_init(), SCULPT_stroke_modifiers_check(), and SculptRaycastData::ss.

Referenced by over_mesh(), paint_brush_stroke_add_step(), paint_line_strokes_spacing(), paint_space_stroke(), paint_stroke_curve_end(), paint_stroke_modal(), sculpt_brush_stroke_exec(), sculpt_brush_stroke_invoke(), sculpt_set_pivot_position_exec(), vpaint_exec(), vpaint_invoke(), wpaint_exec(), and wpaint_invoke().

◆ SCULPT_stroke_is_dynamic_topology()

bool SCULPT_stroke_is_dynamic_topology ( const SculptSession ss,
const Brush brush 
)

Returns true if the stroke will use dynamic topology, false otherwise.

Factors: some brushes like grab cannot do dynamic topology. Others, like smooth, are better without. Same goes for alt-key smoothing.

Definition at line 1338 of file sculpt.c.

References StrokeCache::alt_smooth, BKE_pbvh_type(), BRUSH_ANCHORED, BRUSH_DRAG_DOT, SculptSession::cache, Brush::flag, SculptSession::pbvh, PBVH_BMESH, Brush::sculpt_tool, and SCULPT_TOOL_HAS_DYNTOPO.

Referenced by sculpt_brush_stroke_cancel(), SCULPT_calc_area_center(), SCULPT_calc_area_normal_and_center(), SCULPT_is_automasking_enabled(), SCULPT_pbvh_calc_area_normal(), and sculpt_stroke_update_step().

◆ SCULPT_stroke_is_first_brush_step()

bool SCULPT_stroke_is_first_brush_step ( struct StrokeCache cache)

Return true only once per stroke on the first symmetry pass, regardless of the symmetry passes enabled.

This should be used for functionality that needs to be computed once per stroke of a particular tool (allocating memory, updating random seeds...).

Definition at line 912 of file sculpt.c.

References StrokeCache::first_time, StrokeCache::mirror_symmetry_pass, StrokeCache::radial_symmetry_pass, and StrokeCache::tile_pass.

Referenced by do_brush_action(), SCULPT_do_cloth_brush(), SCULPT_do_paint_brush(), and SCULPT_enhance_details_brush().

◆ SCULPT_stroke_is_first_brush_step_of_symmetry_pass()

bool SCULPT_stroke_is_first_brush_step_of_symmetry_pass ( struct StrokeCache cache)

◆ SCULPT_stroke_is_main_symmetry_pass()

bool SCULPT_stroke_is_main_symmetry_pass ( struct StrokeCache cache)

Returns true when the step belongs to the stroke that is directly performed by the brush and not by one of the symmetry passes.

Definition at line 906 of file sculpt.c.

References StrokeCache::mirror_symmetry_pass, StrokeCache::radial_symmetry_pass, and StrokeCache::tile_pass.

Referenced by calc_sculpt_plane(), do_brush_action(), SCULPT_calc_brush_plane(), and SCULPT_do_clay_thumb_brush().

◆ SCULPT_stroke_modifiers_check()

void SCULPT_stroke_modifiers_check ( const bContext C,
Object ob,
const Brush brush 
)

◆ sculpt_stroke_test_start()

static bool sculpt_stroke_test_start ( bContext C,
struct wmOperator op,
const float  mval[2] 
)
static

◆ sculpt_stroke_update_step()

static void sculpt_stroke_update_step ( bContext C,
wmOperator UNUSEDop,
struct PaintStroke stroke,
PointerRNA itemptr 
)
static

◆ SCULPT_tag_update_overlays()

void SCULPT_tag_update_overlays ( bContext C)

◆ SCULPT_tilt_apply_to_normal()

void SCULPT_tilt_apply_to_normal ( float  r_normal[3],
struct StrokeCache cache,
float  tilt_strength 
)

◆ SCULPT_tilt_effective_normal_get()

void SCULPT_tilt_effective_normal_get ( const SculptSession ss,
const Brush brush,
float  r_no[3] 
)

Get effective surface normal with pen tilt and tilt strength applied to it.

Definition at line 2767 of file sculpt.c.

References SculptSession::cache, copy_v3_v3(), StrokeCache::sculpt_normal_symm, SCULPT_tilt_apply_to_normal(), and Brush::tilt_strength_factor.

Referenced by SCULPT_do_draw_brush(), and SCULPT_do_draw_sharp_brush().

◆ sculpt_tool_has_cube_tip()

static bool sculpt_tool_has_cube_tip ( const char  sculpt_tool)
static

Definition at line 1183 of file sculpt.c.

References ELEM, SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_MULTIPLANE_SCRAPE, and SCULPT_TOOL_PAINT.

Referenced by do_brush_action().

◆ sculpt_tool_is_proxy_used()

static bool sculpt_tool_is_proxy_used ( const char  sculpt_tool)
static

◆ sculpt_tool_name()

static const char* sculpt_tool_name ( Sculpt sd)
static

◆ sculpt_tool_needs_original()

static bool sculpt_tool_needs_original ( const char  sculpt_tool)
static

◆ sculpt_topology_update()

static void sculpt_topology_update ( Sculpt sd,
Object ob,
Brush brush,
UnifiedPaintSettings UNUSEDups,
PaintModeSettings UNUSEDpaint_mode_settings 
)
static

◆ sculpt_update_brush_delta()

static void sculpt_update_brush_delta ( UnifiedPaintSettings ups,
Object ob,
Brush brush 
)
static

Definition at line 4383 of file sculpt.c.

References add_v3_v3(), UnifiedPaintSettings::anchored_initial_mouse, StrokeCache::anchored_location, UnifiedPaintSettings::anchored_size, angle(), axis_angle_normalized_to_quat(), BRUSH_ANCHORED, BRUSH_CLOTH_DEFORM_SNAKE_HOOK, BRUSH_GRAB_ACTIVE_VERTEX, SculptSession::cache, Brush::cloth_deform_type, copy_v2_v2(), copy_v3_v3(), UnifiedPaintSettings::draw_anchored, ED_view3d_win_to_3d(), ELEM, eps, Brush::falloff_shape, Brush::flag, SculptRakeData::follow_co, SculptRakeData::follow_dist, StrokeCache::grab_delta, StrokeCache::initial_mouse, invert_m4_m4(), StrokeCache::is_rake_rotation_valid, is_zero_v3(), len_squared_v3v3(), StrokeCache::mouse_event, mul_mat3_m4_v3(), mul_v3_m4v3(), normalize_v3(), Object::obmat, StrokeCache::old_grab_location, StrokeCache::orig_grab_location, PAINT_FALLOFF_SHAPE_TUBE, UnifiedPaintSettings::pixel_radius, project_plane_v3_v3v3(), quat_to_axis_angle(), StrokeCache::radius, StrokeCache::rake_data, Brush::rake_factor, StrokeCache::rake_rotation, ViewContext::region, rotation_between_vecs_to_quat(), Object::sculpt, SCULPT_active_vertex_get(), sculpt_brush_needs_rake_rotation(), sculpt_brush_use_topology_rake(), SCULPT_is_cloth_deform_brush(), sculpt_needs_delta_for_tip_orientation(), sculpt_needs_delta_from_anchored_origin(), SCULPT_RAKE_BRUSH_FACTOR, sculpt_rake_data_update(), SCULPT_stroke_is_first_brush_step_of_symmetry_pass(), Brush::sculpt_tool, SCULPT_TOOL_BOUNDARY, SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_CLAY_THUMB, SCULPT_TOOL_CLOTH, SCULPT_TOOL_ELASTIC_DEFORM, SCULPT_TOOL_GRAB, SCULPT_TOOL_MULTIPLANE_SCRAPE, SCULPT_TOOL_NUDGE, SCULPT_TOOL_PAINT, SCULPT_TOOL_PINCH, SCULPT_TOOL_POSE, SCULPT_TOOL_SMEAR, SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB, SCULPT_vertex_co_for_grab_active_get(), sqrtf, square_f(), sub_v3_v3(), sub_v3_v3v3(), StrokeCache::true_location, StrokeCache::true_view_normal, v1, v2, ViewContext::v3d, StrokeCache::vc, and zero_v3().

Referenced by sculpt_update_cache_variants().

◆ sculpt_update_cache_invariants()

static void sculpt_update_cache_invariants ( bContext C,
Sculpt sd,
SculptSession ss,
wmOperator op,
const float  mval[2] 
)
static

Definition at line 4183 of file sculpt.c.

References StrokeCache::alt_smooth, BKE_paint_brush(), BLI_dial_init(), StrokeCache::brush, BRUSH_ACCUMULATE, BRUSH_ANCHORED, BRUSH_STROKE_INVERT, BRUSH_STROKE_SMOOTH, C, SculptSession::cache, copy_m3_m4(), copy_v2_v2(), copy_v3_v3(), CTX_data_active_object(), CTX_data_tool_settings(), SculptSession::cursor_location, SculptSession::cursor_normal, wmOperator::customdata, StrokeCache::dial, UnifiedPaintSettings::draw_inverted, ED_view3d_ob_project_mat_get(), ELEM, fabsf, StrokeCache::first_time, StrokeCache::flag, Brush::flag, Sculpt::gravity_factor, Sculpt::gravity_object, Object::imat, StrokeCache::initial_location, StrokeCache::initial_mouse, StrokeCache::initial_normal, StrokeCache::invert, invert_m4_m4(), max_ff(), MEM_callocN, StrokeCache::mouse, StrokeCache::mouse_event, mul_m3_v3(), StrokeCache::normal_weight, Brush::normal_weight, normalize_v3(), normalize_v3_v3(), Object::obmat, StrokeCache::original, Sculpt::paint, paint_stroke_view_context(), PIXEL_INPUT_THRESHHOLD, Brush::plane_trim, StrokeCache::plane_trim_squared, StrokeCache::projection_mat, wmOperator::ptr, RNA_enum_get(), ViewContext::rv3d, StrokeCache::scale, Object::scale, sculpt_init_mirror_clipping(), Brush::sculpt_tool, SCULPT_TOOL_DISPLACEMENT_ERASER, SCULPT_TOOL_DISPLACEMENT_SMEAR, SCULPT_TOOL_DRAW_SHARP, SCULPT_TOOL_HAS_ACCUMULATE, SCULPT_TOOL_HAS_NORMAL_WEIGHT, SCULPT_TOOL_MASK, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SIMPLIFY, SCULPT_TOOL_SMOOTH, smooth_brush_toggle_on(), StrokeCache::supports_gravity, UnifiedPaintSettings::tex_mouse, StrokeCache::true_gravity_direction, StrokeCache::true_initial_location, StrokeCache::true_initial_normal, StrokeCache::true_view_normal, ToolSettings::unified_paint_settings, StrokeCache::vc, RegionView3D::viewinv, and zero_v2().

Referenced by sculpt_stroke_test_start().

◆ sculpt_update_cache_paint_variants()

static void sculpt_update_cache_paint_variants ( StrokeCache cache,
const Brush brush 
)
static

◆ sculpt_update_cache_variants()

static void sculpt_update_cache_variants ( bContext C,
Sculpt sd,
Object ob,
PointerRNA ptr 
)
static

Definition at line 4586 of file sculpt.c.

References UnifiedPaintSettings::anchored_initial_mouse, StrokeCache::anchored_location, UnifiedPaintSettings::anchored_size, BKE_brush_size_get(), BKE_brush_unprojected_radius_get(), BKE_brush_unprojected_radius_set(), BKE_brush_use_locked_size(), BKE_brush_use_size_pressure(), BKE_paint_brush(), BLI_dial_angle(), BRUSH_ANCHORED, BRUSH_EDGE_TO_EDGE, UnifiedPaintSettings::brush_rotation, StrokeCache::bstrength, C, SculptSession::cache, StrokeCache::clay_pressure_stabilizer, StrokeCache::clay_pressure_stabilizer_index, copy_v2_v2(), copy_v3_v3(), CTX_data_scene(), StrokeCache::dial, UnifiedPaintSettings::draw_anchored, StrokeCache::dyntopo_pixel_radius, StrokeCache::first_time, Brush::flag, StrokeCache::initial_mouse, UnifiedPaintSettings::initial_pixel_radius, StrokeCache::initial_radius, StrokeCache::iteration_count, StrokeCache::mouse, StrokeCache::mouse_event, Sculpt::paint, paint_calc_object_space_radius(), PAINT_MODE_SCULPT, paint_supports_dynamic_size(), StrokeCache::pen_flip, UnifiedPaintSettings::pixel_radius, StrokeCache::pressure, ptr, StrokeCache::radius, StrokeCache::radius_squared, RNA_boolean_get(), RNA_float_get(), RNA_float_get_array(), scene, Object::sculpt, sculpt_brush_dynamic_size_get(), SCULPT_CLAY_STABILIZER_LEN, SCULPT_is_cloth_deform_brush(), SCULPT_stroke_is_first_brush_step_of_symmetry_pass(), Brush::sculpt_tool, SCULPT_TOOL_CLAY_THUMB, SCULPT_TOOL_ROTATE, SCULPT_TOOL_SNAKE_HOOK, sculpt_update_brush_delta(), sculpt_update_cache_paint_variants(), StrokeCache::special_rotation, Scene::toolsettings, StrokeCache::true_location, ToolSettings::unified_paint_settings, StrokeCache::vc, StrokeCache::vertex_rotation, StrokeCache::x_tilt, and StrokeCache::y_tilt.

Referenced by sculpt_stroke_update_step().

◆ sculpt_update_keyblock()

static void sculpt_update_keyblock ( Object ob)
static

◆ SCULPT_update_object_bounding_box()

void SCULPT_update_object_bounding_box ( struct Object ob)

Copy the PBVH bounding box into the object's bounding box.

Definition at line 5134 of file sculpt.c.

References Object_Runtime::bb, BKE_boundbox_init_from_minmax(), BKE_pbvh_bounding_box(), SculptSession::pbvh, Object::runtime, and Object::sculpt.

Referenced by SCULPT_flush_update_step(), and sculpt_undo_restore_list().

◆ SCULPT_vertcos_to_key()

void SCULPT_vertcos_to_key ( Object ob,
KeyBlock kb,
const float(*)  vertCos[3] 
)

◆ SCULPT_vertex_all_face_sets_visible_get()

bool SCULPT_vertex_all_face_sets_visible_get ( const SculptSession ss,
int  index 
)

◆ SCULPT_vertex_any_face_set_visible_get()

bool SCULPT_vertex_any_face_set_visible_get ( SculptSession ss,
int  index 
)

◆ SCULPT_vertex_co_for_grab_active_get()

const float* SCULPT_vertex_co_for_grab_active_get ( SculptSession ss,
int  index 
)

◆ SCULPT_vertex_co_get()

const float* SCULPT_vertex_co_get ( SculptSession ss,
int  index 
)

Definition at line 125 of file sculpt.c.

References BKE_pbvh_get_bmesh(), BKE_pbvh_get_grid_key(), BKE_pbvh_get_grids(), BKE_pbvh_get_verts(), BKE_pbvh_type(), BM_vert_at_index(), CCG_elem_co(), CCG_elem_offset(), BMVert::co, MVert::co, SculptSession::deform_modifiers_active, CCGKey::grid_area, SculptSession::mvert, NULL, SculptSession::pbvh, PBVH_BMESH, PBVH_FACES, PBVH_GRIDS, and SculptSession::shapekey_active.

Referenced by automask_floodfill_cb(), boundary_floodfill_cb(), boundary_initial_vertex_floodfill_cb(), cloth_brush_add_length_constraint(), do_boundary_brush_smooth_task_cb_ex(), do_displacement_smear_store_prev_disp_task_cb_ex(), do_smear_brush_task_cb_exec(), do_topology_slide_task_cb_ex(), dyntopo_detail_size_sample_from_surface(), mesh_filter_enhance_details_init_directions(), mesh_filter_sharpen_init(), mesh_filter_task_cb(), neighbor_dirty_mask(), paint_cursor_draw_3d_view_brush_cursor_inactive(), paint_cursor_preview_boundary_data_pivot_draw(), pose_face_sets_floodfill_cb(), pose_ik_chain_init_face_sets(), pose_ik_chain_init_face_sets_fk(), pose_topology_floodfill_cb(), sample_detail_voxel(), SCULPT_active_vertex_co_get(), sculpt_boundary_bend_data_init(), SCULPT_boundary_edges_preview_draw(), sculpt_boundary_edit_data_init(), sculpt_boundary_indices_init(), SCULPT_boundary_pivot_line_preview_draw(), sculpt_boundary_slide_data_init(), sculpt_boundary_twist_data_init(), SCULPT_cloth_brush_simulation_init(), SCULPT_cloth_brush_store_simulation_state(), sculpt_cloth_filter_modal(), SCULPT_do_displacement_smear_brush(), SCULPT_enhance_details_brush(), sculpt_expand_falloff_value_vertex_get(), sculpt_expand_get_vertex_index_for_symmetry_pass(), sculpt_expand_reposition_pivot(), sculpt_expand_spherical_falloff_create(), SCULPT_fake_neighbor_search(), SCULPT_floodfill_add_initial_with_symmetry(), SCULPT_geodesic_fallback_create(), SCULPT_geodesic_from_vertex_and_symm(), sculpt_gesture_trim_calculate_depth(), SCULPT_neighbor_coords_average(), SCULPT_neighbor_coords_average_interior(), SCULPT_relax_vertex(), sculpt_set_persistent_base_exec(), SCULPT_vertex_co_for_grab_active_get(), SCULPT_vertex_limit_surface_get(), and SCULPT_vertex_persistent_co_get().

◆ SCULPT_vertex_color_get()

void SCULPT_vertex_color_get ( const SculptSession ss,
int  index,
float  r_color[4] 
)

◆ SCULPT_vertex_color_set()

void SCULPT_vertex_color_set ( SculptSession ss,
int  index,
const float  color[4] 
)

◆ SCULPT_vertex_count_get()

int SCULPT_vertex_count_get ( SculptSession ss)

Definition at line 111 of file sculpt.c.

References BKE_pbvh_get_bmesh(), BKE_pbvh_get_grid_num_vertices(), BKE_pbvh_type(), BM_mesh_elem_count(), BM_VERT, SculptSession::pbvh, PBVH_BMESH, PBVH_FACES, PBVH_GRIDS, and SculptSession::totvert.

Referenced by cloth_brush_apply_brush_foces(), do_brush_action(), mesh_filter_enhance_details_init_directions(), mesh_filter_init_limit_surface_co(), mesh_filter_sharpen_init(), mesh_filter_surface_smooth_init(), pose_ik_chain_init_face_sets(), pose_ik_chain_init_face_sets_fk(), pose_ik_chain_init_topology(), SCULPT_automasking_cache_init(), SCULPT_boundary_automasking_init(), sculpt_boundary_bend_data_init(), sculpt_boundary_edit_data_init(), sculpt_boundary_falloff_factor_init(), sculpt_boundary_get_closest_boundary_vertex(), sculpt_boundary_indices_init(), sculpt_boundary_slide_data_init(), SCULPT_cloth_brush_simulation_create(), SCULPT_cloth_brush_simulation_init(), SCULPT_cloth_brush_store_simulation_state(), sculpt_cloth_filter_modal(), sculpt_color_presmooth_init(), SCULPT_connected_components_ensure(), SCULPT_do_displacement_smear_brush(), SCULPT_do_layer_brush(), SCULPT_do_smear_brush(), SCULPT_enhance_details_brush(), sculpt_expand_bitmap_from_enabled(), sculpt_expand_boundary_from_enabled(), sculpt_expand_boundary_topology_falloff_create(), sculpt_expand_diagonals_falloff_create(), sculpt_expand_geodesics_from_state_boundary(), sculpt_expand_initialize_from_face_set_boundary(), sculpt_expand_invoke(), sculpt_expand_modal(), sculpt_expand_normal_falloff_create(), sculpt_expand_original_state_store(), sculpt_expand_reposition_pivot(), sculpt_expand_spherical_falloff_create(), sculpt_expand_topology_falloff_create(), sculpt_expand_topology_from_state_boundary(), sculpt_expand_update_max_vert_falloff_value(), sculpt_face_set_create_exec(), sculpt_face_set_edit_fair_face_set(), sculpt_face_sets_automasking_init(), sculpt_face_sets_change_visibility_exec(), SCULPT_fake_neighbor_init(), SCULPT_fake_neighbors_ensure(), SCULPT_floodfill_init(), SCULPT_geometry_preview_lines_update(), sculpt_gesture_trim_calculate_depth(), sculpt_mask_by_color_contiguous(), sculpt_mask_expand_invoke(), sculpt_mask_filter_exec(), sculpt_pose_grow_pose_factor(), sculpt_set_persistent_base_exec(), and SCULPT_topology_automasking_init().

◆ SCULPT_vertex_face_set_get()

int SCULPT_vertex_face_set_get ( SculptSession ss,
int  index 
)

◆ SCULPT_vertex_face_set_set()

void SCULPT_vertex_face_set_set ( SculptSession ss,
int  index,
int  face_set 
)

◆ SCULPT_vertex_get_connected_component()

static int SCULPT_vertex_get_connected_component ( SculptSession ss,
int  index 
)
static

◆ SCULPT_vertex_has_face_set()

bool SCULPT_vertex_has_face_set ( SculptSession ss,
int  index,
int  face_set 
)

◆ SCULPT_vertex_has_unique_face_set()

bool SCULPT_vertex_has_unique_face_set ( SculptSession ss,
int  index 
)

◆ SCULPT_vertex_is_boundary()

bool SCULPT_vertex_is_boundary ( const SculptSession ss,
const int  index 
)

◆ SCULPT_vertex_limit_surface_get()

void SCULPT_vertex_limit_surface_get ( SculptSession ss,
int  index,
float  r_co[3] 
)

◆ SCULPT_vertex_mask_get()

float SCULPT_vertex_mask_get ( SculptSession ss,
int  index 
)

◆ sculpt_vertex_neighbor_add()

static void sculpt_vertex_neighbor_add ( SculptVertexNeighborIter iter,
int  neighbor_index 
)
static

◆ SCULPT_vertex_neighbors_get()

void SCULPT_vertex_neighbors_get ( SculptSession ss,
const int  index,
const bool  include_duplicates,
SculptVertexNeighborIter iter 
)

◆ sculpt_vertex_neighbors_get_bmesh()

static void sculpt_vertex_neighbors_get_bmesh ( SculptSession ss,
int  index,
SculptVertexNeighborIter iter 
)
static

◆ sculpt_vertex_neighbors_get_faces()

static void sculpt_vertex_neighbors_get_faces ( SculptSession ss,
int  index,
SculptVertexNeighborIter iter 
)
static

◆ sculpt_vertex_neighbors_get_grids()

static void sculpt_vertex_neighbors_get_grids ( SculptSession ss,
const int  index,
const bool  include_duplicates,
SculptVertexNeighborIter iter 
)
static

◆ SCULPT_vertex_normal_get()

void SCULPT_vertex_normal_get ( SculptSession ss,
int  index,
float  no[3] 
)

◆ SCULPT_vertex_persistent_co_get()

const float* SCULPT_vertex_persistent_co_get ( SculptSession ss,
int  index 
)

◆ SCULPT_vertex_persistent_normal_get()

void SCULPT_vertex_persistent_normal_get ( SculptSession ss,
int  index,
float  no[3] 
)

◆ SCULPT_vertex_random_access_ensure()

void SCULPT_vertex_random_access_ensure ( struct SculptSession ss)

◆ SCULPT_vertex_visible_get()

bool SCULPT_vertex_visible_get ( SculptSession ss,
int  index 
)

◆ SCULPT_vertex_visible_set()

void SCULPT_vertex_visible_set ( SculptSession ss,
int  index,
bool  visible 
)

◆ SCULPT_visibility_sync_all_face_sets_to_vertices()

void SCULPT_visibility_sync_all_face_sets_to_vertices ( Object ob)

◆ SCULPT_visibility_sync_all_vertex_to_face_sets()

void SCULPT_visibility_sync_all_vertex_to_face_sets ( SculptSession ss)

◆ sculpt_visibility_sync_vertex_to_face_sets()

static void UNUSED_FUNCTION() sculpt_visibility_sync_vertex_to_face_sets ( SculptSession ss,
int  index 
)
static

Definition at line 576 of file sculpt.c.

References blender::math::abs(), MeshElemMap::indices, and SCULPT_vertex_visible_get().

◆ smooth_brush_toggle_off()

static void smooth_brush_toggle_off ( const bContext C,
Paint paint,
StrokeCache cache 
)
static

◆ smooth_brush_toggle_on()

static void smooth_brush_toggle_on ( const bContext C,
Paint paint,
StrokeCache cache 
)
static

◆ update_brush_local_mat()

static void update_brush_local_mat ( Sculpt sd,
Object ob 
)
static

◆ update_sculpt_normal()

static void update_sculpt_normal ( Sculpt sd,
Object ob,
PBVHNode **  nodes,
int  totnode 
)
static