Stupid me! Committed in wrong console with wrong dir... here's the rest of
authorTon Roosendaal <ton@blender.org>
Mon, 10 Oct 2005 18:05:30 +0000 (18:05 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 10 Oct 2005 18:05:30 +0000 (18:05 +0000)
all files for the Ipo/Action/NLA makeover...

36 files changed:
source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/BKE_constraint.h
source/blender/blenkernel/BKE_ipo.h
source/blender/blenkernel/bad_level_call_stubs/stubs.c
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/constraint.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/effect.c
source/blender/blenkernel/intern/ipo.c
source/blender/blenkernel/intern/object.c
source/blender/include/BDR_drawaction.h
source/blender/include/BIF_editaction.h
source/blender/include/BIF_editconstraint.h
source/blender/include/BIF_editnla.h
source/blender/include/BIF_glutil.h
source/blender/include/BIF_resources.h
source/blender/include/BSE_drawnla.h
source/blender/include/BSE_editipo.h
source/blender/include/BSE_editnla_types.h
source/blender/include/BSE_headerbuttons.h
source/blender/include/blendef.h
source/blender/makesdna/DNA_ID.h
source/blender/makesdna/DNA_action_types.h
source/blender/makesdna/DNA_nla_types.h
source/blender/makesdna/DNA_object_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/python/api2_2x/Bone.c
source/blender/python/api2_2x/Camera.c
source/blender/python/api2_2x/Ipo.c
source/blender/python/api2_2x/Ipocurve.c
source/blender/python/api2_2x/Lamp.c
source/blender/python/api2_2x/Material.c
source/blender/python/api2_2x/NLA.c
source/blender/python/api2_2x/Object.c
source/blender/python/api2_2x/World.c

index 5b8c8c1a929c46b60f7c1056b4f9e3e662fd8c7b..21e7b2f7fc062df47db686a125cf4ba1eed15296 100644 (file)
@@ -75,8 +75,13 @@ void free_action(struct bAction * id);
 
 void make_local_action(struct bAction *act);
 
-/* if NULL it does all, otherwise only from Object */
-void do_all_actions(struct Object *);
+/* only for armatures, doing pose actions only too */
+void do_all_pose_actions(struct Object *);
+/* only for objects, doing only 1 channel */
+void do_all_object_actions(struct Object *);
+/* only for Mesh, Curve, Surface, Lattice, doing only Shape channel */
+void do_all_shape_actions(struct Object *);
+
 
 /**
  * Return a pointer to the pose channel of the given name
@@ -121,13 +126,20 @@ void extract_pose_from_action(struct bPose *pose, struct bAction *act,
  * and return the channel with the given name.
  * Returns NULL if no channel.
  */
-struct bActionChannel *get_named_actionchannel(struct bAction *act,
-                                                                                          const char *name);
+struct bActionChannel *get_action_channel(struct bAction *act,  const char *name);
+/**
+ * Iterate through the action channels of the action
+ * and return the channel with the given name.
+ * Returns and adds new channel if no channel.
+ */
+struct bActionChannel *verify_action_channel(struct bAction *act, const char *name);
 
-// exported for game engine
+/* exported for game engine */
 void blend_poses(struct bPose *dst, const struct bPose *src, float srcweight, short mode);
 void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
 
+/* map global time (frame nr) to strip converted time, doesn't clip */
+float get_action_frame(struct Object *ob, float cframe);
 
 #ifdef __cplusplus
 };
index fc45daf455fd1f78adb80306f449ef6babaf81b1..2bec643d5b00a9b9a0cc002cf585e10bc119a87e 100644 (file)
@@ -51,13 +51,14 @@ void clone_constraint_channels (struct ListBase *dst, struct ListBase *src);
 void relink_constraints (struct ListBase *list);
 void free_constraint_data (struct bConstraint *con);
 
-void do_constraint_channels (struct ListBase *conbase, struct ListBase *chanbase, float ctime);
-short get_constraint_target_matrix (struct bConstraint *con, short ownertype, void *ownerdata, float mat[][4], float size[3], float time);
-struct bConstraintChannel *find_constraint_channel (ListBase *list, const char *name);
+/* channels */
+struct bConstraintChannel *get_constraint_channel (ListBase *list, const char *name);
+struct bConstraintChannel *verify_constraint_channel (ListBase *list, const char *name);
 void free_constraint_channels (ListBase *chanbase);
 
 /* Gemeric functions */
-
+void do_constraint_channels (struct ListBase *conbase, struct ListBase *chanbase, float ctime);
+short get_constraint_target_matrix (struct bConstraint *con, short ownertype, void *ownerdata, float mat[][4], float size[3], float time);
 char constraint_has_target (struct bConstraint *con);
 struct Object *get_constraint_target(struct bConstraint *con, char **subtarget);
 void set_constraint_target(struct bConstraint *con, struct Object *ob, char *subtarget);
index 6acbceb8e3f08a3e9ef90dc624035d0af4fac3f1..a1fb24ae9b2681309fbf96cfb96d750206d4238c 100644 (file)
@@ -49,13 +49,15 @@ struct Sequence;
 struct ListBase;
 struct BezTriple;
 struct ID;
-/*  struct IPO_Channel; */
+struct bPoseChannel;
+struct bActionChannel;
+struct rctf;
 
 float frame_to_float(int cfra);
 
 void free_ipo_curve(struct IpoCurve *icu);
 void free_ipo(struct Ipo *ipo);
-
+void ipo_default_v2d_cur(int blocktype, struct rctf *cur);
 struct Ipo *add_ipo(char *name, int idcode);
 struct Ipo *copy_ipo(struct Ipo *ipo);
 void make_local_obipo(struct Ipo *ipo);
@@ -79,9 +81,14 @@ void calc_ipo(struct Ipo *ipo, float ctime);
 void write_ipo_poin(void *poin, int type, float val);
 float read_ipo_poin(void *poin, int type);
 void *give_mtex_poin(struct MTex *mtex, int adrcode );
+
 void *get_ipo_poin(struct ID *id, struct IpoCurve *icu, int *type);
+void *get_pchan_ipo_poin(struct bPoseChannel *pchan, int adrcode);
+
 void set_icu_vars(struct IpoCurve *icu);
+
 void execute_ipo(struct ID *id, struct Ipo *ipo);
+void execute_action_ipo(struct bActionChannel *achan, struct bPoseChannel *pchan);
 
 void do_ipo_nocalc(struct Ipo *ipo);
 void do_ipo(struct Ipo *ipo);
@@ -96,9 +103,9 @@ int calc_ipo_spec(struct Ipo *ipo, int adrcode, float *ctime);
 void clear_delta_obipo(struct Ipo *ipo);
 void add_to_cfra_elem(struct ListBase *lb, struct BezTriple *bezt);
 void make_cfra_list(struct Ipo *ipo, struct ListBase *elems);
+
 /* the sort is an IPO_Channel... */
 int IPO_GetChannels(struct Ipo *ipo, short *channels);
-void test_ipo_get(void);                             
 
 float IPO_GetFloatValue(struct Ipo *ipo,
 /*                                             struct IPO_Channel channel, */
index f5d06fc5a7eb488a8881c85ba01d74a708ceab0b..706c998034424fb75e4dd7339bbce7e2eaf1957a 100644 (file)
@@ -61,11 +61,6 @@ char* getIpoCurveName( struct IpoCurve * icu )
        return 0;
 };
 
-struct IpoCurve *get_ipocurve(struct ID *from, short type, int adrcode, struct Ipo *useipo)
-{
-       return 0;
-}
-
 void insert_vert_ipo(struct IpoCurve *icu, float x, float y)
 {
 
index 2df93f47e2ace3ff815686f7d6151c24aee083f2..276f5ecdcec5f3122b0eb451af69be23ecf33870 100644 (file)
@@ -310,7 +310,10 @@ void update_pose_constraint_flags(bPose *pose)
 
 /* ************************ END Pose channels *************** */
 
-bActionChannel *get_named_actionchannel(bAction *act, const char *name)
+/* ************************ Action channels *************** */
+
+
+bActionChannel *get_action_channel(bAction *act, const char *name)
 {
        bActionChannel *chan;
        
@@ -325,6 +328,22 @@ bActionChannel *get_named_actionchannel(bAction *act, const char *name)
        return NULL;
 }
 
+/* returns existing channel, or adds new one. In latter case it doesnt activate it, context is required for that*/
+bActionChannel *verify_action_channel(bAction *act, const char *name)
+{
+       bActionChannel *chan;
+       
+       chan= get_action_channel(act, name);
+       if(chan==NULL) {
+               if (!chan) {
+                       chan = MEM_callocN (sizeof(bActionChannel), "actionChannel");
+                       strcpy (chan->name, name);
+                       BLI_addtail (&act->chanbase, chan);
+               }
+       }
+       return chan;
+}
+
 /* ************************ Blending with NLA *************** */
 
 
@@ -395,20 +414,25 @@ float calc_action_start(const bAction *act)
        if (!act)
                return 0;
 
-       for (chan=act->chanbase.first; chan; chan=chan->next){
-               for (icu=chan->ipo->curve.first; icu; icu=icu->next)
-                       for (i=0; i<icu->totvert; i++){
-                               size = MIN2 (size, icu->bezt[i].vec[1][0]);
-                               foundvert=1;
-                               
+       for (chan=act->chanbase.first; chan; chan=chan->next) {
+               if(chan->ipo) {
+                       for (icu=chan->ipo->curve.first; icu; icu=icu->next) {
+                               for (i=0; i<icu->totvert; i++){
+                                       size = MIN2 (size, icu->bezt[i].vec[1][0]);
+                                       foundvert=1;
+                               }
                        }
-                       for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
-                               for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
+               }
+               for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
+                       if(conchan->ipo) {
+                               for (icu=conchan->ipo->curve.first; icu; icu=icu->next) {
                                        for (i=0; i<icu->totvert; i++){
                                                size = MIN2 (size, icu->bezt[i].vec[1][0]);
                                                foundvert=1;
                                        }
+                               }
                        }
+               }
        }
        
        if (!foundvert)
@@ -428,16 +452,20 @@ float calc_action_end(const bAction *act)
        if (!act)
                return 0;
 
-       for (chan=act->chanbase.first; chan; chan=chan->next){
-               for (icu=chan->ipo->curve.first; icu; icu=icu->next)
-                       for (i=0; i<icu->totvert; i++)
-                               size = MAX2 (size, icu->bezt[i].vec[1][0]);
-                       
-                       for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
+       for (chan=act->chanbase.first; chan; chan=chan->next) {
+               if(chan->ipo) {
+                       for (icu=chan->ipo->curve.first; icu; icu=icu->next)
+                               for (i=0; i<icu->totvert; i++)
+                                       size = MAX2 (size, icu->bezt[i].vec[1][0]);
+               }
+               
+               for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
+                       if(conchan->ipo) {
                                for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
                                        for (i=0; i<icu->totvert; i++)
                                                size = MAX2 (size, icu->bezt[i].vec[1][0]);
                        }
+               }
        }
        return size;
 }
@@ -469,18 +497,16 @@ void extract_pose_from_action(bPose *pose, bAction *act, float ctime)
        
        /* Copy the data from the action into the pose */
        for (pchan= pose->chanbase.first; pchan; pchan=pchan->next) {
-               achan= get_named_actionchannel(act, pchan->name);
+               achan= get_action_channel(act, pchan->name);
                pchan->flag= 0;
                if(achan) {
                        ipo = achan->ipo;
                        if (ipo) {
-                               act->achan= achan;  // for ipos
-                               act->pchan= pchan;  // for ipos
                                
                                /* Evaluates and sets the internal ipo value */
                                calc_ipo(ipo, ctime);
                                /* This call also sets the pchan flags */
-                               execute_ipo((ID*)act, achan->ipo);
+                               execute_action_ipo(achan, pchan);
                                
                                do_constraint_channels(&pchan->constraints, &achan->constraintChannels, ctime);
                        }
@@ -488,8 +514,8 @@ void extract_pose_from_action(bPose *pose, bAction *act, float ctime)
        }
 }
 
-/* for do_all_actions, clears the pose */
-static void rest_pose(bPose *pose, int clearflag)
+/* for do_all_pose_actions, clears the pose */
+static void rest_pose(bPose *pose)
 {
        bPoseChannel *chan;
        int i;
@@ -505,13 +531,166 @@ static void rest_pose(bPose *pose, int clearflag)
                }
                chan->quat[0]=1.0;
                
-               if (clearflag)
-                       chan->flag =0;
+               chan->flag =0;
+       }
+}
+
+/* ********** NLA with non-poses works with ipo channels ********** */
+
+typedef struct NlaIpoChannel {
+       struct NlaIpoChannel *next, *prev;
+       float val;
+       void *poin;
+       int type;
+} NlaIpoChannel;
+
+static void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, char *name, float ctime)
+{
+       bActionChannel *achan= get_action_channel(act, name);
+       IpoCurve *icu;
+       NlaIpoChannel *nic;
+       
+       if(achan==NULL) return;
+       
+       if(achan->ipo) {
+               calc_ipo(achan->ipo, ctime);
+               
+               for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
+                       
+                       nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel");
+                       BLI_addtail(lb, nic);
+                       nic->val= icu->curval;
+                       nic->poin= get_ipo_poin(id, icu, &nic->type);
+               }
+       }
+       
+       /* constraint channels only for objects */
+       if(GS(id->name)==ID_OB) {
+               Object *ob= (Object *)id;
+               bConstraint *con;
+               bConstraintChannel *conchan;
+               
+               for (con=ob->constraints.first; con; con=con->next) {
+                       conchan = get_constraint_channel(&achan->constraintChannels, con->name);
+                       
+                       if(conchan && conchan->ipo) {
+                               calc_ipo(conchan->ipo, ctime);
+
+                               icu= conchan->ipo->curve.first; // only one ipo now
+                               if(icu) {
+                                       nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel constr");
+                                       BLI_addtail(lb, nic);
+                                       nic->val= icu->curval;
+                                       nic->poin= &con->enforce;
+                                       nic->type= IPO_FLOAT;
+                               }
+                       }
+               }
+       }
+}
+
+static NlaIpoChannel *find_nla_ipochannel(ListBase *lb, void *poin)
+{
+       NlaIpoChannel *nic;
+       
+       if(poin) {
+               for(nic= lb->first; nic; nic= nic->next) {
+                       if(nic->poin==poin)
+                               return nic;
+               }
+       }
+       return NULL;
+}
+
+
+static void blend_ipochannels(ListBase *dst, ListBase *src, float srcweight, int mode)
+{
+       NlaIpoChannel *snic, *dnic, *next;
+       float dstweight;
+       
+       switch (mode){
+               case POSE_BLEND:
+                       dstweight = 1.0F - srcweight;
+                       break;
+               case POSE_ADD:
+                       dstweight = 1.0F;
+                       break;
+               default :
+                       dstweight = 1.0F;
+       }
+       
+       for(snic= src->first; snic; snic= next) {
+               next= snic->next;
+               
+               dnic= find_nla_ipochannel(dst, snic->poin);
+               if(dnic==NULL) {
+                       /* remove from src list, and insert in dest */
+                       BLI_remlink(src, snic);
+                       BLI_addtail(dst, snic);
+               }
+               else {
+                       /* we do the blend */
+                       dnic->val= dstweight*dnic->val + srcweight*snic->val;
+               }
+       }
+}
+
+static void execute_ipochannels(Object *ob, ListBase *lb)
+{
+       NlaIpoChannel *nic;
+       
+       for(nic= lb->first; nic; nic= nic->next) {
+               if(nic->poin) write_ipo_poin(nic->poin, nic->type, nic->val);
        }
 }
 
+
 /* ************** time ****************** */
 
+static bActionStrip *get_active_strip(Object *ob)
+{
+       bActionStrip *strip;
+       
+       if(ob->action==NULL)
+               return NULL;
+       
+       for (strip=ob->nlastrips.first; strip; strip=strip->next)
+               if(strip->flag & ACTSTRIP_ACTIVE)
+                       break;
+       
+       if(strip && strip->act==ob->action)
+               return strip;
+       return NULL;
+}
+
+/* non clipped mapping of strip */
+static float get_actionstrip_frame(bActionStrip *strip, float cframe)
+{
+       float length, actlength, repeat;
+       
+       if (strip->flag & ACTSTRIP_USESTRIDE)
+               repeat= 1.0f;
+       else
+               repeat= strip->repeat;
+       
+       length = strip->end-strip->start;
+       if(length==0.0f)
+               length= 1.0f;
+       actlength = strip->actend-strip->actstart;
+       
+       return repeat*actlength*(cframe - strip->start)/length + strip->actstart;
+}
+
+/* if the conditions match, it converts current time to strip time */
+float get_action_frame(Object *ob, float cframe)
+{
+       bActionStrip *strip= get_active_strip(ob);
+       
+       if(strip)
+               return get_actionstrip_frame(strip, cframe);
+       return cframe;
+}
+
 /* this now only used for repeating cycles, to enable fields and blur. */
 /* the whole time control in blender needs serious thinking... */
 static float nla_time(float cfra, float unit)
@@ -538,129 +717,185 @@ static float nla_time(float cfra, float unit)
 
 /* ************** do the action ************ */
 
-void do_all_actions(Object *ob)
+static void do_nla(Object *ob, int blocktype)
 {
-       bPose *tpose=NULL;
+       bPose *tpose= NULL;
+       ListBase tchanbase={NULL, NULL}, chanbase={NULL, NULL};
        bActionStrip *strip;
-       float ctime, striptime, frametime, length, actlength;
+       float striptime, frametime, length, actlength;
        float blendfac, stripframe;
        int     doit;
-
-       // only to have safe calls from editor
-       if(ob==NULL) return;
-       if(ob->type!=OB_ARMATURE || ob->pose==NULL) return;
-
        
-       ctime= bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0);
-               
-       if(ob->pose->flag & POSE_LOCKED) {  // no actions to execute while transform
-               ;
-       }
-       else if(ob->action) {
-               /* Do local action (always overrides the nla actions) */
-               extract_pose_from_action (ob->pose, ob->action, bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0));
+       if(blocktype==ID_AR) {
+               copy_pose(&tpose, ob->pose, 1);
+               rest_pose(ob->pose);            // potentially destroying current not-keyed pose
        }
-       else if(ob->nlastrips.first) {
+       
+       for (strip=ob->nlastrips.first; strip; strip=strip->next){
                doit=0;
-
-               copy_pose(&tpose, ob->pose, 1);
-               rest_pose(ob->pose, 1);         // potentially destroying current not-keyed pose
-
-               for (strip=ob->nlastrips.first; strip; strip=strip->next){
-                       doit = 0;
-                       if (strip->act){
                
-                               /* Determine if the current frame is within the strip's range */
-                               length = strip->end-strip->start;
-                               actlength = strip->actend-strip->actstart;
-                               striptime = (G.scene->r.cfra-(strip->start)) / length;
-                               stripframe = (G.scene->r.cfra-(strip->start)) ;
-
-
-                               if (striptime>=0.0){
-                                       
-                                       rest_pose(tpose, 1);
-
-                                       /* Handle path */
-                                       if (strip->flag & ACTSTRIP_USESTRIDE){
-                                               if (ob->parent && ob->parent->type==OB_CURVE){
-                                                       Curve *cu = ob->parent->data;
-                                                       float ctime, pdist;
-
-                                                       if (cu->flag & CU_PATH){
-                                                               /* Ensure we have a valid path */
-                                                               if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(ob->parent, 0);
-                                                               if(cu->path) {
-
-                                                                       /* Find the position on the path */
-                                                                       ctime= bsystem_time(ob, ob->parent, (float)G.scene->r.cfra, 0.0);
-                                                                       
-                                                                       if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
-                                                                               ctime /= cu->pathlen;
-                                                                               CLAMP(ctime, 0.0, 1.0);
-                                                                       }
-                                                                       pdist = ctime*cu->path->totdist;
-                                                                       
-                                                                       if (strip->stridelen)
-                                                                               striptime = pdist / strip->stridelen;
-                                                                       else
-                                                                               striptime = 0;
-                                                                       
-                                                                       striptime = (float)fmod (striptime, 1.0);
-                                                                       
-                                                                       frametime = (striptime * actlength) + strip->actstart;
-                                                                       extract_pose_from_action (tpose, strip->act, bsystem_time(ob, 0, frametime, 0.0));
-                                                                       doit=1;
+               if (strip->act){        /* so theres an action */
+                       
+                       /* Determine if the current frame is within the strip's range */
+                       length = strip->end-strip->start;
+                       actlength = strip->actend-strip->actstart;
+                       striptime = (G.scene->r.cfra-(strip->start)) / length;
+                       stripframe = (G.scene->r.cfra-(strip->start)) ;
+                       
+                       if (striptime>=0.0){
+                               
+                               if(blocktype==ID_AR) 
+                                       rest_pose(tpose);
+                               
+                               /* Handle path */
+                               if (strip->flag & ACTSTRIP_USESTRIDE){
+                                       if (ob->parent && ob->parent->type==OB_CURVE){
+                                               Curve *cu = ob->parent->data;
+                                               float ctime, pdist;
+                                               
+                                               if (cu->flag & CU_PATH){
+                                                       /* Ensure we have a valid path */
+                                                       if(cu->path==NULL || cu->path->data==NULL) makeDispListCurveTypes(ob->parent, 0);
+                                                       if(cu->path) {
+                                                               
+                                                               /* Find the position on the path */
+                                                               ctime= bsystem_time(ob, ob->parent, (float)G.scene->r.cfra, 0.0);
+                                                               
+                                                               if(calc_ipo_spec(cu->ipo, CU_SPEED, &ctime)==0) {
+                                                                       ctime /= cu->pathlen;
+                                                                       CLAMP(ctime, 0.0, 1.0);
                                                                }
+                                                               pdist = ctime*cu->path->totdist;
+                                                               
+                                                               if (strip->stridelen)
+                                                                       striptime = pdist / strip->stridelen;
+                                                               else
+                                                                       striptime = 0;
+                                                               
+                                                               striptime = (float)fmod (striptime, 1.0);
+                                                               
+                                                               frametime = (striptime * actlength) + strip->actstart;
+                                                               
+                                                               if(blocktype==ID_AR)
+                                                                       extract_pose_from_action (tpose, strip->act, bsystem_time(ob, 0, frametime, 0.0));
+                                                               else if(blocktype==ID_OB)
+                                                                       extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", bsystem_time(ob, 0, frametime, 0.0));
+                                                               
+                                                               doit=1;
                                                        }
                                                }
                                        }
-
-                                       /* Handle repeat */
-       
-                                       else if (striptime < 1.0){
-                                               /* Mod to repeat */
-                                               striptime*=strip->repeat;
-                                               striptime = (float)fmod (striptime, 1.0);
+                               }
+                               /* Handle repeat */
+                               else if (striptime < 1.0) {     
+                                       /* Mod to repeat */
+                                       striptime*=strip->repeat;
+                                       striptime = (float)fmod (striptime, 1.0);
+                                       
+                                       frametime = (striptime * actlength) + strip->actstart;
+                                       
+                                       if(blocktype==ID_AR)
+                                               extract_pose_from_action (tpose, strip->act, nla_time(frametime, (float)strip->repeat));
+                                       else if(blocktype==ID_OB)
+                                               extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", nla_time(frametime, (float)strip->repeat));
                                                
+                                       doit=1;
+                               }
+                               /* Handle extend */
+                               else{
+                                       if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
+                                               striptime = 1.0;
                                                frametime = (striptime * actlength) + strip->actstart;
-                                               extract_pose_from_action (tpose, strip->act, nla_time(frametime, (float)strip->repeat));
+                                               
+                                               if(blocktype==ID_AR)
+                                                       extract_pose_from_action (tpose, strip->act, bsystem_time(ob, 0, frametime, 0.0));
+                                               else if(blocktype==ID_OB)
+                                                       extract_ipochannels_from_action(&tchanbase, &ob->id, strip->act, "Object", bsystem_time(ob, 0, frametime, 0.0));
+                                               
                                                doit=1;
                                        }
-                                       /* Handle extend */
-                                       else{
-                                               if (strip->flag & ACTSTRIP_HOLDLASTFRAME){
-                                                       striptime = 1.0;
-                                                       frametime = (striptime * actlength) + strip->actstart;
-                                                       extract_pose_from_action (tpose, strip->act, bsystem_time(ob, 0, frametime, 0.0));
-                                                       doit=1;
-                                               }
+                               }
+                               
+                               /* Handle blendin & blendout */
+                               if (doit){
+                                       /* Handle blendin */
+                                       
+                                       if (strip->blendin>0.0 && stripframe<=strip->blendin && G.scene->r.cfra>=strip->start){
+                                               blendfac = stripframe/strip->blendin;
                                        }
-
-                                       /* Handle blendin & blendout */
-                                       if (doit){
-                                               /* Handle blendin */
-
-                                               if (strip->blendin>0.0 && stripframe<=strip->blendin && G.scene->r.cfra>=strip->start){
-                                                       blendfac = stripframe/strip->blendin;
-                                               }
-                                               else if (strip->blendout>0.0 && stripframe>=(length-strip->blendout) && G.scene->r.cfra<=strip->end){
-                                                       blendfac = (length-stripframe)/(strip->blendout);
-                                               }
-                                               else
-                                                       blendfac = 1;
-
-                                               /* Blend this pose with the accumulated pose */
+                                       else if (strip->blendout>0.0 && stripframe>=(length-strip->blendout) && G.scene->r.cfra<=strip->end){
+                                               blendfac = (length-stripframe)/(strip->blendout);
+                                       }
+                                       else
+                                               blendfac = 1;
+                                       
+                                       if(blocktype==ID_AR) /* Blend this pose with the accumulated pose */
                                                blend_poses (ob->pose, tpose, blendfac, strip->mode);
+                                       else {
+                                               blend_ipochannels(&chanbase, &tchanbase, blendfac, strip->mode);
+                                               BLI_freelistN(&tchanbase);
                                        }
-                               }                                       
-                       }
+                               }
+                       }                                       
                }
        }
        
+       if(blocktype==ID_OB) {
+               execute_ipochannels(ob, &chanbase);
+       }
+
        if (tpose){
                free_pose_channels(tpose);
                MEM_freeN(tpose);
        }
+       if(chanbase.first)
+               BLI_freelistN(&chanbase);
+       
+       
+}
+
+void do_all_pose_actions(Object *ob)
+{
+
+       // only to have safe calls from editor
+       if(ob==NULL) return;
+       if(ob->type!=OB_ARMATURE || ob->pose==NULL) return;
+
+       if(ob->pose->flag & POSE_LOCKED) {  // no actions to execute while transform
+               ;
+       }
+       else if(ob->action && ((ob->nlaflag & OB_NLA_OVERRIDE)==0 || ob->nlastrips.first==NULL) ) {
+               float cframe= (float) G.scene->r.cfra;
+               
+               cframe= get_action_frame(ob, cframe);
+               
+               extract_pose_from_action (ob->pose, ob->action, bsystem_time(ob, 0, cframe, 0.0));
+       }
+       else if(ob->nlastrips.first) {
+               do_nla(ob, ID_AR);
+       }
+}
+
+/* called from where_is_object */
+void do_all_object_actions(Object *ob)
+{
+       if(ob==NULL) return;
+       
+       /* Do local action */
+       if(ob->action && ((ob->nlaflag & OB_NLA_OVERRIDE)==0 || ob->nlastrips.first==NULL) ) {
+               ListBase tchanbase= {NULL, NULL};
+               float cframe= (float) G.scene->r.cfra;
+               
+               cframe= get_action_frame(ob, cframe);
+               
+               extract_ipochannels_from_action(&tchanbase, &ob->id, ob->action, "Object", bsystem_time(ob, 0, cframe, 0.0));
+               if(tchanbase.first) {
+                       execute_ipochannels(ob, &tchanbase);
+                       BLI_freelistN(&tchanbase);
+               }
+       }
+       else if(ob->nlastrips.first) {
+               do_nla(ob, ID_OB);
+       }
 }
 
index 6fd3cbcfd8b0a90ce893680b89dc3e6c2dc54064..48d9db1a51653ddab3efd0890da92d9bdab5f5b9 100644 (file)
@@ -618,7 +618,7 @@ void *new_constraint_data (short type)
        return result;
 }
 
-bConstraintChannel *find_constraint_channel (ListBase *list, const char *name)
+bConstraintChannel *get_constraint_channel (ListBase *list, const char *name)
 {
        bConstraintChannel *chan;
 
@@ -630,6 +630,22 @@ bConstraintChannel *find_constraint_channel (ListBase *list, const char *name)
        return NULL;
 }
 
+/* finds or creates new constraint channel */
+bConstraintChannel *verify_constraint_channel (ListBase *list, const char *name)
+{
+       bConstraintChannel *chan;
+       
+       chan= get_constraint_channel (list, name);
+       if(chan==NULL) {
+               chan= MEM_callocN(sizeof(bConstraintChannel), "new constraint chan");
+               BLI_addtail(list, chan);
+               strcpy(chan->name, name);
+       }
+       
+       return chan;
+}
+
+
 /* ***************** Evaluating ********************* */
 
 /* does ipos only */
@@ -640,7 +656,7 @@ void do_constraint_channels (ListBase *conbase, ListBase *chanbase, float ctime)
        IpoCurve *icu=NULL;
        
        for (con=conbase->first; con; con=con->next) {
-               chan = find_constraint_channel(chanbase, con->name);
+               chan = get_constraint_channel(chanbase, con->name);
                if (chan && chan->ipo){
                        calc_ipo(chan->ipo, ctime);
                        for (icu=chan->ipo->curve.first; icu; icu=icu->next){
index 68ab67c399df77043581f6993c695d1b9a16ce66..76acb9cfdc8977db19dc150fcd38622e21b63065 100644 (file)
@@ -1460,8 +1460,12 @@ void DAG_scene_update_flags(Scene *sce, unsigned int lay)
                        if(ob->parent->type==OB_CURVE) ob->recalc |= OB_RECALC_OB;
                }
                
-               if(ob->action) ob->recalc |= OB_RECALC_DATA;
-               else if(ob->nlastrips.first) ob->recalc |= OB_RECALC_DATA;
+               if(ob->action || ob->nlastrips.first) {
+                       /* since actions now are mixed, we set the recalcs on the safe side */
+                       ob->recalc |= OB_RECALC_OB;
+                       if(ob->type==OB_ARMATURE)
+                               ob->recalc |= OB_RECALC_DATA;
+               }
                else if(modifiers_isSoftbodyEnabled(ob)) ob->recalc |= OB_RECALC_DATA;
                else if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
                else {
index 86ac9d76db51887709ee1869ba1f32e412a7039c..b604af0f2215da23fd1993a5fbb9e8d1310f8a1d 100644 (file)
@@ -1235,7 +1235,7 @@ void build_particle_system(Object *ob)
                                        par->ctime= -1234567.0;
                                        do_ob_key(par);
                                        if(par->type==OB_ARMATURE) {
-                                               do_all_actions(par);    // only does this object actions
+                                               do_all_pose_actions(par);       // only does this object actions
                                                where_is_pose(par);
                                        }
                                        par= par->parent;
@@ -1318,7 +1318,7 @@ void build_particle_system(Object *ob)
                do_ob_key(par);
                
                if(par->type==OB_ARMATURE) {
-                       do_all_actions(par);    // only does this object actions
+                       do_all_pose_actions(par);       // only does this object actions
                        where_is_pose(par);
                }
                par= par->parent;
index 7c8a272c3728350f8ffba90e82be3bf59f87470c..c6c991377616b6859687fe5e2e4f662d3cef22e5 100644 (file)
@@ -205,13 +205,56 @@ void free_ipo(Ipo *ipo)
        }
 }
 
+/* on adding new ipos, or for empty views */
+void ipo_default_v2d_cur(int blocktype, rctf *cur)
+{
+       if(blocktype==ID_CA) {
+               cur->xmin= G.scene->r.sfra;
+               cur->xmax= G.scene->r.efra;
+               cur->ymin= 0.0;
+               cur->ymax= 100.0;
+       }
+       else if ELEM5(blocktype, ID_MA, ID_CU, ID_WO, ID_LA, ID_CO) {
+               cur->xmin= (float)G.scene->r.sfra-0.1;
+               cur->xmax= G.scene->r.efra;
+               cur->ymin= (float)-0.1;
+               cur->ymax= (float)+1.1;
+       }
+       else if(blocktype==ID_TE) {
+               cur->xmin= (float)G.scene->r.sfra-0.1;
+               cur->xmax= G.scene->r.efra;
+               cur->ymin= (float)-0.1;
+               cur->ymax= (float)+1.1;
+       }
+       else if(blocktype==ID_SEQ) {
+               cur->xmin= -5.0+G.scene->r.sfra;
+               cur->xmax= 105.0;
+               cur->ymin= (float)-0.1;
+               cur->ymax= (float)+1.1;
+       }
+       else if(blocktype==ID_KE) {
+               cur->xmin= (float)G.scene->r.sfra-0.1;
+               cur->xmax= G.scene->r.efra;
+               cur->ymin= (float)-0.1;
+               cur->ymax= (float)+2.1;
+       }
+       else {  /* ID_OB and everything else */
+               cur->xmin= G.scene->r.sfra;
+               cur->xmax= G.scene->r.efra;
+               cur->ymin= -5.0;
+               cur->ymax= +5.0;
+       }
+}
+
+
 Ipo *add_ipo(char *name, int idcode)
 {
        Ipo *ipo;
        
        ipo= alloc_libblock(&G.main->ipo, ID_IP, name);
        ipo->blocktype= idcode;
-       
+       ipo_default_v2d_cur(idcode, &ipo->cur);
+
        return ipo;
 }
 
@@ -226,11 +269,9 @@ Ipo *copy_ipo(Ipo *ipo)
        
        duplicatelist(&(ipon->curve), &(ipo->curve));
 
-       icu= ipon->curve.first;
-       while(icu) {
+       for(icu= ipo->curve.first; icu; icu= icu->next) {
                icu->bezt= MEM_dupallocN(icu->bezt);
                if(icu->driver) icu->driver= MEM_dupallocN(icu->driver);
-               icu= icu->next;
        }
        
        return ipon;
@@ -389,10 +430,9 @@ void make_local_ipo(Ipo *ipo)
 IpoCurve *find_ipocurve(Ipo *ipo, int adrcode)
 {
        if(ipo) {
-               IpoCurve *icu= ipo->curve.first;
-               while(icu) {
+               IpoCurve *icu;
+               for(icu= ipo->curve.first; icu; icu= icu->next) {
                        if(icu->adrcode==adrcode) return icu;
-                       icu= icu->next;
                }
        }
        return NULL;
@@ -909,12 +949,9 @@ void calc_ipo(Ipo *ipo, float ctime)
        
        if(ipo==NULL) return;
        
-       icu= ipo->curve.first;
-       while(icu) {
-               
-               if(icu->driver || (icu->flag & IPO_LOCK)==0) calc_icu(icu, ctime);
-               
-               icu= icu->next;
+       for(icu= ipo->curve.first; icu; icu= icu->next) {
+               if(icu->driver || (icu->flag & IPO_LOCK)==0) 
+                       calc_icu(icu, ctime);
        }
 }
 
@@ -1090,14 +1127,11 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
        Lamp *la;
        Sequence *seq;
        World *wo;
-       bAction                 *act;
-       bActionChannel  *achan;
-       bPoseChannel    *pchan;
 
        *type= IPO_FLOAT;
 
        if( GS(id->name)==ID_OB) {
-       
+               
                ob= (Object *)id;
 
                switch(icu->adrcode) {
@@ -1172,56 +1206,6 @@ void *get_ipo_poin(ID *id, IpoCurve *icu, int *type)
                        break;
                }
        }
-       else if (GS(id->name)==ID_AC){
-               act= (bAction *)id;
-               achan = act->achan;
-               pchan = act->pchan;
-               if (!pchan || !achan)
-                       return NULL;
-               switch (icu->adrcode){
-               case AC_QUAT_W:
-                       poin= &(pchan->quat[0]); 
-                       pchan->flag |= POSE_ROT;
-                       break;
-               case AC_QUAT_X:
-                       poin= &(pchan->quat[1]); 
-                       pchan->flag |= POSE_ROT;
-                       break;
-               case AC_QUAT_Y:
-                       poin= &(pchan->quat[2]); 
-                       pchan->flag |= POSE_ROT;
-                       break;
-               case AC_QUAT_Z:
-                       poin= &(pchan->quat[3]); 
-                       pchan->flag |= POSE_ROT;
-                       break;
-               case AC_LOC_X:
-                       poin= &(pchan->loc[0]); 
-                       pchan->flag |= POSE_LOC;
-                       break;
-               case AC_LOC_Y:
-                       poin= &(pchan->loc[1]); 
-                       pchan->flag |= POSE_LOC;
-                       break;
-               case AC_LOC_Z:
-                       poin= &(pchan->loc[2]); 
-                       pchan->flag |= POSE_LOC;
-                       break;                  
-               case AC_SIZE_X:
-                       poin= &(pchan->size[0]); 
-                       pchan->flag |= POSE_SIZE;
-                       break;
-               case AC_SIZE_Y:
-                       poin= &(pchan->size[1]); 
-                       pchan->flag |= POSE_SIZE;
-                       break;
-               case AC_SIZE_Z:
-                       poin= &(pchan->size[2]); 
-                       pchan->flag |= POSE_SIZE;
-                       break;
-               };
-       }
-
        else if( GS(id->name)==ID_MA) {
                
                ma= (Material *)id;
@@ -1738,7 +1722,7 @@ void set_icu_vars(IpoCurve *icu)
        }
 }
 
-
+/* not for actions or constraints! */
 void execute_ipo(ID *id, Ipo *ipo)
 {
        IpoCurve *icu;
@@ -1747,11 +1731,70 @@ void execute_ipo(ID *id, Ipo *ipo)
        
        if(ipo==NULL) return;
        
-       icu= ipo->curve.first;
-       while(icu) {
+       for(icu= ipo->curve.first; icu; icu= icu->next) {
                poin= get_ipo_poin(id, icu, &type);
                if(poin) write_ipo_poin(poin, type, icu->curval);
-               icu= icu->next;
+       }
+}
+
+void *get_pchan_ipo_poin(bPoseChannel *pchan, int adrcode)
+{
+       void *poin= NULL;
+       
+       switch (adrcode) {
+               case AC_QUAT_W:
+                       poin= &(pchan->quat[0]); 
+                       pchan->flag |= POSE_ROT;
+                       break;
+               case AC_QUAT_X:
+                       poin= &(pchan->quat[1]); 
+                       pchan->flag |= POSE_ROT;
+                       break;
+               case AC_QUAT_Y:
+                       poin= &(pchan->quat[2]); 
+                       pchan->flag |= POSE_ROT;
+                       break;
+               case AC_QUAT_Z:
+                       poin= &(pchan->quat[3]); 
+                       pchan->flag |= POSE_ROT;
+                       break;
+               case AC_LOC_X:
+                       poin= &(pchan->loc[0]); 
+                       pchan->flag |= POSE_LOC;
+                       break;
+               case AC_LOC_Y:
+                       poin= &(pchan->loc[1]); 
+                       pchan->flag |= POSE_LOC;
+                       break;
+               case AC_LOC_Z:
+                       poin= &(pchan->loc[2]); 
+                       pchan->flag |= POSE_LOC;
+                       break;                  
+               case AC_SIZE_X:
+                       poin= &(pchan->size[0]); 
+                       pchan->flag |= POSE_SIZE;
+                       break;
+               case AC_SIZE_Y:
+                       poin= &(pchan->size[1]); 
+                       pchan->flag |= POSE_SIZE;
+                       break;
+               case AC_SIZE_Z:
+                       poin= &(pchan->size[2]); 
+                       pchan->flag |= POSE_SIZE;
+                       break;
+       }
+       return poin;
+}
+
+void execute_action_ipo(bActionChannel *achan, bPoseChannel *pchan)
+{
+
+       if(achan && achan->ipo) {
+               IpoCurve *icu;
+               for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
+                       void *poin= get_pchan_ipo_poin(pchan, icu->adrcode);
+                       if(poin) write_ipo_poin(poin, IPO_FLOAT, icu->curval);
+               }
        }
 }
 
@@ -1925,12 +1968,8 @@ int has_ipo_code(Ipo *ipo, int code)
        
        if(ipo==NULL) return 0;
        
-       icu= ipo->curve.first;
-       while(icu) {
-       
+       for(icu= ipo->curve.first; icu; icu= icu->next) {
                if(icu->adrcode==code) return 1;
-               
-               icu= icu->next;
        }
        return 0;
 }
@@ -2036,8 +2075,7 @@ int calc_ipo_spec(Ipo *ipo, int adrcode, float *ctime)
 
        if(ipo==NULL) return 0;
 
-       icu= ipo->curve.first;
-       while(icu) {
+       for(icu= ipo->curve.first; icu; icu= icu->next) {
                if(icu->adrcode == adrcode) {
                        if(icu->flag & IPO_LOCK);
                        else calc_icu(icu, *ctime);
@@ -2045,7 +2083,6 @@ int calc_ipo_spec(Ipo *ipo, int adrcode, float *ctime)
                        *ctime= icu->curval;
                        return 1;
                }
-               icu= icu->next;
        }
        
        return 0;
@@ -2108,8 +2145,7 @@ void make_cfra_list(Ipo *ipo, ListBase *elems)
        int a;
        
        if(ipo->blocktype==ID_OB) {
-               icu= ipo->curve.first;
-               while(icu) {
+               for(icu= ipo->curve.first; icu; icu= icu->next) {
                        if(icu->flag & IPO_VISIBLE) {
                                switch(icu->adrcode) {
                                case OB_DLOC_X:
@@ -2147,12 +2183,10 @@ void make_cfra_list(Ipo *ipo, ListBase *elems)
                                        break;
                                }
                        }
-                       icu= icu->next;
                }
        }
        else if(ipo->blocktype==ID_AC) {
-               icu= ipo->curve.first;
-               while(icu) {
+               for(icu= ipo->curve.first; icu; icu= icu->next) {
                        if(icu->flag & IPO_VISIBLE) {
                                switch(icu->adrcode) {
                                case AC_LOC_X:
@@ -2176,7 +2210,6 @@ void make_cfra_list(Ipo *ipo, ListBase *elems)
                                        break;
                                }
                        }
-                       icu= icu->next;
                }
        }
        else {
@@ -2216,14 +2249,10 @@ int IPO_GetChannels(Ipo *ipo, IPO_Channel *channels)
        
        if(ipo==NULL) return 0;
        
-       icu= ipo->curve.first;
-       while(icu) {
-               
+       for(icu= ipo->curve.first; icu; icu= icu->next) {
                channels[total]= icu->adrcode;
                total++;
                if(total>31) break;
-               
-               icu= icu->next;
        }
        
        return total;
@@ -2245,25 +2274,3 @@ float IPO_GetFloatValue(Ipo *ipo, IPO_Channel channel, float ctime)
 
        return ctime;
 }
-
-
-void test_ipo_get()
-{
-       Object *ob;
-       int tot;
-       IPO_Channel chan[32];
-
-       ob = (G.scene->basact ? G.scene->basact->object : 0);
-       
-       if(ob==NULL) return;
-       if(ob->ipo==NULL) return;
-       
-       tot= IPO_GetChannels(ob->ipo, chan);
-       printf("tot %d \n", tot);
-       
-       while(tot--) {
-               printf("var1 %d \n", chan[tot]);
-       }
-       
-       printf("var1 %f \n", IPO_GetFloatValue(ob->ipo, chan[0], 10.0));
-}
index aa8efe6156512243660d52f9bd1ae7469e16dbbe..6bdf6a7faa59d903e8076050319f2fcb2817b89a 100644 (file)
@@ -1306,6 +1306,9 @@ void where_is_object_time(Object *ob, float ctime)
                        calc_ipo(ob->ipo, stime);
                        execute_ipo((ID *)ob, ob->ipo);
                }
+               else 
+                       do_all_object_actions(ob);
+               
                /* do constraint ipos ... */
                do_constraint_channels(&ob->constraints, &ob->constraintChannels, ctime);
        }
@@ -1796,7 +1799,7 @@ void object_handle_update(Object *ob)
                                /* this actually only happens for reading old files... */
                                if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
                                        armature_rebuild_pose(ob, ob->data);
-                               do_all_actions(ob);
+                               do_all_pose_actions(ob);
                                where_is_pose(ob);
                        }
                }
index 6764ced261ee579f2aeb2a068d1e9f721aa62fb9..e02fc6b69312f9f97a844531802f30a9f77c7138 100644 (file)
@@ -40,7 +40,6 @@ struct bAction;
 struct Object;
 
 void draw_cfra_action(void);
-void draw_bevel_but(int x, int y, int w, int h, int sel);
 void draw_ipo_channel(struct gla2DDrawInfo *di, struct Ipo *ipo, int flags, float ypos);
 void draw_action_channel(struct gla2DDrawInfo *di, struct bAction *act, int flags, float ypos);
 void draw_object_channel(struct gla2DDrawInfo *di, struct Object *ob, int flags, float ypos);
index 495b7a620c204411f8141a0c652466b4358d528a..47ffb3fea0018439982824f66812c823eaeee524 100644 (file)
@@ -67,7 +67,7 @@ void delete_meshchannel_keys(struct Key *key);
 void delete_actionchannel_keys(void);
 void duplicate_meshchannel_keys(struct Key *key);
 void duplicate_actionchannel_keys(void);
-void transform_actionchannel_keys(char mode);
+void transform_actionchannel_keys(int mode, int dummy);
 void transform_meshchannel_keys(char mode, struct Key *key);
 struct Key *get_action_mesh_key(void);
 int get_nearest_key_num(struct Key *key, short *mval, float *x);
@@ -91,12 +91,13 @@ void select_actionchannel_by_name (struct bAction *act, char *name, int select);
 
 /* Action */
 struct bActionChannel* get_hilighted_action_channel(struct bAction* action);
-void set_action_key (struct bAction *act, struct bPoseChannel *chan, int adrcode, short makecurve);
-struct bAction *add_empty_action(void);
+struct bAction *add_empty_action(int blocktype);
+
 void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
 struct bAction *bake_action_with_client (struct bAction *act, struct Object *arm, float tolerance);
 
-void verify_active_action_channel(struct Object *ob);
+/* contextual get action */
+struct bAction *ob_get_action(struct Object *ob);
 
 void remake_action_ipos(struct bAction *act);
 
index 8665d65e2f7b51cac68fd7bd4f1b7e67f88ba205..4d14919ddaac46fef253d602964b7acc351fb102 100644 (file)
@@ -33,6 +33,7 @@
 #ifndef BIF_EDITCONSTRAINT_H
 #define BIF_EDITCONSTRAINT_H
 
+struct ID;
 struct ListBase;
 struct Object;
 struct bConstraint;
index f5e72c793ebb4c1297f391bd1d426c9ced1e88e9..c1ab70fd0f5edeb93ff9b076d8cf9a7b67fd6b58 100644 (file)
 
 struct BWinEvent;
 
-void clever_numbuts_nla(void);
 extern void winqreadnlaspace(struct ScrArea *sa, void *spacedata, struct BWinEvent *evt);
 
 /* NLA channel operations */
 void delete_nlachannel_keys(void);
-void delete_nlachannels(void);
 void duplicate_nlachannel_keys(void);
-void transform_nlachannel_keys(char mode);
+void transform_nlachannel_keys(int mode, int dummy);
 
 /* Select */
 void borderselect_nla(void);
index ec4e586cb02901b91e11b302b592584bc1572b4b..43fa758d3cfa65b2fcfb2346a4da26332ef886f8 100644 (file)
@@ -187,6 +187,11 @@ void                       gla2DDrawTranslatePtv   (gla2DDrawInfo *di, float world[2], int screen_r[2]
         */
 void                   glaEnd2DDraw                    (gla2DDrawInfo *di);
 
+       /** Adjust the transformation mapping of a 2d area */
+void gla2DGetMap(gla2DDrawInfo *di, struct rctf *rect);
+void gla2DSetMap(gla2DDrawInfo *di, struct rctf *rect);
+
+
 /* use this for platform hacks. for now glPointSize is solved here */
 void bglBegin(int mode);
 void bglEnd(void);
index 7040c78192721475173308a9ea3c6a2b70d1de23..f7a075e55b139eabb5ca616e90c8b4035ce52dba 100644 (file)
@@ -447,7 +447,10 @@ enum {
        TH_SYNTAX_N,
        
        TH_BONE_SOLID,
-       TH_BONE_POSE
+       TH_BONE_POSE,
+       
+       TH_STRIP,
+       TH_STRIP_SELECT
        
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
index e46f4217de7d66f1e24bc9e064001f2ebd12338b..923d9a3f0dfbd4990e1a0f40ac0acdd521c3af25 100644 (file)
 #define BSE_DRAWNLA_H
 
 struct ScrArea;
+struct Base;
+struct gla2DDrawInfo;
+struct Object;
 
 void drawnlaspace(struct ScrArea *sa, void *spacedata);
 void do_nlabuts(unsigned short event);
 
+int count_nla_levels(void);    
+int nla_filter (struct Base* base);
+
+       /* changes the gla2d system to map the strip transform */
+void map_active_strip(struct gla2DDrawInfo *di, struct Object *ob, int restore);
+
+
 #endif /* BSE_DRAWNLA */
 
index e0036de5eaceb2e4ffcc76e240b39c403e9e7251..5e3a4ec5562aa2408b0b61e109261e496abbe873 100644 (file)
@@ -65,22 +65,9 @@ void boundbox_ipocurve(struct IpoCurve *icu);
 void boundbox_ipo(struct Ipo *ipo, struct rctf *bb);
 void editipo_changed(struct SpaceIpo *si, int doredraw);
 void scale_editipo(void);
-struct Ipo *get_ipo_to_edit(struct ID **from);
+
 unsigned int ipo_rainbow(int cur, int tot);
-void make_ob_editipo(struct Object *ob, struct SpaceIpo *si);
-void make_seq_editipo(struct SpaceIpo *si);
-void make_cu_editipo(struct SpaceIpo *si);
-void make_key_editipo(struct SpaceIpo *si);
-int texchannel_to_adrcode(int channel);
-void make_mat_editipo(struct SpaceIpo *si);
-void make_world_editipo(struct SpaceIpo *si);
-void make_texture_editipo(struct SpaceIpo *si);
-void make_lamp_editipo(struct SpaceIpo *si);
-void make_camera_editipo(struct SpaceIpo *si);
-int make_action_editipo(struct Ipo *ipo, struct EditIpo **si);
-int make_constraint_editipo(struct Ipo *ipo, struct EditIpo **si);
-void make_sound_editipo(struct SpaceIpo *si);
-void make_editipo(void);
+
 void test_editipo(void);
 void get_status_editipo(void);
 void update_editipo_flags(void);
@@ -89,13 +76,17 @@ void ipo_toggle_showkey(void);
 void swap_selectall_editipo(void);
 void swap_visible_editipo(void);
 void deselectall_editipo(void);
-short findnearest_ipovert(struct IpoCurve **icu, struct BezTriple **bezt);
+
 void move_to_frame(void);
 void do_ipowin_buts(short event);
 void do_ipo_selectbuttons(void);
-struct EditIpo *get_editipo(void);
-struct Ipo *get_ipo(struct ID *from, short type, int make);
-struct IpoCurve *get_ipocurve(struct ID *from, short type, int adrcode, struct Ipo* useipo);
+
+
+/* gets ipo curve, creates if needed */
+struct IpoCurve *verify_ipocurve(struct ID *, short, char *, char *, int);
+struct Ipo *verify_ipo(struct ID *, short, char *, char *);
+int texchannel_to_adrcode(int channel);
+
 void insert_vert_ipo(struct IpoCurve *icu, float x, float y);
 void add_vert_ipo(void);
 void add_duplicate_editipo(void);
@@ -114,11 +105,11 @@ void del_ipoCurve ( struct IpoCurve * icu );
 void free_ipocopybuf(void);
 void copy_editipo(void);
 void paste_editipo(void);
+
 void set_exprap_ipo(int mode);
-int find_other_handles(struct EditIpo *eicur, 
-                                          float ctime, struct BezTriple **beztar);
+
 void set_speed_editipo(float speed);
-void insertkey(struct ID *id, int adrcode);
+void insertkey(ID *id, int blocktype, char *actname, char *constname, int adrcode);
 void insertkey_editipo(void);
 void common_insertkey(void);
 void free_ipokey(struct ListBase *lb);
@@ -151,8 +142,10 @@ void duplicate_ipo_keys(struct Ipo *ipo);
 void borderselect_ipo_key(struct Ipo *ipo, float xmin, float xmax, int val);
 void borderselect_icu_key(struct IpoCurve *icu, float xmin, float xmax, 
                                                  int (*select_function)(struct BezTriple *));
+
 void select_ipo_key(struct Ipo *ipo, float selx, int sel);
 void select_icu_key(struct IpoCurve *icu, float selx, int selectmode);
+/* callbacks */
 int select_bezier_add(struct BezTriple *bezt);
 int select_bezier_subtract(struct BezTriple *bezt);
 int select_bezier_invert(struct BezTriple *bezt);
index 4316b8575686e795f6044bd995f17067c4aef045..434e87fbbc475505a4ca840cd5fb28fdfbc889e6 100644 (file)
@@ -37,7 +37,5 @@
 #define NLACHANNELHEIGHT       16
 #define NLACHANNELSKIP         1
 
-#define ACTIVE_ARMATURE(base) ((base)->object->type==OB_ARMATURE && (base)->object->action)
-
 #endif /* BSE_EDITNLA_TYPES_H */
 
index a42cfe0801f0a1a9f03b51cab701047bc08f6d50..4f2179cca286bee9ec8337104a9a452642b5caef 100644 (file)
@@ -36,6 +36,8 @@
 struct uiBlock;
 struct ScrArea;
 struct ID;
+struct SpaceIpo;
+struct Ipo;
 
 /* these used to be in blender/src/headerbuttons.c: */
 #define SPACEICONMAX  15 /* See release/datafiles/blenderbuttons */
@@ -112,6 +114,9 @@ void do_view3d_buttons(short event);
 
 void do_headerbuttons(short event);
 
+/* header_ipo.c */
+void spaceipo_assign_ipo(struct SpaceIpo *si, struct Ipo *ipo);
+
 /* header_text.c */
 void do_text_editmenu_to3dmenu(void *arg, int event);
 
index 22c13c54e5532793bddcae484c56ac38c31970fd..e0c40760061bc5a3889e241e25f007c1c3f723d4 100644 (file)
 #define B_MAN_ROT              162
 #define B_MAN_SCALE            163
 #define B_HEMESHBROWSE 164
-#define B_HEMESHLOCAL 165
+#define B_HEMESHLOCAL  165
 
 /* IPO: 200 */
 #define B_IPOHOME              201
 #define B_IPOEXTRAP            206
 #define B_IPOCYCLIC            207
 #define B_IPOMAIN              208
-#define B_IPOSHOWKEY           209
-#define B_IPOCYCLICX           210
+#define B_IPOSHOWKEY   209
+#define B_IPOCYCLICX   210
        /* warn: also used for oops and seq */
-#define B_VIEW2DZOOM           211
+#define B_VIEW2DZOOM   211
 #define B_IPOPIN               212
+#define B_IPO_ACTION_OB                213
+#define B_IPO_ACTION_KEY       214
+
 
 /* OOPS: 250 */
 #define B_OOPSHOME             251
index 86ee9eabb15faf8af02bbc183afeb84eaa8d7a57..da1bd98a6035118a1907cd8f62603bd1fa42caaa 100644 (file)
@@ -123,14 +123,20 @@ typedef struct Library {
 #define ID_SAMPLE      MAKE_ID2('S', 'A')
 #define ID_GR          MAKE_ID2('G', 'R')
 #define ID_ID          MAKE_ID2('I', 'D')
-#define ID_SEQ         MAKE_ID2('S', 'Q')
 #define ID_AR          MAKE_ID2('A', 'R')
 #define ID_AC          MAKE_ID2('A', 'C')
 #define ID_SCRIPT      MAKE_ID2('P', 'Y')
 
-#define IPO_CO         MAKE_ID2('C', 'O')      /* NOTE! This is not an ID, but is needed for g.sipo->blocktype */
-#define ID_NLA         MAKE_ID2('N', 'L')      /* fake ID for outliner */
-                                                        
+       /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
+#define ID_SEQ         MAKE_ID2('S', 'Q')
+                       /* constraint */
+#define ID_CO          MAKE_ID2('C', 'O')
+                       /* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
+#define ID_PO          MAKE_ID2('A', 'C')
+                       /* used in outliner... */
+#define ID_NLA         MAKE_ID2('N', 'L')
+
+
 /* id->flag: set frist 8 bits always at zero while reading */
 #define LIB_LOCAL              0
 #define LIB_EXTERN             1
index 872d4b8e1cea954b1783446026419a9d8b5b32a4..90f8760462b0648965f35d97385ec0dfe4b40753 100644 (file)
@@ -91,8 +91,6 @@ typedef struct bActionChannel {
 typedef struct bAction {
        ID                              id;
        ListBase                chanbase;       /* Channels in this action */
-       bActionChannel  *achan;         /* Current action channel */
-       bPoseChannel    *pchan;         /* Current pose channel */
 } bAction;
 
 typedef struct SpaceAction {
index 49c8363192ce7d439b9093d2587ca49c4145bca4..17a15fecfcf4ad437f41780c6651427157c27efb 100644 (file)
@@ -56,10 +56,11 @@ typedef struct bActionStrip {
 #define ACTSTRIPMODE_BLEND             0
 #define ACTSTRIPMODE_ADD               1
 
-#define ACTSTRIP_SELECT                        0x00000001
-#define ACTSTRIP_USESTRIDE             0x00000002
-#define ACTSTRIP_BLENDTONEXT   0x00000004
-#define ACTSTRIP_HOLDLASTFRAME 0x00000008
+#define ACTSTRIP_SELECT                        0x01
+#define ACTSTRIP_USESTRIDE             0x02
+#define ACTSTRIP_BLENDTONEXT   0x04
+#define ACTSTRIP_HOLDLASTFRAME 0x08
+#define ACTSTRIP_ACTIVE                        0x10
 
 #endif
 
index b4f0c369d55f3ff40258769449f22c2a946754fd..187aeb51dfe21590301a5a0806414e8455dedcca 100644 (file)
@@ -113,10 +113,13 @@ typedef struct Object {
        float imat[4][4];       /* for during render, old game engine, temporally: ipokeys of transform  */
        
        unsigned int lay;                               /* copy of Base */
+       
        short flag;                     /* copy of Base */
        short colbits;          /* when zero, from obdata */
-       char transflag, ipoflag;
-       char trackflag, upflag;
+       
+       short transflag, ipoflag;       /* transformation and ipo settings */
+       short trackflag, upflag;
+       short nlaflag, pad;
        short ipowin, scaflag;  /* ipowin: blocktype last ipowindow */
        short scavisflag, boundtype;
        
@@ -255,7 +258,7 @@ extern Object workob;
 #define PARBONE                        7
 #define PARSLOW                        16
 
-/* char! transflag */
+/* (short) transflag */
 #define OB_OFFS_LOCAL  1
 #define OB_QUAT                        2
 #define OB_NEG_SCALE   4
@@ -267,7 +270,7 @@ extern Object workob;
 
 #define OB_POWERTRACK  128
 
-/* char! ipoflag */
+/* (short) ipoflag */
 #define OB_DRAWKEY                     1
 #define OB_DRAWKEYSEL          2
 #define OB_OFFS_OB                     4
@@ -276,9 +279,11 @@ extern Object workob;
 #define OB_OFFS_PATH           32
 #define OB_OFFS_PARENT         64
 #define OB_OFFS_PARTICLE       128
+       /* get ipo from from action or not? */
+#define OB_ACTION_OB           256
+#define OB_ACTION_KEY          512
 
-
-/* trackflag / upflag */
+/* (short) trackflag / upflag */
 #define OB_POSX                        0
 #define OB_POSY                        1
 #define OB_POSZ                        2
@@ -288,7 +293,7 @@ extern Object workob;
 
 /* gameflag in game.h */
 
-/* dt: nummers */
+/* dt: no flags */
 #define OB_BOUNDBOX            1
 #define OB_WIRE                        2
 #define OB_SOLID               3
@@ -379,6 +384,8 @@ extern Object workob;
 #define OB_SHAPE_LOCK          1
 #define OB_SHAPE_TEMPLOCK      2
 
+/* ob->nlaflag */
+#define OB_NLA_OVERRIDE                1
 
 /* ob->softflag in DNA_object_force.h */
 
index 1c28296964670d8642e8bb9f53ead1bd311379c1..f56f620cc0e533228a89d1649b90b92108f702b9 100644 (file)
@@ -86,8 +86,11 @@ typedef struct SpaceIpo {
        
        void *editipo;
        ListBase ipokey;
+       
+       /* the ipo context we need to store */
        struct Ipo *ipo;
        struct ID *from;
+       char actname[32], constname[32];
 
        short totipo, pin;
        short butofs, channel;
index 7d00460403a0ebe5ae0acd08763923b3ded941e2..6aac12ea622e554cada61098905abf4dd3825118 100644 (file)
@@ -87,6 +87,7 @@ typedef struct ThemeSpace {
        char face_dot[4];       // selected color
        char normal[4];
        char bone_solid[4], bone_pose[4];
+       char strip[4], strip_select[4];
        
        char vertex_size, facedot_size;
        char bpad[2];
index 6a6980107a227f3a6de5db3275d486035ec963a0..9fd751248aafa3cd2beed44392b667bd5b41eae6 100644 (file)
@@ -48,6 +48,7 @@ struct ScrArea; /*keep me up here */
 #include "BKE_utildefines.h"
 
 #include "BIF_editaction.h"
+#include "BSE_editipo.h"
 
 #include "NLA.h"
 
@@ -1401,7 +1402,6 @@ static PyObject *Bone_setPose( BPy_Bone * self, PyObject * args )
        Bone *root = NULL;
        bPoseChannel *chan = NULL;
        bPoseChannel *setChan = NULL;
-       bPoseChannel *test = NULL;
        Object *object = NULL;
        bArmature *arm = NULL;
        Bone *bone = NULL;
@@ -1410,7 +1410,6 @@ static PyObject *Bone_setPose( BPy_Bone * self, PyObject * args )
        BPy_Action *py_action = NULL;
        int x;
        int flagValue = 0;
-       int makeCurve = 1;
 
        if( !self->bone ) {     //test to see if linked to armature
                //use python vars
@@ -1502,43 +1501,26 @@ static PyObject *Bone_setPose( BPy_Bone * self, PyObject * args )
 
                //create an action if one not already assigned to object
                if( !py_action && !object->action ) {
-                       object->action = ( bAction * ) add_empty_action(  );
-                       object->ipowin = ID_AC;
-               } else {
-                       //test if posechannel is already in action
-                       for( test = object->action->chanbase.first; test;
-                            test = test->next ) {
-                               if( test == setChan )
-                                       makeCurve = 0;  //already there
-                       }
+                       object->action = ( bAction * ) add_empty_action(ID_PO);
+                       object->ipowin = ID_PO;
                }
 
-               //set action keys
+               //set action keys (note, new uniform API for Pose ipos (ton)
                if( setChan->flag & POSE_ROT ) {
-                       set_action_key( object->action, setChan, AC_QUAT_X,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_QUAT_Y,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_QUAT_Z,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_QUAT_W,
-                                       (short)makeCurve );
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_QUAT_X);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_QUAT_Y);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_QUAT_Z);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_QUAT_W);
                }
                if( setChan->flag & POSE_SIZE ) {
-                       set_action_key( object->action, setChan, AC_SIZE_X,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_SIZE_Y,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_SIZE_Z,
-                                       (short)makeCurve );
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_SIZE_X);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_SIZE_Y);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_SIZE_Z);
                }
                if( setChan->flag & POSE_LOC ) {
-                       set_action_key( object->action, setChan, AC_LOC_X,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_LOC_Y,
-                                       (short)makeCurve );
-                       set_action_key( object->action, setChan, AC_LOC_Z,
-                                       (short)makeCurve );
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_LOC_X);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_LOC_Y);
+                       insertkey(&object->id, ID_PO, setChan->name, NULL, AC_LOC_Z);
                }
                //rebuild ipos
                remake_action_ipos( object->action );
index 6314ff908f0ccedb680023223b4291f4af358c81..a8625def1c9df287a401c9506e3a5af773eee57c 100644 (file)
@@ -959,11 +959,11 @@ static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args )
                                                                                "expected int argument" ) );
 
        if (key == IPOKEY_LENS){
-               insertkey((ID *)self->camera, CAM_LENS);     
+               insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS);     
        }
        else if (key == IPOKEY_CLIPPING){
-               insertkey((ID *)self->camera, CAM_STA);
-               insertkey((ID *)self->camera, CAM_END);   
+               insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA);
+               insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END);   
        }
 
        allspace(REMAKEIPO, 0);
index 55f6147012ce2be49b369cdb65ab7897b289a1db..8ecd3bb5041d21877f35263ec678ba44c3d5c2fd 100644 (file)
@@ -212,9 +212,9 @@ static PyObject *M_Ipo_New( PyObject * self, PyObject * args )
        if( !strcmp( code, "Lamp" ) )
                idcode = ID_LA;
        if( !strcmp( code, "Action" ) )
-               idcode = ID_AC;
+               idcode = ID_PO;
        if( !strcmp( code, "Constraint" ) )
-               idcode = IPO_CO;
+               idcode = ID_CO;
        if( !strcmp( code, "Sequence" ) )
                idcode = ID_SEQ;
        if( !strcmp( code, "Curve" ) )
@@ -890,10 +890,10 @@ static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * args )
        case ID_MA:
                ok = Ipo_maIcuName( cur_name, &param );
                break;
-       case ID_AC:
+       case ID_PO:
                ok = Ipo_acIcuName( cur_name, &param );
                break;
-       case IPO_CO:
+       case ID_CO:
                ok = Ipo_coIcuName( cur_name, &param );
                break;
        case ID_CU:
@@ -913,14 +913,13 @@ static PyObject *Ipo_addCurve( BPy_Ipo * self, PyObject * args )
                return EXPP_ReturnPyObjError
                        ( PyExc_NameError, "curve name was invalid" );
 
-       /* ask blender to create the new ipo curve */
-       icu = get_ipocurve( NULL, ipo->blocktype, param, self->ipo );
-
-       if( icu == 0 )          /* could not create curve */
-               return EXPP_ReturnPyObjError
-                       ( PyExc_RuntimeError,
-                         "blender could not create ipo curve" );
-
+       /* create the new ipo curve */
+       icu = MEM_callocN(sizeof(IpoCurve), "Pyhon added ipocurve");
+       icu->blocktype= ipo->blocktype;
+       icu->flag |= IPO_VISIBLE|IPO_AUTO_HORIZ;
+       icu->blocktype= ipo->blocktype;
+       icu->adrcode= param;
+       
        allspace( REMAKEIPO, 0 );
        EXPP_allqueue( REDRAWIPO, 0 );
 
index 612da52cd180d72eec7e0bfc8ad7d3af093d1627..f4fbd539b990c2862bc32db3fa76c04d427df9e3 100644 (file)
@@ -416,7 +416,7 @@ static PyObject *IpoCurve_getName( C_IpoCurve * self )
        case ID_WO:
                return PyString_FromString( getname_world_ei
                                            ( self->ipocurve->adrcode ) );
-       case ID_AC:
+       case ID_PO:
                return PyString_FromString( getname_ac_ei
                                            ( self->ipocurve->adrcode ) );
        case ID_CU:
@@ -427,7 +427,7 @@ static PyObject *IpoCurve_getName( C_IpoCurve * self )
        case ID_SEQ:
                return PyString_FromString( getname_seq_ei
                                            ( self->ipocurve->adrcode ) );
-       case IPO_CO:
+       case ID_CO:
                return PyString_FromString( getname_co_ei
                                            ( self->ipocurve->adrcode ) );
        default:
@@ -605,7 +605,7 @@ char *getIpoCurveName( IpoCurve * icu )
                return getname_tex_ei( icu->adrcode );
        case ID_LA:
                return getname_la_ei( icu->adrcode );
-       case ID_AC:
+       case ID_PO:
                return getname_ac_ei( icu->adrcode );
        case ID_CU:
                return getname_cu_ei( icu->adrcode );
@@ -613,7 +613,7 @@ char *getIpoCurveName( IpoCurve * icu )
                return "Key";   /* ipo curves have no names... that was only meant for drawing the buttons... (ton) */
        case ID_SEQ:
                return getname_seq_ei( icu->adrcode );
-       case IPO_CO:
+       case ID_CO:
                return getname_co_ei( icu->adrcode );
        }
        return NULL;
index 89d0eef891c64194cc63fcec2addbd3b60d05dfa..f3e6214e966efba58e786662bafb6ac6af0ea468 100644 (file)
@@ -1395,25 +1395,25 @@ static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args )
        map = texchannel_to_adrcode(self->lamp->texact);
 
        if (key == IPOKEY_RGB ) {
-               insertkey((ID *)self->lamp,LA_COL_R);
-               insertkey((ID *)self->lamp,LA_COL_G);
-               insertkey((ID *)self->lamp,LA_COL_B);      
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R);
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G);
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B);      
        }
        if (key == IPOKEY_ENERGY ) {
-               insertkey((ID *)self->lamp,LA_ENERGY);    
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY);    
        }       
        if (key == IPOKEY_SPOTSIZE ) {
-               insertkey((ID *)self->lamp,LA_SPOTSI);    
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI);    
        }
        if (key == IPOKEY_OFFSET ) {
-               insertkey((ID *)self->lamp, map+MAP_OFS_X);
-               insertkey((ID *)self->lamp, map+MAP_OFS_Y);
-               insertkey((ID *)self->lamp, map+MAP_OFS_Z);  
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X);
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y);
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z);  
        }
        if (key == IPOKEY_SIZE ) {
-               insertkey((ID *)self->lamp, map+MAP_SIZE_X);
-               insertkey((ID *)self->lamp, map+MAP_SIZE_Y);
-               insertkey((ID *)self->lamp, map+MAP_SIZE_Z);  
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X);
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y);
+               insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z);  
        }
 
        allspace(REMAKEIPO, 0);
index 7a3bbc89f45051001f18301d068ed88697080833..50390025ee2d3361491d89fccb90597213b93fbf 100644 (file)
@@ -1829,58 +1829,58 @@ static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args )
        map = texchannel_to_adrcode(self->material->texact);
        
        if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) {
-               insertkey((ID *)self->material, MA_COL_R);
-               insertkey((ID *)self->material, MA_COL_G);
-               insertkey((ID *)self->material, MA_COL_B);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B);
        }
        if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) {
-               insertkey((ID *)self->material, MA_ALPHA);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA);
        }
        if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) {
-               insertkey((ID *)self->material, MA_HASIZE);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE);
        }
        if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) {
-               insertkey((ID *)self->material, MA_MODE);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE);
        }
        if(key==IPOKEY_ALLCOLOR) {
-               insertkey((ID *)self->material, MA_SPEC_R);
-               insertkey((ID *)self->material, MA_SPEC_G);
-               insertkey((ID *)self->material, MA_SPEC_B);
-               insertkey((ID *)self->material, MA_REF);
-               insertkey((ID *)self->material, MA_EMIT);
-               insertkey((ID *)self->material, MA_AMB);
-               insertkey((ID *)self->material, MA_SPEC);
-               insertkey((ID *)self->material, MA_HARD);
-               insertkey((ID *)self->material, MA_MODE);
-               insertkey((ID *)self->material, MA_TRANSLU);
-               insertkey((ID *)self->material, MA_ADD);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD);
        }
        if(key==IPOKEY_ALLMIRROR) {
-               insertkey((ID *)self->material, MA_RAYM);
-               insertkey((ID *)self->material, MA_FRESMIR);
-               insertkey((ID *)self->material, MA_FRESMIRI);
-               insertkey((ID *)self->material, MA_FRESTRA);
-               insertkey((ID *)self->material, MA_FRESTRAI);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI);
        }
        if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) {
-               insertkey((ID *)self->material, map+MAP_OFS_X);
-               insertkey((ID *)self->material, map+MAP_OFS_Y);
-               insertkey((ID *)self->material, map+MAP_OFS_Z);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z);
        }
        if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) {
-               insertkey((ID *)self->material, map+MAP_SIZE_X);
-               insertkey((ID *)self->material, map+MAP_SIZE_Y);
-               insertkey((ID *)self->material, map+MAP_SIZE_Z);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z);
        }
        if(key==IPOKEY_ALLMAPPING) {
-               insertkey((ID *)self->material, map+MAP_R);
-               insertkey((ID *)self->material, map+MAP_G);
-               insertkey((ID *)self->material, map+MAP_B);
-               insertkey((ID *)self->material, map+MAP_DVAR);
-               insertkey((ID *)self->material, map+MAP_COLF);
-               insertkey((ID *)self->material, map+MAP_NORF);
-               insertkey((ID *)self->material, map+MAP_VARF);
-               insertkey((ID *)self->material, map+MAP_DISP);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF);
+               insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP);
        }
 
        allspace(REMAKEIPO, 0);
index f2d9b657816f00f129bf5dfe167bd8d23f0c3279..a07f15b3cab62719c9f685072d121cca1cc685c7 100644 (file)
@@ -307,7 +307,7 @@ static PyObject *Action_getChannelIpo( BPy_Action * self, PyObject * args )
                return NULL;
        }
 
-       chan = get_named_actionchannel( self->action, chanName );
+       chan = get_action_channel( self->action, chanName );
        if( chan == NULL ) {
                EXPP_ReturnPyObjError( PyExc_AttributeError,
                                       "no channel with that name..." );
@@ -328,7 +328,7 @@ static PyObject *Action_removeChannel( BPy_Action * self, PyObject * args )
                return NULL;
        }
 
-       chan = get_named_actionchannel( self->action, chanName );
+       chan = get_action_channel( self->action, chanName );
        if( chan == NULL ) {
                EXPP_ReturnPyObjError( PyExc_AttributeError,
                                       "no channel with that name..." );
index 888cab2bc929176839c09d7c8ce95c2d2cd677ce..4da5dfc74ae42f6cff7718cd2c0ff22971a5d65d 100644 (file)
@@ -1991,50 +1991,55 @@ static PyObject *Object_setIpo( BPy_Object * self, PyObject * args )
 /*
  * Object_insertIpoKey()
  *  inserts Object IPO key for LOC, ROT, SIZE, LOCROT, or LOCROTSIZE
+ *  Note it also inserts actions! 
  */
 
 static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args )
 {
+       Object *ob= self->object;
     int key = 0;
+       char *actname= NULL;
     
        if( !PyArg_ParseTuple( args, "i", &( key ) ) )
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
                                                                                "expected int argument" ) );
-
+       if(ob->ipoflag & OB_ACTION_OB)
+               actname= "Object";
+       
        if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){
-               insertkey((ID *)self->object,OB_LOC_X);
-               insertkey((ID *)self->object,OB_LOC_Y);
-               insertkey((ID *)self->object,OB_LOC_Z);      
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X);
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y);
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z);      
        }
     if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){
-               insertkey((ID *)self->object,OB_ROT_X);
-               insertkey((ID *)self->object,OB_ROT_Y);
-               insertkey((ID *)self->object,OB_ROT_Z);      
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X);
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y);
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z);      
        }
     if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){
-               insertkey((ID *)self->object,OB_SIZE_X);
-               insertkey((ID *)self->object,OB_SIZE_Y);
-               insertkey((ID *)self->object,OB_SIZE_Z);      
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X);
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y);
+               insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z);      
        }
 
     if (key == IPOKEY_PI_STRENGTH ){
-        insertkey((ID *)self->object, OB_PD_FSTR);   
+        insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR);   
        }
 
     if (key == IPOKEY_PI_FALLOFF ){
-        insertkey((ID *)self->object, OB_PD_FFALL);   
+        insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL);   
        }
        
     if (key == IPOKEY_PI_SURFACEDAMP ){
-        insertkey((ID *)self->object, OB_PD_SDAMP);   
+        insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP);   
        }
 
     if (key == IPOKEY_PI_RANDOMDAMP ){
-        insertkey((ID *)self->object, OB_PD_RDAMP);   
+        insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP);   
        }
 
     if (key == IPOKEY_PI_PERM ){
-        insertkey((ID *)self->object, OB_PD_PERM);   
+        insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM);   
        }
 
 
index f065f3ebf588820730c94c8a88a67e233a8e5713..c91f2b1a2d841b12d39412c06ce5d585afc80200 100644 (file)
@@ -1113,37 +1113,37 @@ static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args )
        map = texchannel_to_adrcode(self->world->texact);
 
        if(key == IPOKEY_ZENITH) {
-               insertkey((ID *)self->world, WO_ZEN_R);
-               insertkey((ID *)self->world, WO_ZEN_G);
-               insertkey((ID *)self->world, WO_ZEN_B);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B);
        }
        if(key == IPOKEY_HORIZON) {
-               insertkey((ID *)self->world, WO_HOR_R);
-               insertkey((ID *)self->world, WO_HOR_G);
-               insertkey((ID *)self->world, WO_HOR_B);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B);
        }
        if(key == IPOKEY_MIST) {
-               insertkey((ID *)self->world, WO_MISI);
-               insertkey((ID *)self->world, WO_MISTDI);
-               insertkey((ID *)self->world, WO_MISTSTA);
-               insertkey((ID *)self->world, WO_MISTHI);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI);
        }
        if(key == IPOKEY_STARS) {
-               insertkey((ID *)self->world, WO_STAR_R);
-               insertkey((ID *)self->world, WO_STAR_G);
-               insertkey((ID *)self->world, WO_STAR_B);
-               insertkey((ID *)self->world, WO_STARDIST);
-               insertkey((ID *)self->world, WO_STARSIZE);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE);
        }
        if(key == IPOKEY_OFFSET) {
-               insertkey((ID *)self->world, map+MAP_OFS_X);
-               insertkey((ID *)self->world, map+MAP_OFS_Y);
-               insertkey((ID *)self->world, map+MAP_OFS_Z);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z);
        }
        if(key == IPOKEY_SIZE) {
-               insertkey((ID *)self->world, map+MAP_SIZE_X);
-               insertkey((ID *)self->world, map+MAP_SIZE_Y);
-               insertkey((ID *)self->world, map+MAP_SIZE_Z);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y);
+               insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z);
        }
 
        allspace(REMAKEIPO, 0);