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