Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-08-05 18:48:05 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-10-04 19:55:44 +0300
commit61a24c799b2882c22a43591138a113d7f09be0ed (patch)
treeea85047e68ff64bf7e25329a7e7048f1b9dbfeb1 /source/blender/blenkernel
parent6932eaa2bcaff0649c82f6b31a205319c966bd15 (diff)
Move B-Bone custom handle settings to Edit mode.
Custom handle settings actually affect the B-Bone rest shape, so they should be changed in Edit mode rather than Pose mode. This is necessary to be able to display the correct rest shape of the bone in Edit Mode. Also, instead of flags, introduce an enum to specify the handle operation modes, so that new ones could be added later. Differential Revision: https://developer.blender.org/D3588
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_blender_version.h2
-rw-r--r--source/blender/blenkernel/intern/action.c2
-rw-r--r--source/blender/blenkernel/intern/armature.c50
3 files changed, 37 insertions, 17 deletions
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 7ac59d6c9d4..84451fe31d4 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 280
-#define BLENDER_SUBVERSION 24
+#define BLENDER_SUBVERSION 25
/* Several breakages with 280, e.g. collections vs layers */
#define BLENDER_MINVERSION 280
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 9c407d27c29..68029ea72f6 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -887,7 +887,6 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
pchan->iklinweight = pchan_from->iklinweight;
/* bbone settings (typically not animated) */
- pchan->bboneflag = pchan_from->bboneflag;
pchan->bbone_next = pchan_from->bbone_next;
pchan->bbone_prev = pchan_from->bbone_prev;
@@ -1356,7 +1355,6 @@ void BKE_pose_copyesult_pchan_result(bPoseChannel *pchanto, const bPoseChannel *
pchanto->rotmode = pchanfrom->rotmode;
pchanto->flag = pchanfrom->flag;
pchanto->protectflag = pchanfrom->protectflag;
- pchanto->bboneflag = pchanfrom->bboneflag;
}
/* both poses should be in sync */
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index e2a41f46e69..61472068399 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -433,23 +433,31 @@ void equalize_bbone_bezier(float *data, int desired)
copy_qt_qt(fp, temp[MAX_BBONE_SUBDIV]);
}
-/* get "next" and "prev" bones - these are used for handle calculations */
+/* Get "next" and "prev" bones - these are used for handle calculations. */
void BKE_pchan_get_bbone_handles(bPoseChannel *pchan, bPoseChannel **r_prev, bPoseChannel **r_next)
{
- if (pchan->bboneflag & PCHAN_BBONE_CUSTOM_HANDLES) {
- /* use the provided bones as the next/prev - leave blank to eliminate this effect altogether */
- *r_prev = pchan->bbone_prev;
- *r_next = pchan->bbone_next;
- }
- else {
- /* evaluate next and prev bones */
- if (pchan->bone->flag & BONE_CONNECTED)
+ if (pchan->bone->bbone_prev_type == BBONE_HANDLE_AUTO) {
+ /* Use connected parent. */
+ if (pchan->bone->flag & BONE_CONNECTED) {
*r_prev = pchan->parent;
- else
+ }
+ else {
*r_prev = NULL;
+ }
+ }
+ else {
+ /* Use the provided bone as prev - leave blank to eliminate this effect altogether. */
+ *r_prev = pchan->bbone_prev;
+ }
+ if (pchan->bone->bbone_next_type == BBONE_HANDLE_AUTO) {
+ /* Use connected child. */
*r_next = pchan->child;
}
+ else {
+ /* Use the provided bone as next - leave blank to eliminate this effect altogether. */
+ *r_next = pchan->bbone_next;
+ }
}
/* returns pointer to static array, filled with desired amount of bone->segments elements */
@@ -499,8 +507,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
float difmat[4][4], result[3][3], imat3[3][3];
/* transform previous point inside this bone space */
- if ((pchan->bboneflag & PCHAN_BBONE_CUSTOM_HANDLES) &&
- (pchan->bboneflag & PCHAN_BBONE_CUSTOM_START_REL))
+ if (bone->bbone_prev_type == BBONE_HANDLE_RELATIVE)
{
/* Use delta movement (from restpose), and apply this relative to the current bone's head */
if (rest) {
@@ -555,8 +562,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
float difmat[4][4], result[3][3], imat3[3][3];
/* transform next point inside this bone space */
- if ((pchan->bboneflag & PCHAN_BBONE_CUSTOM_HANDLES) &&
- (pchan->bboneflag & PCHAN_BBONE_CUSTOM_END_REL))
+ if (bone->bbone_next_type == BBONE_HANDLE_RELATIVE)
{
/* Use delta movement (from restpose), and apply this relative to the current bone's tail */
if (rest) {
@@ -2019,6 +2025,22 @@ void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_
BKE_pose_channels_hash_free(pose);
BLI_freelinkN(&pose->chanbase, pchan);
}
+ else {
+ /* Find the custom B-Bone handles. */
+ if (pchan->bone->bbone_prev) {
+ pchan->bbone_prev = BKE_pose_channel_find_name(pose, pchan->bone->bbone_prev->name);
+ }
+ else {
+ pchan->bbone_prev = NULL;
+ }
+
+ if (pchan->bone->bbone_next) {
+ pchan->bbone_next = BKE_pose_channel_find_name(pose, pchan->bone->bbone_next->name);
+ }
+ else {
+ pchan->bbone_next = NULL;
+ }
+ }
}
/* printf("rebuild pose %s, %d bones\n", ob->id.name, counter); */