Animato - Basic version patching support

This is work-in-progress patching support for converting animation saved in old system to work in the new one. 

* Only IPOs/Actions directly attached to Objects + Shapekeys are converted for now. More types will follow...
* This is currently done as a step outside of do_versions() due to problems with various pointers not having been resolved yet, but which are necessary for correct resolution of issues such as drivers... However, the current code does illustrate how the data should be converted to give best results/compat between the two systems.
* Still need to get the converted data working with depsgraph correctly. Currently, some of my testfiles work, but the BBB files still don't.
This commit is contained in:
Joshua Leung 2009-01-22 10:53:22 +00:00
parent 3cdac8e9f7
commit a017982074
15 changed files with 799 additions and 2636 deletions

View File

@ -24,7 +24,7 @@
*
* The Original Code is: all of this file.
*
* Contributor(s): 2008, Joshua Leung (Animation Cleanup)
* Contributor(s): 2008,2009 Joshua Leung (Animation Cleanup, Animation Systme Recode)
*
* ***** END GPL LICENSE BLOCK *****
*/
@ -35,128 +35,19 @@
extern "C" {
#endif
/* -------- IPO-Curve (Bezier) Calculations ---------- */
struct Main;
struct Ipo;
void do_versions_ipo_to_animato(struct Main *main);
/* --------------------- xxx stuff ------------------------ */
void free_ipo(struct Ipo *ipo);
// xxx perhaps this should be in curve api not in anim api
void correct_bezpart(float *v1, float *v2, float *v3, float *v4);
// XXX this file will soon be depreceated...
#if 0 // XXX old animation system
typedef struct CfraElem {
struct CfraElem *next, *prev;
float cfra;
int sel;
} CfraElem;
struct Ipo;
struct IpoCurve;
struct MTex;
struct Material;
struct Scene;
struct Object;
struct Sequence;
struct ListBase;
struct BezTriple;
struct ID;
struct bPoseChannel;
struct bActionChannel;
struct rctf;
/* ------------ Time Management ------------ */
float frame_to_float(struct Scene *scene, int cfra);
/* ------------ IPO Management ---------- */
void free_ipo_curve(struct IpoCurve *icu);
void free_ipo(struct Ipo *ipo);
void ipo_default_v2d_cur(struct Scene *scene, int blocktype, struct rctf *cur);
struct Ipo *add_ipo(struct Scene *scene, char *name, int idcode);
struct Ipo *copy_ipo(struct Ipo *ipo);
void ipo_idnew(struct Ipo *ipo);
struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
short has_ipo_code(struct Ipo *ipo, int code);
/* -------------- Make Local -------------- */
void make_local_obipo(struct Ipo *ipo);
void make_local_matipo(struct Ipo *ipo);
void make_local_keyipo(struct Ipo *ipo);
void make_local_ipo(struct Ipo *ipo);
/* ------------ IPO-Curve Sanity ---------------- */
void calchandles_ipocurve(struct IpoCurve *icu);
void testhandles_ipocurve(struct IpoCurve *icu);
void sort_time_ipocurve(struct IpoCurve *icu);
int test_time_ipocurve(struct IpoCurve *icu);
void set_interpolation_ipocurve(struct IpoCurve *icu, short ipo);
/* -------- IPO-Curve (Bezier) Calculations ---------- */
void correct_bezpart(float *v1, float *v2, float *v3, float *v4);
int findzero(float x, float q0, float q1, float q2, float q3, float *o);
void berekeny(float f1, float f2, float f3, float f4, float *o, int b);
void berekenx(float *f, float *o, int b);
/* -------- IPO Curve Calculation and Evaluation --------- */
float eval_icu(struct IpoCurve *icu, float ipotime);
void calc_icu(struct IpoCurve *icu, float ctime);
float calc_ipo_time(struct Ipo *ipo, float ctime);
void calc_ipo(struct Ipo *ipo, float ctime);
void calc_ipo_range(struct Ipo *ipo, float *start, float *end);
/* ------------ Keyframe Column Tools -------------- */
void add_to_cfra_elem(struct ListBase *lb, struct BezTriple *bezt);
void make_cfra_list(struct Ipo *ipo, struct ListBase *elems);
/* ---------------- IPO DataAPI ----------------- */
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_pchan_ipo_poin(struct bPoseChannel *pchan, int adrcode);
void *get_ipo_poin(struct ID *id, struct IpoCurve *icu, int *type);
void set_icu_vars(struct IpoCurve *icu);
/* ---------------- IPO Execution --------------- */
void execute_ipo(struct ID *id, struct Ipo *ipo);
void execute_action_ipo(struct bActionChannel *achan, struct bPoseChannel *pchan);
void do_ipo_nocalc(struct Scene *scene, struct Ipo *ipo);
void do_ipo(struct Scene *scene, struct Ipo *ipo);
void do_mat_ipo(struct Scene *scene, struct Material *ma);
void do_ob_ipo(struct Scene *scene, struct Object *ob);
void do_seq_ipo(struct Scene *scene, struct Sequence *seq, int cfra);
void do_ob_ipodrivers(struct Object *ob, struct Ipo *ipo, float ctime);
void do_all_data_ipos(struct Scene *scene);
short calc_ipo_spec(struct Ipo *ipo, int adrcode, float *ctime);
void clear_delta_obipo(struct Ipo *ipo);
/* ----------- IPO <-> GameEngine API ---------------- */
/* the short is an IPO_Channel... */
short IPO_GetChannels(struct Ipo *ipo, short *channels);
float IPO_GetFloatValue(struct Ipo *ipo, short c, float ctime);
#endif // XXX old animation system
#ifdef __cplusplus
};
#endif

View File

@ -52,4 +52,4 @@ if env['BF_NO_ELBEEM']:
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'):
incs += ' ' + env['BF_PTHREADS_INC']
env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [155] )
env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [165] )

View File

@ -86,7 +86,10 @@ AnimData *BKE_id_add_animdata (ID *id)
if (id_has_animdata(id)) {
IdAdtTemplate *iat= (IdAdtTemplate *)id;
iat->adt= MEM_callocN(sizeof(AnimData), "AnimData");
/* check if there's already AnimData, in which case, don't add */
if (iat->adt == NULL)
iat->adt= MEM_callocN(sizeof(AnimData), "AnimData");
return iat->adt;
}
else
@ -232,7 +235,8 @@ static void animsys_execute_fcurve (PointerRNA *ptr, AnimMapper *remap, FCurve *
free_path= animsys_remap_path(remap, fcu->rna_path, &path);
/* write value to setting */
animsys_write_rna_setting(ptr, path, fcu->array_index, fcu->curval);
if (path)
animsys_write_rna_setting(ptr, path, fcu->array_index, fcu->curval);
/* free temp path-info */
if (free_path)
@ -586,7 +590,7 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re
* or be layered on top of existing animation data.
* - Drivers should be in the appropriate order to be evaluated without problems...
*/
if ((recalc & ADT_RECALC_DRIVERS) && (adt->recalc & ADT_RECALC_DRIVERS))
if ((recalc & ADT_RECALC_DRIVERS) /*&& (adt->recalc & ADT_RECALC_DRIVERS)*/) // XXX for now, don't check yet, as depsgraph hasn't been updated
{
animsys_evaluate_drivers(&id_ptr, adt, ctime);
}
@ -615,7 +619,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
{
ID *id;
//printf("Evaluate all animation - %f \n", ctime);
printf("Evaluate all animation - %f \n", ctime);
/* macro for less typing */
#define EVAL_ANIM_IDS(first) \
@ -640,7 +644,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
EVAL_ANIM_IDS(main->camera.first);
/* shapekeys */
// TODO...
EVAL_ANIM_IDS(main->key.first);
/* curves */
// TODO...

View File

@ -74,6 +74,7 @@
#include "BKE_font.h"
#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_ipo.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_object.h"
@ -371,12 +372,12 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
//setscreen(G.curscreen);
}
// XXX is this in the right place?
do_versions_ipos_to_animato(G.main); // XXX fixme... complicated versionpatching
/* baseflags, groups, make depsgraph, etc */
set_scene_bg(CTX_data_scene(C));
/* clear BONE_UNKEYED flags, these are not valid anymore for proxies */
framechange_poses_clear_unkeyed();
/* last stage of do_versions actually, that sets recalc flags for recalc poses */
for(ob= G.main->object.first; ob; ob= ob->id.next) {
if(ob->type==OB_ARMATURE)

View File

@ -303,50 +303,66 @@ DagForest * dag_init()
return forest;
}
static void dag_add_driver_relation(Ipo *ipo, DagForest *dag, DagNode *node, int isdata)
/* isdata = object data... */
// XXX this needs to be extended to be more flexible (so that not only objects are evaluated via depsgraph)...
static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node, int isdata)
{
IpoCurve *icu;
FCurve *fcu;
DagNode *node1;
for(icu= ipo->curve.first; icu; icu= icu->next) {
if(icu->driver) {
if (icu->driver->type == IPO_DRIVER_TYPE_PYTHON) {
if ((icu->driver->flag & IPO_DRIVER_FLAG_INVALID) || (icu->driver->name[0] == '\0'))
continue; /* empty or invalid expression */
for (fcu= adt->drivers.first; fcu; fcu= fcu->next) {
ChannelDriver *driver= fcu->driver;
if (driver->type == DRIVER_TYPE_PYTHON) {
/* PyDriver / 'Expression' */
/* skip if invalid in some way */
if ((driver->flag & DRIVER_FLAG_INVALID) || (driver->expression[0] == '\0'))
continue;
#ifndef DISABLE_PYTHON
else {
/* now we need refs to all objects mentioned in this
* pydriver expression, to call 'dag_add_relation'
* for each of them */
Object **obarray = BPY_pydriver_get_objects(icu->driver);
if (obarray) {
Object *ob, **oba = obarray;
while (*oba) {
ob = *oba;
node1 = dag_get_node(dag, ob);
if (ob->type == OB_ARMATURE)
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Python Ipo Driver");
else
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Python Ipo Driver");
oba++;
}
MEM_freeN(obarray);
else {
/* now we need refs to all objects mentioned in this
* pydriver expression, to call 'dag_add_relation'
* for each of them */
Object **obarray = BPY_pydriver_get_objects(fcu->driver);
if (obarray) {
Object *ob, **oba = obarray;
while (*oba) {
ob = *oba;
node1 = dag_get_node(dag, ob);
if (ob->type == OB_ARMATURE)
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Python Driver");
else
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Python Driver");
oba++;
}
MEM_freeN(obarray);
}
}
#endif /* DISABLE_PYTHON */
}
else if (icu->driver->ob) {
node1 = dag_get_node(dag, icu->driver->ob);
if(icu->driver->blocktype==ID_AR)
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Ipo Driver");
else
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver");
}
}
else if (driver->type == DRIVER_TYPE_ROTDIFF) {
// XXX rotational difference
}
else {
/* normal channel-drives-channel */
node1 = dag_get_node(dag, driver->id); // XXX we assume that id is an object...
// XXX what happens for bone drivers?
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver");
}
#if 0 // XXX old 'normal' type
else if (icu->driver->ob) {
node1 = dag_get_node(dag, icu->driver->ob);
if(icu->driver->blocktype==ID_AR)
dag_add_relation(dag, node1, node, isdata?DAG_RL_DATA_DATA:DAG_RL_DATA_OB, "Ipo Driver");
else
dag_add_relation(dag, node1, node, isdata?DAG_RL_OB_DATA:DAG_RL_OB_OB, "Ipo Driver");
}
#endif // XXX old 'normal' type
}
}
@ -371,7 +387,6 @@ static void dag_add_collision_field_relation(DagForest *dag, Scene *scene, Objec
static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, Object *ob, int mask)
{
bConstraint *con;
bConstraintChannel *conchan;
DagNode * node;
DagNode * node2;
DagNode * node3;
@ -426,6 +441,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
/* driver dependencies, nla modifiers */
#if 0 // XXX old animation system
if(ob->ipo)
dag_add_driver_relation(ob->ipo, dag, node, 0);
@ -466,6 +482,14 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
}
}
#endif // XXX old animation system
if (ob->adt)
dag_add_driver_relation(ob->adt, dag, node, (ob->type == OB_ARMATURE)); // XXX isdata arg here doesn't give an accurate picture of situation
key= ob_get_key(ob);
if (key && key->adt)
dag_add_driver_relation(key->adt, dag, node, 1);
if (ob->modifiers.first) {
ModifierData *md;
@ -515,11 +539,12 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
dag_add_relation(dag, node, node2, DAG_RL_DATA_DATA|DAG_RL_OB_OB, "Proxy");
/* inverted relation, so addtoroot shouldn't be set to zero */
}
if (ob->type==OB_CAMERA) {
Camera *cam = (Camera *)ob->data;
if (cam->ipo) {
dag_add_driver_relation(cam->ipo, dag, node, 1);
}
if (cam->adt)
dag_add_driver_relation(cam->adt, dag, node, 1);
if (cam->dof_ob) {
node2 = dag_get_node(dag, cam->dof_ob);
dag_add_relation(dag,node2,node,DAG_RL_OB_OB, "Camera DoF");
@ -527,10 +552,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
}
if (ob->type==OB_LAMP) {
Lamp *la = (Lamp *)ob->data;
if (la->ipo) {
dag_add_driver_relation(la->ipo, dag, node, 1);
}
if (la->adt)
dag_add_driver_relation(la->adt, dag, node, 1);
}
if (ob->transflag & OB_DUPLI) {
if((ob->transflag & OB_DUPLIGROUP) && ob->dup_group) {
GroupObject *go;
@ -566,9 +591,8 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
node2 = dag_get_node(dag, cu->taperobj);
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Curve Taper");
}
if(cu->ipo)
dag_add_driver_relation(cu->ipo, dag, node, 1);
if (cu->adt)
dag_add_driver_relation(cu->adt, dag, node, 1);
}
else if(ob->type==OB_FONT) {
Curve *cu= ob->data;
@ -1953,24 +1977,6 @@ static int object_modifiers_use_time(Object *ob)
return 0;
}
#if 0 // XXX old animation system
static int exists_channel(Object *ob, char *name)
{
bActionStrip *strip;
if(ob->action)
if(get_action_channel(ob->action, name))
return 1;
for (strip=ob->nlastrips.first; strip; strip=strip->next)
if(get_action_channel(strip->act, name))
return 1;
return 0;
}
#endif // XXX old animation system
static short animdata_use_time(AnimData *adt)
{
NlaTrack *nlt;
@ -2023,14 +2029,8 @@ static void dag_object_time_update_flags(Object *ob)
}
#if 0 // XXX old animation system
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(exists_channel(ob, "Shape"))
ob->recalc |= OB_RECALC_DATA;
else if(ob->dup_group) {
if(ob->nlastrips.first) {
if(ob->dup_group) {
bActionStrip *strip;
/* this case is for groups with nla, whilst nla target has no action or nla */
for(strip= ob->nlastrips.first; strip; strip= strip->next) {
@ -2041,6 +2041,7 @@ static void dag_object_time_update_flags(Object *ob)
}
#endif // XXX old animation system
if(animdata_use_time(ob->adt)) ob->recalc |= OB_RECALC;
if((ob->adt) && (ob->type==OB_ARMATURE)) ob->recalc |= OB_RECALC_DATA;
if(object_modifiers_use_time(ob)) ob->recalc |= OB_RECALC_DATA;
if((ob->pose) && (ob->pose->flag & POSE_CONSTRAINTS_TIMEDEPEND)) ob->recalc |= OB_RECALC_DATA;
@ -2316,6 +2317,7 @@ void DAG_pose_sort(Object *ob)
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
#if 0 // XXX old animation system... driver stuff to watch out for
if(con->ipo) {
IpoCurve *icu;
for(icu= con->ipo->curve.first; icu; icu= icu->next) {
@ -2327,7 +2329,7 @@ void DAG_pose_sort(Object *ob)
if(target) {
node2 = dag_get_node(dag, target);
dag_add_relation(dag, node2, node, 0, "Ipo Driver");
/* uncommented this line, results in dependencies
* not being added properly for this constraint,
* what is the purpose of this? - brecht */
@ -2336,6 +2338,7 @@ void DAG_pose_sort(Object *ob)
}
}
}
#endif // XXX old animation system... driver stuff to watch out for
if (cti && cti->get_constraint_targets) {
cti->get_constraint_targets(con, &targets);

View File

@ -1190,7 +1190,7 @@ static void fcm_cycles_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, flo
cycles= data->after_cycles;
}
}
if ELEM3(0, side, mode, cycles)
if ELEM(0, side, mode)
return;
/* extrapolation mode is 'cyclic' - find relative place within a cycle */
@ -1209,7 +1209,12 @@ static void fcm_cycles_evaluate (FCurve *fcu, FModifier *fcm, float *cvalue, flo
if (cycdx == 0)
return;
/* check that cyclic is still enabled for the specified time */
if ( ((float)side * (evaltime - ofs) / cycdx) > cycles )
if (cycles == 0) {
/* catch this case so that we don't exit when we have cycles=0
* as this indicates infinite cycles...
*/
}
else if ( ((float)side * (evaltime - ofs) / cycdx) > cycles )
return;

File diff suppressed because it is too large Load Diff

View File

@ -35,6 +35,7 @@
#include "MEM_guardedalloc.h"
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
#include "DNA_lattice_types.h"
@ -1367,6 +1368,10 @@ int do_ob_key(Scene *scene, Object *ob)
execute_ipo((ID *)key, key->ipo);
}
#endif // XXX old animation system
/* do shapekey local drivers */
float ctime= (float)scene->r.cfra; // XXX this needs to be checked
printf("ob %s - do shapekey drivers \n", ob->id.name+2);
BKE_animsys_evaluate_animdata(&key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
if(ob->type==OB_MESH) return do_mesh_key(scene, ob, ob->data);
else if(ob->type==OB_CURVE) return do_curve_key(scene, ob->data);

View File

@ -232,6 +232,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
/* BACKWARDS! also watch order of free-ing! (mesh<->mat) */
lb[a++]= &(main->ipo);
lb[a++]= &(main->action); // xxx moved here to avoid problems when freeing with animato (aligorith)
lb[a++]= &(main->key);
lb[a++]= &(main->nodetree);
lb[a++]= &(main->image);
@ -244,7 +245,6 @@ int set_listbasepointers(Main *main, ListBase **lb)
*/
lb[a++]= &(main->armature);
lb[a++]= &(main->action);
lb[a++]= &(main->mesh);
lb[a++]= &(main->curve);
@ -490,7 +490,7 @@ void free_libblock(ListBase *lb, void *idv)
free_camera((Camera*) id);
break;
case ID_IP:
/*free_ipo((Ipo *)id);*/
free_ipo((Ipo *)id);
break;
case ID_KE:
free_key((Key *)id);
@ -682,52 +682,6 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
}
}
/* Silly routine, the only difference between the one
* above is that it only adds items with a matching
* blocktype... this should be unified somehow... - zr
*/
static void IPOnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, short *nr, int blocktype)
{
ID *id;
int i, nids;
for (id= lb->first, nids= 0; id; id= id->next) {
Ipo *ipo= (Ipo*) id;
if (ipo->blocktype==blocktype)
nids++;
}
if (nids>MAX_IDPUP) {
BLI_dynstr_append(pupds, "DataBrowse %x-2");
} else {
for (i=0, id= lb->first; id; id= id->next) {
Ipo *ipo= (Ipo*) id;
if (ipo->blocktype==blocktype) {
char buf[32];
if (id==link)
*nr= i+1;
if (U.uiflag & USER_HIDE_DOT && id->name[2]=='.')
continue;
get_flags_for_id(id, buf);
BLI_dynstr_append(pupds, buf);
BLI_dynstr_append(pupds, id->name+2);
sprintf(buf, "%%x%d", i+1);
BLI_dynstr_append(pupds, buf);
if(id->next)
BLI_dynstr_append(pupds, "|");
i++;
}
}
}
}
/* used by headerbuttons.c buttons.c editobject.c editseq.c */
/* if nr==NULL no MAX_IDPUP, this for non-header browsing */
@ -775,28 +729,6 @@ void IMAnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb
}
/* only used by headerbuttons.c */
void IPOnames_to_pupstring(char **str, char *title, char *extraops, ListBase *lb, ID *link, short *nr, int blocktype)
{
DynStr *pupds= BLI_dynstr_new();
if (title) {
BLI_dynstr_append(pupds, title);
BLI_dynstr_append(pupds, "%t|");
}
if (extraops) {
BLI_dynstr_append(pupds, extraops);
if (BLI_dynstr_get_len(pupds))
BLI_dynstr_append(pupds, "|");
}
IPOnames_to_dyn_pupstring(pupds, lb, link, nr, blocktype);
*str= BLI_dynstr_get_cstring(pupds);
BLI_dynstr_free(pupds);
}
/* used by buttons.c library.c mball.c */
void splitIDname(char *name, char *left, int *nr)
{

View File

@ -2274,7 +2274,7 @@ void object_handle_update(Scene *scene, Object *ob)
if(ob->recalc & OB_RECALC_OB) {
// printf("recalcob %s\n", ob->id.name+2);
printf("recalcob %s\n", ob->id.name+2);
/* handle proxy copy for target */
if(ob->id.lib && ob->proxy_from) {
@ -2296,7 +2296,7 @@ void object_handle_update(Scene *scene, Object *ob)
if(ob->recalc & OB_RECALC_DATA) {
// printf("recalcdata %s\n", ob->id.name+2);
printf("recalcdata %s\n", ob->id.name+2);
/* includes all keys and modifiers */
if(ob->type==OB_MESH) {
@ -2312,29 +2312,20 @@ void object_handle_update(Scene *scene, Object *ob)
else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
makeDispListCurveTypes(scene, ob, 0);
}
else if(ELEM(ob->type, OB_CAMERA, OB_LAMP)) {
ID *data_id= (ID *)ob->data;
AnimData *adt= BKE_animdata_from_id(data_id);
float ctime= (float)scene->r.cfra; // XXX this is bad...
/* evaluate drivers */
BKE_animsys_evaluate_animdata(data_id, adt, ctime, ADT_RECALC_DRIVERS);
}
else if(ob->type==OB_LATTICE) {
lattice_calc_modifiers(scene, ob);
}
else if(ob->type==OB_CAMERA) {
//Camera *cam = (Camera *)ob->data;
// xxx old animation code here
//calc_ipo(cam->ipo, frame_to_float(scene, scene->r.cfra));
//execute_ipo(&cam->id, cam->ipo);
// in new system, this has already been done! - aligorith
}
else if(ob->type==OB_LAMP) {
//Lamp *la = (Lamp *)ob->data;
// xxx old animation code here
//calc_ipo(la->ipo, frame_to_float(scene, scene->r.cfra));
//execute_ipo(&la->id, la->ipo);
// in new system, this has already been done! - aligorith
}
else if(ob->type==OB_ARMATURE) {
/* this happens for reading old files and to match library armatures with poses */
// XXX this won't screw up the pose set already...
if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
armature_rebuild_pose(ob, ob->data);
@ -2343,7 +2334,6 @@ void object_handle_update(Scene *scene, Object *ob)
// printf("pose proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
}
else {
//do_all_pose_actions(scene, ob); // xxx old animation system
where_is_pose(scene, ob);
}
}

View File

@ -11,4 +11,4 @@ incs += ' ' + env['BF_ZLIB_INC']
defs = []
env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [165, 30] )
env.BlenderLib ( 'bf_blenloader', sources, Split(incs), defs, libtype=['core','player'], priority = [135, 30] )

View File

@ -122,6 +122,7 @@
#include "BKE_global.h" // for G
#include "BKE_group.h"
#include "BKE_image.h"
#include "BKE_ipo.h"
#include "BKE_key.h" //void set_four_ipo
#include "BKE_lattice.h"
#include "BKE_library.h" // for wich_libbase
@ -1823,6 +1824,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
}
}
/* NOTE: this assumes that link_list has already been called on the list */
static void direct_link_fcurves(FileData *fd, ListBase *list)
{
FCurve *fcu;
@ -1904,8 +1906,8 @@ static void direct_link_action(FileData *fd, bAction *act)
bActionChannel *achan; // XXX depreceated - old animation system
bActionGroup *agrp;
link_list(fd, &act->curves); // xxx - do we need to patch the data for this?
link_list(fd, &act->chanbase);
link_list(fd, &act->curves);
link_list(fd, &act->chanbase); // XXX depreceated - old animation system
link_list(fd, &act->groups);
link_list(fd, &act->markers);
@ -1951,6 +1953,7 @@ static void direct_link_animdata(FileData *fd, AnimData *adt)
return;
/* link drivers */
link_list(fd, &adt->drivers);
direct_link_fcurves(fd, &adt->drivers);
/* link overrides */
@ -8665,14 +8668,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 3)) {
bScreen *sc;
Ipo *ipo;
IpoCurve *icu;
/* fix IPO-curves to work with new interpolation options */
//for (ipo=main->ipo.first; ipo; ipo= ipo->id.next) {
// for (icu= ipo->curve.first; icu; icu= icu->next)
// set_interpolation_ipocurve(icu, icu->ipo); // function removed (XXX add it here)
//}
/* adjust default settings for Animation Editors */
for (sc= main->screen.first; sc; sc= sc->id.next) {
@ -8719,10 +8714,15 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(screen= main->screen.first; screen; screen= screen->id.next)
do_versions_windowmanager_2_50(screen);
/* old Animation System (using IPO's) needs to be converted to the new Animato system
* (NOTE: conversion code in blenkernel/intern/ipo.c for now)
*/
//do_versions_ipos_to_animato(main);
/* struct audio data moved to renderdata */
for(scene= main->scene.first; scene; scene= scene->id.next) {
scene->r.audio = scene->audio;
if(!scene->toolsettings->uv_selectmode)
scene->toolsettings->uv_selectmode= UV_SELECT_VERTEX;
}
@ -8836,7 +8836,7 @@ static void lib_link_all(FileData *fd, Main *main)
lib_link_material(fd, main);
lib_link_texture(fd, main);
lib_link_image(fd, main);
lib_link_ipo(fd, main);
lib_link_ipo(fd, main); // XXX depreceated... still needs to be maintained for version patches still
lib_link_key(fd, main);
lib_link_world(fd, main);
lib_link_lamp(fd, main);
@ -9136,7 +9136,6 @@ static void expand_animdata(FileData *fd, Main *mainvar, AnimData *adt)
/* own action */
expand_doit(fd, mainvar, adt->action);
expand_action(fd, mainvar, adt->action); // XXX this call is only used for patching old animation system
/* drivers - assume that these F-Curves have driver data to be in this list... */
for (fcd= adt->drivers.first; fcd; fcd= fcd->next) {
@ -9167,6 +9166,9 @@ static void expand_group(FileData *fd, Main *mainvar, Group *group)
static void expand_key(FileData *fd, Main *mainvar, Key *key)
{
expand_doit(fd, mainvar, key->ipo); // XXX depreceated - old animation system
if(key->adt)
expand_animdata(fd, mainvar, key->adt);
}
static void expand_nodetree(FileData *fd, Main *mainvar, bNodeTree *ntree)

View File

@ -1058,6 +1058,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *ar)
}
break;
case ANIMTYPE_FILLACTD:
case ANIMTYPE_FILLMATD:
case ANIMTYPE_DSSKEY:
{
if (sel) glColor4ub(col2b[0], col2b[1], col2b[2], 0x45);

View File

@ -255,32 +255,15 @@ static float actcopy_firstframe= 999999999.0f;
// XXX find some header to put this in!
void free_actcopybuf ()
{
#if 0 // XXX old animation system
bActionChannel *achan, *anext;
bConstraintChannel *conchan, *cnext;
FCurve *fcu, *fcn;
for (achan= actcopybuf.first; achan; achan= anext) {
anext= achan->next;
if (achan->ipo) {
free_ipo(achan->ipo);
MEM_freeN(achan->ipo);
}
for (conchan=achan->constraintChannels.first; conchan; conchan=cnext) {
cnext= conchan->next;
if (conchan->ipo) {
free_ipo(conchan->ipo);
MEM_freeN(conchan->ipo);
}
BLI_freelinkN(&achan->constraintChannels, conchan);
}
BLI_freelinkN(&actcopybuf, achan);
/* free_fcurve() frees F-Curve memory too, but we don't need to do remlink first, as we're freeing all
* channels anyway, and the freeing func only cares about the data it's given
*/
for (fcu= actcopybuf.first; fcu; fcu= fcn) {
fcn= fcu->next;
free_fcurve(fcu);
}
#endif // XXX old animation system
actcopybuf.first= actcopybuf.last= NULL;
actcopy_firstframe= 999999999.0f;
@ -292,7 +275,7 @@ void free_actcopybuf ()
* Only the selected action channels gets their selected keyframes copied.
*/
static short copy_action_keys (bAnimContext *ac)
{
{
#if 0 // XXX old animation system
ListBase anim_data = {NULL, NULL};
bAnimListElem *ale;

View File

@ -124,7 +124,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "loc");
RNA_def_property_ui_text(prop, "Location", "");
prop= RNA_def_property(srna, "size", PROP_FLOAT, PROP_VECTOR);
prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_float_sdna(prop, NULL, "size");
RNA_def_property_ui_text(prop, "Scale", "");