Merge from master
This commit is contained in:
parent
dd45a4bc6e
commit
e9f9217f75
|
@ -368,6 +368,18 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh,
|
|||
int symaxis,
|
||||
bool updatePBVH);
|
||||
|
||||
bool BKE_pbvh_bmesh_update_topology_nodes(PBVH *pbvh,
|
||||
bool (*searchcb)(PBVHNode *node, void *data),
|
||||
void (*undopush)(PBVHNode *node, void *data),
|
||||
void *searchdata,
|
||||
PBVHTopologyUpdateMode mode,
|
||||
const float center[3],
|
||||
const float view_normal[3],
|
||||
float radius,
|
||||
const bool use_frontface,
|
||||
const bool use_projected,
|
||||
int sym_axis,
|
||||
bool updatePBVH);
|
||||
/* Node Access */
|
||||
|
||||
void BKE_pbvh_node_mark_update(PBVHNode *node);
|
||||
|
|
|
@ -1944,6 +1944,19 @@ void BKE_pbvh_node_num_verts(PBVH *pbvh, PBVHNode *node, int *r_uniquevert, int
|
|||
}
|
||||
break;
|
||||
case PBVH_BMESH:
|
||||
// not a leaf? return zero
|
||||
if (!(node->flag & PBVH_Leaf)) {
|
||||
if (r_totvert) {
|
||||
*r_totvert = 0;
|
||||
}
|
||||
|
||||
if (r_uniquevert) {
|
||||
*r_uniquevert = 0;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tot = BLI_table_gset_len(node->bm_unique_verts);
|
||||
if (r_totvert) {
|
||||
*r_totvert = tot + BLI_table_gset_len(node->bm_other_verts);
|
||||
|
|
|
@ -992,8 +992,7 @@ off fort;
|
|||
fdis := (sqrt(dis)/nz)**2 + planedis**2;
|
||||
*/
|
||||
|
||||
static float dist_to_tri_sphere(
|
||||
float p[3], float v1[3], float v2[3], float v3[3], float n[3])
|
||||
static float dist_to_tri_sphere(float p[3], float v1[3], float v2[3], float v3[3], float n[3])
|
||||
{
|
||||
|
||||
// find projection axis;
|
||||
|
@ -1027,7 +1026,7 @@ static float dist_to_tri_sphere(
|
|||
double bx = v2[axis1] - ax, by = v2[axis2] - ay;
|
||||
double cx = v3[axis1] - ax, cy = v3[axis2] - ay;
|
||||
double bx2 = bx * bx, by2 = by * by, cx2 = cx * cx, cy2 = cy * cy;
|
||||
|
||||
|
||||
double x1 = p[axis1] - ax;
|
||||
double y1 = p[axis2] - ay;
|
||||
|
||||
|
@ -1043,7 +1042,6 @@ static float dist_to_tri_sphere(
|
|||
}
|
||||
|
||||
double d1, d2, d3, div;
|
||||
|
||||
|
||||
/*
|
||||
//\ 3|
|
||||
|
@ -1096,7 +1094,7 @@ static float dist_to_tri_sphere(
|
|||
d3 = (d3 * d3) / div;
|
||||
}
|
||||
else {
|
||||
d3 = (x1-cx)*(x1-cx) + (y1-cy)*(y1-cy);
|
||||
d3 = (x1 - cx) * (x1 - cx) + (y1 - cy) * (y1 - cy);
|
||||
}
|
||||
|
||||
dis = d3;
|
||||
|
@ -1122,10 +1120,10 @@ static bool edge_queue_tri_in_sphere(const EdgeQueue *q, BMFace *f)
|
|||
/* Check if triangle intersects the sphere */
|
||||
float dis = dist_to_tri_sphere(q->center, l->v->co, l->next->v->co, l->prev->v->co, f->no);
|
||||
|
||||
//closest_on_tri_to_point_v3(c, co, v1, v2, v3);
|
||||
// closest_on_tri_to_point_v3(c, co, v1, v2, v3);
|
||||
|
||||
//float dis2 = len_squared_v3v3(q->center, c);
|
||||
//float dis3 = sqrtf(dis2);
|
||||
// float dis2 = len_squared_v3v3(q->center, c);
|
||||
// float dis3 = sqrtf(dis2);
|
||||
|
||||
return dis <= q->radius_squared;
|
||||
|
||||
|
@ -2991,6 +2989,48 @@ static double last_update_time[128] = {
|
|||
0,
|
||||
};
|
||||
|
||||
bool BKE_pbvh_bmesh_update_topology_nodes(PBVH *pbvh,
|
||||
bool (*searchcb)(PBVHNode *node, void *data),
|
||||
void (*undopush)(PBVHNode *node, void *data),
|
||||
void *searchdata,
|
||||
PBVHTopologyUpdateMode mode,
|
||||
const float center[3],
|
||||
const float view_normal[3],
|
||||
float radius,
|
||||
const bool use_frontface,
|
||||
const bool use_projected,
|
||||
int sym_axis,
|
||||
bool updatePBVH)
|
||||
{
|
||||
bool modified = false;
|
||||
|
||||
for (int i = 0; i < pbvh->totnode; i++) {
|
||||
PBVHNode *node = pbvh->nodes + i;
|
||||
|
||||
if (!(node->flag & PBVH_Leaf) || !searchcb(node, searchdata)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
undopush(node, searchdata);
|
||||
|
||||
modified =
|
||||
modified ||
|
||||
BKE_pbvh_bmesh_update_topology(
|
||||
pbvh, mode, center, view_normal, radius, use_frontface, use_projected, sym_axis, updatePBVH);
|
||||
|
||||
if (i < pbvh->totnode) { //nodes could have been reallocated on us
|
||||
node = pbvh->nodes + i;
|
||||
|
||||
if (node->flag & PBVH_Leaf) {
|
||||
BKE_pbvh_node_mark_topology_update(pbvh->nodes + i);
|
||||
BKE_pbvh_bmesh_node_save_ortri(pbvh->bm, pbvh->nodes + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
/* Collapse short edges, subdivide long edges */
|
||||
bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh,
|
||||
PBVHTopologyUpdateMode mode,
|
||||
|
|
|
@ -818,6 +818,8 @@ void SCULPT_visibility_sync_all_vertex_to_face_sets(SculptSession *ss)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case PBVH_GRIDS:
|
||||
break;
|
||||
case PBVH_BMESH: {
|
||||
BMIter iter;
|
||||
BMFace *f;
|
||||
|
@ -2396,8 +2398,9 @@ static void calc_area_normal_and_center_task_cb(void *__restrict userdata,
|
|||
|
||||
if (use_original) {
|
||||
if (unode->bm_entry) {
|
||||
const float *temp_co;
|
||||
const float *temp_no;
|
||||
float *temp_co;
|
||||
float *temp_no;
|
||||
|
||||
BKE_pbvh_bmesh_update_origvert(ss->pbvh, vd.bm_vert, &temp_co, &temp_no, NULL);
|
||||
if (temp_no) {
|
||||
normal_float_to_short_v3(no_s, temp_no);
|
||||
|
@ -6179,6 +6182,17 @@ void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3])
|
|||
BKE_keyblock_update_from_vertcos(ob, kb, vertCos);
|
||||
}
|
||||
|
||||
static void topology_undopush_cb(PBVHNode *node, void *data)
|
||||
{
|
||||
SculptSearchSphereData *sdata = (SculptSearchSphereData *)data;
|
||||
|
||||
SCULPT_undo_push_node(sdata->ob,
|
||||
node,
|
||||
sdata->brush->sculpt_tool == SCULPT_TOOL_MASK ? SCULPT_UNDO_MASK :
|
||||
SCULPT_UNDO_COORDS);
|
||||
BKE_pbvh_node_mark_update(node);
|
||||
}
|
||||
|
||||
/* Note: we do the topology update before any brush actions to avoid
|
||||
* issues with the proxies. The size of the proxy can't change, so
|
||||
* topology must be updated first. */
|
||||
|
@ -6194,13 +6208,6 @@ static void sculpt_topology_update(Sculpt *sd,
|
|||
const bool use_original = sculpt_tool_needs_original(brush->sculpt_tool) ? true :
|
||||
ss->cache->original;
|
||||
const float radius_scale = 1.25f;
|
||||
PBVHNode **nodes = sculpt_pbvh_gather_generic(
|
||||
ob, sd, brush, use_original, radius_scale, &totnode);
|
||||
|
||||
/* Only act if some verts are inside the brush area. */
|
||||
if (totnode == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Free index based vertex info as it will become invalid after modifying the topology during the
|
||||
* stroke. */
|
||||
|
@ -6220,35 +6227,35 @@ static void sculpt_topology_update(Sculpt *sd,
|
|||
}
|
||||
}
|
||||
|
||||
for (n = 0; n < totnode; n++) {
|
||||
SCULPT_undo_push_node(ob,
|
||||
nodes[n],
|
||||
brush->sculpt_tool == SCULPT_TOOL_MASK ? SCULPT_UNDO_MASK :
|
||||
SCULPT_UNDO_COORDS);
|
||||
BKE_pbvh_node_mark_update(nodes[n]);
|
||||
PBVHNode **nodes = NULL;
|
||||
SculptSearchSphereData sdata = {.ss = ss,
|
||||
.sd = sd,
|
||||
.ob = ob,
|
||||
.radius_squared = square_f(ss->cache->radius * radius_scale),
|
||||
.original = use_original,
|
||||
.ignore_fully_ineffective = brush->sculpt_tool !=
|
||||
SCULPT_TOOL_MASK,
|
||||
.center = NULL,
|
||||
.brush = brush};
|
||||
|
||||
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
|
||||
int symidx = ss->cache->mirror_symmetry_pass + (ss->cache->radial_symmetry_pass * 8);
|
||||
if (symidx > 127) {
|
||||
symidx = 127;
|
||||
}
|
||||
|
||||
BKE_pbvh_bmesh_update_topology(ss->pbvh,
|
||||
mode,
|
||||
ss->cache->location,
|
||||
ss->cache->view_normal,
|
||||
ss->cache->radius,
|
||||
(brush->flag & BRUSH_FRONTFACE) != 0,
|
||||
(brush->falloff_shape != PAINT_FALLOFF_SHAPE_SPHERE),
|
||||
symidx,
|
||||
brush->sculpt_tool != SCULPT_TOOL_DRAW_SHARP);
|
||||
|
||||
BKE_pbvh_node_mark_topology_update(nodes[n]);
|
||||
BKE_pbvh_bmesh_node_save_orig(ss->bm, nodes[n]);
|
||||
}
|
||||
int symidx = ss->cache->mirror_symmetry_pass + (ss->cache->radial_symmetry_pass * 8);
|
||||
if (symidx > 127) {
|
||||
symidx = 127;
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(nodes);
|
||||
/* do nodes under the brush cursor */
|
||||
BKE_pbvh_bmesh_update_topology_nodes(ss->pbvh,
|
||||
SCULPT_search_sphere_cb,
|
||||
topology_undopush_cb,
|
||||
&sdata,
|
||||
mode,
|
||||
ss->cache->location,
|
||||
ss->cache->view_normal,
|
||||
ss->cache->radius,
|
||||
(brush->flag & BRUSH_FRONTFACE) != 0,
|
||||
(brush->falloff_shape != PAINT_FALLOFF_SHAPE_SPHERE),
|
||||
symidx,
|
||||
brush->sculpt_tool != SCULPT_TOOL_DRAW_SHARP);
|
||||
|
||||
/* Update average stroke position. */
|
||||
copy_v3_v3(location, ss->cache->true_location);
|
||||
|
@ -7794,7 +7801,7 @@ static void sculpt_raycast_cb(PBVHNode *node, void *data_v, float *tmin)
|
|||
}
|
||||
else {
|
||||
/* Intersect with coordinates from before we started stroke. */
|
||||
SculptUndoNode *unode = SCULPT_undo_get_node(node);
|
||||
SculptUndoNode *unode = SCULPT_undo_get_node(node, SCULPT_UNDO_COORDS);
|
||||
origco = (unode) ? unode->co : NULL;
|
||||
use_origco = origco ? true : false;
|
||||
}
|
||||
|
@ -7831,7 +7838,7 @@ static void sculpt_find_nearest_to_ray_cb(PBVHNode *node, void *data_v, float *t
|
|||
}
|
||||
else {
|
||||
/* Intersect with coordinates from before we started stroke. */
|
||||
SculptUndoNode *unode = SCULPT_undo_get_node(node);
|
||||
SculptUndoNode *unode = SCULPT_undo_get_node(node, SCULPT_UNDO_COORDS);
|
||||
origco = (unode) ? unode->co : NULL;
|
||||
use_origco = origco ? true : false;
|
||||
}
|
||||
|
|
|
@ -338,7 +338,7 @@ float *SCULPT_boundary_automasking_init(Object *ob,
|
|||
|
||||
for (int propagation_it = 0; propagation_it < propagation_steps; propagation_it++) {
|
||||
for (int i = 0; i < totvert; i++) {
|
||||
ScultVertRef vref = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
|
||||
SculptVertRef vref = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
|
||||
|
||||
if (edge_distance[i] != EDGE_DISTANCE_INF) {
|
||||
continue;
|
||||
|
|
|
@ -248,34 +248,20 @@ static bool boundary_floodfill_cb(
|
|||
{
|
||||
BoundaryFloodFillData *data = userdata;
|
||||
SculptBoundary *boundary = data->boundary;
|
||||
<<<<<<< HEAD
|
||||
const int from_v_i = BKE_pbvh_vertex_index_to_table(ss->pbvh, from_v);
|
||||
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)) {
|
||||
const float edge_len = len_v3v3(SCULPT_vertex_co_get(ss, from_v),
|
||||
SCULPT_vertex_co_get(ss, to_v));
|
||||
const float distance_boundary_to_dst = boundary->distance ?
|
||||
boundary->distance[from_v_i] + edge_len :
|
||||
0.0f;
|
||||
sculpt_boundary_index_add(
|
||||
ss, boundary, to_v, distance_boundary_to_dst, data->included_vertices);
|
||||
if (!is_duplicate) {
|
||||
sculpt_boundary_preview_edge_add(boundary, from_v, to_v);
|
||||
}
|
||||
return sculpt_boundary_is_vertex_in_editable_boundary(ss, to_v);
|
||||
=======
|
||||
if (!SCULPT_vertex_is_boundary(ss, to_v)) {
|
||||
return false;
|
||||
}
|
||||
const float edge_len = len_v3v3(SCULPT_vertex_co_get(ss, from_v),
|
||||
SCULPT_vertex_co_get(ss, to_v));
|
||||
const float distance_boundary_to_dst = boundary->distance ?
|
||||
boundary->distance[from_v] + edge_len :
|
||||
boundary->distance[from_v_i] + edge_len :
|
||||
0.0f;
|
||||
sculpt_boundary_index_add(boundary, to_v, distance_boundary_to_dst, data->included_vertices);
|
||||
sculpt_boundary_index_add(ss, boundary, to_v, distance_boundary_to_dst, data->included_vertices);
|
||||
if (!is_duplicate) {
|
||||
sculpt_boundary_preview_edge_add(boundary, from_v, to_v);
|
||||
>>>>>>> master
|
||||
}
|
||||
return sculpt_boundary_is_vertex_in_editable_boundary(ss, to_v);
|
||||
}
|
||||
|
@ -408,66 +394,25 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
|
|||
|
||||
SculptVertexNeighborIter ni;
|
||||
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
|
||||
<<<<<<< HEAD
|
||||
const int index = ni.index;
|
||||
|
||||
const bool is_visible = SCULPT_vertex_visible_get(ss, ni.vertex);
|
||||
if (is_visible &&
|
||||
boundary->edit_info[index].num_propagation_steps == BOUNDARY_STEPS_NONE) {
|
||||
|
||||
boundary->edit_info[index].original_vertex =
|
||||
boundary->edit_info[from_v_i].original_vertex;
|
||||
boundary->edit_info[index].original_vertex_i =
|
||||
boundary->edit_info[from_v_i].original_vertex_i;
|
||||
|
||||
BLI_BITMAP_ENABLE(visited_vertices, index);
|
||||
|
||||
if (ni.is_duplicate) {
|
||||
/* Grids duplicates handling. */
|
||||
boundary->edit_info[index].num_propagation_steps =
|
||||
boundary->edit_info[from_v_i].num_propagation_steps;
|
||||
}
|
||||
else {
|
||||
boundary->edit_info[index].num_propagation_steps =
|
||||
boundary->edit_info[from_v_i].num_propagation_steps + 1;
|
||||
|
||||
BLI_gsqueue_push(next_iteration, &ni.vertex);
|
||||
|
||||
/* When copying the data to the neighbor for the next iteration, it has to be copied to
|
||||
* all its duplicates too. This is because it is not possible to know if the updated
|
||||
* neighbor or one if its uninitialized duplicates is going to come first in order to
|
||||
* copy the data in the from_v neighbor iterator. */
|
||||
if (has_duplicates) {
|
||||
SculptVertexNeighborIter ni_duplis;
|
||||
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, ni.vertex, ni_duplis) {
|
||||
if (ni_duplis.is_duplicate) {
|
||||
const int index = ni_duplis.index;
|
||||
boundary->edit_info[index].original_vertex =
|
||||
boundary->edit_info[from_v_i].original_vertex;
|
||||
boundary->edit_info[index].original_vertex_i =
|
||||
boundary->edit_info[from_v_i].original_vertex_i;
|
||||
boundary->edit_info[index].num_propagation_steps =
|
||||
boundary->edit_info[from_v_i].num_propagation_steps + 1;
|
||||
}
|
||||
=======
|
||||
const bool is_visible = SCULPT_vertex_visible_get(ss, ni.index);
|
||||
if (!is_visible ||
|
||||
boundary->edit_info[ni.index].num_propagation_steps != BOUNDARY_STEPS_NONE) {
|
||||
continue;
|
||||
}
|
||||
boundary->edit_info[ni.index].original_vertex =
|
||||
boundary->edit_info[from_v].original_vertex;
|
||||
boundary->edit_info[from_v_i].original_vertex;
|
||||
|
||||
BLI_BITMAP_ENABLE(visited_vertices, ni.index);
|
||||
|
||||
if (ni.is_duplicate) {
|
||||
/* Grids duplicates handling. */
|
||||
boundary->edit_info[ni.index].num_propagation_steps =
|
||||
boundary->edit_info[from_v].num_propagation_steps;
|
||||
boundary->edit_info[from_v_i].num_propagation_steps;
|
||||
}
|
||||
else {
|
||||
boundary->edit_info[ni.index].num_propagation_steps =
|
||||
boundary->edit_info[from_v].num_propagation_steps + 1;
|
||||
boundary->edit_info[from_v_i].num_propagation_steps + 1;
|
||||
|
||||
BLI_gsqueue_push(next_iteration, &ni.index);
|
||||
|
||||
|
@ -477,36 +422,24 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
|
|||
* copy the data in the from_v neighbor iterator. */
|
||||
if (has_duplicates) {
|
||||
SculptVertexNeighborIter ni_duplis;
|
||||
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, ni.index, ni_duplis) {
|
||||
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, ni.vertex, ni_duplis) {
|
||||
if (ni_duplis.is_duplicate) {
|
||||
boundary->edit_info[ni_duplis.index].original_vertex =
|
||||
boundary->edit_info[from_v].original_vertex;
|
||||
boundary->edit_info[from_v_i].original_vertex;
|
||||
boundary->edit_info[ni_duplis.index].num_propagation_steps =
|
||||
boundary->edit_info[from_v].num_propagation_steps + 1;
|
||||
>>>>>>> master
|
||||
boundary->edit_info[from_v_i].num_propagation_steps + 1;
|
||||
}
|
||||
}
|
||||
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni_duplis);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
/* Check the distance using the vertex that was propagated from the initial vertex that
|
||||
* was used to initialize the boundary. */
|
||||
if (boundary->edit_info[from_v_i].original_vertex.i == initial_vertex.i) {
|
||||
boundary->pivot_vertex = ni.vertex;
|
||||
copy_v3_v3(boundary->initial_pivot_position, SCULPT_vertex_co_get(ss, ni.vertex));
|
||||
accum_distance += len_v3v3(SCULPT_vertex_co_get(ss, from_v),
|
||||
SCULPT_vertex_co_get(ss, ni.vertex));
|
||||
}
|
||||
=======
|
||||
/* Check the distance using the vertex that was propagated from the initial vertex that
|
||||
* was used to initialize the boundary. */
|
||||
if (boundary->edit_info[from_v].original_vertex == initial_vertex) {
|
||||
boundary->pivot_vertex = ni.index;
|
||||
copy_v3_v3(boundary->initial_pivot_position, SCULPT_vertex_co_get(ss, ni.index));
|
||||
if (boundary->edit_info[from_v_i].original_vertex.i == initial_vertex.i) {
|
||||
boundary->pivot_vertex = ni.vertex;
|
||||
copy_v3_v3(boundary->initial_pivot_position, SCULPT_vertex_co_get(ss, ni.vertex));
|
||||
accum_distance += len_v3v3(SCULPT_vertex_co_get(ss, from_v),
|
||||
SCULPT_vertex_co_get(ss, ni.index));
|
||||
>>>>>>> master
|
||||
SCULPT_vertex_co_get(ss, ni.vertex));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -657,56 +590,34 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo
|
|||
totvert, 3 * sizeof(float), "pivot positions");
|
||||
|
||||
for (int i = 0; i < totvert; i++) {
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[i].num_propagation_steps == boundary->max_propagation_steps) {
|
||||
float dir[3];
|
||||
float normal[3];
|
||||
SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
|
||||
SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
|
||||
|
||||
SCULPT_vertex_normal_get(ss, vertex, normal);
|
||||
sub_v3_v3v3(dir,
|
||||
SCULPT_vertex_co_get(ss, boundary->edit_info[i].original_vertex),
|
||||
SCULPT_vertex_co_get(ss, vertex));
|
||||
cross_v3_v3v3(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]);
|
||||
copy_v3_v3(boundary->bend.pivot_positions[boundary->edit_info[i].original_vertex_i],
|
||||
SCULPT_vertex_co_get(ss, vertex));
|
||||
=======
|
||||
if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
float dir[3];
|
||||
float normal[3];
|
||||
SCULPT_vertex_normal_get(ss, i, normal);
|
||||
SCULPT_vertex_normal_get(ss, vertex, normal);
|
||||
sub_v3_v3v3(dir,
|
||||
SCULPT_vertex_co_get(ss, boundary->edit_info[i].original_vertex),
|
||||
SCULPT_vertex_co_get(ss, i));
|
||||
SCULPT_vertex_co_get(ss, vertex));
|
||||
cross_v3_v3v3(
|
||||
boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex], dir, normal);
|
||||
normalize_v3(boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex]);
|
||||
copy_v3_v3(boundary->bend.pivot_positions[boundary->edit_info[i].original_vertex],
|
||||
SCULPT_vertex_co_get(ss, i));
|
||||
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]);
|
||||
copy_v3_v3(boundary->bend.pivot_positions[boundary->edit_info[i].original_vertex_i],
|
||||
SCULPT_vertex_co_get(ss, vertex));
|
||||
}
|
||||
|
||||
for (int i = 0; i < totvert; i++) {
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[i].num_propagation_steps != BOUNDARY_STEPS_NONE) {
|
||||
copy_v3_v3(boundary->bend.pivot_positions[i],
|
||||
boundary->bend.pivot_positions[boundary->edit_info[i].original_vertex_i]);
|
||||
copy_v3_v3(boundary->bend.pivot_rotation_axis[i],
|
||||
boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex_i]);
|
||||
=======
|
||||
if (boundary->edit_info[i].num_propagation_steps == BOUNDARY_STEPS_NONE) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
copy_v3_v3(boundary->bend.pivot_positions[i],
|
||||
boundary->bend.pivot_positions[boundary->edit_info[i].original_vertex]);
|
||||
boundary->bend.pivot_positions[boundary->edit_info[i].original_vertex_i]);
|
||||
copy_v3_v3(boundary->bend.pivot_rotation_axis[i],
|
||||
boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex]);
|
||||
boundary->bend.pivot_rotation_axis[boundary->edit_info[i].original_vertex_i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -716,37 +627,23 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b
|
|||
boundary->slide.directions = MEM_calloc_arrayN(totvert, 3 * sizeof(float), "slide directions");
|
||||
|
||||
for (int i = 0; i < totvert; i++) {
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[i].num_propagation_steps == boundary->max_propagation_steps) {
|
||||
const int index = boundary->edit_info[i].original_vertex_i;
|
||||
SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
|
||||
|
||||
sub_v3_v3v3(boundary->slide.directions[index],
|
||||
SCULPT_vertex_co_get(ss, boundary->edit_info[i].original_vertex),
|
||||
SCULPT_vertex_co_get(ss, BKE_pbvh_table_index_to_vertex(ss->pbvh, i)));
|
||||
normalize_v3(boundary->slide.directions[index]);
|
||||
=======
|
||||
if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) {
|
||||
>>>>>>> master
|
||||
}
|
||||
sub_v3_v3v3(boundary->slide.directions[boundary->edit_info[i].original_vertex],
|
||||
|
||||
sub_v3_v3v3(boundary->slide.directions[boundary->edit_info[i].original_vertex_i],
|
||||
SCULPT_vertex_co_get(ss, boundary->edit_info[i].original_vertex),
|
||||
SCULPT_vertex_co_get(ss, i));
|
||||
normalize_v3(boundary->slide.directions[boundary->edit_info[i].original_vertex]);
|
||||
SCULPT_vertex_co_get(ss, vertex));
|
||||
normalize_v3(boundary->slide.directions[boundary->edit_info[i].original_vertex_i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < totvert; i++) {
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[i].num_propagation_steps != BOUNDARY_STEPS_NONE) {
|
||||
copy_v3_v3(boundary->slide.directions[i],
|
||||
boundary->slide.directions[BKE_pbvh_vertex_index_to_table(
|
||||
ss->pbvh, boundary->edit_info[i].original_vertex)]);
|
||||
=======
|
||||
if (boundary->edit_info[i].num_propagation_steps == BOUNDARY_STEPS_NONE) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
copy_v3_v3(boundary->slide.directions[i],
|
||||
boundary->slide.directions[boundary->edit_info[i].original_vertex]);
|
||||
boundary->slide.directions[boundary->edit_info[i].original_vertex_i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -817,35 +714,14 @@ static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata,
|
|||
continue;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[vd.index].num_propagation_steps != -1) {
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(
|
||||
ss->cache->automasking, ss, vd.vertex);
|
||||
float t_orig_co[3];
|
||||
const int index = vd.index;
|
||||
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
sub_v3_v3v3(t_orig_co, orig_data.co, boundary->bend.pivot_positions[index]);
|
||||
rotate_v3_v3v3fl(target_co,
|
||||
t_orig_co,
|
||||
boundary->bend.pivot_rotation_axis[vd.index],
|
||||
angle * boundary->edit_info[vd.index].strength_factor * mask * automask);
|
||||
add_v3_v3(target_co, boundary->bend.pivot_positions[vd.index]);
|
||||
}
|
||||
=======
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (!SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.index);
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.vertex);
|
||||
float t_orig_co[3];
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
sub_v3_v3v3(t_orig_co, orig_data.co, boundary->bend.pivot_positions[vd.index]);
|
||||
|
@ -887,31 +763,14 @@ static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata,
|
|||
continue;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[vd.index].num_propagation_steps != -1) {
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(
|
||||
ss->cache->automasking, ss, vd.vertex);
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
madd_v3_v3v3fl(target_co,
|
||||
orig_data.co,
|
||||
boundary->slide.directions[vd.index],
|
||||
boundary->edit_info[vd.index].strength_factor * disp * mask * automask *
|
||||
strength);
|
||||
}
|
||||
=======
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (!SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.index);
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.vertex);
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
madd_v3_v3v3fl(target_co,
|
||||
orig_data.co,
|
||||
|
@ -998,30 +857,14 @@ static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata,
|
|||
continue;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[vd.index].num_propagation_steps != -1) {
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(
|
||||
ss->cache->automasking, ss, vd.vertex);
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
madd_v3_v3v3fl(target_co,
|
||||
orig_data.co,
|
||||
ss->cache->grab_delta_symmetry,
|
||||
boundary->edit_info[vd.index].strength_factor * mask * automask * strength);
|
||||
}
|
||||
=======
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (!SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.index);
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.vertex);
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
madd_v3_v3v3fl(target_co,
|
||||
orig_data.co,
|
||||
|
@ -1066,33 +909,14 @@ static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata,
|
|||
continue;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (boundary->edit_info[vd.index].num_propagation_steps != -1) {
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(
|
||||
ss->cache->automasking, ss, vd.vertex);
|
||||
float t_orig_co[3];
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
sub_v3_v3v3(t_orig_co, orig_data.co, boundary->twist.pivot_position);
|
||||
rotate_v3_v3v3fl(target_co,
|
||||
t_orig_co,
|
||||
boundary->twist.rotation_axis,
|
||||
angle * mask * automask * boundary->edit_info[vd.index].strength_factor);
|
||||
add_v3_v3(target_co, boundary->twist.pivot_position);
|
||||
}
|
||||
=======
|
||||
SCULPT_orig_vert_data_update(&orig_data, &vd);
|
||||
if (!SCULPT_check_vertex_pivot_symmetry(
|
||||
orig_data.co, boundary->initial_vertex_position, symm)) {
|
||||
continue;
|
||||
>>>>>>> master
|
||||
}
|
||||
|
||||
const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f;
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.index);
|
||||
const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.vertex);
|
||||
float t_orig_co[3];
|
||||
float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd);
|
||||
sub_v3_v3v3(t_orig_co, orig_data.co, boundary->twist.pivot_position);
|
||||
|
|
|
@ -831,6 +831,8 @@ typedef struct {
|
|||
bool original;
|
||||
/* This ignores fully masked and fully hidden nodes. */
|
||||
bool ignore_fully_ineffective;
|
||||
struct Object *ob;
|
||||
struct Brush *brush;
|
||||
} SculptSearchSphereData;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in New Issue