diff options
author | Ton Roosendaal <ton@blender.org> | 2013-02-12 18:42:46 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2013-02-12 18:42:46 +0400 |
commit | 7dbce1930ab6a15d7e936e06f734b3fab6a5a56b (patch) | |
tree | 10918d9d46ade89db87df752acc9d290b75f3f00 /source/blender/editors | |
parent | 08cf8865aa8d38f6e7a298ab02428cade19dc50f (diff) |
Reports #34042 and #33749
Tweak for new option for Relative Bone parenting
(which transforms child object based on rest pose, so you can change bones
in editmode to define pivot)
In the original commit it was made default, but that was too invisble for
users. Now it's an option in the Make Parent menu to choose. Communicates
a new feature better.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 4 | ||||
-rw-r--r-- | source/blender/editors/include/ED_object.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 15 |
3 files changed, 16 insertions, 4 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 3bcb4002ece..06e00cd02c1 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2268,7 +2268,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) BLI_addtail(arm->edbo, bone); - bone->flag |= BONE_TIPSEL | BONE_RELATIVE_PARENTING; + bone->flag |= BONE_TIPSEL; bone->weight = 1.0f; bone->dist = 0.25f; bone->xwidth = 0.1f; @@ -3422,7 +3422,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) copy_v3_v3(newbone->tail, ebone->head); newbone->parent = ebone->parent; - newbone->flag = BONE_TIPSEL | BONE_RELATIVE_PARENTING; + newbone->flag = BONE_TIPSEL; if (newbone->parent && (ebone->flag & BONE_CONNECTED)) { newbone->flag |= BONE_CONNECTED; diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 533bfe2fa20..e212f2cc17d 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -83,6 +83,7 @@ typedef enum eParentType { PAR_ARMATURE_ENVELOPE, PAR_ARMATURE_AUTO, PAR_BONE, + PAR_BONE_RELATIVE, PAR_CURVE, PAR_FOLLOW, PAR_PATH_CONST, diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 33b159f3cf2..ce37fd79d55 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -35,6 +35,7 @@ #include "MEM_guardedalloc.h" #include "DNA_anim_types.h" +#include "DNA_armature_types.h" #include "DNA_mesh_types.h" #include "DNA_constraint_types.h" #include "DNA_group_types.h" @@ -578,6 +579,7 @@ EnumPropertyItem prop_make_parent_types[] = { {PAR_ARMATURE_AUTO, "ARMATURE_AUTO", 0, " With Automatic Weights", ""}, {PAR_ARMATURE_ENVELOPE, "ARMATURE_ENVELOPE", 0, " With Envelope Weights", ""}, {PAR_BONE, "BONE", 0, "Bone", ""}, + {PAR_BONE_RELATIVE, "BONE_RELATIVE", 0, "Bone Relative", ""}, {PAR_CURVE, "CURVE", 0, "Curve Deform", ""}, {PAR_FOLLOW, "FOLLOW", 0, "Follow Path", ""}, {PAR_PATH_CONST, "PATH_CONST", 0, "Path Constraint", ""}, @@ -624,7 +626,7 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object partype = PAR_OBJECT; } } - else if (partype == PAR_BONE) { + else if (ELEM(partype, PAR_BONE, PAR_BONE_RELATIVE)) { pchan = BKE_pose_channel_active(par); if (pchan == NULL) { @@ -705,8 +707,16 @@ int ED_object_parent_set(ReportList *reports, Main *bmain, Scene *scene, Object } } } - else if (partype == PAR_BONE) + else if (partype == PAR_BONE) { ob->partype = PARBONE; /* note, dna define, not operator property */ + if (pchan->bone) + pchan->bone->flag &= ~BONE_RELATIVE_PARENTING; + } + else if (partype == PAR_BONE_RELATIVE) { + ob->partype = PARBONE; /* note, dna define, not operator property */ + if (pchan->bone) + pchan->bone->flag |= BONE_RELATIVE_PARENTING; + } else ob->partype = PAROBJECT; /* note, dna define, not operator property */ @@ -815,6 +825,7 @@ static int parent_set_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSE uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_ENVELOPE); uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_ARMATURE_AUTO); uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE); + uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_BONE_RELATIVE); } else if (ob->type == OB_CURVE) { uiItemEnumO_ptr(layout, ot, NULL, 0, "type", PAR_CURVE); |