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