[Bf-blender-cvs] [fc7fdc5c4ed] master: Cleanup: Move pose brush to its own file
Pablo Dobarro
noreply at git.blender.org
Sun Mar 1 19:56:50 CET 2020
Commit: fc7fdc5c4ed69809bcecc5762957aa42375ca6a2
Author: Pablo Dobarro
Date: Sun Mar 1 19:53:40 2020 +0100
Branches: master
https://developer.blender.org/rBfc7fdc5c4ed69809bcecc5762957aa42375ca6a2
Cleanup: Move pose brush to its own file
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D6973
===================================================================
M source/blender/editors/sculpt_paint/CMakeLists.txt
M source/blender/editors/sculpt_paint/paint_cursor.c
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
A source/blender/editors/sculpt_paint/sculpt_pose.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt
index 2522bc0f5cc..1f568250f3f 100644
--- a/source/blender/editors/sculpt_paint/CMakeLists.txt
+++ b/source/blender/editors/sculpt_paint/CMakeLists.txt
@@ -60,6 +60,7 @@ set(SRC
paint_vertex_weight_utils.c
sculpt.c
sculpt_cloth.c
+ sculpt_pose.c
sculpt_undo.c
sculpt_uv.c
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index ff26b347035..a5da577859a 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -1482,11 +1482,11 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused))
/* Free the previous pose brush preview. */
if (ss->pose_ik_chain_preview) {
- sculpt_pose_ik_chain_free(ss->pose_ik_chain_preview);
+ SCULPT_pose_ik_chain_free(ss->pose_ik_chain_preview);
}
/* Generate a new pose brush preview from the current cursor location. */
- ss->pose_ik_chain_preview = sculpt_pose_ik_chain_init(
+ ss->pose_ik_chain_preview = SCULPT_pose_ik_chain_init(
sd, vc.obact, ss, brush, gi.location, rds);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 06aa3f22de0..c2ae563c45f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -104,7 +104,7 @@
* For multires, the same vertex in multiple grids is counted multiple times, with
* different index for each grid. */
-static void sculpt_vertex_random_access_init(SculptSession *ss)
+void sculpt_vertex_random_access_init(SculptSession *ss)
{
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
BM_mesh_elem_index_ensure(ss->bm, BM_VERT);
@@ -369,7 +369,7 @@ void sculpt_vertex_neighbors_get(SculptSession *ss,
((void)0)
/* Utils */
-static bool check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm)
+bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm)
{
bool is_in_symmetry_area = true;
for (int i = 0; i < 3; i++) {
@@ -430,7 +430,7 @@ static void nearest_vertex_get_reduce(const void *__restrict UNUSED(userdata),
}
}
-static int sculpt_nearest_vertex_get(
+int SCULPT_nearest_vertex_get(
Sculpt *sd, Object *ob, const float co[3], float max_distance, bool use_original)
{
SculptSession *ss = ob->sculpt;
@@ -472,7 +472,7 @@ static int sculpt_nearest_vertex_get(
return nvtd.nearest_vertex_index;
}
-static bool is_symmetry_iteration_valid(char i, char symm)
+bool SCULPT_is_symmetry_iteration_valid(char i, char symm)
{
return i == 0 || (symm & i && (symm != 5 || i != 3) && (symm != 6 || (i != 3 && i != 5)));
}
@@ -484,7 +484,7 @@ static bool sculpt_is_vertex_inside_brush_radius_symm(const float vertex[3],
char symm)
{
for (char i = 0; i <= symm; ++i) {
- if (is_symmetry_iteration_valid(i, symm)) {
+ if (SCULPT_is_symmetry_iteration_valid(i, symm)) {
float location[3];
flip_v3_v3(location, br_co, (char)i);
if (len_squared_v3v3(location, vertex) < radius * radius) {
@@ -499,12 +499,7 @@ static bool sculpt_is_vertex_inside_brush_radius_symm(const float vertex[3],
*
* Iterate over connected vertices, starting from one or more initial vertices. */
-typedef struct SculptFloodFill {
- GSQueue *queue;
- char *visited_vertices;
-} SculptFloodFill;
-
-static void sculpt_floodfill_init(SculptSession *ss, SculptFloodFill *flood)
+void SCULPT_floodfill_init(SculptSession *ss, SculptFloodFill *flood)
{
int vertex_count = sculpt_vertex_count_get(ss);
sculpt_vertex_random_access_init(ss);
@@ -518,13 +513,13 @@ static void sculpt_floodfill_add_initial(SculptFloodFill *flood, int index)
BLI_gsqueue_push(flood->queue, &index);
}
-static void sculpt_floodfill_add_active(
+void SCULPT_floodfill_add_active(
Sculpt *sd, Object *ob, SculptSession *ss, SculptFloodFill *flood, float radius)
{
/* Add active vertex and symmetric vertices to the queue. */
const char symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL;
for (char i = 0; i <= symm; ++i) {
- if (is_symmetry_iteration_valid(i, symm)) {
+ if (SCULPT_is_symmetry_iteration_valid(i, symm)) {
int v = -1;
if (i == 0) {
v = sculpt_active_vertex_get(ss);
@@ -533,7 +528,7 @@ static void sculpt_floodfill_add_active(
float radius_squared = (radius == FLT_MAX) ? FLT_MAX : radius * radius;
float location[3];
flip_v3_v3(location, sculpt_active_vertex_co_get(ss), i);
- v = sculpt_nearest_vertex_get(sd, ob, location, radius_squared, false);
+ v = SCULPT_nearest_vertex_get(sd, ob, location, radius_squared, false);
}
if (v != -1) {
sculpt_floodfill_add_initial(flood, v);
@@ -542,7 +537,7 @@ static void sculpt_floodfill_add_active(
}
}
-static void sculpt_floodfill_execute(
+void SCULPT_floodfill_execute(
SculptSession *ss,
SculptFloodFill *flood,
bool (*func)(SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata),
@@ -567,7 +562,7 @@ static void sculpt_floodfill_execute(
}
}
-static void sculpt_floodfill_free(SculptFloodFill *flood)
+void SCULPT_floodfill_free(SculptFloodFill *flood)
{
MEM_SAFE_FREE(flood->visited_vertices);
BLI_gsqueue_free(flood->queue);
@@ -660,22 +655,6 @@ typedef enum StrokeFlags {
CLIP_Z = 4,
} StrokeFlags;
-/************** Access to original unmodified vertex data *************/
-
-typedef struct {
- BMLog *bm_log;
-
- SculptUndoNode *unode;
- float (*coords)[3];
- short (*normals)[3];
- const float *vmasks;
-
- /* Original coordinate, normal, and mask. */
- const float *co;
- const short *no;
- float mask;
-} SculptOrigVertData;
-
/* Initialize a SculptOrigVertData for accessing original vertex data;
* handles BMesh, mesh, and multires. */
static void sculpt_orig_vert_data_unode_init(SculptOrigVertData *data,
@@ -700,7 +679,7 @@ static void sculpt_orig_vert_data_unode_init(SculptOrigVertData *data,
/* Initialize a SculptOrigVertData for accessing original vertex data;
* handles BMesh, mesh, and multires. */
-static void sculpt_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node)
+void SCULPT_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBVHNode *node)
{
SculptUndoNode *unode;
unode = sculpt_undo_push_node(ob, node, SCULPT_UNDO_COORDS);
@@ -709,7 +688,7 @@ static void sculpt_orig_vert_data_init(SculptOrigVertData *data, Object *ob, PBV
/* Update a SculptOrigVertData for a particular vertex from the PBVH
* iterator. */
-static void sculpt_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter)
+void SCULPT_orig_vert_data_update(SculptOrigVertData *orig_data, PBVHVertexIter *iter)
{
if (orig_data->unode->type == SCULPT_UNDO_COORDS) {
if (orig_data->bm_log) {
@@ -884,7 +863,7 @@ static void paint_mesh_restore_co_task_cb(void *__restrict userdata,
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{
- sculpt_orig_vert_data_update(&orig_data, &vd);
+ SCULPT_orig_vert_data_update(&orig_data, &vd);
if (orig_data.unode->type == SCULPT_UNDO_COORDS) {
copy_v3_v3(vd.co, orig_data.co);
@@ -1310,8 +1289,8 @@ static float *sculpt_topology_automasking_init(Sculpt *sd, Object *ob, float *au
/* Flood fill automask to connected vertices. Limited to vertices inside
* the brush radius if the tool requires it. */
SculptFloodFill flood;
- sculpt_floodfill_init(ss, &flood);
- sculpt_floodfill_add_active(sd, ob, ss, &flood, ss->cache->radius);
+ SCULPT_floodfill_init(ss, &flood);
+ SCULPT_floodfill_add_active(sd, ob, ss, &flood, ss->cache->radius);
AutomaskFloodFillData fdata = {
.automask_factor = automask_factor,
@@ -1320,8 +1299,8 @@ static float *sculpt_topology_automasking_init(Sculpt *sd, Object *ob, float *au
.symm = sd->paint.symmetry_flags & PAINT_SYMM_AXIS_ALL,
};
copy_v3_v3(fdata.location, sculpt_active_vertex_co_get(ss));
- sculpt_floodfill_execute(ss, &flood, automask_floodfill_cb, &fdata);
- sculpt_floodfill_free(&flood);
+ SCULPT_floodfill_execute(ss, &flood, automask_floodfill_cb, &fdata);
+ SCULPT_floodfill_free(&flood);
return automask_factor;
}
@@ -2991,7 +2970,7 @@ static void do_draw_sharp_brush_task_cb_ex(void *__restrict userdata,
SculptOrigVertData orig_data;
float(*proxy)[3];
- sculpt_orig_vert_data_init(&orig_data, data->ob, data->nodes[n]);
+ SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n]);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[n])->co;
@@ -3001,7 +2980,7 @@ static void do_draw_sharp_brush_task_cb_ex(void *__restrict userdata,
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{
- sculpt_orig_vert_data_update(&orig_data, &vd);
+ SCULPT_orig_vert_data_update(&orig_data, &vd);
if (sculpt_brush_test_sq_fn(&test, orig_data.co)) {
/* Offset vertex. */
const float fade = tex_strength(ss,
@@ -3071,7 +3050,7 @@ static void do_topology_slide_task_cb_ex(void *__restrict userdata,
SculptOrigVertData orig_data;
float(*proxy)[3];
- sculpt_orig_vert_data_init(&orig_data, data->ob, data->nodes[n]);
+ SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n]);
proxy = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[n])->co;
@@ -3081,7 +3060,7 @@ static void do_topology_slide_task_cb_ex(void *__restrict userdata,
BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE)
{
- sculpt_orig_vert_data_update(&orig_data, &vd);
+ SCULPT_orig_vert_data_update(&orig_data, &vd);
if (sculpt_brush_test_sq_fn(&test, orig_data.co)) {
const float fade = tex_strength(ss,
brush,
@@ -3173,7 +3152,7 @@ static void do_topology_relax_task_cb_ex(void *__restrict
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list