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:
authorCampbell Barton <ideasman42@gmail.com>2018-06-17 18:10:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-17 18:10:19 +0300
commit06a1a66a9b6f120867d3bbebe3928744ec8e3495 (patch)
tree42e827a3cf58eb76474e479206b02a8d97dd3bf7 /source/blender/blenkernel/intern/action.c
parent61d27db35967710421ab92748e09624db068258d (diff)
parenta24b4e6090057479796e914bc603119b12f6ca06 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r--source/blender/blenkernel/intern/action.c302
1 files changed, 151 insertions, 151 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c
index 28534fc9783..9f5b81a8915 100644
--- a/source/blender/blenkernel/intern/action.c
+++ b/source/blender/blenkernel/intern/action.c
@@ -32,7 +32,7 @@
#include <string.h>
#include <math.h>
#include <stdlib.h>
-#include <stddef.h>
+#include <stddef.h>
#include "MEM_guardedalloc.h"
@@ -88,11 +88,11 @@
bAction *BKE_action_add(Main *bmain, const char name[])
{
bAction *act;
-
+
act = BKE_libblock_alloc(bmain, ID_AC, name, 0);
-
+
return act;
-}
+}
/* .................................. */
@@ -106,15 +106,15 @@ void BKE_action_make_local(Main *bmain, bAction *act, const bool lib_local)
/** Free (or release) any data used by this action (does not free the action itself). */
void BKE_action_free(bAction *act)
-{
+{
/* No animdata here. */
/* Free F-Curves */
free_fcurves(&act->curves);
-
+
/* Free groups */
BLI_freelistN(&act->groups);
-
+
/* Free pose-references (aka local markers) */
BLI_freelistN(&act->markers);
}
@@ -179,14 +179,14 @@ bAction *BKE_action_copy(Main *bmain, const bAction *act_src)
bActionGroup *get_active_actiongroup(bAction *act)
{
bActionGroup *agrp = NULL;
-
+
if (act && act->groups.first) {
for (agrp = act->groups.first; agrp; agrp = agrp->next) {
if (agrp->flag & AGRP_ACTIVE)
break;
}
}
-
+
return agrp;
}
@@ -194,11 +194,11 @@ bActionGroup *get_active_actiongroup(bAction *act)
void set_active_action_group(bAction *act, bActionGroup *agrp, short select)
{
bActionGroup *grp;
-
+
/* sanity checks */
if (act == NULL)
return;
-
+
/* Deactive all others */
for (grp = act->groups.first; grp; grp = grp->next) {
if ((grp == agrp) && (select))
@@ -217,7 +217,7 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
/* copy theme colors on-to group's custom color in case user tries to edit color */
bTheme *btheme = U.themes.first;
ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)];
-
+
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
}
else {
@@ -243,69 +243,69 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
bActionGroup *action_groups_add_new(bAction *act, const char name[])
{
bActionGroup *agrp;
-
+
/* sanity check: must have action and name */
if (ELEM(NULL, act, name))
return NULL;
-
+
/* allocate a new one */
agrp = MEM_callocN(sizeof(bActionGroup), "bActionGroup");
-
+
/* make it selected, with default name */
agrp->flag = AGRP_SELECTED;
BLI_strncpy(agrp->name, name[0] ? name : DATA_("Group"), sizeof(agrp->name));
-
+
/* add to action, and validate */
BLI_addtail(&act->groups, agrp);
BLI_uniquename(&act->groups, agrp, DATA_("Group"), '.', offsetof(bActionGroup, name), sizeof(agrp->name));
-
+
/* return the new group */
return agrp;
}
-/* Add given channel into (active) group
+/* Add given channel into (active) group
* - assumes that channel is not linked to anything anymore
* - always adds at the end of the group
*/
void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
-{
+{
/* sanity checks */
if (ELEM(NULL, act, agrp, fcurve))
return;
-
+
/* if no channels anywhere, just add to two lists at the same time */
if (BLI_listbase_is_empty(&act->curves)) {
fcurve->next = fcurve->prev = NULL;
-
+
agrp->channels.first = agrp->channels.last = fcurve;
act->curves.first = act->curves.last = fcurve;
}
-
- /* if the group already has channels, the F-Curve can simply be added to the list
+
+ /* if the group already has channels, the F-Curve can simply be added to the list
* (i.e. as the last channel in the group)
*/
else if (agrp->channels.first) {
- /* if the group's last F-Curve is the action's last F-Curve too,
+ /* if the group's last F-Curve is the action's last F-Curve too,
* then set the F-Curve as the last for the action first so that
* the lists will be in sync after linking
*/
if (agrp->channels.last == act->curves.last)
act->curves.last = fcurve;
-
+
/* link in the given F-Curve after the last F-Curve in the group,
* which means that it should be able to fit in with the rest of the
* list seamlessly
*/
BLI_insertlinkafter(&agrp->channels, agrp->channels.last, fcurve);
}
-
+
/* otherwise, need to find the nearest F-Curve in group before/after current to link with */
else {
bActionGroup *grp;
-
+
/* firstly, link this F-Curve to the group */
agrp->channels.first = agrp->channels.last = fcurve;
-
+
/* step through the groups preceding this one, finding the F-Curve there to attach this one after */
for (grp = agrp->prev; grp; grp = grp->prev) {
/* if this group has F-Curves, we want weave the given one in right after the last channel there,
@@ -319,18 +319,18 @@ void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
break;
}
}
-
+
/* if grp is NULL, that means we fell through, and this F-Curve should be added as the new first
- * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the
+ * since group is (effectively) the first group. Thus, the existing first F-Curve becomes the
* second in the chain, etc. etc.
*/
if (grp == NULL)
BLI_insertlinkbefore(&act->curves, act->curves.first, fcurve);
}
-
+
/* set the F-Curve's new group */
fcurve->grp = agrp;
-}
+}
/* Remove the given channel from all groups */
void action_groups_remove_channel(bAction *act, FCurve *fcu)
@@ -338,11 +338,11 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu)
/* sanity checks */
if (ELEM(NULL, act, fcu))
return;
-
+
/* check if any group used this directly */
if (fcu->grp) {
bActionGroup *agrp = fcu->grp;
-
+
if (agrp->channels.first == agrp->channels.last) {
if (agrp->channels.first == fcu) {
BLI_listbase_clear(&agrp->channels);
@@ -360,10 +360,10 @@ void action_groups_remove_channel(bAction *act, FCurve *fcu)
else
agrp->channels.last = NULL;
}
-
+
fcu->grp = NULL;
}
-
+
/* now just remove from list */
BLI_remlink(&act->curves, fcu);
}
@@ -374,7 +374,7 @@ bActionGroup *BKE_action_group_find_name(bAction *act, const char name[])
/* sanity checks */
if (ELEM(NULL, act, act->groups.first, name) || (name[0] == 0))
return NULL;
-
+
/* do string comparisons */
return BLI_findstring(&act->groups, name, offsetof(bActionGroup, name));
}
@@ -383,11 +383,11 @@ bActionGroup *BKE_action_group_find_name(bAction *act, const char name[])
void action_groups_clear_tempflags(bAction *act)
{
bActionGroup *agrp;
-
+
/* sanity checks */
if (ELEM(NULL, act, act->groups.first))
return;
-
+
/* flag clearing loop */
for (agrp = act->groups.first; agrp; agrp = agrp->next)
agrp->flag &= ~AGRP_TEMP;
@@ -403,10 +403,10 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
{
if (ELEM(NULL, pose, name) || (name[0] == '\0'))
return NULL;
-
+
if (pose->chanhash)
return BLI_ghash_lookup(pose->chanhash, (const void *)name);
-
+
return BLI_findstring(&((const bPose *)pose)->chanbase, name, offsetof(bPoseChannel, name));
}
@@ -421,10 +421,10 @@ bPoseChannel *BKE_pose_channel_find_name(const bPose *pose, const char *name)
bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
{
bPoseChannel *chan;
-
+
if (pose == NULL)
return NULL;
-
+
/* See if this channel exists */
chan = BKE_pose_channel_find_name(pose, name);
if (chan) {
@@ -433,7 +433,7 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
/* If not, create it and add it */
chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel");
-
+
BLI_strncpy(chan->name, name, sizeof(chan->name));
chan->custom_scale = 1.0f;
@@ -442,22 +442,22 @@ bPoseChannel *BKE_pose_channel_verify(bPose *pose, const char *name)
unit_qt(chan->quat);
unit_axis_angle(chan->rotAxis, &chan->rotAngle);
chan->size[0] = chan->size[1] = chan->size[2] = 1.0f;
-
+
chan->scaleIn = chan->scaleOut = 1.0f;
-
+
chan->limitmin[0] = chan->limitmin[1] = chan->limitmin[2] = -M_PI;
chan->limitmax[0] = chan->limitmax[1] = chan->limitmax[2] = M_PI;
chan->stiffness[0] = chan->stiffness[1] = chan->stiffness[2] = 0.0f;
chan->ikrotweight = chan->iklinweight = 0.0f;
unit_m4(chan->constinv);
-
+
chan->protectflag = OB_LOCK_ROT4D; /* lock by components by default */
-
+
BLI_addtail(&pose->chanbase, chan);
if (pose->chanhash) {
BLI_ghash_insert(pose->chanhash, chan->name, chan);
}
-
+
return chan;
}
@@ -497,7 +497,7 @@ bPoseChannel *BKE_pose_channel_active(Object *ob)
if ((pchan->bone) && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer))
return pchan;
}
-
+
return NULL;
}
@@ -546,11 +546,11 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
*dst = NULL;
return;
}
-
+
outPose = MEM_callocN(sizeof(bPose), "pose");
-
+
BLI_duplicatelist(&outPose->chanbase, &src->chanbase);
-
+
/* Rebuild ghash here too, so that name lookups below won't be too bad...
* BUT this will have the penalty that the ghash will be built twice
* if BKE_pose_rebuild() gets called after this...
@@ -559,12 +559,12 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
outPose->chanhash = NULL;
BKE_pose_channels_hash_make(outPose);
}
-
+
outPose->iksolver = src->iksolver;
outPose->ikdata = NULL;
outPose->ikparam = MEM_dupallocN(src->ikparam);
outPose->avs = src->avs;
-
+
for (pchan = outPose->chanbase.first; pchan; pchan = pchan->next) {
if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) {
id_us_plus((ID *)pchan->custom);
@@ -588,7 +588,7 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
/* XXX: This is needed for motionpath drawing to work. Dunno why it was setting to null before... */
pchan->mpath = animviz_copy_motionpath(pchan->mpath);
}
-
+
if (pchan->prop) {
pchan->prop = IDP_CopyProperty_ex(pchan->prop, flag);
}
@@ -600,7 +600,7 @@ void BKE_pose_copy_data_ex(bPose **dst, const bPose *src, const int flag, const
if (copy_constraints) {
BLI_duplicatelist(&outPose->agroups, &src->agroups);
}
-
+
*dst = outPose;
}
@@ -648,7 +648,7 @@ static bool pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan, int level)
{
bConstraint *con;
Bone *bone;
-
+
/* No need to check if constraint is active (has influence),
* since all constraints with CONSTRAINT_IK_AUTO are active */
for (con = pchan->constraints.first; con; con = con->next) {
@@ -677,18 +677,18 @@ bool BKE_pose_channel_in_IK_chain(Object *ob, bPoseChannel *pchan)
* Removes the hash for quick lookup of channels, must
* be done when adding/removing channels.
*/
-void BKE_pose_channels_hash_make(bPose *pose)
+void BKE_pose_channels_hash_make(bPose *pose)
{
if (!pose->chanhash) {
bPoseChannel *pchan;
-
+
pose->chanhash = BLI_ghash_str_new("make_pose_chan gh");
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next)
BLI_ghash_insert(pose->chanhash, pchan->name, pchan);
}
}
-void BKE_pose_channels_hash_free(bPose *pose)
+void BKE_pose_channels_hash_free(bPose *pose)
{
if (pose->chanhash) {
BLI_ghash_free(pose->chanhash, NULL, NULL);
@@ -744,7 +744,7 @@ void BKE_pose_channels_remove(
cti->flush_constraint_targets(con, &targets, 0);
}
}
-
+
if (pchan->bbone_prev) {
if (filter_fn(pchan->bbone_prev->name, user_data))
pchan->bbone_prev = NULL;
@@ -753,7 +753,7 @@ void BKE_pose_channels_remove(
if (filter_fn(pchan->bbone_next->name, user_data))
pchan->bbone_next = NULL;
}
-
+
if (pchan->custom_tx) {
if (filter_fn(pchan->custom_tx->name, user_data))
pchan->custom_tx = NULL;
@@ -782,7 +782,7 @@ void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user)
}
BKE_constraints_free_ex(&pchan->constraints, do_id_user);
-
+
if (pchan->prop) {
IDP_FreeProperty(pchan->prop);
MEM_freeN(pchan->prop);
@@ -804,11 +804,11 @@ void BKE_pose_channel_free(bPoseChannel *pchan)
void BKE_pose_channels_free_ex(bPose *pose, bool do_id_user)
{
bPoseChannel *pchan;
-
+
if (pose->chanbase.first) {
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next)
BKE_pose_channel_free_ex(pchan, do_id_user);
-
+
BLI_freelistN(&pose->chanbase);
}
@@ -885,7 +885,7 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
pchan->ikstretch = pchan_from->ikstretch;
pchan->ikrotweight = pchan_from->ikrotweight;
pchan->iklinweight = pchan_from->iklinweight;
-
+
/* bbone settings (typically not animated) */
pchan->bboneflag = pchan_from->bboneflag;
pchan->bbone_next = pchan_from->bbone_next;
@@ -923,31 +923,31 @@ void BKE_pose_update_constraint_flags(bPose *pose)
{
bPoseChannel *pchan, *parchan;
bConstraint *con;
-
+
/* clear */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
pchan->constflag = 0;
}
pose->flag &= ~POSE_CONSTRAINTS_TIMEDEPEND;
-
+
/* detect */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
for (con = pchan->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = (bKinematicConstraint *)con->data;
-
+
pchan->constflag |= PCHAN_HAS_IK;
-
+
if (data->tar == NULL || (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0))
pchan->constflag |= PCHAN_HAS_TARGET;
-
+
/* negative rootbone = recalc rootbone index. used in do_versions */
if (data->rootbone < 0) {
data->rootbone = 0;
-
+
if (data->flag & CONSTRAINT_IK_TIP) parchan = pchan;
else parchan = pchan->parent;
-
+
while (parchan) {
data->rootbone++;
if ((parchan->bone->flag & BONE_CONNECTED) == 0)
@@ -958,10 +958,10 @@ void BKE_pose_update_constraint_flags(bPose *pose)
}
else if (con->type == CONSTRAINT_TYPE_FOLLOWPATH) {
bFollowPathConstraint *data = (bFollowPathConstraint *)con->data;
-
+
/* for drawing constraint colors when color set allows this */
pchan->constflag |= PCHAN_HAS_CONST;
-
+
/* if we have a valid target, make sure that this will get updated on frame-change
* (needed for when there is no anim-data for this pose)
*/
@@ -970,7 +970,7 @@ void BKE_pose_update_constraint_flags(bPose *pose)
}
else if (con->type == CONSTRAINT_TYPE_SPLINEIK)
pchan->constflag |= PCHAN_HAS_SPLINEIK;
- else
+ else
pchan->constflag |= PCHAN_HAS_CONST;
}
}
@@ -982,7 +982,7 @@ void BKE_pose_tag_update_constraint_flags(bPose *pose)
pose->flag |= POSE_CONSTRAINTS_NEED_UPDATE_FLAGS;
}
-/* Clears all BONE_UNKEYED flags for every pose channel in every pose
+/* Clears all BONE_UNKEYED flags for every pose channel in every pose
* This should only be called on frame changing, when it is acceptable to
* do this. Otherwise, these flags should not get cleared as poses may get lost.
*/
@@ -991,14 +991,14 @@ void framechange_poses_clear_unkeyed(Main *bmain)
Object *ob;
bPose *pose;
bPoseChannel *pchan;
-
+
/* This needs to be done for each object that has a pose */
/* TODO: proxies may/may not be correctly handled here... (this needs checking) */
for (ob = bmain->object.first; ob; ob = ob->id.next) {
/* we only need to do this on objects with a pose */
if ((pose = ob->pose)) {
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
- if (pchan->bone)
+ if (pchan->bone)
pchan->bone->flag &= ~BONE_UNKEYED;
}
}
@@ -1011,18 +1011,18 @@ void framechange_poses_clear_unkeyed(Main *bmain)
bActionGroup *BKE_pose_add_group(bPose *pose, const char *name)
{
bActionGroup *grp;
-
+
if (!name) {
name = DATA_("Group");
}
-
+
grp = MEM_callocN(sizeof(bActionGroup), "PoseGroup");
BLI_strncpy(grp->name, name, sizeof(grp->name));
BLI_addtail(&pose->agroups, grp);
BLI_uniquename(&pose->agroups, grp, name, '.', offsetof(bActionGroup, name), sizeof(grp->name));
-
+
pose->active_group = BLI_listbase_count(&pose->agroups);
-
+
return grp;
}
@@ -1032,13 +1032,13 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
{
bPoseChannel *pchan;
int idx = index;
-
+
if (idx < 1) {
idx = BLI_findindex(&pose->agroups, grp) + 1;
}
-
+
BLI_assert(idx > 0);
-
+
/* adjust group references (the trouble of using indices!):
* - firstly, make sure nothing references it
* - also, make sure that those after this item get corrected
@@ -1068,7 +1068,7 @@ void BKE_pose_remove_group(bPose *pose, bActionGroup *grp, const int index)
void BKE_pose_remove_group_index(bPose *pose, const int index)
{
bActionGroup *grp = NULL;
-
+
/* get group to remove */
grp = BLI_findlink(&pose->agroups, index - 1);
if (grp) {
@@ -1082,7 +1082,7 @@ void BKE_pose_remove_group_index(bPose *pose, const int index)
bool action_has_motion(const bAction *act)
{
FCurve *fcu;
-
+
/* return on the first F-Curve that has some keyframes/samples defined */
if (act) {
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
@@ -1090,7 +1090,7 @@ bool action_has_motion(const bAction *act)
return true;
}
}
-
+
/* nothing found */
return false;
}
@@ -1107,7 +1107,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
/* if curve has keyframes, consider them first */
if (fcu->totvert) {
float nmin, nmax;
-
+
/* get extents for this curve
* - no "selected only", since this is often used in the backend
* - no "minimum length" (we will apply this later), otherwise
@@ -1115,26 +1115,26 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
* a phantom frame (T50354)
*/
calc_fcurve_range(fcu, &nmin, &nmax, false, false);
-
+
/* compare to the running tally */
min = min_ff(min, nmin);
max = max_ff(max, nmax);
-
+
foundvert = 1;
}
-
+
/* if incl_modifiers is enabled, need to consider modifiers too
* - only really care about the last modifier
*/
if ((incl_modifiers) && (fcu->modifiers.last)) {
FModifier *fcm = fcu->modifiers.last;
-
+
/* only use the maximum sensible limits of the modifiers if they are more extreme */
switch (fcm->type) {
case FMODIFIER_TYPE_LIMITS: /* Limits F-Modifier */
{
FMod_Limits *fmd = (FMod_Limits *)fcm->data;
-
+
if (fmd->flag & FCM_LIMIT_XMIN) {
min = min_ff(min, fmd->rect.xmin);
}
@@ -1146,7 +1146,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
case FMODIFIER_TYPE_CYCLES: /* Cycles F-Modifier */
{
FMod_Cycles *fmd = (FMod_Cycles *)fcm->data;
-
+
if (fmd->before_mode != FCM_EXTRAPOLATE_NONE)
min = MINAFRAMEF;
if (fmd->after_mode != FCM_EXTRAPOLATE_NONE)
@@ -1154,22 +1154,22 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
break;
}
/* TODO: function modifier may need some special limits */
-
+
default: /* all other standard modifiers are on the infinite range... */
min = MINAFRAMEF;
max = MAXFRAMEF;
break;
}
-
+
foundmod = 1;
}
}
}
-
+
if (foundvert || foundmod) {
/* ensure that action is at least 1 frame long (for NLA strips to have a valid length) */
if (min == max) max += 1.0f;
-
+
*start = min;
*end = max;
}
@@ -1179,7 +1179,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
}
}
-/* Return flags indicating which transforms the given object/posechannel has
+/* Return flags indicating which transforms the given object/posechannel has
* - if 'curves' is provided, a list of links to these curves are also returned
*/
short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan, ListBase *curves)
@@ -1188,7 +1188,7 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
FCurve *fcu;
char *basePath = NULL;
short flags = 0;
-
+
/* build PointerRNA from provided data to obtain the paths to use */
if (pchan)
RNA_pointer_create((ID *)ob, &RNA_PoseBone, pchan, &ptr);
@@ -1196,37 +1196,37 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
RNA_id_pointer_create((ID *)ob, &ptr);
else
return 0;
-
+
/* get the basic path to the properties of interest */
basePath = RNA_path_from_ID_to_struct(&ptr);
if (basePath == NULL)
return 0;
-
- /* search F-Curves for the given properties
+
+ /* search F-Curves for the given properties
* - we cannot use the groups, since they may not be grouped in that way...
*/
for (fcu = act->curves.first; fcu; fcu = fcu->next) {
const char *bPtr = NULL, *pPtr = NULL;
-
+
/* if enough flags have been found, we can stop checking unless we're also getting the curves */
if ((flags == ACT_TRANS_ALL) && (curves == NULL))
break;
-
+
/* just in case... */
if (fcu->rna_path == NULL)
continue;
-
+
/* step 1: check for matching base path */
bPtr = strstr(fcu->rna_path, basePath);
-
+
if (bPtr) {
- /* we must add len(basePath) bytes to the match so that we are at the end of the
+ /* we must add len(basePath) bytes to the match so that we are at the end of the
* base path so that we don't get false positives with these strings in the names
*/
bPtr += strlen(basePath);
-
- /* step 2: check for some property with transforms
- * - to speed things up, only check for the ones not yet found
+
+ /* step 2: check for some property with transforms
+ * - to speed things up, only check for the ones not yet found
* unless we're getting the curves too
* - if we're getting the curves, the BLI_genericNodeN() creates a LinkData
* node wrapping the F-Curve, which then gets added to the list
@@ -1236,53 +1236,53 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
pPtr = strstr(bPtr, "location");
if (pPtr) {
flags |= ACT_TRANS_LOC;
-
- if (curves)
+
+ if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_SCALE) == 0) {
pPtr = strstr(bPtr, "scale");
if (pPtr) {
flags |= ACT_TRANS_SCALE;
-
- if (curves)
+
+ if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_ROT) == 0) {
pPtr = strstr(bPtr, "rotation");
if (pPtr) {
flags |= ACT_TRANS_ROT;
-
- if (curves)
+
+ if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_BBONE) == 0) {
/* bbone shape properties */
pPtr = strstr(bPtr, "bbone_");
if (pPtr) {
flags |= ACT_TRANS_BBONE;
-
+
if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
}
}
-
+
if ((curves) || (flags & ACT_TRANS_PROP) == 0) {
/* custom properties only */
pPtr = strstr(bPtr, "[\""); /* extra '"' comment here to keep my texteditor functionlist working :) */
if (pPtr) {
flags |= ACT_TRANS_PROP;
-
+
if (curves)
BLI_addtail(curves, BLI_genericNodeN(fcu));
continue;
@@ -1290,10 +1290,10 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
}
}
}
-
+
/* free basePath */
MEM_freeN(basePath);
-
+
/* return flags found */
return flags;
}
@@ -1304,26 +1304,26 @@ short action_get_item_transforms(bAction *act, Object *ob, bPoseChannel *pchan,
void BKE_pose_rest(bPose *pose)
{
bPoseChannel *pchan;
-
+
if (!pose)
return;
-
+
memset(pose->stride_offset, 0, sizeof(pose->stride_offset));
memset(pose->cyclic_offset, 0, sizeof(pose->cyclic_offset));
-
+
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
zero_v3(pchan->loc);
zero_v3(pchan->eul);
unit_qt(pchan->quat);
unit_axis_angle(pchan->rotAxis, &pchan->rotAngle);
pchan->size[0] = pchan->size[1] = pchan->size[2] = 1.0f;
-
+
pchan->roll1 = pchan->roll2 = 0.0f;
pchan->curveInX = pchan->curveInY = 0.0f;
pchan->curveOutX = pchan->curveOutY = 0.0f;
pchan->ease1 = pchan->ease2 = 0.0f;
pchan->scaleIn = pchan->scaleOut = 1.0f;
-
+
pchan->flag &= ~(POSE_LOC | POSE_ROT | POSE_SIZE | POSE_BBONE_SHAPE);
}
}
@@ -1332,7 +1332,7 @@ void BKE_pose_rest(bPose *pose)
bool BKE_pose_copy_result(bPose *to, bPose *from)
{
bPoseChannel *pchanto, *pchanfrom;
-
+
if (to == NULL || from == NULL) {
printf("Pose copy error, pose to:%p from:%p\n", (void *)to, (void *)from); /* debug temp */
return false;
@@ -1349,16 +1349,16 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
if (pchanto) {
copy_m4_m4(pchanto->pose_mat, pchanfrom->pose_mat);
copy_m4_m4(pchanto->chan_mat, pchanfrom->chan_mat);
-
+
/* used for local constraints */
copy_v3_v3(pchanto->loc, pchanfrom->loc);
copy_qt_qt(pchanto->quat, pchanfrom->quat);
copy_v3_v3(pchanto->eul, pchanfrom->eul);
copy_v3_v3(pchanto->size, pchanfrom->size);
-
+
copy_v3_v3(pchanto->pose_head, pchanfrom->pose_head);
copy_v3_v3(pchanto->pose_tail, pchanfrom->pose_tail);
-
+
pchanto->roll1 = pchanfrom->roll1;
pchanto->roll2 = pchanfrom->roll2;
pchanto->curveInX = pchanfrom->curveInX;
@@ -1369,7 +1369,7 @@ bool BKE_pose_copy_result(bPose *to, bPose *from)
pchanto->ease2 = pchanfrom->ease2;
pchanto->scaleIn = pchanfrom->scaleIn;
pchanto->scaleOut = pchanfrom->scaleOut;
-
+
pchanto->rotmode = pchanfrom->rotmode;
pchanto->flag = pchanfrom->flag;
pchanto->protectflag = pchanfrom->protectflag;
@@ -1389,27 +1389,27 @@ void BKE_pose_tag_recalc(Main *bmain, bPose *pose)
DEG_relations_tag_update(bmain);
}
-/* For the calculation of the effects of an Action at the given frame on an object
+/* For the calculation of the effects of an Action at the given frame on an object
* This is currently only used for the Action Constraint
*/
void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, char groupname[], float cframe)
{
bActionGroup *agrp = BKE_action_group_find_name(act, groupname);
-
+
/* clear workob */
BKE_object_workob_clear(workob);
-
+
/* init workob */
copy_m4_m4(workob->obmat, ob->obmat);
copy_m4_m4(workob->parentinv, ob->parentinv);
copy_m4_m4(workob->constinv, ob->constinv);
workob->parent = ob->parent;
-
+
workob->rotmode = ob->rotmode;
-
+
workob->trackflag = ob->trackflag;
workob->upflag = ob->upflag;
-
+
workob->partype = ob->partype;
workob->par1 = ob->par1;
workob->par2 = ob->par2;
@@ -1417,7 +1417,7 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
workob->constraints.first = ob->constraints.first;
workob->constraints.last = ob->constraints.last;
-
+
workob->pose = pose; /* need to set pose too, since this is used for both types of Action Constraint */
if (pose) {
/* This function is most likely to be used with a temporary pose with a single bone in there.
@@ -1434,27 +1434,27 @@ void what_does_obaction(Object *ob, Object *workob, bPose *pose, bAction *act, c
BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr));
BLI_strncpy(workob->id.name, "OB<ConstrWorkOb>", sizeof(workob->id.name)); /* we don't use real object name, otherwise RNA screws with the real thing */
-
+
/* if we're given a group to use, it's likely to be more efficient (though a bit more dangerous) */
if (agrp) {
/* specifically evaluate this group only */
PointerRNA id_ptr;
-
+
/* get RNA-pointer for the workob's ID */
RNA_id_pointer_create(&workob->id, &id_ptr);
-
+
/* execute action for this group only */
animsys_evaluate_action_group(&id_ptr, act, agrp, NULL, cframe);
}
else {
AnimData adt = {NULL};
-
+
/* init animdata, and attach to workob */
workob->adt = &adt;
-
+
adt.recalc = ADT_RECALC_ANIM;
adt.action = act;
-
+
/* execute effects of Action on to workob (or it's PoseChannels) */
BKE_animsys_evaluate_animdata(NULL, NULL, &workob->id, &adt, cframe, ADT_RECALC_ANIM);
}