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_armature_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_armature_api.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c
index cd78bd6e578..00c0342ac3e 100644
--- a/source/blender/makesrna/intern/rna_armature_api.c
+++ b/source/blender/makesrna/intern/rna_armature_api.c
@@ -1,4 +1,4 @@
-/**
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
@@ -36,16 +36,17 @@
#include <stddef.h>
#include "BLI_blenlib.h"
+#include "BKE_armature.h"
+void rna_EditBone_align_roll(EditBone *ebo, float no[3])
+{
+ ebo->roll= ED_rollBoneToVector(ebo, no, FALSE);
+}
-void rna_EditBone_align_roll(EditBone *ebo, float *no)
+float rna_Bone_do_envelope(Bone *bone, float *vec)
{
- if(!is_zero_v3(no)) {
- float normal[3];
- copy_v3_v3(normal, no);
- normalize_v3(normal);
- ebo->roll= ED_rollBoneToVector(ebo, normal);
- }
+ float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
+ return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale);
}
#else
@@ -61,4 +62,18 @@ void RNA_api_armature_edit_bone(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
}
+void RNA_api_bone(StructRNA *srna)
+{
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ func= RNA_def_function(srna, "evaluate_envelope", "rna_Bone_do_envelope");
+ RNA_def_function_ui_description(func, "Calculate bone envelope at given point.");
+ parm= RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* return value */
+ parm= RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
+ RNA_def_function_return(func, parm);
+}
+
#endif