Fix T47081: laplacian smooth edit mode tool crash.
This commit is contained in:
parent
f5c978074c
commit
cf2005d942
Notes:
blender-bot
2023-02-14 08:20:34 +01:00
Referenced by issue #47081, Crash with Laplacian Smooth (W - key in edit mode)
|
@ -156,6 +156,14 @@ void EIG_linear_solver_variable_lock(LinearSolver *solver, int index)
|
|||
}
|
||||
}
|
||||
|
||||
void EIG_linear_solver_variable_unlock(LinearSolver *solver, int index)
|
||||
{
|
||||
if (solver->variable[index].locked) {
|
||||
assert(solver->state == LinearSolver::STATE_VARIABLES_CONSTRUCT);
|
||||
solver->variable[index].locked = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void linear_solver_variables_to_vector(LinearSolver *solver)
|
||||
{
|
||||
int num_rhs = solver->num_rhs;
|
||||
|
@ -269,6 +277,10 @@ void EIG_linear_solver_right_hand_side_add(LinearSolver *solver, int rhs, int in
|
|||
|
||||
bool EIG_linear_solver_solve(LinearSolver *solver)
|
||||
{
|
||||
/* nothing to solve, perhaps all variables were locked */
|
||||
if (solver->m == 0 || solver->n == 0)
|
||||
return true;
|
||||
|
||||
bool result = true;
|
||||
|
||||
assert(solver->state != LinearSolver::STATE_VARIABLES_CONSTRUCT);
|
||||
|
|
|
@ -51,6 +51,7 @@ void EIG_linear_solver_delete(LinearSolver *solver);
|
|||
void EIG_linear_solver_variable_set(LinearSolver *solver, int rhs, int index, double value);
|
||||
double EIG_linear_solver_variable_get(LinearSolver *solver, int rhs, int index);
|
||||
void EIG_linear_solver_variable_lock(LinearSolver *solver, int index);
|
||||
void EIG_linear_solver_variable_unlock(LinearSolver *solver, int index);
|
||||
|
||||
/* Matrix (A) and right hand side (b) */
|
||||
|
||||
|
|
|
@ -505,6 +505,7 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op)
|
|||
}
|
||||
BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
|
||||
m_vertex_id = BM_elem_index_get(v);
|
||||
EIG_linear_solver_variable_unlock(sys->context, m_vertex_id);
|
||||
EIG_linear_solver_variable_set(sys->context, 0, m_vertex_id, v->co[0]);
|
||||
EIG_linear_solver_variable_set(sys->context, 1, m_vertex_id, v->co[1]);
|
||||
EIG_linear_solver_variable_set(sys->context, 2, m_vertex_id, v->co[2]);
|
||||
|
|
Loading…
Reference in New Issue