[Bf-blender-cvs] [624e93bbef8] master: B-Bones: split the Scale In/Out properties into X and Y values.

Alexander Gavrilov noreply at git.blender.org
Tue Apr 23 12:45:16 CEST 2019


Commit: 624e93bbef8a8a34be822c1a98df131439c32788
Author: Alexander Gavrilov
Date:   Sat Apr 20 18:06:31 2019 +0300
Branches: master
https://developer.blender.org/rB624e93bbef8a8a34be822c1a98df131439c32788

B-Bones: split the Scale In/Out properties into X and Y values.

As far as I can tell, there is no technical reason why the B-Bone
segment thickness scaling can't be separated into two axes. The
only downside is the increase in complexity of the B-Bone settings,
but this is inevitable due to the increase in flexibility.

Updating the file is somewhat complicated though, because F-Curves
and drivers have to be duplicated and updated to the new names.

Reviewers: campbellbarton

Subscribers: icappiello, jpbouza

Differential Revision: https://developer.blender.org/D4716

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

M	release/scripts/startup/bl_ui/properties_data_bone.py
M	source/blender/blenkernel/BKE_armature.h
M	source/blender/blenkernel/intern/action.c
M	source/blender/blenkernel/intern/armature.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/draw/intern/draw_armature.c
M	source/blender/editors/armature/armature_add.c
M	source/blender/editors/armature/armature_intern.h
M	source/blender/editors/armature/armature_utils.c
M	source/blender/editors/armature/pose_transform.c
M	source/blender/editors/armature/pose_utils.c
M	source/blender/editors/include/ED_armature.h
M	source/blender/makesdna/DNA_action_types.h
M	source/blender/makesdna/DNA_armature_types.h
M	source/blender/makesdna/intern/dna_rename_defs.h
M	source/blender/makesrna/intern/rna_armature.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py
index 0af51ddd5ba..707b1ca3f1a 100644
--- a/release/scripts/startup/bl_ui/properties_data_bone.py
+++ b/release/scripts/startup/bl_ui/properties_data_bone.py
@@ -160,8 +160,12 @@ class BONE_PT_curved(BoneButtonsPanel, Panel):
         col.prop(bone, "use_endroll_as_inroll")
 
         col = topcol.column(align=True)
-        col.prop(bbone, "bbone_scalein", text="Scale In")
-        col.prop(bbone, "bbone_scaleout", text="Out")
+        col.prop(bbone, "bbone_scaleinx", text="Scale In X")
+        col.prop(bbone, "bbone_scaleiny", text="In Y")
+
+        col = topcol.column(align=True)
+        col.prop(bbone, "bbone_scaleoutx", text="Scale Out X")
+        col.prop(bbone, "bbone_scaleouty", text="Out Y")
 
         col = topcol.column(align=True)
         col.prop(bbone, "bbone_easein", text="Ease In")
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index e171eec023f..366fdc0ce45 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -207,7 +207,7 @@ typedef struct BBoneSplineParameters {
   /* Control values. */
   float ease1, ease2;
   float roll1, roll2;
-  float scaleIn, scaleOut;
+  float scale_in_x, scale_in_y, scale_out_x, scale_out_y;
   float curveInX, curveInY, curveOutX, curveOutY;
 } BBoneSplineParameters;
 
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 9ae8d27b27f..59e279d8054 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -458,7 +458,8 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
   unit_axis_angle(chan->rotAxis, &chan->rotAngle);
   chan->size[0] = chan->size[1] = chan->size[2] = 1.0f;
 
-  chan->scaleIn = chan->scaleOut = 1.0f;
+  chan->scale_in_x = chan->scale_in_y = 1.0f;
+  chan->scale_out_x = chan->scale_out_y = 1.0f;
 
   chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -M_PI;
   chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = M_PI;
@@ -1410,7 +1411,8 @@ void BKE_pose_rest(bPose *pose)
     pchan->curveInX = pchan->curveInY = 0.0f;
     pchan->curveOutX = pchan->curveOutY = 0.0f;
     pchan->ease1 = pchan->ease2 = 0.0f;
-    pchan->scaleIn = pchan->scaleOut = 1.0f;
+    pchan->scale_in_x = pchan->scale_in_y = 1.0f;
+    pchan->scale_out_x = pchan->scale_out_y = 1.0f;
 
     pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE);
   }
@@ -1438,8 +1440,10 @@ void BKE_pose_copyesult_pchan_result(bPoseChannel *pchanto, const bPoseChannel *
   pchanto->curveOutY = pchanfrom->curveOutY;
   pchanto->ease1 = pchanfrom->ease1;
   pchanto->ease2 = pchanfrom->ease2;
-  pchanto->scaleIn = pchanfrom->scaleIn;
-  pchanto->scaleOut = pchanfrom->scaleOut;
+  pchanto->scale_in_x = pchanfrom->scale_in_x;
+  pchanto->scale_in_y = pchanfrom->scale_in_y;
+  pchanto->scale_out_x = pchanfrom->scale_out_x;
+  pchanto->scale_out_y = pchanfrom->scale_out_y;
 
   pchanto->rotmode = pchanfrom->rotmode;
   pchanto->flag = pchanfrom->flag;
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index b726ea6c20d..3dd655ee9a8 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -680,8 +680,10 @@ void BKE_pchan_bbone_spline_params_get(struct bPoseChannel *pchan,
       }
     }
 
-    param->scaleIn = bone->scaleIn * (!rest ? pchan->scaleIn : 1.0f);
-    param->scaleOut = bone->scaleOut * (!rest ? pchan->scaleOut : 1.0f);
+    param->scale_in_x = bone->scale_in_x * (!rest ? pchan->scale_in_x : 1.0f);
+    param->scale_in_y = bone->scale_in_y * (!rest ? pchan->scale_in_y : 1.0f);
+    param->scale_out_x = bone->scale_out_x * (!rest ? pchan->scale_out_x : 1.0f);
+    param->scale_out_y = bone->scale_out_y * (!rest ? pchan->scale_out_y : 1.0f);
 
     /* Extra curve x / y */
     param->curveInX = bone->curveInX + (!rest ? pchan->curveInX : 0.0f);
@@ -827,7 +829,8 @@ static void make_bbone_spline_matrix(BBoneSplineParameters *param,
                                      float pos[3],
                                      float axis[3],
                                      float roll,
-                                     float scalefac,
+                                     float scalex,
+                                     float scaley,
                                      float result[4][4])
 {
   float mat3[3][3];
@@ -843,8 +846,8 @@ static void make_bbone_spline_matrix(BBoneSplineParameters *param,
   }
 
   /* BBone scale... */
-  mul_v3_fl(result[0], scalefac);
-  mul_v3_fl(result[2], scalefac);
+  mul_v3_fl(result[0], scalex);
+  mul_v3_fl(result[2], scaley);
 }
 
 /* Fade from first to second derivative when the handle is very short. */
@@ -908,17 +911,25 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param,
 
     /* End points require special handling to fix zero length handles. */
     ease_handle_axis(bezt_deriv1[0], bezt_deriv2[0], axis);
-    make_bbone_spline_matrix(
-        param, scalemats, bezt_controls[0], axis, roll1, param->scaleIn, result_array[0].mat);
+    make_bbone_spline_matrix(param,
+                             scalemats,
+                             bezt_controls[0],
+                             axis,
+                             roll1,
+                             param->scale_in_x,
+                             param->scale_in_y,
+                             result_array[0].mat);
 
     for (int a = 1; a < param->segments; a++) {
       evaluate_cubic_bezier(bezt_controls, bezt_points[a], cur, axis);
 
       float fac = ((float)a) / param->segments;
       float roll = interpf(roll2, roll1, fac);
-      float scalefac = interpf(param->scaleOut, param->scaleIn, fac);
+      float scalex = interpf(param->scale_out_x, param->scale_in_x, fac);
+      float scaley = interpf(param->scale_out_y, param->scale_in_y, fac);
 
-      make_bbone_spline_matrix(param, scalemats, cur, axis, roll, scalefac, result_array[a].mat);
+      make_bbone_spline_matrix(
+          param, scalemats, cur, axis, roll, scalex, scaley, result_array[a].mat);
     }
 
     negate_v3(bezt_deriv2[1]);
@@ -928,7 +939,8 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param,
                              bezt_controls[3],
                              axis,
                              roll2,
-                             param->scaleOut,
+                             param->scale_out_x,
+                             param->scale_out_y,
                              result_array[param->segments].mat);
   }
   /* Other code (e.g. display) uses matrices for the segments themselves. */
@@ -942,9 +954,11 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param,
 
       float fac = (a + 0.5f) / param->segments;
       float roll = interpf(roll2, roll1, fac);
-      float scalefac = interpf(param->scaleOut, param->scaleIn, fac);
+      float scalex = interpf(param->scale_out_x, param->scale_in_x, fac);
+      float scaley = interpf(param->scale_out_y, param->scale_in_y, fac);
 
-      make_bbone_spline_matrix(param, scalemats, prev, axis, roll, scalefac, result_array[a].mat);
+      make_bbone_spline_matrix(
+          param, scalemats, prev, axis, roll, scalex, scaley, result_array[a].mat);
       copy_v3_v3(prev, cur);
     }
   }
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index bd405bd6410..20b2bfd95c8 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -256,8 +256,8 @@ static void do_version_action_editor_properties_region(ListBase *regionbase)
 static void do_version_bones_super_bbone(ListBase *lb)
 {
   for (Bone *bone = lb->first; bone; bone = bone->next) {
-    bone->scaleIn = 1.0f;
-    bone->scaleOut = 1.0f;
+    bone->scale_in_x = bone->scale_in_y = 1.0f;
+    bone->scale_out_x = bone->scale_out_y = 1.0f;
 
     do_version_bones_super_bbone(&bone->childbase);
   }
@@ -1338,8 +1338,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain)
         if (ob->pose) {
           for (bPoseChannel *pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
             /* see do_version_bones_super_bbone()... */
-            pchan->scaleIn = 1.0f;
-            pchan->scaleOut = 1.0f;
+            pchan->scale_in_x = pchan->scale_in_y = 1.0f;
+            pchan->scale_out_x = pchan->scale_out_y = 1.0f;
 
             /* also make sure some legacy (unused for over a decade) flags are unset,
              * so that we can reuse them for stuff that matters now...
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index fbe0f70527b..73109cd9a6b 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -30,6 +30,7 @@
 #include "BLI_string.h"
 #include "BLI_utildefines.h"
 
+#include "DNA_anim_types.h"
 #include "DNA_object_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_cloth_types.h"
@@ -56,11 +57,13 @@
 #include "DNA_text_types.h"
 
 #include "BKE_action.h"
+#include "BKE_animsys.h"
 #include "BKE_cloth.h"
 #include "BKE_collection.h"
 #include "BKE_constraint.h"
 #include "BKE_colortools.h"
 #include "BKE_customdata.h"
+#include "BKE_fcurve.h"
 #include "BKE_freestyle.h"
 #include "BKE_gpencil.h"
 #include "BKE_idprop.h"
@@ -621,6 +624,74 @@ static ARegion *do_versions_add_region(int regiontype, const char *name)
   return ar;
 }
 
+static void do_version_bones_split_bbone_scale(ListBase *lb)
+{
+  for (Bone *bone = lb->first; bone; bone = bone->next) {
+    bone->scale_in_y = bone->scale_in_x;
+    bone->scale_out_y = bone->scale_out_x;
+
+    do_version_bones_split_bbone_scale(&bone->childbase);
+  }
+}
+
+static bool replace_bbone_scale_rnapath(char **p_old_path)
+{
+  char *old_path = *p_old_path;
+
+  if (old_path == NULL) {
+    return false;
+  }
+
+  if (BLI_str_endswith(old_path, "bbone_scalein") ||
+      BLI_str_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list