Fix T103783: crash when canceling vertex crease having vertex groups
`transdata_restore_basic` uses `copy_v3_v3` to restore a pointer that is 1D.
This commit is contained in:
@@ -49,8 +49,8 @@ static void tc_mesh_cdata_transdata_create(TransDataBasic *td,
|
|||||||
{
|
{
|
||||||
BLI_assert(BM_elem_flag_test(eve, BM_ELEM_HIDDEN) == 0);
|
BLI_assert(BM_elem_flag_test(eve, BM_ELEM_HIDDEN) == 0);
|
||||||
|
|
||||||
td->loc = weight;
|
td->val = weight;
|
||||||
td->iloc[0] = *weight;
|
td->ival = *weight;
|
||||||
|
|
||||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||||
td->flag |= TD_SELECTED;
|
td->flag |= TD_SELECTED;
|
||||||
@@ -268,7 +268,7 @@ static void tc_mesh_cdata_apply_to_mirror(TransInfo *t)
|
|||||||
if (tc->use_mirror_axis_any) {
|
if (tc->use_mirror_axis_any) {
|
||||||
TransDataMirror *td_mirror = tc->data_mirror;
|
TransDataMirror *td_mirror = tc->data_mirror;
|
||||||
for (int i = 0; i < tc->data_mirror_len; i++, td_mirror++) {
|
for (int i = 0; i < tc->data_mirror_len; i++, td_mirror++) {
|
||||||
td_mirror->loc[0] = td_mirror->loc_src[0];
|
*td_mirror->val = td_mirror->loc_src[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ struct bConstraint;
|
|||||||
float iloc[3]; \
|
float iloc[3]; \
|
||||||
/** Individual data center. */ \
|
/** Individual data center. */ \
|
||||||
float center[3]; \
|
float center[3]; \
|
||||||
|
/** Value pointer for special transforms. */ \
|
||||||
|
float *val; \
|
||||||
|
/** Old value. */ \
|
||||||
|
float ival; \
|
||||||
/** Various flags. */ \
|
/** Various flags. */ \
|
||||||
int flag
|
int flag
|
||||||
|
|
||||||
@@ -114,10 +118,6 @@ typedef struct TransData {
|
|||||||
float rdist;
|
float rdist;
|
||||||
/** Factor of the transformation (for Proportional Editing). */
|
/** Factor of the transformation (for Proportional Editing). */
|
||||||
float factor;
|
float factor;
|
||||||
/** Value pointer for special transforms. */
|
|
||||||
float *val;
|
|
||||||
/** Old value. */
|
|
||||||
float ival;
|
|
||||||
/** Transformation matrix from data space to global space. */
|
/** Transformation matrix from data space to global space. */
|
||||||
float mtx[3][3];
|
float mtx[3][3];
|
||||||
/** Transformation matrix from global space to data space. */
|
/** Transformation matrix from global space to data space. */
|
||||||
|
|||||||
@@ -815,16 +815,16 @@ static void transdata_restore_basic(TransDataBasic *td_basic)
|
|||||||
if (td_basic->loc) {
|
if (td_basic->loc) {
|
||||||
copy_v3_v3(td_basic->loc, td_basic->iloc);
|
copy_v3_v3(td_basic->loc, td_basic->iloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (td_basic->val && td_basic->val != td_basic->loc) {
|
||||||
|
*td_basic->val = td_basic->ival;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void restoreElement(TransData *td)
|
static void restoreElement(TransData *td)
|
||||||
{
|
{
|
||||||
transdata_restore_basic((TransDataBasic *)td);
|
transdata_restore_basic((TransDataBasic *)td);
|
||||||
|
|
||||||
if (td->val && td->val != td->loc) {
|
|
||||||
*td->val = td->ival;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (td->ext && (td->flag & TD_NO_EXT) == 0) {
|
if (td->ext && (td->flag & TD_NO_EXT) == 0) {
|
||||||
if (td->ext->rot) {
|
if (td->ext->rot) {
|
||||||
copy_v3_v3(td->ext->rot, td->ext->irot);
|
copy_v3_v3(td->ext->rot, td->ext->irot);
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ static void transdata_elem_bevel_weight(const TransInfo *UNUSED(t),
|
|||||||
TransData *td,
|
TransData *td,
|
||||||
const float weight)
|
const float weight)
|
||||||
{
|
{
|
||||||
if (td->loc == NULL) {
|
if (td->val == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*td->loc = td->iloc[0] + weight * td->factor;
|
*td->val = td->ival + weight * td->factor;
|
||||||
CLAMP(*td->loc, 0.0f, 1.0f);
|
CLAMP(*td->val, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transdata_elem_bevel_weight_fn(void *__restrict iter_data_v,
|
static void transdata_elem_bevel_weight_fn(void *__restrict iter_data_v,
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ static void transdata_elem_crease(const TransInfo *UNUSED(t),
|
|||||||
TransData *td,
|
TransData *td,
|
||||||
const float crease)
|
const float crease)
|
||||||
{
|
{
|
||||||
if (td->loc == NULL) {
|
if (td->val == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
*td->loc = td->iloc[0] + crease * td->factor;
|
*td->val = td->ival + crease * td->factor;
|
||||||
CLAMP(*td->loc, 0.0f, 1.0f);
|
CLAMP(*td->val, 0.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transdata_elem_crease_fn(void *__restrict iter_data_v,
|
static void transdata_elem_crease_fn(void *__restrict iter_data_v,
|
||||||
|
|||||||
Reference in New Issue
Block a user