Blender  V3.3
Classes | Macros | Typedefs | Functions
sculpt_ops.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_array.h"
#include "BLI_blenlib.h"
#include "BLI_dial_2d.h"
#include "BLI_ghash.h"
#include "BLI_gsqueue.h"
#include "BLI_hash.h"
#include "BLI_link_utils.h"
#include "BLI_linklist.h"
#include "BLI_linklist_stack.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_color_blend.h"
#include "BLI_memarena.h"
#include "BLI_rand.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "atomic_ops.h"
#include "BLT_translation.h"
#include "PIL_time.h"
#include "DNA_brush_types.h"
#include "DNA_customdata_types.h"
#include "DNA_listBase.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_fair.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 "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
#include "IMB_colormanagement.h"
#include "GPU_batch.h"
#include "GPU_batch_presets.h"
#include "GPU_immediate.h"
#include "GPU_immediate_util.h"
#include "GPU_matrix.h"
#include "GPU_state.h"
#include "WM_api.h"
#include "WM_message.h"
#include "WM_toolsystem.h"
#include "WM_types.h"
#include "ED_image.h"
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_sculpt.h"
#include "ED_space_api.h"
#include "ED_transform_snap_object_context.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  MaskByColorContiguousFloodFillData
 

Macros

#define MASK_BY_COLOR_SLOPE   0.25f
 

Typedefs

typedef struct MaskByColorContiguousFloodFillData MaskByColorContiguousFloodFillData
 

Functions

static int sculpt_set_persistent_base_exec (bContext *C, wmOperator *UNUSED(op))
 
static void SCULPT_OT_set_persistent_base (wmOperatorType *ot)
 
static int sculpt_optimize_exec (bContext *C, wmOperator *UNUSED(op))
 
static void SCULPT_OT_optimize (wmOperatorType *ot)
 
static bool sculpt_no_multires_poll (bContext *C)
 
static int sculpt_symmetrize_exec (bContext *C, wmOperator *op)
 
static void SCULPT_OT_symmetrize (wmOperatorType *ot)
 
static void sculpt_init_session (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void ED_object_sculptmode_enter_ex (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob, const bool force_dyntopo, ReportList *reports)
 
void ED_object_sculptmode_enter (struct bContext *C, Depsgraph *depsgraph, ReportList *reports)
 
void ED_object_sculptmode_exit_ex (Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob)
 
void ED_object_sculptmode_exit (bContext *C, Depsgraph *depsgraph)
 
static int sculpt_mode_toggle_exec (bContext *C, wmOperator *op)
 
static void SCULPT_OT_sculptmode_toggle (wmOperatorType *ot)
 
void SCULPT_geometry_preview_lines_update (bContext *C, SculptSession *ss, float radius)
 
static int vertex_to_loop_colors_exec (bContext *C, wmOperator *UNUSED(op))
 
static bool sculpt_colors_poll (bContext *C)
 
static void SCULPT_OT_vertex_to_loop_colors (wmOperatorType *ot)
 
static int loop_to_vertex_colors_exec (bContext *C, wmOperator *UNUSED(op))
 
static void SCULPT_OT_loop_to_vertex_colors (wmOperatorType *ot)
 
static int sculpt_sample_color_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(e))
 
static void SCULPT_OT_sample_color (wmOperatorType *ot)
 
static float sculpt_mask_by_color_delta_get (const float *color_a, const float *color_b, const float threshold, const bool invert)
 
static float sculpt_mask_by_color_final_mask_get (const float current_mask, const float new_mask, const bool invert, const bool preserve_mask)
 
static void do_mask_by_color_contiguous_update_nodes_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static bool sculpt_mask_by_color_contiguous_floodfill_cb (SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata)
 
static void sculpt_mask_by_color_contiguous (Object *object, const int vertex, const float threshold, const bool invert, const bool preserve_mask)
 
static void do_mask_by_color_task_cb (void *__restrict userdata, const int n, const TaskParallelTLS *__restrict UNUSED(tls))
 
static void sculpt_mask_by_color_full_mesh (Object *object, const int vertex, const float threshold, const bool invert, const bool preserve_mask)
 
static int sculpt_mask_by_color_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static void SCULPT_OT_mask_by_color (wmOperatorType *ot)
 
void ED_operatortypes_sculpt (void)
 

Detailed Description

Implements the Sculpt Mode tools.

Definition in file sculpt_ops.c.

Macro Definition Documentation

◆ MASK_BY_COLOR_SLOPE

#define MASK_BY_COLOR_SLOPE   0.25f

sculpt_mask_by_color_delta_get returns values in the (0,1) range that are used to generate the mask based on the difference between two colors (the active color and the color of any other vertex). Ideally, a threshold of 0 should mask only the colors that are equal to the active color and threshold of 1 should mask all colors. In order to avoid artifacts and produce softer falloffs in the mask, the MASK_BY_COLOR_SLOPE defines the size of the transition values between masked and unmasked vertices. The smaller this value is, the sharper the generated mask is going to be.

Definition at line 816 of file sculpt_ops.c.

Typedef Documentation

◆ MaskByColorContiguousFloodFillData

Function Documentation

◆ do_mask_by_color_contiguous_update_nodes_cb()

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

◆ do_mask_by_color_task_cb()

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

◆ ED_object_sculptmode_enter()

void ED_object_sculptmode_enter ( struct bContext C,
Depsgraph depsgraph,
ReportList reports 
)

◆ ED_object_sculptmode_enter_ex()

void ED_object_sculptmode_enter_ex ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob,
const bool  force_dyntopo,
ReportList reports 
)

◆ ED_object_sculptmode_exit()

void ED_object_sculptmode_exit ( bContext C,
Depsgraph depsgraph 
)

◆ ED_object_sculptmode_exit_ex()

void ED_object_sculptmode_exit_ex ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob 
)

◆ ED_operatortypes_sculpt()

void ED_operatortypes_sculpt ( void  )

◆ loop_to_vertex_colors_exec()

static int loop_to_vertex_colors_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ sculpt_colors_poll()

static bool sculpt_colors_poll ( bContext C)
static

◆ SCULPT_geometry_preview_lines_update()

void SCULPT_geometry_preview_lines_update ( bContext C,
SculptSession ss,
float  radius 
)

◆ sculpt_init_session()

static void sculpt_init_session ( Main bmain,
Depsgraph depsgraph,
Scene scene,
Object ob 
)
static

◆ sculpt_mask_by_color_contiguous()

static void sculpt_mask_by_color_contiguous ( Object object,
const int  vertex,
const float  threshold,
const bool  invert,
const bool  preserve_mask 
)
static

◆ sculpt_mask_by_color_contiguous_floodfill_cb()

static bool sculpt_mask_by_color_contiguous_floodfill_cb ( SculptSession ss,
int  from_v,
int  to_v,
bool  is_duplicate,
void userdata 
)
static

◆ sculpt_mask_by_color_delta_get()

static float sculpt_mask_by_color_delta_get ( const float color_a,
const float color_b,
const float  threshold,
const bool  invert 
)
static

◆ sculpt_mask_by_color_final_mask_get()

static float sculpt_mask_by_color_final_mask_get ( const float  current_mask,
const float  new_mask,
const bool  invert,
const bool  preserve_mask 
)
static

Definition at line 843 of file sculpt_ops.c.

References invert(), max_ff(), and min_ff().

Referenced by do_mask_by_color_contiguous_update_nodes_cb(), and do_mask_by_color_task_cb().

◆ sculpt_mask_by_color_full_mesh()

static void sculpt_mask_by_color_full_mesh ( Object object,
const int  vertex,
const float  threshold,
const bool  invert,
const bool  preserve_mask 
)
static

◆ sculpt_mask_by_color_invoke()

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

◆ sculpt_mode_toggle_exec()

static int sculpt_mode_toggle_exec ( bContext C,
wmOperator op 
)
static

◆ sculpt_no_multires_poll()

static bool sculpt_no_multires_poll ( bContext C)
static

◆ sculpt_optimize_exec()

static int sculpt_optimize_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ SCULPT_OT_loop_to_vertex_colors()

static void SCULPT_OT_loop_to_vertex_colors ( wmOperatorType ot)
static

◆ SCULPT_OT_mask_by_color()

static void SCULPT_OT_mask_by_color ( wmOperatorType ot)
static

◆ SCULPT_OT_optimize()

static void SCULPT_OT_optimize ( wmOperatorType ot)
static

◆ SCULPT_OT_sample_color()

static void SCULPT_OT_sample_color ( wmOperatorType ot)
static

◆ SCULPT_OT_sculptmode_toggle()

static void SCULPT_OT_sculptmode_toggle ( wmOperatorType ot)
static

◆ SCULPT_OT_set_persistent_base()

static void SCULPT_OT_set_persistent_base ( wmOperatorType ot)
static

◆ SCULPT_OT_symmetrize()

static void SCULPT_OT_symmetrize ( wmOperatorType ot)
static

◆ SCULPT_OT_vertex_to_loop_colors()

static void SCULPT_OT_vertex_to_loop_colors ( wmOperatorType ot)
static

◆ sculpt_sample_color_invoke()

static int sculpt_sample_color_invoke ( bContext C,
wmOperator op,
const wmEvent UNUSED
)
static

◆ sculpt_set_persistent_base_exec()

static int sculpt_set_persistent_base_exec ( bContext C,
wmOperator UNUSEDop 
)
static

◆ sculpt_symmetrize_exec()

static int sculpt_symmetrize_exec ( bContext C,
wmOperator op 
)
static

◆ vertex_to_loop_colors_exec()

static int vertex_to_loop_colors_exec ( bContext C,
wmOperator UNUSEDop 
)
static