4 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version. The Blender
10 * Foundation also sells licenses for use in proprietary software under
11 * the Blender License. See http://www.blender.org/BL/ for information
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24 * All rights reserved.
26 * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
28 * ***** END GPL/BL DUAL LICENSE BLOCK *****
37 #include <stdlib.h> /* for NULL */
39 #include "MEM_guardedalloc.h"
41 #include "DNA_action_types.h"
42 #include "DNA_armature_types.h"
43 #include "DNA_constraint_types.h"
44 #include "DNA_curve_types.h"
45 #include "DNA_ipo_types.h"
46 #include "DNA_key_types.h"
47 #include "DNA_nla_types.h"
48 #include "DNA_object_types.h"
49 #include "DNA_scene_types.h"
51 #include "BKE_action.h"
53 #include "BKE_armature.h"
54 #include "BKE_blender.h"
55 #include "BKE_constraint.h"
56 #include "BKE_displist.h"
57 #include "BKE_global.h"
60 #include "BKE_library.h"
62 #include "BKE_object.h"
63 #include "BKE_utildefines.h"
65 #include "BLI_arithb.h"
66 #include "BLI_blenlib.h"
71 /* *********************** NOTE ON POSE AND ACTION **********************
73 - Pose is the local (object level) component of armature. The current
74 object pose is saved in files, and (will be) is presorted for dependency
75 - Actions have fewer (or other) channels, and write data to a Pose
76 - Currently ob->pose data is controlled in where_is_pose only. The (recalc)
77 event system takes care of calling that
78 - The NLA system (here too) uses Poses as interpolation format for Actions
79 - Therefore we assume poses to be static, and duplicates of poses have channels in
80 same order, for quick interpolation reasons
82 ****************************** (ton) ************************************ */
84 /* ***************** Library data level operations on action ************** */
86 void make_local_action(bAction *act)
92 if(act->id.lib==0) return;
95 act->id.flag= LIB_LOCAL;
96 new_id(0, (ID *)act, 0);
100 ob= G.main->object.first;
102 if(ob->action==act) {
103 if(ob->id.lib) lib= 1;
109 if(local && lib==0) {
111 act->id.flag= LIB_LOCAL;
112 new_id(0, (ID *)act, 0);
114 else if(local && lib) {
115 actn= copy_action(act);
118 ob= G.main->object.first;
120 if(ob->action==act) {
134 void free_action(bAction *act)
136 bActionChannel *chan;
139 for (chan=act->chanbase.first; chan; chan=chan->next){
142 free_constraint_channels(&chan->constraintChannels);
145 if (act->chanbase.first)
146 BLI_freelistN (&act->chanbase);
149 bAction* copy_action(bAction *src)
152 bActionChannel *dchan, *schan;
154 if(!src) return NULL;
156 dst= copy_libblock(src);
157 duplicatelist(&(dst->chanbase), &(src->chanbase));
159 for (dchan=dst->chanbase.first, schan=src->chanbase.first; dchan; dchan=dchan->next, schan=schan->next){
160 dchan->ipo = copy_ipo(dchan->ipo);
161 copy_constraint_channels(&dchan->constraintChannels, &schan->constraintChannels);
163 dst->id.flag |= LIB_FAKEUSER;
170 /* ************************ Pose channels *************** */
172 /* usually used within a loop, so we got a N^2 slowdown */
173 bPoseChannel *get_pose_channel(const bPose *pose, const char *name)
177 if(pose==NULL) return NULL;
179 for (chan=pose->chanbase.first; chan; chan=chan->next) {
180 if(chan->name[0] == name[0])
181 if (!strcmp (chan->name, name))
188 /* Use with care, not on Armature poses but for temporal ones */
189 /* (currently used for action constraints and in rebuild_pose) */
190 bPoseChannel *verify_pose_channel(bPose* pose, const char* name)
198 /* See if this channel exists */
199 for (chan=pose->chanbase.first; chan; chan=chan->next){
200 if (!strcmp (name, chan->name))
204 /* If not, create it and add it */
205 chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel");
207 strncpy (chan->name, name, 31);
208 /* init vars to prevent mat errors */
209 chan->quat[0] = 1.0F;
210 chan->size[0] = chan->size[1] = chan->size[2] = 1.0F;
212 chan->limitmin[0]= chan->limitmin[1]= chan->limitmin[2]= -180.0f;
213 chan->limitmax[0]= chan->limitmax[1]= chan->limitmax[2]= 180.0f;
214 chan->stiffness[0]= chan->stiffness[1]= chan->stiffness[2]= 0.0f;
216 BLI_addtail (&pose->chanbase, chan);
222 /* dst should be freed already, makes entire duplicate */
223 void copy_pose(bPose **dst, bPose *src, int copycon)
234 outPose= MEM_callocN(sizeof(bPose), "pose");
236 duplicatelist (&outPose->chanbase, &src->chanbase);
239 for (pchan=outPose->chanbase.first; pchan; pchan=pchan->next) {
240 copy_constraints(&listb, &pchan->constraints); // copy_constraints NULLs listb
241 pchan->constraints= listb;
249 void free_pose_channels(bPose *pose)
253 if (pose->chanbase.first){
254 for (pchan = pose->chanbase.first; pchan; pchan=pchan->next){
256 MEM_freeN(pchan->path);
257 free_constraints(&pchan->constraints);
259 BLI_freelistN (&pose->chanbase);
263 static void copy_pose_channel_data(bPoseChannel *pchan, const bPoseChannel *chan)
265 bConstraint *pcon, *con;
267 VECCOPY(pchan->loc, chan->loc);
268 VECCOPY(pchan->size, chan->size);
269 QUATCOPY(pchan->quat, chan->quat);
270 pchan->flag= chan->flag;
272 con= chan->constraints.first;
273 for(pcon= pchan->constraints.first; pcon; pcon= pcon->next)
274 pcon->enforce= con->enforce;
277 /* checks for IK constraint, can do more constraints flags later */
278 /* pose should be entirely OK */
279 void update_pose_constraint_flags(bPose *pose)
281 bPoseChannel *pchan, *parchan;
285 for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
289 for (pchan = pose->chanbase.first; pchan; pchan=pchan->next) {
290 for(con= pchan->constraints.first; con; con= con->next) {
291 if(con->type==CONSTRAINT_TYPE_KINEMATIC) {
292 bKinematicConstraint *data = (bKinematicConstraint*)con->data;
294 pchan->constflag |= PCHAN_HAS_IK;
296 if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0))
297 pchan->constflag |= PCHAN_HAS_TARGET;
299 /* negative rootbone = recalc rootbone index. used in do_versions */
300 if(data->rootbone<0) {
303 if(data->flag & CONSTRAINT_IK_TIP) parchan= pchan;
304 else parchan= pchan->parent;
308 if((parchan->bone->flag & BONE_CONNECTED)==0)
310 parchan= parchan->parent;
314 else pchan->constflag |= PCHAN_HAS_CONST;
320 /* ************************ END Pose channels *************** */
322 /* ************************ Action channels *************** */
325 bActionChannel *get_action_channel(bAction *act, const char *name)
327 bActionChannel *chan;
332 for (chan = act->chanbase.first; chan; chan=chan->next){
333 if (!strcmp (chan->name, name))
340 /* returns existing channel, or adds new one. In latter case it doesnt activate it, context is required for that*/
341 bActionChannel *verify_action_channel(bAction *act, const char *name)
343 bActionChannel *chan;
345 chan= get_action_channel(act, name);
348 chan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
349 strncpy (chan->name, name, 31);
350 BLI_addtail (&act->chanbase, chan);
356 /* ************************ Blending with NLA *************** */
358 static void blend_pose_strides(bPose *dst, bPose *src, float srcweight, short mode)
364 dstweight = 1.0F - srcweight;
373 VecLerpf(dst->stride_offset, dst->stride_offset, src->stride_offset, srcweight);
376 /* Only allowed for Poses with identical channels */
377 void blend_poses(bPose *dst, bPose *src, float srcweight, short mode)
380 const bPoseChannel *schan;
381 bConstraint *dcon, *scon;
382 float dquat[4], squat[4];
388 dstweight = 1.0F - srcweight;
397 schan= src->chanbase.first;
398 for (dchan = dst->chanbase.first; dchan; dchan=dchan->next, schan= schan->next){
399 if (schan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE)) {
400 /* replaced quat->matrix->quat conversion with decent quaternion interpol (ton) */
402 /* Do the transformation blend */
403 if (schan->flag & POSE_ROT) {
404 QUATCOPY(dquat, dchan->quat);
405 QUATCOPY(squat, schan->quat);
407 QuatInterpol(dchan->quat, dquat, squat, srcweight);
409 QuatAdd(dchan->quat, dquat, squat, srcweight);
411 NormalQuat (dchan->quat);
415 if (schan->flag & POSE_LOC)
416 dchan->loc[i] = (dchan->loc[i]*dstweight) + (schan->loc[i]*srcweight);
417 if (schan->flag & POSE_SIZE)
418 dchan->size[i] = 1.0f + ((dchan->size[i]-1.0f)*dstweight) + ((schan->size[i]-1.0f)*srcweight);
420 dchan->flag |= schan->flag;
422 for(dcon= dchan->constraints.first, scon= schan->constraints.first; dcon && scon; dcon= dcon->next, scon= scon->next) {
423 /* no 'add' option for constraint blending */
424 dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight;
430 void calc_action_range(const bAction *act, float *start, float *end)
432 const bActionChannel *chan;
433 const bConstraintChannel *conchan;
435 float min=999999999.0f, max=-999999999.0;
439 for (chan=act->chanbase.first; chan; chan=chan->next) {
441 for (icu=chan->ipo->curve.first; icu; icu=icu->next) {
443 min= MIN2 (min, icu->bezt[0].vec[1][0]);
444 max= MAX2 (max, icu->bezt[icu->totvert-1].vec[1][0]);
449 for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
451 for (icu=conchan->ipo->curve.first; icu; icu=icu->next) {
453 min= MIN2 (min, icu->bezt[0].vec[1][0]);
454 max= MAX2 (max, icu->bezt[icu->totvert-1].vec[1][0]);
463 if(min==max) max+= 1.0f;
473 /* Copy the data from the action-pose (src) into the pose */
474 /* both args are assumed to be valid */
475 /* exported to game engine */
476 void extract_pose_from_pose(bPose *pose, const bPose *src)
478 const bPoseChannel *schan;
479 bPoseChannel *pchan= pose->chanbase.first;
481 for (schan=src->chanbase.first; schan; schan=schan->next, pchan= pchan->next) {
482 copy_pose_channel_data(pchan, schan);
486 /* Pose should exist, can have any number of channels too (used for constraint) */
487 void extract_pose_from_action(bPose *pose, bAction *act, float ctime)
489 bActionChannel *achan;
498 /* Copy the data from the action into the pose */
499 for (pchan= pose->chanbase.first; pchan; pchan=pchan->next) {
500 achan= get_action_channel(act, pchan->name);
501 pchan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE);
505 /* Evaluates and sets the internal ipo value */
506 calc_ipo(ipo, ctime);
507 /* This call also sets the pchan flags */
508 execute_action_ipo(achan, pchan);
510 do_constraint_channels(&pchan->constraints, &achan->constraintChannels, ctime);
515 /* for do_all_pose_actions, clears the pose */
516 static void rest_pose(bPose *pose)
524 pose->stride_offset[0]= 0.0f;
525 pose->stride_offset[1]= 0.0f;
526 pose->stride_offset[2]= 0.0f;
528 for (pchan=pose->chanbase.first; pchan; pchan=pchan->next){
531 pchan->quat[i+1]=0.0;
536 pchan->flag &= ~(POSE_LOC|POSE_ROT|POSE_SIZE);
540 /* ********** NLA with non-poses works with ipo channels ********** */
542 typedef struct NlaIpoChannel {
543 struct NlaIpoChannel *next, *prev;
549 static void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, char *name, float ctime)
551 bActionChannel *achan= get_action_channel(act, name);
555 if(achan==NULL) return;
558 calc_ipo(achan->ipo, ctime);
560 for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
562 nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel");
563 BLI_addtail(lb, nic);
564 nic->val= icu->curval;
565 nic->poin= get_ipo_poin(id, icu, &nic->type);
569 /* constraint channels only for objects */
570 if(GS(id->name)==ID_OB) {
571 Object *ob= (Object *)id;
573 bConstraintChannel *conchan;
575 for (con=ob->constraints.first; con; con=con->next) {
576 conchan = get_constraint_channel(&achan->constraintChannels, con->name);
578 if(conchan && conchan->ipo) {
579 calc_ipo(conchan->ipo, ctime);
581 icu= conchan->ipo->curve.first; // only one ipo now
583 nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel constr");
584 BLI_addtail(lb, nic);
585 nic->val= icu->curval;
586 nic->poin= &con->enforce;
587 nic->type= IPO_FLOAT;
594 static NlaIpoChannel *find_nla_ipochannel(ListBase *lb, void *poin)
599 for(nic= lb->first; nic; nic= nic->next) {
608 static void blend_ipochannels(ListBase *dst, ListBase *src, float srcweight, int mode)
610 NlaIpoChannel *snic, *dnic, *next;
615 dstweight = 1.0F - srcweight;
624 for(snic= src->first; snic; snic= next) {
627 dnic= find_nla_ipochannel(dst, snic->poin);
629 /* remove from src list, and insert in dest */
630 BLI_remlink(src, snic);
631 BLI_addtail(dst, snic);
634 /* we do the blend */
635 dnic->val= dstweight*dnic->val + srcweight*snic->val;
640 static void execute_ipochannels(ListBase *lb)
644 for(nic= lb->first; nic; nic= nic->next) {
646 write_ipo_poin(nic->poin, nic->type, nic->val);
652 /* ************** time ****************** */
654 static bActionStrip *get_active_strip(Object *ob)
661 for (strip=ob->nlastrips.first; strip; strip=strip->next)
662 if(strip->flag & ACTSTRIP_ACTIVE)
665 if(strip && strip->act==ob->action)
670 /* non clipped mapping of strip */
671 static float get_actionstrip_frame(bActionStrip *strip, float cframe, int invert)
673 float length, actlength, repeat;
675 if (strip->flag & ACTSTRIP_USESTRIDE)
678 repeat= strip->repeat;
680 length = strip->end-strip->start;
683 actlength = strip->actend-strip->actstart;
688 return length*(cframe - strip->actstart)/(repeat*actlength) + strip->start;
690 return repeat*actlength*(cframe - strip->start)/length + strip->actstart;
693 /* if the conditions match, it converts current time to strip time */
694 float get_action_frame(Object *ob, float cframe)
696 bActionStrip *strip= get_active_strip(ob);
699 return get_actionstrip_frame(strip, cframe, 0);
703 /* inverted, strip time to current time */
704 float get_action_frame_inv(Object *ob, float cframe)
706 bActionStrip *strip= get_active_strip(ob);
709 return get_actionstrip_frame(strip, cframe, 1);
715 /* this now only used for repeating cycles, to enable fields and blur. */
716 /* the whole time control in blender needs serious thinking... */
717 static float nla_time(float cfra, float unit)
719 extern float bluroffs; // bad construct, borrowed from object.c for now
722 if(R.flag & R_SEC_FIELD) {
723 if(R.r.mode & R_FIELDSTILL); else cfra+= 0.5f*unit;
727 cfra+= unit*bluroffs;
730 cfra*= G.scene->r.framelen;
733 /* decide later... */
734 // if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra);
739 static float stridechannel_frame(Object *ob, bActionStrip *strip, Path *path, float pathdist, float *stride_offset)
741 bAction *act= strip->act;
742 char *name= strip->stridechannel;
743 bActionChannel *achan= get_action_channel(act, name);
744 int stride_axis= strip->stride_axis;
746 if(achan && achan->ipo) {
748 float minx=0.0f, maxx=0.0f, miny=0.0f, maxy=0.0f;
751 if(stride_axis==0) stride_axis= AC_LOC_X;
752 else if(stride_axis==1) stride_axis= AC_LOC_Y;
753 else stride_axis= AC_LOC_Z;
755 /* calculate the min/max */
756 for (icu=achan->ipo->curve.first; icu; icu=icu->next) {
757 if(icu->adrcode==stride_axis) {
760 minx= icu->bezt[0].vec[1][0];
761 maxx= icu->bezt[icu->totvert-1].vec[1][0];
763 miny= icu->bezt[0].vec[1][1];
764 maxy= icu->bezt[icu->totvert-1].vec[1][1];
770 if(foundvert && miny!=maxy) {
771 float stridelen= fabs(maxy-miny), striptime;
772 float actiondist, pdist, pdistNewNormalized;
773 float vec1[4], vec2[4], dir[3];
775 /* amount path moves object */
776 pdist = (float)fmod (pathdist, stridelen);
777 striptime= pdist/stridelen;
779 /* amount stride bone moves */
780 actiondist= eval_icu(icu, minx + striptime*(maxx-minx)) - miny;
782 pdist = fabs(actiondist) - pdist;
783 pdistNewNormalized = (pathdist+pdist)/path->totdist;
785 /* now we need to go pdist further (or less) on cu path */
786 where_on_path(ob, (pathdist)/path->totdist, vec1, dir); /* vec needs size 4 */
787 if (pdistNewNormalized <= 1) {
788 // search for correction in positive path-direction
789 where_on_path(ob, pdistNewNormalized, vec2, dir); /* vec needs size 4 */
790 VecSubf(stride_offset, vec2, vec1);
793 // we reached the end of the path, search backwards instead
794 where_on_path(ob, (pathdist-pdist)/path->totdist, vec2, dir); /* vec needs size 4 */
795 VecSubf(stride_offset, vec1, vec2);
797 Mat4Mul3Vecfl(ob->obmat, stride_offset);
804 /* ************** do the action ************ */
806 static void do_nla(Object *ob, int blocktype)
810 ListBase tchanbase={NULL, NULL}, chanbase={NULL, NULL};
812 float striptime, frametime, length, actlength;
813 float blendfac, stripframe;
816 if(blocktype==ID_AR) {
817 copy_pose(&tpose, ob->pose, 1);
818 rest_pose(ob->pose); // potentially destroying current not-keyed pose
824 for (strip=ob->nlastrips.first; strip; strip=strip->next){
827 if (strip->act){ /* so theres an action */
829 /* Determine if the current frame is within the strip's range */
830 length = strip->end-strip->start;
831 actlength = strip->actend-strip->actstart;
832 striptime = (G.scene->r.cfra-(strip->start)) / length;
833 stripframe = (G.scene->r.cfra-(strip->start)) ;
841 if ((strip->flag & ACTSTRIP_USESTRIDE) && (blocktype==ID_AR) && (ob->ipoflag & OB_DISABLE_PATH)==0){
842 if (ob->parent && ob->parent->type==OB_CURVE){
843 Curve *cu = ob->parent->data;
846 if (cu->flag & CU_PATH){
847 /* Ensure we have a valid path */
848 if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(ob->parent, 0);
851 /* Find the position on the path */
852 ctime= bsystem_time(ob, ob->parent, (float)G.scene->r.cfra, 0.0);
854 if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
855 ctime /= cu->pathlen;
856 CLAMP(ctime, 0.0, 1.0);
858 pdist = ctime*cu->path->totdist;
860 if(tpose && strip->stridechannel[0]) {
861 striptime= stridechannel_frame(ob->parent, strip, cu->path, pdist, tpose->stride_offset);
864 if (strip->stridelen) {
865 striptime = pdist / strip->stridelen;
866 striptime = (float)fmod (striptime, 1.0);
872 frametime = (striptime * actlength) + strip->actstart;
873 frametime= bsystem_time(ob, 0, frametime, 0.0);
875 if(blocktype==ID_AR) {
876 extract_pose_from_action (tpose, strip->act, frametime);
878 else if(blocktype==ID_OB) {
879 extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
881 extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
888 /* Handle repeat, we add 0.1 frame extra to make sure the last frame is included */
889 else if (striptime < 1.0f + 0.1f/length) {
892 if(strip->repeat!=1.0f) {
893 striptime*= strip->repeat;
894 striptime = (float)fmod (striptime, 1.0f + 0.1f/length);
897 frametime = (striptime * actlength) + strip->actstart;
898 frametime= nla_time(frametime, (float)strip->repeat);
901 extract_pose_from_action (tpose, strip->act, frametime);
902 else if(blocktype==ID_OB) {
903 extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
905 extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
911 if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
912 /* we want the strip to hold on the exact fraction of the repeat value */
914 frametime = actlength * (strip->repeat-(int)strip->repeat);
915 if(frametime<=0.000001f) frametime= actlength; /* rounding errors... */
916 frametime= bsystem_time(ob, 0, frametime+strip->actstart, 0.0);
919 extract_pose_from_action (tpose, strip->act, frametime);
920 else if(blocktype==ID_OB) {
921 extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", frametime);
923 extract_ipochannels_from_action(&tchanbase, &key->id, strip->act, "Shape", frametime);
929 /* Handle blendin & blendout */
933 if (strip->blendin>0.0 && stripframe<=strip->blendin && G.scene->r.cfra>=strip->start){
934 blendfac = stripframe/strip->blendin;
936 else if (strip->blendout>0.0 && stripframe>=(length-strip->blendout) && G.scene->r.cfra<=strip->end){
937 blendfac = (length-stripframe)/(strip->blendout);
942 if(blocktype==ID_AR) {/* Blend this pose with the accumulated pose */
943 blend_poses (ob->pose, tpose, blendfac, strip->mode);
945 blend_pose_strides (ob->pose, tpose, blendfac, strip->mode);
948 blend_ipochannels(&chanbase, &tchanbase, blendfac, strip->mode);
949 BLI_freelistN(&tchanbase);
956 if(blocktype==ID_OB) {
957 execute_ipochannels(&chanbase);
959 else if(blocktype==ID_AR) {
960 /* apply stride offset to object */
961 VecAddf(ob->obmat[3], ob->obmat[3], ob->pose->stride_offset);
966 free_pose_channels(tpose);
970 BLI_freelistN(&chanbase);
974 void do_all_pose_actions(Object *ob)
977 // only to have safe calls from editor
979 if(ob->type!=OB_ARMATURE || ob->pose==NULL) return;
981 if(ob->pose->flag & POSE_LOCKED) { // no actions to execute while transform
982 if(ob->pose->flag & POSE_DO_UNLOCK)
983 ob->pose->flag &= ~(POSE_LOCKED|POSE_DO_UNLOCK);
985 else if(ob->action && ((ob->nlaflag & OB_NLA_OVERRIDE)==0 || ob->nlastrips.first==NULL) ) {
986 float cframe= (float) G.scene->r.cfra;
988 cframe= get_action_frame(ob, cframe);
990 extract_pose_from_action (ob->pose, ob->action, bsystem_time(ob, 0, cframe, 0.0));
992 else if(ob->nlastrips.first) {
997 /* called from where_is_object */
998 void do_all_object_actions(Object *ob)
1000 if(ob==NULL) return;
1001 if(ob->dup_group) return; /* prevent conflicts, might add smarter check later */
1003 /* Do local action */
1004 if(ob->action && ((ob->nlaflag & OB_NLA_OVERRIDE)==0 || ob->nlastrips.first==NULL) ) {
1005 ListBase tchanbase= {NULL, NULL};
1006 Key *key= ob_get_key(ob);
1007 float cframe= (float) G.scene->r.cfra;
1009 cframe= get_action_frame(ob, cframe);
1011 extract_ipochannels_from_action(&tchanbase, &ob->id, ob->action, "Object", bsystem_time(ob, 0, cframe, 0.0));
1013 extract_ipochannels_from_action(&tchanbase, &key->id, ob->action, "Shape", bsystem_time(ob, 0, cframe, 0.0));
1015 if(tchanbase.first) {
1016 execute_ipochannels(&tchanbase);
1017 BLI_freelistN(&tchanbase);
1020 else if(ob->nlastrips.first) {