Sculpt: Split the brushes from sculpt.c into sculpt_brushes.c.

* Also killed the warnings in sculpt_boundary.c
This commit is contained in:
Joseph Eagar 2021-10-17 15:45:05 -07:00
parent f7bf7bec99
commit 08960bcda6
6 changed files with 4305 additions and 4075 deletions

View File

@ -61,8 +61,11 @@ set(SRC
sculpt_curvature.c
sculpt_automasking.c
sculpt_boundary.c
sculpt_brushes.c
sculpt_cloth.c
sculpt_detail.c
sculpt_displacement.c
sculpt_displacement.h
sculpt_dyntopo.c
sculpt_expand.c
sculpt_face_set.c
@ -78,14 +81,12 @@ set(SRC
sculpt_paint_color.c
sculpt_pose.c
sculpt_poly_loop.c
sculpt_replay.c
sculpt_symmetrize.c
sculpt_smooth.c
sculpt_transform.c
sculpt_undo.c
sculpt_uv.c
sculpt_displacement.c
sculpt_displacement.h
sculpt_replay.c
sculpt.cc
sculpt.hh

View File

@ -397,6 +397,8 @@ bool paint_curve_poll(struct bContext *C);
bool facemask_paint_poll(struct bContext *C);
void flip_v3_v3(float out[3], const float in[3], const enum ePaintSymmetryFlags symm);
void flip_qt_qt(float out[4], const float in[4], const enum ePaintSymmetryFlags symm);
void flip_qt(float quat[4], const ePaintSymmetryFlags symm);
void flip_v3(float v[3], const ePaintSymmetryFlags symm);
/* stroke operator */
typedef enum BrushStrokeMode {

File diff suppressed because it is too large Load Diff

View File

@ -283,7 +283,6 @@ static bool boundary_floodfill_cb(
BoundaryFloodFillData *data = userdata;
SculptBoundary *boundary = data->boundary;
int from_v_i = BKE_pbvh_vertex_index_to_table(ss->pbvh, from_v);
int to_v_i = BKE_pbvh_vertex_index_to_table(ss->pbvh, to_v);
if (!SCULPT_vertex_is_boundary(ss, to_v, SCULPT_BOUNDARY_MESH)) {
return false;
@ -580,7 +579,7 @@ static void sculpt_boundary_indices_init(Object *ob,
SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
float tot = 0.0f;
StoredCotangentW *cotw = boundary->boundary_cotangents + i;
// StoredCotangentW *cotw = boundary->boundary_cotangents + i;
float tan[3] = {0.0f, 0.0f, 0.0f};
SculptVertexNeighborIter ni;
@ -1232,9 +1231,6 @@ Object *sculpt_get_vis_object(bContext *C, SculptSession *ss, char *name)
Main *bmain = CTX_data_main(C);
Object *actob = CTX_data_active_object(C);
View3D *v3d = CTX_wm_view3d(C);
unsigned short local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
Object *ob = (Object *)BKE_libblock_find_name(bmain, ID_OB, name);
if (!ob) {
@ -1272,10 +1268,7 @@ void sculpt_end_vis_object(bContext *C, SculptSession *ss, Object *ob, BMesh *bm
C = ss->cache->C;
}
Scene *scene = CTX_data_scene(C);
ViewLayer *vlayer = CTX_data_view_layer(C);
Main *bmain = CTX_data_main(C);
Object *actob = CTX_data_active_object(C);
Mesh *me = (Mesh *)ob->data;
@ -1322,9 +1315,9 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss,
}
for (int i = 0; i < totvert; i++) {
#ifdef VISBM
SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
#ifdef VISBM
if (boundary->boundary_dist[i] != FLT_MAX) {
const float *co1 = SCULPT_vertex_co_get(ss, vertex);
float *dir = boundary->boundary_tangents[i];
@ -1375,8 +1368,6 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss,
copy_v3_v3(olddir, dir);
if (boundary->boundary_dist[i] != FLT_MAX) {
float f1 = boundary->boundary_dist[i];
zero_v3(dir);
copy_v3_v3(dir, boundary->boundary_tangents[i]);
@ -1394,7 +1385,6 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss,
boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex_i], dir, normal);
normalize_v3(boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex_i]);
const float *oco = SCULPT_vertex_co_get(ss, boundary->edit_info[i].original_vertex);
float pos[3];
copy_v3_v3(pos, co1);
@ -1627,7 +1617,6 @@ static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata,
const int symm_area = ss->cache->mirror_symmetry_pass;
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1682,7 +1671,6 @@ static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata,
const int symm_area = ss->cache->mirror_symmetry_pass;
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1728,7 +1716,6 @@ static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata,
const int symm_area = ss->cache->mirror_symmetry_pass;
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1776,7 +1763,6 @@ static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata,
const int symm_area = ss->cache->mirror_symmetry_pass;
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1819,7 +1805,6 @@ static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata,
const int symm_area = ss->cache->mirror_symmetry_pass;
SculptBoundary *boundary = ss->cache->boundaries[symm_area];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1873,7 +1858,6 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata,
const int symmetry_pass = ss->cache->mirror_symmetry_pass;
const SculptBoundary *boundary = ss->cache->boundaries[symmetry_pass];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1932,7 +1916,6 @@ static void do_boundary_brush_circle_task_cb_ex(void *__restrict userdata,
const int symmetry_pass = ss->cache->mirror_symmetry_pass;
const SculptBoundary *boundary = ss->cache->boundaries[symmetry_pass];
const ePaintSymmetryFlags symm = SCULPT_mesh_symmetry_xyz_get(data->ob);
const Brush *brush = data->brush;
const float strength = ss->cache->bstrength;
@ -1979,7 +1962,6 @@ static void do_boundary_brush_circle_task_cb_ex(void *__restrict userdata,
static void SCULPT_boundary_autosmooth(SculptSession *ss, SculptBoundary *boundary)
{
const int totvert = SCULPT_vertex_count_get(ss);
PBVHNode **nodes;
int totnode;

File diff suppressed because it is too large Load Diff

View File

@ -2035,3 +2035,131 @@ void SCULPT_bound_smooth_init(SculptSession *ss, SculptCustomLayer *r_bound_scl)
void SCULPT_undo_ensure_bmlog(struct Object *ob);
enum { SCULPT_SHARP_SIMPLE, SCULPT_SHARP_PLANE };
/* utility functions for brushes */
void SCULPT_calc_area_center(
struct Sculpt *sd, struct Object *ob, PBVHNode **nodes, int totnode, float r_area_co[3]);
/* This calculates flatten center and area normal together,
* amortizing the memory bandwidth and loop overhead to calculate both at the same time. */
void SCULPT_calc_area_normal_and_center(struct Sculpt *sd,
struct Object *ob,
PBVHNode **nodes,
int totnode,
float r_area_no[3],
float r_area_co[3]);
/* sculpt_brushes.c */
void SCULPT_do_twist_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_fill_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_scrape_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_clay_thumb_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_flatten_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_clay_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_clay_strips_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_snake_hook_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_thumb_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_rotate_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_layer_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_inflate_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_nudge_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_crease_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_pinch_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_grab_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_elastic_deform_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_draw_sharp_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_scene_project_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_slide_relax_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_fairing_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_displacement_smear_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_displacement_eraser_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_draw_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_mask_brush_draw(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_do_mask_brush(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
int totnode);
void SCULPT_bmesh_topology_rake(struct Sculpt *sd,
struct Object *ob,
struct PBVHNode **nodes,
const int totnode,
float bstrength,
bool needs_origco);
void SCULPT_stroke_cache_snap_context_init(struct bContext *C, struct Object *ob);
void SCULPT_fairing_brush_exec_fairing_for_cache(struct Sculpt *sd, struct Object *ob);