diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-05-05 22:56:38 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-05-05 22:57:52 +0400 |
commit | 036de9bfa58dcfceb09d804eda651f48a9986a8f (patch) | |
tree | d919d5e89196bd372fa5e5755104648f3f6fcde9 /source/blender/makesrna/intern/rna_armature.c | |
parent | f5687323a362847a2f8d101da8512f06e3c1f5f3 (diff) |
Make bpy.types.EditBone.matrix writeable.
Makes importing armatures from matrices (FBX...) *much* easier.
Diffstat (limited to 'source/blender/makesrna/intern/rna_armature.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 612ce14f039..1bccceab5ab 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -401,6 +401,12 @@ static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values) ED_armature_ebone_to_mat4(ebone, (float(*)[4])values); } +static void rna_EditBone_matrix_set(PointerRNA *ptr, const float *values) +{ + EditBone *ebone = (EditBone *)(ptr->data); + ED_armature_ebone_from_mat4(ebone, (float(*)[4])values); +} + static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bArmature *arm = (bArmature *)ptr->id.data; @@ -795,11 +801,12 @@ static void rna_def_edit_bone(BlenderRNA *brna) prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); /*RNA_def_property_float_sdna(prop, NULL, ""); *//* doesnt access any real data */ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); + //RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */ - RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space)"); - /* TODO - this could be made writable also */ - RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Editbone Matrix", + "Matrix combining loc/rot of the bone (head position, direction and roll), " + "in armature space (WARNING: does not include/support bone's length/size)"); + RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL); RNA_api_armature_edit_bone(srna); |