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:
Diffstat (limited to 'source/blender/makesrna/intern/rna_pose.c')
-rw-r--r--source/blender/makesrna/intern/rna_pose.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 996a80548b3..47c8435cc46 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -71,14 +71,14 @@
#include "RNA_access.h"
-static void rna_Pose_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
// XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
}
-static void rna_Pose_IK_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
// XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
Object *ob= ptr->id.data;
@@ -254,7 +254,7 @@ static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
}
}
-static void rna_Itasc_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = ptr->id.data;
bItasc *itasc = ptr->data;
@@ -585,6 +585,25 @@ static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *value
pchan_apply_mat4(pchan, (float (*)[4])values, FALSE); /* no compat for predictable result */
}
+static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
+{
+ bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+ Object *ob= (Object*)ptr->id.data;
+ float umat[4][4]= MAT4_UNITY;
+ float tmat[4][4];
+
+ /* recalculate pose matrix with only parent transformations,
+ * bone loc/sca/rot is ignored, scene and frame are not used. */
+ where_is_pose_bone(NULL, ob, pchan, 0.0f, FALSE);
+
+ /* find the matrix, need to remove the bone transforms first so this is
+ * calculated as a matrix to set rather then a difference ontop of whats
+ * already there. */
+ pchan_apply_mat4(pchan, umat, FALSE);
+ armature_mat_pose_to_bone(pchan, (float (*)[4])values, tmat);
+ pchan_apply_mat4(pchan, tmat, FALSE); /* no compat for predictable result */
+}
+
#else
static void rna_def_bone_group(BlenderRNA *brna)
@@ -830,8 +849,9 @@ static void rna_def_pose_channel(BlenderRNA *brna)
prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
RNA_def_property_multi_array(prop, 2, matrix_dimsize);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix after constraints and drivers are applied (object space)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
/* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
prop= RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);