[Bf-blender-cvs] [fdc6fb2c538] temp_bmesh_multires: SCULPT_calc_principle_curvatures now has option to use slower but more accurate BLI_eigen_solve_selfadjoint_m3 solver.
Joseph Eagar
noreply at git.blender.org
Sun Apr 18 05:28:48 CEST 2021
Commit: fdc6fb2c5389ab4eac1efcc3d25bd1e8a22563cc
Author: Joseph Eagar
Date: Sat Apr 17 20:25:51 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBfdc6fb2c5389ab4eac1efcc3d25bd1e8a22563cc
SCULPT_calc_principle_curvatures now has option to use
slower but more accurate BLI_eigen_solve_selfadjoint_m3 solver.
===================================================================
M source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
M source/blender/editors/sculpt_paint/sculpt.c
M source/blender/editors/sculpt_paint/sculpt_curvature.c
M source/blender/editors/sculpt_paint/sculpt_intern.h
===================================================================
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
index dbc8bbd31fa..68f571a50c0 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc
@@ -140,7 +140,7 @@ bool schedule_non_checked_node(CyclesSolverState *state)
return false;
}
-bool check_relation_can_murder(Relation *relation)
+bool check_relation_can_murder(Relation *relation)
{
if (relation->flag & RELATION_FLAG_GODMODE) {
return false;
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 511776c4e67..87e326fbf18 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3353,7 +3353,7 @@ static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
// const bool update_curvature = node->flag & PBVH_UpdateCurvatureDir;
const bool update_curvature = BKE_pbvh_curvature_update_get(node);
- SCULPT_curvature_begin(ss, node);
+ SCULPT_curvature_begin(ss, node, false);
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) {
@@ -3371,7 +3371,7 @@ static void do_topology_rake_bmesh_task_cb_ex(void *__restrict userdata,
float avg[3], val[3];
if (use_curvature) {
- SCULPT_curvature_dir_get(ss, vd.vertex, direction2);
+ SCULPT_curvature_dir_get(ss, vd.vertex, direction2, false);
// SculptCurvatureData cdata;
// SCULPT_calc_principle_curvatures(ss, vd.vertex, &cdata);
// copy_v3_v3(direction2, cdata.principle[0]);
@@ -9757,6 +9757,10 @@ void SCULPT_connected_components_ensure(Object *ob)
for (int i = 0; i < totvert; i++) {
SculptVertRef vertex = BKE_pbvh_table_index_to_vertex(ss->pbvh, i);
+ if (!SCULPT_vertex_visible_get(ss, vertex)) {
+ continue;
+ }
+
if (ss->vertex_info.connected_component[i] == SCULPT_TOPOLOGY_ID_NONE) {
SculptFloodFill flood;
SCULPT_floodfill_init(ss, &flood);
diff --git a/source/blender/editors/sculpt_paint/sculpt_curvature.c b/source/blender/editors/sculpt_paint/sculpt_curvature.c
index 411994d4da1..a23afb93407 100644
--- a/source/blender/editors/sculpt_paint/sculpt_curvature.c
+++ b/source/blender/editors/sculpt_paint/sculpt_curvature.c
@@ -31,6 +31,7 @@
#include "BLI_hash.h"
#include "BLI_math.h"
#include "BLI_math_color_blend.h"
+#include "BLI_math_solvers.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
@@ -138,7 +139,8 @@ BLI_INLINE void normal_covariance(float mat[3][3], float no[3])
bool SCULPT_calc_principle_curvatures(SculptSession *ss,
SculptVertRef vertex,
- SculptCurvatureData *out)
+ SculptCurvatureData *out,
+ bool useAccurateSolver)
{
SculptVertexNeighborIter ni;
float nmat[3][3], nmat2[3][3];
@@ -159,7 +161,7 @@ bool SCULPT_calc_principle_curvatures(SculptSession *ss,
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
- if (true || !BLI_eigen_solve_selfadjoint_m3(nmat, out->ks, out->principle)) {
+ if (!useAccurateSolver || !BLI_eigen_solve_selfadjoint_m3(nmat, out->ks, out->principle)) {
// do simple power solve in one direction
float t[3];
@@ -192,11 +194,14 @@ bool SCULPT_calc_principle_curvatures(SculptSession *ss,
return true;
}
-void SCULPT_curvature_dir_get(SculptSession *ss, SculptVertRef v, float dir[3])
+void SCULPT_curvature_dir_get(SculptSession *ss,
+ SculptVertRef v,
+ float dir[3],
+ bool useAccurateSolver)
{
if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) {
SculptCurvatureData curv;
- SCULPT_calc_principle_curvatures(ss, v, &curv);
+ SCULPT_calc_principle_curvatures(ss, v, &curv, useAccurateSolver);
copy_v3_v3(dir, curv.principle[0]);
return;
@@ -208,7 +213,7 @@ void SCULPT_curvature_dir_get(SculptSession *ss, SculptVertRef v, float dir[3])
copy_v3_v3(dir, mv->curvature_dir);
}
-void SCULPT_curvature_begin(SculptSession *ss, struct PBVHNode *node)
+void SCULPT_curvature_begin(SculptSession *ss, struct PBVHNode *node, bool useAccurateSolver)
{
if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) {
// caching only happens for bmesh for now
@@ -225,7 +230,7 @@ void SCULPT_curvature_begin(SculptSession *ss, struct PBVHNode *node)
MDynTopoVert *mv = BKE_PBVH_DYNVERT(ss->cd_dyn_vert, v);
SculptCurvatureData curv;
- SCULPT_calc_principle_curvatures(ss, vi.vertex, &curv);
+ SCULPT_calc_principle_curvatures(ss, vi.vertex, &curv, useAccurateSolver);
copy_v3_v3(mv->curvature_dir, curv.principle[0]);
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 5fbb7f2884f..cb96d926161 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -1435,12 +1435,21 @@ typedef struct SculptCurvatureData {
float principle[3][3]; // normalized
} SculptCurvatureData;
+/*
+If useAccurateSolver is false, a faster but less accurate
+power solver will be used. If true then BLI_eigen_solve_selfadjoint_m3
+will be called.
+*/
bool SCULPT_calc_principle_curvatures(SculptSession *ss,
SculptVertRef vertex,
- SculptCurvatureData *out);
-
-void SCULPT_curvature_begin(SculptSession *ss, struct PBVHNode *node);
-void SCULPT_curvature_dir_get(SculptSession *ss, SculptVertRef v, float dir[3]);
+ SculptCurvatureData *out,
+ bool useAccurateSolver);
+
+void SCULPT_curvature_begin(SculptSession *ss, struct PBVHNode *node, bool useAccurateSolver);
+void SCULPT_curvature_dir_get(SculptSession *ss,
+ SculptVertRef v,
+ float dir[3],
+ bool useAccurateSolver);
/*
Ensure a named temporary layer exists, creating it if necassary.
More information about the Bf-blender-cvs
mailing list