diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-09 17:25:56 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-09 17:25:56 +0300 |
commit | a41131db24cd063f770b22bfdfa452511560c4ac (patch) | |
tree | 126daebe383911f01ea22f2cfd3b33366fd380df /source/blender | |
parent | d6c583cc540257aeb516471fd724d79efc63ad11 (diff) |
- added editbone.matrix, readonly, utility property that calculates the matrix from the bone roll
- spine fixes
- arm now uses the average Z axis to place the poll target
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_armature.c | 26 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_driver.c | 4 |
2 files changed, 28 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index bfab46aa11c..6a6c370977a 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -43,9 +43,10 @@ #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" -#include "BKE_main.h" +#include "BKE_main.h"" #include "ED_armature.h" +#include "BKE_armature.h" static void rna_Armature_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) { @@ -304,6 +305,21 @@ static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value) } } +static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values) +{ + EditBone *ebone= (EditBone*)(ptr->data); + + float delta[3], tmat[3][3], mat[4][4]; + + /* Find the current bone matrix */ + sub_v3_v3v3(delta, ebone->tail, ebone->head); + vec_roll_to_mat3(delta, ebone->roll, tmat); + copy_m4_m3(mat, tmat); + VECCOPY(mat[3], ebone->head); + + memcpy(values, mat, 16 * sizeof(float)); +} + static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr) { bArmature *arm= (bArmature*)ptr->id.data; @@ -618,6 +634,14 @@ static void rna_def_edit_bone(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Tail Selected", ""); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + /* calculated and read only, not actual data access */ + 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_array(prop, 16); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Editbone Matrix", "Read-only matrix calculated from the roll (armature space)."); + RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", NULL, NULL); // TODO - this could be made writable also + RNA_api_armature_edit_bone(srna); RNA_define_verify_sdna(1); diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 9acd6b1cd44..76df28494ac 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -192,7 +192,9 @@ float BPY_pydriver_eval (ChannelDriver *driver) } fprintf(stderr, "\tBPY_pydriver_eval() - couldn't add variable '%s' to namespace \n", dtar->name); - BPy_errors_to_report(NULL); // TODO - reports + // BPy_errors_to_report(NULL); // TODO - reports + PyErr_Print(); + PyErr_Clear(); } } |