[Bf-blender-cvs] [533e267e95c] master: Remove Sticky option from the Floor constraint

Sergey Sharybin noreply at git.blender.org
Fri Jun 28 15:03:56 CEST 2019


Commit: 533e267e95cf1115eebde95a67dc3b05d48e6ffd
Author: Sergey Sharybin
Date:   Fri Jun 28 14:59:50 2019 +0200
Branches: master
https://developer.blender.org/rB533e267e95cf1115eebde95a67dc3b05d48e6ffd

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

===================================================================

M	release/scripts/startup/bl_ui/properties_constraint.py
M	source/blender/blenkernel/intern/constraint.c
M	source/blender/blenloader/intern/versioning_legacy.c
M	source/blender/makesdna/DNA_constraint_types.h
M	source/blender/makesrna/intern/rna_constraint.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_constraint.py b/release/scripts/startup/bl_ui/properties_constraint.py
index 888a3a856e6..6fa953574cb 100644
--- a/release/scripts/startup/bl_ui/properties_constraint.py
+++ b/release/scripts/startup/bl_ui/properties_constraint.py
@@ -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()
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index 5766e84f960..793dc910394 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -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;
-    }
   }
 }
 
diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c
index df26ca37826..69802b35ff9 100644
--- a/source/blender/blenloader/intern/versioning_legacy.c
+++ b/source/blender/blenloader/intern/versioning_legacy.c
@@ -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)) {
diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h
index 396030445f3..b613c661f29 100644
--- a/source/blender/makesdna/DNA_constraint_types.h
+++ b/source/blender/makesdna/DNA_constraint_types.h
@@ -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;
 
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 1724bf1652b..6e57d16df27 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -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");



More information about the Bf-blender-cvs mailing list