diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_bone.py | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 5 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature.c | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_armature_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 5 |
5 files changed, 21 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_bone.py b/release/scripts/startup/bl_ui/properties_data_bone.py index fdaee6b7cde..d99d7e7972b 100644 --- a/release/scripts/startup/bl_ui/properties_data_bone.py +++ b/release/scripts/startup/bl_ui/properties_data_bone.py @@ -170,6 +170,8 @@ class BONE_PT_relations(BoneButtonsPanel, Panel): if ob and pchan: col.label(text="Bone Group:") col.prop_search(pchan, "bone_group", ob.pose, "bone_groups", text="") + col.label(text="Object Children:") + col.prop(bone, "use_relative_parenting") col = split.column() col.label(text="Parent:") @@ -181,11 +183,11 @@ class BONE_PT_relations(BoneButtonsPanel, Panel): sub = col.column() sub.active = (bone.parent is not None) sub.prop(bone, "use_connect") - sub.prop(bone, "use_inherit_rotation", text="Inherit Rotation") - sub.prop(bone, "use_inherit_scale", text="Inherit Scale") + sub.prop(bone, "use_inherit_rotation") + sub.prop(bone, "use_inherit_scale") sub = col.column() sub.active = (not bone.parent or not bone.use_connect) - sub.prop(bone, "use_local_location", text="Local Location") + sub.prop(bone, "use_local_location") class BONE_PT_display(BoneButtonsPanel, Panel): diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 28aa3a523cd..f9bbf0dcc53 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1839,7 +1839,10 @@ static void ob_parbone(Object *ob, Object *par, float mat[4][4]) } /* get bone transform */ - copy_m4_m4(mat, pchan->pose_mat); + if (pchan->bone->flag & BONE_RELATIVE_PARENTING) + copy_m4_m4(mat, pchan->chan_mat); + else + copy_m4_m4(mat, pchan->pose_mat); /* but for backwards compatibility, the child has to move to the tail */ copy_v3_v3(vec, mat[1]); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index ffe58be0139..ae405c0e113 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2256,6 +2256,7 @@ void undo_push_armature(bContext *C, const char *name) /* *************** Adding stuff in editmode *************** */ /* default bone add, returns it selected, but without tail set */ +/* XXX should be used everywhere, now it mallocs bones still locally in functions */ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) { EditBone *bone = MEM_callocN(sizeof(EditBone), "eBone"); @@ -2265,7 +2266,7 @@ EditBone *ED_armature_edit_bone_add(bArmature *arm, const char *name) BLI_addtail(arm->edbo, bone); - bone->flag |= BONE_TIPSEL; + bone->flag |= BONE_TIPSEL | BONE_RELATIVE_PARENTING; bone->weight = 1.0f; bone->dist = 0.25f; bone->xwidth = 0.1f; @@ -3410,7 +3411,7 @@ static int armature_extrude_exec(bContext *C, wmOperator *op) copy_v3_v3(newbone->tail, newbone->head); newbone->parent = ebone; - newbone->flag = ebone->flag & BONE_TIPSEL; // copies it, in case mirrored bone + newbone->flag = ebone->flag & (BONE_TIPSEL | BONE_RELATIVE_PARENTING); // copies it, in case mirrored bone if (newbone->parent) newbone->flag |= BONE_CONNECTED; } @@ -3419,7 +3420,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; + newbone->flag = BONE_TIPSEL | BONE_RELATIVE_PARENTING; if (newbone->parent && (ebone->flag & BONE_CONNECTED)) { newbone->flag |= BONE_CONNECTED; diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index fd68a6d9a27..8fcb079cd4f 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -198,7 +198,9 @@ typedef enum eBone_Flag { BONE_EDITMODE_LOCKED = (1 << 19), /* bone transforms are locked in EditMode */ BONE_TRANSFORM_CHILD = (1 << 20), /* Indicates that a parent is also being transformed */ BONE_UNSELECTABLE = (1 << 21), /* bone cannot be selected */ - BONE_NO_LOCAL_LOCATION = (1 << 22) /* bone location is in armature space */ + BONE_NO_LOCAL_LOCATION = (1 << 22), /* bone location is in armature space */ + BONE_RELATIVE_PARENTING = (1 << 23) /* object child will use relative transform (like deform) */ + } eBone_Flag; #define MAXBONENAME 64 diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 4c566d71981..f800e7b9e48 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -529,6 +529,11 @@ static void rna_def_bone_common(StructRNA *srna, int editbone) RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION); RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + prop = RNA_def_property(srna, "use_relative_parenting", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, "Relative Parenting", "Object children will use relative transform, like deform"); + RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_RELATIVE_PARENTING); + RNA_def_property_update(prop, 0, "rna_Armature_update_data"); + prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE); RNA_def_property_ui_text(prop, "Draw Wire", |