Remove Sticky option from the Floor constraint
This option from the very beginning of its existence needed more work to make it work correct and this was never done. This option was working fine during continuous playback, when there are no skipped frames, but it was failing when AV-sync of framedrop was enabled. It was never working correct when jumping between frames, including rendering on a farm which usually does frame-range based rendering. With copy-on-write things became even more tricky, since the "stuck" flag was never preserved between re-evaluations. Fixes T65683: Sticky Option in Floor Constraint for Bones Not Working
This commit is contained in:
@@ -548,10 +548,7 @@ class ConstraintButtonsPanel:
|
||||
def FLOOR(self, _context, layout, con):
|
||||
self.target_template(layout, con)
|
||||
|
||||
row = layout.row()
|
||||
row.prop(con, "use_sticky")
|
||||
row.prop(con, "use_rotation")
|
||||
|
||||
layout.prop(con, "use_rotation")
|
||||
layout.prop(con, "offset")
|
||||
|
||||
row = layout.row()
|
||||
|
||||
@@ -3329,7 +3329,6 @@ static void minmax_new_data(void *cdata)
|
||||
|
||||
data->minmaxflag = TRACK_Z;
|
||||
data->offset = 0.0f;
|
||||
zero_v3(data->cache);
|
||||
data->flag = 0;
|
||||
}
|
||||
|
||||
@@ -3426,15 +3425,6 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
|
||||
|
||||
if (val1 > val2) {
|
||||
obmat[3][index] = tarmat[3][index] + data->offset;
|
||||
if (data->flag & MINMAX_STICKY) {
|
||||
if (data->flag & MINMAX_STUCK) {
|
||||
copy_v3_v3(obmat[3], data->cache);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(data->cache, obmat[3]);
|
||||
data->flag |= MINMAX_STUCK;
|
||||
}
|
||||
}
|
||||
if (data->flag & MINMAX_USEROT) {
|
||||
/* get out of localspace */
|
||||
mul_m4_m4m4(tmat, ct->matrix, obmat);
|
||||
@@ -3444,9 +3434,6 @@ static void minmax_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
|
||||
copy_v3_v3(cob->matrix[3], obmat[3]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
data->flag &= ~MINMAX_STUCK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1738,17 +1738,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
bConstraint *curcon;
|
||||
for (curcon = list->first; curcon; curcon = curcon->next) {
|
||||
switch (curcon->type) {
|
||||
case CONSTRAINT_TYPE_MINMAX: {
|
||||
bMinMaxConstraint *data = curcon->data;
|
||||
if (data->sticky == 1) {
|
||||
data->flag |= MINMAX_STICKY;
|
||||
}
|
||||
else {
|
||||
data->flag &= ~MINMAX_STICKY;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case CONSTRAINT_TYPE_ROTLIKE: {
|
||||
bRotateLikeConstraint *data = curcon->data;
|
||||
|
||||
@@ -1770,16 +1759,6 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
|
||||
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
|
||||
for (curcon = pchan->constraints.first; curcon; curcon = curcon->next) {
|
||||
switch (curcon->type) {
|
||||
case CONSTRAINT_TYPE_MINMAX: {
|
||||
bMinMaxConstraint *data = curcon->data;
|
||||
if (data->sticky == 1) {
|
||||
data->flag |= MINMAX_STICKY;
|
||||
}
|
||||
else {
|
||||
data->flag &= ~MINMAX_STICKY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONSTRAINT_TYPE_KINEMATIC: {
|
||||
bKinematicConstraint *data = curcon->data;
|
||||
if (!(data->flag & CONSTRAINT_IK_POS)) {
|
||||
|
||||
@@ -315,12 +315,9 @@ typedef struct bMinMaxConstraint {
|
||||
int minmaxflag;
|
||||
float offset;
|
||||
int flag;
|
||||
/** For backward compatibility. */
|
||||
short sticky, stuck;
|
||||
char _pad[4];
|
||||
float cache[3];
|
||||
/** MAX_ID_NAME-2. */
|
||||
char subtarget[64];
|
||||
int _pad;
|
||||
} bMinMaxConstraint;
|
||||
|
||||
/* Action Constraint */
|
||||
@@ -945,8 +942,8 @@ typedef enum eArmature_Flags {
|
||||
|
||||
/* MinMax (floor) flags */
|
||||
typedef enum eFloor_Flags {
|
||||
MINMAX_STICKY = (1 << 0),
|
||||
MINMAX_STUCK = (1 << 1),
|
||||
/* MINMAX_STICKY = (1 << 0), */ /* Deprecated. */
|
||||
/* MINMAX_STUCK = (1 << 1), */ /* Deprecated. */
|
||||
MINMAX_USEROT = (1 << 2),
|
||||
} eFloor_Flags;
|
||||
|
||||
|
||||
@@ -1483,11 +1483,6 @@ static void rna_def_constraint_minmax(BlenderRNA *brna)
|
||||
prop, "Floor Location", "Location of target that object will not pass through");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY);
|
||||
RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained");
|
||||
RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
|
||||
|
||||
prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
|
||||
RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
|
||||
|
||||
Reference in New Issue
Block a user