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:
authorCampbell Barton <ideasman42@gmail.com>2019-08-23 04:53:45 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-08-23 05:03:11 +0300
commit232049dd9408e15d2082181e60ddd775b375ff19 (patch)
tree445988faa416644cfb0d210d864fb908e69d4f77 /source/blender/editors
parent30582c59ccd00fc5c3221540c078947d25fc1bfd (diff)
Armature: use BKE_armature_transform when applying transformation
Keep ED_armature_transform for RNA Armature.transform since it operates on edit-bones in edit-mode. Rename ED_armature_transform_bones to ED_armature_edit_transform since it wasn't obviously an edit-mode function.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/armature_edit.c34
-rw-r--r--source/blender/editors/include/ED_armature.h12
-rw-r--r--source/blender/editors/object/object_transform.c3
3 files changed, 12 insertions, 37 deletions
diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c
index 4e6661b1d15..c4c10549da3 100644
--- a/source/blender/editors/armature/armature_edit.c
+++ b/source/blender/editors/armature/armature_edit.c
@@ -62,22 +62,10 @@
/* ************************** Object Tools Exports ******************************* */
/* NOTE: these functions are exported to the Object module to be called from the tools there */
-void ED_armature_transform_apply(Main *bmain, Object *ob, float mat[4][4], const bool do_props)
-{
- bArmature *arm = ob->data;
-
- /* Put the armature into editmode */
- ED_armature_to_edit(arm);
-
- /* Transform the bones */
- ED_armature_transform_bones(arm, mat, do_props);
-
- /* Turn the list into an armature */
- ED_armature_from_edit(bmain, arm);
- ED_armature_edit_free(arm);
-}
-
-void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props)
+/**
+ * See #BKE_armature_transform for object-mode transform.
+ */
+void ED_armature_edit_transform(bArmature *arm, const float mat[4][4], const bool do_props)
{
EditBone *ebone;
float scale = mat4_to_scale(mat); /* store the scale of the matrix here to use on envelopes */
@@ -114,21 +102,13 @@ void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const b
}
}
-void ED_armature_transform(Main *bmain, bArmature *arm, float mat[4][4], const bool do_props)
+void ED_armature_transform(bArmature *arm, const float mat[4][4], const bool do_props)
{
if (arm->edbo) {
- ED_armature_transform_bones(arm, mat, do_props);
+ ED_armature_edit_transform(arm, mat, do_props);
}
else {
- /* Put the armature into editmode */
- ED_armature_to_edit(arm);
-
- /* Transform the bones */
- ED_armature_transform_bones(arm, mat, do_props);
-
- /* Go back to object mode*/
- ED_armature_from_edit(bmain, arm);
- ED_armature_edit_free(arm);
+ BKE_armature_transform(arm, mat, do_props);
}
}
diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h
index 76be0e82aa4..8dbe832d18b 100644
--- a/source/blender/editors/include/ED_armature.h
+++ b/source/blender/editors/include/ED_armature.h
@@ -229,15 +229,9 @@ void ED_armature_edit_transform_mirror_update(struct Object *obedit);
void ED_armature_origin_set(
struct Main *bmain, struct Object *ob, const float cursor[3], int centermode, int around);
-void ED_armature_transform_bones(struct bArmature *arm, float mat[4][4], const bool do_props);
-void ED_armature_transform_apply(struct Main *bmain,
- struct Object *ob,
- float mat[4][4],
- const bool do_props);
-void ED_armature_transform(struct Main *bmain,
- struct bArmature *arm,
- float mat[4][4],
- const bool do_props);
+void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], const bool do_props);
+
+void ED_armature_transform(struct bArmature *arm, const float mat[4][4], const bool do_props);
#define ARM_GROUPS_NAME 1
#define ARM_GROUPS_ENVELOPE 2
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 9b39c5b2a88..76a45f219fe 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -768,7 +768,8 @@ static int apply_objects_internal(bContext *C,
BKE_mesh_calc_normals(me);
}
else if (ob->type == OB_ARMATURE) {
- ED_armature_transform_apply(bmain, ob, mat, do_props);
+ bArmature *arm = ob->data;
+ BKE_armature_transform(arm, mat, do_props);
}
else if (ob->type == OB_LATTICE) {
Lattice *lt = ob->data;