diff options
19 files changed, 299 insertions, 188 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index 6452ad8465b..7afc19f5e95 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -156,11 +156,11 @@ class BONE_PT_curved(BoneButtonsPanel, Panel): col = topcol.column(align=True) col.prop(bbone, "bbone_curveinx", text="Curve In X") - col.prop(bbone, "bbone_curveiny", text="In Y") + col.prop(bbone, "bbone_curveinz", text="Z") col = topcol.column(align=True) col.prop(bbone, "bbone_curveoutx", text="Curve Out X") - col.prop(bbone, "bbone_curveouty", text="Out Y") + col.prop(bbone, "bbone_curveoutz", text="Z") col = topcol.column(align=True) col.prop(bbone, "bbone_rollin", text="Roll In") @@ -168,12 +168,10 @@ class BONE_PT_curved(BoneButtonsPanel, Panel): col.prop(bone, "use_endroll_as_inroll") col = topcol.column(align=True) - col.prop(bbone, "bbone_scaleinx", text="Scale In X") - col.prop(bbone, "bbone_scaleiny", text="In Y") + col.prop(bbone, "bbone_scalein", text="Scale In") col = topcol.column(align=True) - col.prop(bbone, "bbone_scaleoutx", text="Scale Out X") - col.prop(bbone, "bbone_scaleouty", text="Out Y") + col.prop(bbone, "bbone_scaleout", text="Scale Out") 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 3002a9cc10d..112b8bf3ad4 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -80,11 +80,10 @@ typedef struct EditBone { /* Bendy-Bone parameters */ short segments; float roll1, roll2; - float curve_in_x, curve_in_y; - float curve_out_x, curve_out_y; + float curve_in_x, curve_in_z; + float curve_out_x, curve_out_z; float ease1, ease2; - float scale_in_x, scale_in_y; - float scale_out_x, scale_out_y; + float scale_in[3], scale_out[3]; /** for envelope scaling */ float oldlength; @@ -92,6 +91,10 @@ typedef struct EditBone { /** Type of next/prev bone handles */ char bbone_prev_type; char bbone_next_type; + /** B-Bone flags. */ + int bbone_flag; + short bbone_prev_flag; + short bbone_next_flag; /** Next/prev bones to use as handle references when calculating bbones (optional) */ struct EditBone *bbone_prev; struct EditBone *bbone_next; @@ -298,8 +301,8 @@ typedef struct BBoneSplineParameters { /* Control values. */ float ease1, ease2; float roll1, roll2; - float scale_in_x, scale_in_y, scale_out_x, scale_out_y; - float curve_in_x, curve_in_y, curve_out_x, curve_out_y; + float scale_in[3], scale_out[3]; + float curve_in_x, curve_in_z, curve_out_x, curve_out_z; } BBoneSplineParameters; void BKE_pchan_bbone_handles_get(struct bPoseChannel *pchan, diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index a7e36b09516..5db2eceb0d1 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -665,8 +665,8 @@ bPoseChannel *BKE_pose_channel_ensure(bPose *pose, const char *name) unit_axis_angle(chan->rotAxis, &chan->rotAngle); chan->size[0] = chan->size[1] = chan->size[2] = 1.0f; - chan->scale_in_x = chan->scale_in_y = 1.0f; - chan->scale_out_x = chan->scale_out_y = 1.0f; + copy_v3_fl(chan->scale_in, 1.0f); + copy_v3_fl(chan->scale_out, 1.0f); chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -M_PI; chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = M_PI; @@ -1659,11 +1659,12 @@ void BKE_pose_rest(bPose *pose, bool selected_bones_only) pchan->size[0] = pchan->size[1] = pchan->size[2] = 1.0f; pchan->roll1 = pchan->roll2 = 0.0f; - pchan->curve_in_x = pchan->curve_in_y = 0.0f; - pchan->curve_out_x = pchan->curve_out_y = 0.0f; + pchan->curve_in_x = pchan->curve_in_z = 0.0f; + pchan->curve_out_x = pchan->curve_out_z = 0.0f; pchan->ease1 = pchan->ease2 = 0.0f; - pchan->scale_in_x = pchan->scale_in_y = 1.0f; - pchan->scale_out_x = pchan->scale_out_y = 1.0f; + + copy_v3_fl(pchan->scale_in, 1.0f); + copy_v3_fl(pchan->scale_out, 1.0f); pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE); } @@ -1686,15 +1687,14 @@ void BKE_pose_copy_pchan_result(bPoseChannel *pchanto, const bPoseChannel *pchan pchanto->roll1 = pchanfrom->roll1; pchanto->roll2 = pchanfrom->roll2; pchanto->curve_in_x = pchanfrom->curve_in_x; - pchanto->curve_in_y = pchanfrom->curve_in_y; + pchanto->curve_in_z = pchanfrom->curve_in_z; pchanto->curve_out_x = pchanfrom->curve_out_x; - pchanto->curve_out_y = pchanfrom->curve_out_y; + pchanto->curve_out_z = pchanfrom->curve_out_z; pchanto->ease1 = pchanfrom->ease1; pchanto->ease2 = pchanfrom->ease2; - 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; + + copy_v3_v3(pchanto->scale_in, pchanfrom->scale_in); + copy_v3_v3(pchanto->scale_out, pchanfrom->scale_out); 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 4ea71922df5..f6b861946ec 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -1103,7 +1103,7 @@ void BKE_pchan_bbone_spline_params_get(struct bPoseChannel *pchan, param->roll1 = bone->roll1 + (!rest ? pchan->roll1 : 0.0f); param->roll2 = bone->roll2 + (!rest ? pchan->roll2 : 0.0f); - if (bone->flag & BONE_ADD_PARENT_END_ROLL) { + if (bone->bbone_flag & BBONE_ADD_PARENT_END_ROLL) { if (prev) { if (prev->bone) { param->roll1 += prev->bone->roll2; @@ -1115,17 +1115,20 @@ void BKE_pchan_bbone_spline_params_get(struct bPoseChannel *pchan, } } - 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); + copy_v3_v3(param->scale_in, bone->scale_in); + copy_v3_v3(param->scale_out, bone->scale_out); - /* Extra curve x / y */ + if (!rest) { + mul_v3_v3(param->scale_in, pchan->scale_in); + mul_v3_v3(param->scale_out, pchan->scale_out); + } + + /* Extra curve x / z */ param->curve_in_x = bone->curve_in_x + (!rest ? pchan->curve_in_x : 0.0f); - param->curve_in_y = bone->curve_in_y + (!rest ? pchan->curve_in_y : 0.0f); + param->curve_in_z = bone->curve_in_z + (!rest ? pchan->curve_in_z : 0.0f); param->curve_out_x = bone->curve_out_x + (!rest ? pchan->curve_out_x : 0.0f); - param->curve_out_y = bone->curve_out_y + (!rest ? pchan->curve_out_y : 0.0f); + param->curve_out_z = bone->curve_out_z + (!rest ? pchan->curve_out_z : 0.0f); } } @@ -1250,13 +1253,13 @@ void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, * in the bone length getting scaled up too (from 1 to 8), causing the curve to flatten out. */ const float xscale_correction = (param->do_scale) ? param->scale[0] : 1.0f; - const float yscale_correction = (param->do_scale) ? param->scale[2] : 1.0f; + const float zscale_correction = (param->do_scale) ? param->scale[2] : 1.0f; h1[0] += param->curve_in_x * xscale_correction; - h1[2] += param->curve_in_y * yscale_correction; + h1[2] += param->curve_in_z * zscale_correction; h2[0] += param->curve_out_x * xscale_correction; - h2[2] += param->curve_out_y * yscale_correction; + h2[2] += param->curve_out_z * zscale_correction; } } @@ -1266,7 +1269,7 @@ static void make_bbone_spline_matrix(BBoneSplineParameters *param, const float axis[3], float roll, float scalex, - float scaley, + float scalez, float result[4][4]) { float mat3[3][3]; @@ -1283,7 +1286,7 @@ static void make_bbone_spline_matrix(BBoneSplineParameters *param, /* BBone scale... */ mul_v3_fl(result[0], scalex); - mul_v3_fl(result[2], scaley); + mul_v3_fl(result[2], scalez); } /* Fade from first to second derivative when the handle is very short. */ @@ -1352,8 +1355,8 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, bezt_controls[0], axis, roll1, - param->scale_in_x, - param->scale_in_y, + param->scale_in[0], + param->scale_in[2], result_array[0].mat); for (int a = 1; a < param->segments; a++) { @@ -1361,11 +1364,11 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, float fac = ((float)a) / param->segments; float roll = interpf(roll2, roll1, 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); + float scalex = interpf(param->scale_out[0], param->scale_in[0], fac); + float scalez = interpf(param->scale_out[2], param->scale_in[2], fac); make_bbone_spline_matrix( - param, scalemats, cur, axis, roll, scalex, scaley, result_array[a].mat); + param, scalemats, cur, axis, roll, scalex, scalez, result_array[a].mat); } negate_v3(bezt_deriv2[1]); @@ -1375,8 +1378,8 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, bezt_controls[3], axis, roll2, - param->scale_out_x, - param->scale_out_y, + param->scale_out[0], + param->scale_out[2], result_array[param->segments].mat); } /* Other code (e.g. display) uses matrices for the segments themselves. */ @@ -1390,11 +1393,11 @@ int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, float fac = (a + 0.5f) / param->segments; float roll = interpf(roll2, roll1, 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); + float scalex = interpf(param->scale_out[0], param->scale_in[0], fac); + float scalez = interpf(param->scale_out[2], param->scale_in[2], fac); make_bbone_spline_matrix( - param, scalemats, prev, axis, roll, scalex, scaley, result_array[a].mat); + param, scalemats, prev, axis, roll, scalex, scalez, 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 289092f7f19..776f6c54363 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -263,8 +263,8 @@ static void do_version_action_editor_properties_region(ListBase *regionbase) static void do_version_bones_super_bbone(ListBase *lb) { LISTBASE_FOREACH (Bone *, bone, lb) { - bone->scale_in_x = bone->scale_in_y = 1.0f; - bone->scale_out_x = bone->scale_out_y = 1.0f; + bone->scale_in_x = bone->scale_in_z = 1.0f; + bone->scale_out_x = bone->scale_out_z = 1.0f; do_version_bones_super_bbone(&bone->childbase); } @@ -1268,8 +1268,8 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *bmain) if (ob->pose) { LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { /* see do_version_bones_super_bbone()... */ - pchan->scale_in_x = pchan->scale_in_y = 1.0f; - pchan->scale_out_x = pchan->scale_out_y = 1.0f; + pchan->scale_in_x = pchan->scale_in_z = 1.0f; + pchan->scale_out_x = pchan->scale_out_z = 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 c9f0cb62fcb..bf8f7eeca5c 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -709,8 +709,8 @@ static void do_versions_area_ensure_tool_region(Main *bmain, static void do_version_bones_split_bbone_scale(ListBase *lb) { LISTBASE_FOREACH (Bone *, bone, lb) { - bone->scale_in_y = bone->scale_in_x; - bone->scale_out_y = bone->scale_out_x; + bone->scale_in_z = bone->scale_in_x; + bone->scale_out_z = bone->scale_out_x; do_version_bones_split_bbone_scale(&bone->childbase); } @@ -3969,8 +3969,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) LISTBASE_FOREACH (Object *, ob, &bmain->objects) { if (ob->pose) { LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { - pchan->scale_in_y = pchan->scale_in_x; - pchan->scale_out_y = pchan->scale_out_x; + pchan->scale_in_z = pchan->scale_in_x; + pchan->scale_out_z = pchan->scale_out_x; } } } diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 268598ccc51..bdefe51f635 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -25,12 +25,16 @@ #include "BLI_string.h" #include "BLI_utildefines.h" +#include "DNA_anim_types.h" +#include "DNA_armature_types.h" #include "DNA_brush_types.h" #include "DNA_genfile.h" #include "DNA_listBase.h" #include "DNA_modifier_types.h" #include "DNA_text_types.h" +#include "BKE_animsys.h" +#include "BKE_fcurve_driver.h" #include "BKE_lib_id.h" #include "BKE_main.h" #include "BKE_node.h" @@ -38,6 +42,8 @@ #include "BLO_readfile.h" #include "readfile.h" +#include "MEM_guardedalloc.h" + static void sort_linked_ids(Main *bmain) { ListBase *lb; @@ -186,6 +192,83 @@ static void version_node_socket_name(bNodeTree *ntree, } } +static bool replace_bbone_len_scale_rnapath(char **p_old_path, int *p_index) +{ + char *old_path = *p_old_path; + + if (old_path == NULL) { + return false; + } + + int len = strlen(old_path); + + if (BLI_str_endswith(old_path, ".bbone_curveiny") || + BLI_str_endswith(old_path, ".bbone_curveouty")) { + old_path[len - 1] = 'z'; + return true; + } + + if (BLI_str_endswith(old_path, ".bbone_scaleinx") || + BLI_str_endswith(old_path, ".bbone_scaleiny") || + BLI_str_endswith(old_path, ".bbone_scaleoutx") || + BLI_str_endswith(old_path, ".bbone_scaleouty")) { + int index = (old_path[len - 1] == 'y' ? 2 : 0); + + old_path[len - 1] = 0; + + if (p_index) { + *p_index = index; + } + else { + *p_old_path = BLI_sprintfN("%s[%d]", old_path, index); + MEM_freeN(old_path); + } + + return true; + } + + return false; +} + +static void do_version_bbone_len_scale_fcurve_fix(FCurve *fcu) +{ + /* Update driver variable paths. */ + if (fcu->driver) { + LISTBASE_FOREACH (DriverVar *, dvar, &fcu->driver->variables) { + DRIVER_TARGETS_LOOPER_BEGIN (dvar) { + replace_bbone_len_scale_rnapath(&dtar->rna_path, NULL); + } + DRIVER_TARGETS_LOOPER_END; + } + } + + /* Update F-Curve's path. */ + replace_bbone_len_scale_rnapath(&fcu->rna_path, &fcu->array_index); +} + +static void do_version_bbone_len_scale_animdata_cb(ID *UNUSED(id), + AnimData *adt, + void *UNUSED(wrapper_data)) +{ + LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &adt->drivers) { + do_version_bbone_len_scale_fcurve_fix(fcu); + } +} + +static void do_version_bones_bbone_len_scale(ListBase *lb) +{ + LISTBASE_FOREACH (Bone *, bone, lb) { + if (bone->flag & BONE_ADD_PARENT_END_ROLL) { + bone->bbone_flag |= BBONE_ADD_PARENT_END_ROLL; + } + + copy_v3_fl3(bone->scale_in, bone->scale_in_x, 1.0f, bone->scale_in_z); + copy_v3_fl3(bone->scale_out, bone->scale_out_x, 1.0f, bone->scale_out_z); + + do_version_bones_bbone_len_scale(&bone->childbase); + } +} + /* NOLINTNEXTLINE: readability-function-size */ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) { @@ -259,5 +342,31 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* Initialize length-wise scale B-Bone settings. */ + if (!DNA_struct_elem_find(fd->filesdna, "Bone", "int", "bbone_flag")) { + /* Update armature data and pose channels. */ + LISTBASE_FOREACH (bArmature *, arm, &bmain->armatures) { + do_version_bones_bbone_len_scale(&arm->bonebase); + } + + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + if (ob->pose) { + LISTBASE_FOREACH (bPoseChannel *, pchan, &ob->pose->chanbase) { + copy_v3_fl3(pchan->scale_in, pchan->scale_in_x, 1.0f, pchan->scale_in_z); + copy_v3_fl3(pchan->scale_out, pchan->scale_out_x, 1.0f, pchan->scale_out_z); + } + } + } + + /* Update action curves and drivers. */ + LISTBASE_FOREACH (bAction *, act, &bmain->actions) { + LISTBASE_FOREACH_MUTABLE (FCurve *, fcu, &act->curves) { + do_version_bbone_len_scale_fcurve_fix(fcu); + } + } + + BKE_animdata_main_cb(bmain, do_version_bbone_len_scale_animdata_cb, NULL); + } } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index 32c36d78250..e4591e2e994 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -421,7 +421,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) if (prev) { OperationCode opcode = OperationCode::BONE_DONE; /* Inheriting parent roll requires access to prev handle's B-Bone properties. */ - if ((pchan->bone->flag & BONE_ADD_PARENT_END_ROLL) != 0 && + if ((pchan->bone->bbone_flag & BBONE_ADD_PARENT_END_ROLL) != 0 && check_pchan_has_bbone_segments(object, prev)) { opcode = OperationCode::BONE_SEGMENTS; } diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index 2f9ececc198..cef78044fde 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -1167,21 +1167,18 @@ static void ebone_spline_preview(EditBone *ebone, const float result_array[MAX_B param.roll1 = ebone->roll1; param.roll2 = ebone->roll2; - if (prev && (ebone->flag & BONE_ADD_PARENT_END_ROLL)) { + if (prev && (ebone->bbone_flag & BBONE_ADD_PARENT_END_ROLL)) { param.roll1 += prev->roll2; } - param.scale_in_x = ebone->scale_in_x; - param.scale_in_y = ebone->scale_in_y; - - param.scale_out_x = ebone->scale_out_x; - param.scale_out_y = ebone->scale_out_y; + copy_v3_v3(param.scale_in, ebone->scale_in); + copy_v3_v3(param.scale_out, ebone->scale_out); param.curve_in_x = ebone->curve_in_x; - param.curve_in_y = ebone->curve_in_y; + param.curve_in_z = ebone->curve_in_z; param.curve_out_x = ebone->curve_out_x; - param.curve_out_y = ebone->curve_out_y; + param.curve_out_z = ebone->curve_out_z; ebone->segments = BKE_pchan_bbone_spline_compute(¶m, false, (Mat4 *)result_array); } diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 3902f6613a1..1d4936bdf5e 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -89,15 +89,14 @@ EditBone *ED_armature_ebone_add(bArmature *arm, const char *name) bone->roll1 = 0.0f; bone->roll2 = 0.0f; bone->curve_in_x = 0.0f; - bone->curve_in_y = 0.0f; + bone->curve_in_z = 0.0f; bone->curve_out_x = 0.0f; - bone->curve_out_y = 0.0f; + bone->curve_out_z = 0.0f; bone->ease1 = 1.0f; bone->ease2 = 1.0f; - bone->scale_in_x = 1.0f; - bone->scale_in_y = 1.0f; - bone->scale_out_x = 1.0f; - bone->scale_out_y = 1.0f; + + copy_v3_fl(bone->scale_in, 1.0f); + copy_v3_fl(bone->scale_out, 1.0f); return bone; } @@ -1265,6 +1264,10 @@ static int armature_symmetrize_exec(bContext *C, wmOperator *op) ebone->bbone_prev_type = ebone_iter->bbone_prev_type; ebone->bbone_next_type = ebone_iter->bbone_next_type; + ebone->bbone_flag = ebone_iter->bbone_flag; + ebone->bbone_prev_flag = ebone_iter->bbone_prev_flag; + ebone->bbone_next_flag = ebone_iter->bbone_next_flag; + /* Lets try to fix any constraint subtargets that might * have been duplicated */ @@ -1464,15 +1467,14 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) newbone->roll1 = ebone->roll1; newbone->roll2 = ebone->roll2; newbone->curve_in_x = ebone->curve_in_x; - newbone->curve_in_y = ebone->curve_in_y; + newbone->curve_in_z = ebone->curve_in_z; newbone->curve_out_x = ebone->curve_out_x; - newbone->curve_out_y = ebone->curve_out_y; + newbone->curve_out_z = ebone->curve_out_z; newbone->ease1 = ebone->ease1; newbone->ease2 = ebone->ease2; - newbone->scale_in_x = ebone->scale_in_x; - newbone->scale_in_y = ebone->scale_in_y; - newbone->scale_out_x = ebone->scale_out_x; - newbone->scale_out_y = ebone->scale_out_y; + + copy_v3_v3(newbone->scale_in, ebone->scale_in); + copy_v3_v3(newbone->scale_out, ebone->scale_out); BLI_strncpy(newbone->name, ebone->name, sizeof(newbone->name)); diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 4fff2ae03b0..d429e51061b 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -161,11 +161,11 @@ typedef struct tPChanFCurveLink { /** old bbone values (to be restored along with the transform properties) */ float roll1, roll2; /** (NOTE: we haven't renamed these this time, as their names are already long enough) */ - float curve_in_x, curve_in_y; - float curve_out_x, curve_out_y; + float curve_in_x, curve_in_z; + float curve_out_x, curve_out_z; float ease1, ease2; - float scale_in_x, scale_in_y; - float scale_out_x, scale_out_y; + float scale_in[3]; + float scale_out[3]; /** copy of custom properties at start of operator (to be restored before each modal step) */ struct IDProperty *oldprops; diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index 3d1d8d0d1f1..ffcdb99c5a3 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -414,9 +414,8 @@ void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bo eboflip->tail[2] = ebo->tail[2]; eboflip->rad_tail = ebo->rad_tail; eboflip->curve_out_x = -ebo->curve_out_x; - eboflip->curve_out_y = ebo->curve_out_y; - eboflip->scale_out_x = ebo->scale_out_x; - eboflip->scale_out_y = ebo->scale_out_y; + eboflip->curve_out_z = ebo->curve_out_z; + copy_v3_v3(eboflip->scale_out, ebo->scale_out); eboflip->ease2 = ebo->ease2; eboflip->roll2 = -ebo->roll2; @@ -438,9 +437,8 @@ void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bo eboflip->rad_head = ebo->rad_head; eboflip->curve_in_x = -ebo->curve_in_x; - eboflip->curve_in_y = ebo->curve_in_y; - eboflip->scale_in_x = ebo->scale_in_x; - eboflip->scale_in_y = ebo->scale_in_y; + eboflip->curve_in_z = ebo->curve_in_z; + copy_v3_v3(eboflip->scale_in, ebo->scale_in); eboflip->ease1 = ebo->ease1; eboflip->roll1 = -ebo->roll1; @@ -542,19 +540,22 @@ static EditBone *make_boneList_recursive(ListBase *edbo, eBone->roll1 = curBone->roll1; eBone->roll2 = curBone->roll2; eBone->curve_in_x = curBone->curve_in_x; - eBone->curve_in_y = curBone->curve_in_y; + eBone->curve_in_z = curBone->curve_in_z; eBone->curve_out_x = curBone->curve_out_x; - eBone->curve_out_y = curBone->curve_out_y; + eBone->curve_out_z = curBone->curve_out_z; eBone->ease1 = curBone->ease1; eBone->ease2 = curBone->ease2; - eBone->scale_in_x = curBone->scale_in_x; - eBone->scale_in_y = curBone->scale_in_y; - eBone->scale_out_x = curBone->scale_out_x; - eBone->scale_out_y = curBone->scale_out_y; + + copy_v3_v3(eBone->scale_in, curBone->scale_in); + copy_v3_v3(eBone->scale_out, curBone->scale_out); eBone->bbone_prev_type = curBone->bbone_prev_type; eBone->bbone_next_type = curBone->bbone_next_type; + eBone->bbone_flag = curBone->bbone_flag; + eBone->bbone_prev_flag = curBone->bbone_prev_flag; + eBone->bbone_next_flag = curBone->bbone_next_flag; + if (curBone->prop) { eBone->prop = IDP_CopyProperty(curBone->prop); } @@ -757,19 +758,21 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm) newBone->roll1 = eBone->roll1; newBone->roll2 = eBone->roll2; newBone->curve_in_x = eBone->curve_in_x; - newBone->curve_in_y = eBone->curve_in_y; + newBone->curve_in_z = eBone->curve_in_z; newBone->curve_out_x = eBone->curve_out_x; - newBone->curve_out_y = eBone->curve_out_y; + newBone->curve_out_z = eBone->curve_out_z; newBone->ease1 = eBone->ease1; newBone->ease2 = eBone->ease2; - newBone->scale_in_x = eBone->scale_in_x; - newBone->scale_in_y = eBone->scale_in_y; - newBone->scale_out_x = eBone->scale_out_x; - newBone->scale_out_y = eBone->scale_out_y; + copy_v3_v3(newBone->scale_in, eBone->scale_in); + copy_v3_v3(newBone->scale_out, eBone->scale_out); newBone->bbone_prev_type = eBone->bbone_prev_type; newBone->bbone_next_type = eBone->bbone_next_type; + newBone->bbone_flag = eBone->bbone_flag; + newBone->bbone_prev_flag = eBone->bbone_prev_flag; + newBone->bbone_next_flag = eBone->bbone_next_flag; + if (eBone->prop) { newBone->prop = IDP_CopyProperty(eBone->prop); } diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 43ab20eb71c..6466773daac 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -144,26 +144,25 @@ static void applyarmature_transfer_properties(EditBone *curbone, if (pchan->bone->segments > 1) { /* Combine rest/pose values. */ curbone->curve_in_x += pchan_eval->curve_in_x; - curbone->curve_in_y += pchan_eval->curve_in_y; + curbone->curve_in_z += pchan_eval->curve_in_z; curbone->curve_out_x += pchan_eval->curve_out_x; - curbone->curve_out_y += pchan_eval->curve_out_y; + curbone->curve_out_z += pchan_eval->curve_out_z; curbone->roll1 += pchan_eval->roll1; curbone->roll2 += pchan_eval->roll2; curbone->ease1 += pchan_eval->ease1; curbone->ease2 += pchan_eval->ease2; - curbone->scale_in_x *= pchan_eval->scale_in_x; - curbone->scale_in_y *= pchan_eval->scale_in_y; - curbone->scale_out_x *= pchan_eval->scale_out_x; - curbone->scale_out_y *= pchan_eval->scale_out_y; + mul_v3_v3(curbone->scale_in, pchan_eval->scale_in); + mul_v3_v3(curbone->scale_out, pchan_eval->scale_out); /* Reset pose values. */ pchan->curve_in_x = pchan->curve_out_x = 0.0f; - pchan->curve_in_y = pchan->curve_out_y = 0.0f; + pchan->curve_in_z = pchan->curve_out_z = 0.0f; pchan->roll1 = pchan->roll2 = 0.0f; pchan->ease1 = pchan->ease2 = 0.0f; - pchan->scale_in_x = pchan->scale_in_y = 1.0f; - pchan->scale_out_x = pchan->scale_out_y = 1.0f; + + copy_v3_fl(pchan->scale_in, 1.0f); + copy_v3_fl(pchan->scale_out, 1.0f); } /* Clear transform values for pchan. */ @@ -699,18 +698,17 @@ static bPoseChannel *pose_bone_do_paste(Object *ob, /* B-Bone posing options should also be included... */ pchan->curve_in_x = chan->curve_in_x; - pchan->curve_in_y = chan->curve_in_y; + pchan->curve_in_z = chan->curve_in_z; pchan->curve_out_x = chan->curve_out_x; - pchan->curve_out_y = chan->curve_out_y; + pchan->curve_out_z = chan->curve_out_z; pchan->roll1 = chan->roll1; pchan->roll2 = chan->roll2; pchan->ease1 = chan->ease1; pchan->ease2 = chan->ease2; - pchan->scale_in_x = chan->scale_in_x; - pchan->scale_in_y = chan->scale_in_y; - pchan->scale_out_x = chan->scale_out_x; - pchan->scale_out_y = chan->scale_out_y; + + copy_v3_v3(pchan->scale_in, chan->scale_in); + copy_v3_v3(pchan->scale_out, chan->scale_out); /* paste flipped pose? */ if (flip) { @@ -972,8 +970,9 @@ static void pchan_clear_scale(bPoseChannel *pchan) pchan->ease1 = 0.0f; pchan->ease2 = 0.0f; - pchan->scale_in_x = pchan->scale_in_y = 1.0f; - pchan->scale_out_x = pchan->scale_out_y = 1.0f; + + copy_v3_fl(pchan->scale_in, 1.0f); + copy_v3_fl(pchan->scale_out, 1.0f); } /* Clear the scale. When X-mirror is enabled, * also clear the scale of the mirrored pose channel. */ @@ -1136,9 +1135,9 @@ static void pchan_clear_rot(bPoseChannel *pchan) pchan->roll2 = 0.0f; pchan->curve_in_x = 0.0f; - pchan->curve_in_y = 0.0f; + pchan->curve_in_z = 0.0f; pchan->curve_out_x = 0.0f; - pchan->curve_out_y = 0.0f; + pchan->curve_out_z = 0.0f; } /* Clear the rotation. When X-mirror is enabled, * also clear the rotation of the mirrored pose channel. */ diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c index 75348c2b196..8eae5288f7a 100644 --- a/source/blender/editors/armature/pose_utils.c +++ b/source/blender/editors/armature/pose_utils.c @@ -116,15 +116,14 @@ static void fcurves_to_pchan_links_get(ListBase *pfLinks, pfl->roll1 = pchan->roll1; pfl->roll2 = pchan->roll2; pfl->curve_in_x = pchan->curve_in_x; - pfl->curve_in_y = pchan->curve_in_y; + pfl->curve_in_z = pchan->curve_in_z; pfl->curve_out_x = pchan->curve_out_x; - pfl->curve_out_y = pchan->curve_out_y; + pfl->curve_out_z = pchan->curve_out_z; pfl->ease1 = pchan->ease1; pfl->ease2 = pchan->ease2; - pfl->scale_in_x = pchan->scale_in_x; - pfl->scale_in_y = pchan->scale_in_y; - pfl->scale_out_x = pchan->scale_out_x; - pfl->scale_out_y = pchan->scale_out_y; + + copy_v3_v3(pfl->scale_in, pchan->scale_in); + copy_v3_v3(pfl->scale_out, pchan->scale_out); /* make copy of custom properties */ if (pchan->prop && (transFlags & ACT_TRANS_PROP)) { @@ -251,15 +250,14 @@ void poseAnim_mapping_reset(ListBase *pfLinks) pchan->roll1 = pfl->roll1; pchan->roll2 = pfl->roll2; pchan->curve_in_x = pfl->curve_in_x; - pchan->curve_in_y = pfl->curve_in_y; + pchan->curve_in_z = pfl->curve_in_z; pchan->curve_out_x = pfl->curve_out_x; - pchan->curve_out_y = pfl->curve_out_y; + pchan->curve_out_z = pfl->curve_out_z; pchan->ease1 = pfl->ease1; pchan->ease2 = pfl->ease2; - pchan->scale_in_x = pfl->scale_in_x; - pchan->scale_in_y = pfl->scale_in_y; - pchan->scale_out_x = pfl->scale_out_x; - pchan->scale_out_y = pfl->scale_out_y; + + copy_v3_v3(pchan->scale_in, pfl->scale_in); + copy_v3_v3(pchan->scale_out, pfl->scale_out); /* just overwrite values of properties from the stored copies (there should be some) */ if (pfl->oldprops) { diff --git a/source/blender/editors/space_view3d/view3d_gizmo_armature.c b/source/blender/editors/space_view3d/view3d_gizmo_armature.c index 4d8102af6ff..16c83b45924 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_armature.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_armature.c @@ -86,12 +86,12 @@ static void gizmo_bbone_offset_get(const wmGizmo *UNUSED(gz), if (bh->index == 0) { bh->co[1] = pchan->bone->ease1 / BBONE_SCALE_Y; bh->co[0] = pchan->curve_in_x; - bh->co[2] = pchan->curve_in_y; + bh->co[2] = pchan->curve_in_z; } else { bh->co[1] = -pchan->bone->ease2 / BBONE_SCALE_Y; bh->co[0] = pchan->curve_out_x; - bh->co[2] = pchan->curve_out_y; + bh->co[2] = pchan->curve_out_z; } copy_v3_v3(value, bh->co); } @@ -111,12 +111,12 @@ static void gizmo_bbone_offset_set(const wmGizmo *UNUSED(gz), if (bh->index == 0) { pchan->bone->ease1 = max_ff(0.0f, bh->co[1] * BBONE_SCALE_Y); pchan->curve_in_x = bh->co[0]; - pchan->curve_in_y = bh->co[2]; + pchan->curve_in_z = bh->co[2]; } else { pchan->bone->ease2 = max_ff(0.0f, -bh->co[1] * BBONE_SCALE_Y); pchan->curve_out_x = bh->co[0]; - pchan->curve_out_y = bh->co[2]; + pchan->curve_out_z = bh->co[2]; } } diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 583e56de9c2..a5ed870ee78 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -328,11 +328,12 @@ typedef struct bPoseChannel { * and are applied on top of the copies in pchan->bone */ float roll1, roll2; - float curve_in_x, curve_in_y; - float curve_out_x, curve_out_y; + float curve_in_x, curve_in_z; + float curve_out_x, curve_out_z; float ease1, ease2; - float scale_in_x, scale_in_y; - float scale_out_x, scale_out_y; + float scale_in_x DNA_DEPRECATED, scale_in_z DNA_DEPRECATED; + float scale_out_x DNA_DEPRECATED, scale_out_z DNA_DEPRECATED; + float scale_in[3], scale_out[3]; /** B-Bone custom handles; set on read file or rebuild pose based on pchan->bone data. */ struct bPoseChannel *bbone_prev; diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 85780bc33c5..f5574b36602 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -86,12 +86,13 @@ typedef struct Bone { /** Curved bones settings - these define the "rest-pose" for a curved bone. */ float roll1, roll2; - float curve_in_x, curve_in_y; - float curve_out_x, curve_out_y; + float curve_in_x, curve_in_z; + float curve_out_x, curve_out_z; /** Length of bezier handles. */ float ease1, ease2; - float scale_in_x, scale_in_y; - float scale_out_x, scale_out_y; + float scale_in_x DNA_DEPRECATED, scale_in_z DNA_DEPRECATED; + float scale_out_x DNA_DEPRECATED, scale_out_z DNA_DEPRECATED; + float scale_in[3], scale_out[3]; /** Patch for upward compatibility, UNUSED! */ float size[3]; @@ -103,6 +104,10 @@ typedef struct Bone { /** Type of next/prev bone handles. */ char bbone_prev_type; char bbone_next_type; + /** B-Bone flags. */ + int bbone_flag; + short bbone_prev_flag; + short bbone_next_flag; /** Next/prev bones to use as handle references when calculating bbones (optional). */ struct Bone *bbone_prev; struct Bone *bbone_next; @@ -259,8 +264,10 @@ typedef enum eBone_Flag { BONE_NO_LOCAL_LOCATION = (1 << 22), /** object child will use relative transform (like deform) */ BONE_RELATIVE_PARENTING = (1 << 23), +#ifdef DNA_DEPRECATED_ALLOW /** it will add the parent end roll to the inroll */ BONE_ADD_PARENT_END_ROLL = (1 << 24), +#endif /** this bone was transformed by the mirror function */ BONE_TRANSFORM_MIRROR = (1 << 25), /** this bone is associated with a locked vertex group, ONLY USE FOR DRAWING */ @@ -291,6 +298,12 @@ typedef enum eBone_BBoneHandleType { BBONE_HANDLE_TANGENT = 3, /* Custom handle in tangent mode (use direction, not location). */ } eBone_BBoneHandleType; +/* bone->bbone_flag */ +typedef enum eBone_BBoneFlag { + /** Add the parent Out roll to the In roll. */ + BBONE_ADD_PARENT_END_ROLL = (1 << 0), +} eBone_BBoneFlag; + #define MAXBONENAME 64 #ifdef __cplusplus diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h index 34413730eb3..84120a54da4 100644 --- a/source/blender/makesdna/intern/dna_rename_defs.h +++ b/source/blender/makesdna/intern/dna_rename_defs.h @@ -59,11 +59,13 @@ DNA_STRUCT_RENAME(SpaceOops, SpaceOutliner) DNA_STRUCT_RENAME_ELEM(BPoint, alfa, tilt) DNA_STRUCT_RENAME_ELEM(BezTriple, alfa, tilt) DNA_STRUCT_RENAME_ELEM(Bone, curveInX, curve_in_x) -DNA_STRUCT_RENAME_ELEM(Bone, curveInY, curve_in_y) +DNA_STRUCT_RENAME_ELEM(Bone, curveInY, curve_in_z) DNA_STRUCT_RENAME_ELEM(Bone, curveOutX, curve_out_x) -DNA_STRUCT_RENAME_ELEM(Bone, curveOutY, curve_out_y) +DNA_STRUCT_RENAME_ELEM(Bone, curveOutY, curve_out_z) DNA_STRUCT_RENAME_ELEM(Bone, scaleIn, scale_in_x) +DNA_STRUCT_RENAME_ELEM(Bone, scale_in_y, scale_in_z) DNA_STRUCT_RENAME_ELEM(Bone, scaleOut, scale_out_x) +DNA_STRUCT_RENAME_ELEM(Bone, scale_out_y, scale_out_z) DNA_STRUCT_RENAME_ELEM(BrushGpencilSettings, gradient_f, hardeness) DNA_STRUCT_RENAME_ELEM(BrushGpencilSettings, gradient_s, aspect_ratio) DNA_STRUCT_RENAME_ELEM(Camera, YF_dofdist, dof_distance) @@ -101,11 +103,13 @@ DNA_STRUCT_RENAME_ELEM(View3D, ob_centre_cursor, ob_center_cursor) DNA_STRUCT_RENAME_ELEM(bGPDstroke, gradient_f, hardeness) DNA_STRUCT_RENAME_ELEM(bGPDstroke, gradient_s, aspect_ratio) DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveInX, curve_in_x) -DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveInY, curve_in_y) +DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveInY, curve_in_z) DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutX, curve_out_x) -DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutY, curve_out_y) +DNA_STRUCT_RENAME_ELEM(bPoseChannel, curveOutY, curve_out_z) DNA_STRUCT_RENAME_ELEM(bPoseChannel, scaleIn, scale_in_x) +DNA_STRUCT_RENAME_ELEM(bPoseChannel, scale_in_y, scale_in_z) DNA_STRUCT_RENAME_ELEM(bPoseChannel, scaleOut, scale_out_x) +DNA_STRUCT_RENAME_ELEM(bPoseChannel, scale_out_y, scale_out_z) DNA_STRUCT_RENAME_ELEM(bSameVolumeConstraint, flag, free_axis) DNA_STRUCT_RENAME_ELEM(bSound, name, filepath) DNA_STRUCT_RENAME_ELEM(bTheme, tact, space_action) diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index c8fccfc27f8..53ccdb3b2b7 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -720,7 +720,7 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text( prop, "Inherit End Roll", "Add Roll Out of the Start Handle bone to the Roll In value"); - RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ADD_PARENT_END_ROLL); + RNA_def_property_boolean_sdna(prop, NULL, "bbone_flag", BBONE_ADD_PARENT_END_ROLL); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, 0, "rna_Armature_dependency_update"); } @@ -733,11 +733,11 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_curveiny", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "curve_in_y"); + prop = RNA_def_property(srna, "bbone_curveinz", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curve_in_z"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_ui_text( - prop, "In Y", "Y-axis handle offset for start of the B-Bone's curve, adjusts curvature"); + prop, "In Z", "Z-axis handle offset for start of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE); @@ -747,11 +747,11 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_curveouty", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "curve_out_y"); + prop = RNA_def_property(srna, "bbone_curveoutz", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "curve_out_z"); RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_ui_text( - prop, "Out Y", "Y-axis handle offset for end of the B-Bone's curve, adjusts curvature"); + prop, "Out Z", "Z-axis handle offset for end of the B-Bone's curve, adjusts curvature"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); /* Ease In/Out */ @@ -769,49 +769,30 @@ void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone, bool is_editb RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - /* Scale In/Out */ - prop = RNA_def_property(srna, "bbone_scaleinx", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_in_x"); - RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale In X", - "X-axis scale factor for start of the B-Bone, " - "adjusts thickness (for tapering effects)"); - RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - - prop = RNA_def_property(srna, "bbone_scaleiny", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_in_y"); - RNA_def_property_flag(prop, PROP_PROPORTIONAL); - RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale In Y", - "Y-axis scale factor for start of the B-Bone, " - "adjusts thickness (for tapering effects)"); - RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_scaleoutx", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_out_x"); + /* Scale In/Out */ + prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "scale_in"); + RNA_def_property_array(prop, 3); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale Out X", - "X-axis scale factor for end of the B-Bone, " - "adjusts thickness (for tapering effects)"); + RNA_def_property_float_array_default(prop, rna_default_scale_3d); + RNA_def_property_ui_text( + prop, + "Scale In", + "Scale factors for the start of the B-Bone, adjusts thickness (for tapering effects)"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); - prop = RNA_def_property(srna, "bbone_scaleouty", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "scale_out_y"); + prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_XYZ); + RNA_def_property_float_sdna(prop, NULL, "scale_out"); + RNA_def_property_array(prop, 3); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3); - RNA_def_property_float_default(prop, 1.0f); - RNA_def_property_ui_text(prop, - "Scale Out Y", - "Y-axis scale factor for end of the B-Bone, " - "adjusts thickness (for tapering effects)"); + RNA_def_property_float_array_default(prop, rna_default_scale_3d); + RNA_def_property_ui_text( + prop, + "Scale Out", + "Scale factors for the end of the B-Bone, adjusts thickness (for tapering effects)"); RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone, is_editbone); # undef RNA_DEF_CURVEBONE_UPDATE |