(Looks like big commit, but is mostly just change of API call!)

Particle emittors now can be parented to an armature Bone, and give the
correct path for each particle. Note that this doesn't work for deform!
And, for each particle the entire armature is evaluated, all actions and
NLA strips.

It used to work a little while BTW, but the code just called ALL armatures
and made ALL deforms again. Was quite slow... thats why the API call
change: do_all_actions() now accepts Object * to only do that one. With
a NULL it now does all still. Will disapppear in recode of course...
This commit is contained in:
Ton Roosendaal 2005-04-11 17:55:20 +00:00
parent bb9548fd16
commit 52b7b978e3
11 changed files with 37 additions and 23 deletions

@ -86,7 +86,8 @@ void free_action(struct bAction * id);
void make_local_action(struct bAction *act); void make_local_action(struct bAction *act);
void do_all_actions(void); /* if NULL it does all, otherwise only from Object */
void do_all_actions(struct Object *);
/** /**
* Return a pointer to the pose channel of the given name * Return a pointer to the pose channel of the given name

@ -430,7 +430,7 @@ void get_pose_from_action(bPose **pose, bAction *act, float ctime)
} }
} }
void do_all_actions() void do_all_actions(Object *only_this)
{ {
Base *base; Base *base;
bPose *apose=NULL; bPose *apose=NULL;
@ -449,7 +449,8 @@ void do_all_actions()
while(base) { while(base) {
ob = base->object; if(only_this) ob= only_this;
else ob = base->object;
/* Retrieve data from the NLA */ /* Retrieve data from the NLA */
if(ob->type==OB_ARMATURE){ if(ob->type==OB_ARMATURE){
@ -471,11 +472,11 @@ void do_all_actions()
copy_pose(&tpose, ob->pose, 1); copy_pose(&tpose, ob->pose, 1);
rest_pose(apose, 1); rest_pose(apose, 1);
if (base->object->nlastrips.first){ if (ob->nlastrips.first){
rest_pose(base->object->pose, 0); rest_pose(ob->pose, 0);
} }
for (strip=base->object->nlastrips.first; strip; strip=strip->next){ for (strip=ob->nlastrips.first; strip; strip=strip->next){
doit = 0; doit = 0;
if (strip->act){ if (strip->act){
@ -585,7 +586,7 @@ void do_all_actions()
/* Do local action (always overrides the nla actions) */ /* Do local action (always overrides the nla actions) */
/* At the moment, only constraint ipos on the local action have any effect */ /* At the moment, only constraint ipos on the local action have any effect */
if(base->object->action) { if(ob->action) {
get_pose_from_action (&ob->pose, ob->action, bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0)); get_pose_from_action (&ob->pose, ob->action, bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0));
do_pose_constraint_channels(ob->pose, ob->action, bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0)); do_pose_constraint_channels(ob->pose, ob->action, bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0));
doit = 1; doit = 1;
@ -595,6 +596,9 @@ void do_all_actions()
apply_pose_armature(get_armature(ob), ob->pose, 1); apply_pose_armature(get_armature(ob), ob->pose, 1);
} }
if(only_this) break;
base= base->next; base= base->next;
if(base==0 && set==0 && G.scene->set) { if(base==0 && set==0 && G.scene->set) {
set= 1; set= 1;

@ -1300,6 +1300,10 @@ void build_particle_system(Object *ob)
/* do_ob_ipo(par); */ /* do_ob_ipo(par); */
par->ctime= -1234567.0; par->ctime= -1234567.0;
do_ob_key(par); do_ob_key(par);
if(par->type==OB_ARMATURE) {
do_all_actions(NULL); // only does this object actions
clear_object_constraint_status(par); // mysterious call, otherwise do_actions doesnt work???
}
par= par->parent; par= par->parent;
} }
if(ma) do_mat_ipo(ma); if(ma) do_mat_ipo(ma);
@ -1310,7 +1314,7 @@ void build_particle_system(Object *ob)
} }
} }
/* get coordinates */ /* get coordinates */
if(paf->flag & PAF_FACE) give_mesh_mvert(me, dlm, a, co, no,paf->seed); if(paf->flag & PAF_FACE) give_mesh_mvert(me, dlm, a, co, no, paf->seed);
else { else {
mvert= me->mvert + (a % me->totvert); mvert= me->mvert + (a % me->totvert);
VECCOPY(co, mvert->co); VECCOPY(co, mvert->co);
@ -1375,6 +1379,11 @@ void build_particle_system(Object *ob)
popfirst(par); popfirst(par);
/* do not do ob->ipo: keep insertkey */ /* do not do ob->ipo: keep insertkey */
do_ob_key(par); do_ob_key(par);
if(par->type==OB_ARMATURE) {
do_all_actions(NULL); // only does this object actions
clear_object_constraint_status(par); // mysterious call, otherwise do_actions doesnt work???
}
par= par->parent; par= par->parent;
} }

@ -337,7 +337,7 @@ void set_scene_bg(Scene *sce)
BPY_do_all_scripts(SCRIPT_FRAMECHANGED); BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
do_all_keys(); do_all_keys();
#ifdef __NLA #ifdef __NLA
do_all_actions(); do_all_actions(NULL);
rebuild_all_armature_displists(); rebuild_all_armature_displists();
#endif #endif
do_all_ikas(); do_all_ikas();

@ -1477,7 +1477,7 @@ void RE_animrender(struct View3D *ogl_render_view3d)
if(R.r.mode & (R_FIELDS|R_MBLUR)) { if(R.r.mode & (R_FIELDS|R_MBLUR)) {
do_all_ipos(); do_all_ipos();
do_all_keys(); do_all_keys();
do_all_actions(); do_all_actions(NULL);
do_all_ikas(); do_all_ikas();
} }

@ -2920,10 +2920,10 @@ void RE_rotateBlenderScene(void)
BPY_do_all_scripts(SCRIPT_FRAMECHANGED); BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
do_all_keys(); do_all_keys();
#ifdef __NLA #ifdef __NLA
do_all_actions(); do_all_actions(NULL);
rebuild_all_armature_displists(); rebuild_all_armature_displists();
/* so nice, better do it twice */ /* so nice, better do it twice */
do_all_actions(); do_all_actions(NULL);
rebuild_all_armature_displists(); rebuild_all_armature_displists();
#endif #endif
do_all_ikas(); do_all_ikas();

@ -2074,7 +2074,7 @@ void drawview3d_render(struct View3D *v3d)
do_all_ipos(); do_all_ipos();
BPY_do_all_scripts(SCRIPT_FRAMECHANGED); BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
do_all_keys(); do_all_keys();
do_all_actions(); do_all_actions(NULL);
do_all_ikas(); do_all_ikas();
test_all_displists(); test_all_displists();
@ -2305,7 +2305,7 @@ void inner_play_anim_loop(int init, int mode)
//do_all_ipos(); //do_all_ipos();
//BPY_do_all_scripts(SCRIPT_FRAMECHANGED); //BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
//do_all_keys(); //do_all_keys();
//do_all_actions(); //do_all_actions(NULL);
//do_all_ikas(); //do_all_ikas();
update_for_newframe_muted(); update_for_newframe_muted();
@ -2410,7 +2410,7 @@ int play_anim(int mode)
clear_all_constraints(); clear_all_constraints();
do_all_ipos(); do_all_ipos();
do_all_keys(); do_all_keys();
do_all_actions(); do_all_actions(NULL);
/* set all objects on current frame... test_all_displists() needs it */ /* set all objects on current frame... test_all_displists() needs it */
base= G.scene->base.first; base= G.scene->base.first;

@ -1261,7 +1261,7 @@ void transform_actionchannel_keys(char mode)
} }
if (G.saction->lock){ if (G.saction->lock){
do_all_actions(); do_all_actions(NULL);
force_draw_all(0); force_draw_all(0);
} }
else { else {
@ -1277,7 +1277,7 @@ void transform_actionchannel_keys(char mode)
/* Update the curve */ /* Update the curve */
/* Depending on the lock status, draw necessary views */ /* Depending on the lock status, draw necessary views */
do_all_actions(); do_all_actions(NULL);
remake_action_ipos(act); remake_action_ipos(act);
if(cancel==0) BIF_undo_push("Transform Action"); if(cancel==0) BIF_undo_push("Transform Action");
@ -1444,7 +1444,7 @@ void transform_meshchannel_keys(char mode, Key *key)
* future * future
*/ */
do_all_actions(); do_all_actions(NULL);
allqueue (REDRAWVIEW3D, 0); allqueue (REDRAWVIEW3D, 0);
allqueue (REDRAWACTION, 0); allqueue (REDRAWACTION, 0);
allqueue (REDRAWIPO, 0); allqueue (REDRAWIPO, 0);

@ -483,7 +483,7 @@ void editipo_changed(SpaceIpo *si, int doredraw)
} }
else if(si->blocktype==ID_SEQ) clear_last_seq(); else if(si->blocktype==ID_SEQ) clear_last_seq();
else if(si->blocktype==ID_AC){ else if(si->blocktype==ID_AC){
do_all_actions(); do_all_actions(NULL);
allqueue(REDRAWACTION, 0); allqueue(REDRAWACTION, 0);
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
} }
@ -4837,7 +4837,7 @@ void transform_ipo(int mode)
force_draw_plus(SPACE_VIEW3D, 0); force_draw_plus(SPACE_VIEW3D, 0);
} }
else if(G.sipo->blocktype==ID_AC) { else if(G.sipo->blocktype==ID_AC) {
do_all_actions(); do_all_actions(NULL);
force_draw_all(0); force_draw_all(0);
} }
else if(G.sipo->blocktype==ID_OB) { else if(G.sipo->blocktype==ID_OB) {

@ -509,10 +509,10 @@ static void do_update_for_newframe(int mute)
clear_all_constraints(); clear_all_constraints();
do_all_keys(); do_all_keys();
do_all_actions(); do_all_actions(NULL);
rebuild_all_armature_displists(); rebuild_all_armature_displists();
/* so nice, better do it twice */ /* so nice, better do it twice */
do_all_actions(); do_all_actions(NULL);
rebuild_all_armature_displists(); rebuild_all_armature_displists();
do_all_ikas(); do_all_ikas();

@ -409,7 +409,7 @@ void persptoetsen(unsigned short event)
countall(); countall();
do_all_ipos(); do_all_ipos();
do_all_keys(); do_all_keys();
do_all_actions(); do_all_actions(NULL);
do_all_ikas(); do_all_ikas();
test_all_displists(); test_all_displists();