Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2009 Blender Foundation. 00019 * All rights reserved. 00020 * 00021 * 00022 * Contributor(s): Campbell Barton 00023 * 00024 * ***** END GPL LICENSE BLOCK ***** 00025 */ 00026 00032 #include <stdlib.h> 00033 #include <stdio.h> 00034 #include <string.h> 00035 #include <time.h> 00036 00037 #include "RNA_define.h" 00038 00039 #ifdef RNA_RUNTIME 00040 00041 #include <stddef.h> 00042 00043 #include "BKE_armature.h" 00044 00045 void rna_EditBone_align_roll(EditBone *ebo, float no[3]) 00046 { 00047 ebo->roll= ED_rollBoneToVector(ebo, no, FALSE); 00048 } 00049 00050 float rna_Bone_do_envelope(Bone *bone, float *vec) 00051 { 00052 float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f; 00053 return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale, bone->rad_tail * scale, bone->dist * scale); 00054 } 00055 00056 #else 00057 00058 void RNA_api_armature_edit_bone(StructRNA *srna) 00059 { 00060 FunctionRNA *func; 00061 PropertyRNA *parm; 00062 00063 func= RNA_def_function(srna, "align_roll", "rna_EditBone_align_roll"); 00064 RNA_def_function_ui_description(func, "Align the bone to a localspace roll so the Z axis " 00065 "points in the direction of the vector given"); 00066 parm= RNA_def_float_vector(func, "vector", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); 00067 RNA_def_property_flag(parm, PROP_REQUIRED); 00068 } 00069 00070 void RNA_api_bone(StructRNA *srna) 00071 { 00072 PropertyRNA *parm; 00073 FunctionRNA *func; 00074 00075 func= RNA_def_function(srna, "evaluate_envelope", "rna_Bone_do_envelope"); 00076 RNA_def_function_ui_description(func, "Calculate bone envelope at given point"); 00077 parm= RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", 00078 "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX); 00079 RNA_def_property_flag(parm, PROP_REQUIRED); 00080 /* return value */ 00081 parm= RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX); 00082 RNA_def_function_return(func, parm); 00083 } 00084 00085 #endif