2011-02-23 10:52:22 +00:00
|
|
|
/*
|
2009-07-07 19:13:05 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2012-03-18 09:27:36 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2009-07-07 19:13:05 +00:00
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-07-07 19:13:05 +00:00
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2009 Blender Foundation.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
2012-03-18 09:27:36 +00:00
|
|
|
*
|
2009-07-07 19:13:05 +00:00
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
*/
|
|
|
|
|
|
2011-02-27 20:20:01 +00:00
|
|
|
/** \file blender/makesrna/intern/rna_pose_api.c
|
|
|
|
|
* \ingroup RNA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2009-07-07 19:13:05 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <time.h>
|
|
|
|
|
|
2012-09-24 22:39:45 +00:00
|
|
|
#include "BLI_utildefines.h"
|
|
|
|
|
|
2009-07-07 19:13:05 +00:00
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
|
|
2013-05-28 19:35:26 +00:00
|
|
|
/* #include "BLI_sys_types.h" */
|
2009-07-07 19:13:05 +00:00
|
|
|
|
2012-09-24 22:39:45 +00:00
|
|
|
#include "rna_internal.h" /* own include */
|
|
|
|
|
|
2009-07-07 19:13:05 +00:00
|
|
|
#ifdef RNA_RUNTIME
|
|
|
|
|
|
|
|
|
|
/* #include "DNA_anim_types.h" */
|
|
|
|
|
#include "DNA_action_types.h" /* bPose */
|
2010-09-17 16:45:42 +00:00
|
|
|
#include "BKE_armature.h"
|
2009-07-07 19:13:05 +00:00
|
|
|
|
2010-09-17 16:45:42 +00:00
|
|
|
static float rna_PoseBone_do_envelope(bPoseChannel *chan, float *vec)
|
|
|
|
|
{
|
|
|
|
|
Bone *bone = chan->bone;
|
|
|
|
|
|
|
|
|
|
float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
|
2009-11-11 19:58:30 +00:00
|
|
|
|
2012-03-18 09:27:36 +00:00
|
|
|
return distfactor_to_bone(vec, chan->pose_head, chan->pose_tail, bone->rad_head * scale,
|
|
|
|
|
bone->rad_tail * scale, bone->dist * scale);
|
2010-09-17 16:45:42 +00:00
|
|
|
}
|
2009-07-07 19:13:05 +00:00
|
|
|
#else
|
|
|
|
|
|
2012-09-24 22:39:45 +00:00
|
|
|
void RNA_api_pose(StructRNA *UNUSED(srna))
|
2009-07-07 19:13:05 +00:00
|
|
|
{
|
2009-08-19 09:52:13 +00:00
|
|
|
/* FunctionRNA *func; */
|
|
|
|
|
/* PropertyRNA *parm; */
|
2009-11-11 19:58:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RNA_api_pose_channel(StructRNA *srna)
|
|
|
|
|
{
|
2010-09-17 16:45:42 +00:00
|
|
|
PropertyRNA *parm;
|
|
|
|
|
FunctionRNA *func;
|
|
|
|
|
|
2012-03-05 23:30:41 +00:00
|
|
|
func = RNA_def_function(srna, "evaluate_envelope", "rna_PoseBone_do_envelope");
|
2011-09-19 13:23:58 +00:00
|
|
|
RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
|
2012-05-12 11:01:29 +00:00
|
|
|
"Position in 3d space to evaluate", -FLT_MAX, FLT_MAX);
|
Refactor RNA property: split flags in property flags, parameter flags, and internal flags.
This gives us 9 flags available again for properties (we had none anymore),
and also makes things slightly cleaner.
To simplify (and make more clear the differences between mere properties
and function parameters), also added RNA_def_parameter_flags function (and
its clear counterpart), to be used instead of RNA_def_property_flag for
function parameters.
This patch is also a big cleanup (some RNA function definitions were
still using 'prop' PropertyRNA pointer, etc.).
And yes, am aware this will be annoying for all branches, but we really need
to get new flags available for properties (will need at least one for override, etc.).
Reviewers: sergey, Severin
Subscribers: dfelinto, brecht
Differential Revision: https://developer.blender.org/D2400
2016-12-12 15:23:55 +01:00
|
|
|
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
2010-09-17 16:45:42 +00:00
|
|
|
/* return value */
|
2012-03-05 23:30:41 +00:00
|
|
|
parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
|
2010-09-17 16:45:42 +00:00
|
|
|
RNA_def_function_return(func, parm);
|
2009-07-07 19:13:05 +00:00
|
|
|
}
|
|
|
|
|
|
2009-11-11 19:58:30 +00:00
|
|
|
|
2009-07-07 19:13:05 +00:00
|
|
|
#endif
|