forked from bartvdbraak/blender
Bug fix #2411
(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:
parent
bb9548fd16
commit
52b7b978e3
@ -86,7 +86,8 @@ void free_action(struct bAction * id);
|
||||
|
||||
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
|
||||
|
@ -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;
|
||||
bPose *apose=NULL;
|
||||
@ -449,7 +449,8 @@ void do_all_actions()
|
||||
|
||||
while(base) {
|
||||
|
||||
ob = base->object;
|
||||
if(only_this) ob= only_this;
|
||||
else ob = base->object;
|
||||
|
||||
/* Retrieve data from the NLA */
|
||||
if(ob->type==OB_ARMATURE){
|
||||
@ -471,11 +472,11 @@ void do_all_actions()
|
||||
copy_pose(&tpose, ob->pose, 1);
|
||||
rest_pose(apose, 1);
|
||||
|
||||
if (base->object->nlastrips.first){
|
||||
rest_pose(base->object->pose, 0);
|
||||
if (ob->nlastrips.first){
|
||||
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;
|
||||
if (strip->act){
|
||||
|
||||
@ -585,7 +586,7 @@ void do_all_actions()
|
||||
|
||||
/* Do local action (always overrides the nla actions) */
|
||||
/* 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));
|
||||
do_pose_constraint_channels(ob->pose, ob->action, bsystem_time(ob, 0, (float) G.scene->r.cfra, 0.0));
|
||||
doit = 1;
|
||||
@ -595,6 +596,9 @@ void do_all_actions()
|
||||
apply_pose_armature(get_armature(ob), ob->pose, 1);
|
||||
|
||||
}
|
||||
|
||||
if(only_this) break;
|
||||
|
||||
base= base->next;
|
||||
if(base==0 && set==0 && G.scene->set) {
|
||||
set= 1;
|
||||
|
@ -1300,6 +1300,10 @@ void build_particle_system(Object *ob)
|
||||
/* do_ob_ipo(par); */
|
||||
par->ctime= -1234567.0;
|
||||
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;
|
||||
}
|
||||
if(ma) do_mat_ipo(ma);
|
||||
@ -1310,7 +1314,7 @@ void build_particle_system(Object *ob)
|
||||
}
|
||||
}
|
||||
/* 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 {
|
||||
mvert= me->mvert + (a % me->totvert);
|
||||
VECCOPY(co, mvert->co);
|
||||
@ -1375,6 +1379,11 @@ void build_particle_system(Object *ob)
|
||||
popfirst(par);
|
||||
/* do not do ob->ipo: keep insertkey */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -337,7 +337,7 @@ void set_scene_bg(Scene *sce)
|
||||
BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
|
||||
do_all_keys();
|
||||
#ifdef __NLA
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
rebuild_all_armature_displists();
|
||||
#endif
|
||||
do_all_ikas();
|
||||
|
@ -1477,7 +1477,7 @@ void RE_animrender(struct View3D *ogl_render_view3d)
|
||||
if(R.r.mode & (R_FIELDS|R_MBLUR)) {
|
||||
do_all_ipos();
|
||||
do_all_keys();
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
do_all_ikas();
|
||||
}
|
||||
|
||||
|
@ -2920,10 +2920,10 @@ void RE_rotateBlenderScene(void)
|
||||
BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
|
||||
do_all_keys();
|
||||
#ifdef __NLA
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
rebuild_all_armature_displists();
|
||||
/* so nice, better do it twice */
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
rebuild_all_armature_displists();
|
||||
#endif
|
||||
do_all_ikas();
|
||||
|
@ -2074,7 +2074,7 @@ void drawview3d_render(struct View3D *v3d)
|
||||
do_all_ipos();
|
||||
BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
|
||||
do_all_keys();
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
do_all_ikas();
|
||||
|
||||
test_all_displists();
|
||||
@ -2305,7 +2305,7 @@ void inner_play_anim_loop(int init, int mode)
|
||||
//do_all_ipos();
|
||||
//BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
|
||||
//do_all_keys();
|
||||
//do_all_actions();
|
||||
//do_all_actions(NULL);
|
||||
//do_all_ikas();
|
||||
update_for_newframe_muted();
|
||||
|
||||
@ -2410,7 +2410,7 @@ int play_anim(int mode)
|
||||
clear_all_constraints();
|
||||
do_all_ipos();
|
||||
do_all_keys();
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
|
||||
/* set all objects on current frame... test_all_displists() needs it */
|
||||
base= G.scene->base.first;
|
||||
|
@ -1261,7 +1261,7 @@ void transform_actionchannel_keys(char mode)
|
||||
}
|
||||
|
||||
if (G.saction->lock){
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
force_draw_all(0);
|
||||
}
|
||||
else {
|
||||
@ -1277,7 +1277,7 @@ void transform_actionchannel_keys(char mode)
|
||||
/* Update the curve */
|
||||
/* Depending on the lock status, draw necessary views */
|
||||
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
remake_action_ipos(act);
|
||||
|
||||
if(cancel==0) BIF_undo_push("Transform Action");
|
||||
@ -1444,7 +1444,7 @@ void transform_meshchannel_keys(char mode, Key *key)
|
||||
* future
|
||||
*/
|
||||
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
allqueue (REDRAWVIEW3D, 0);
|
||||
allqueue (REDRAWACTION, 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_AC){
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
allqueue(REDRAWACTION, 0);
|
||||
allqueue(REDRAWNLA, 0);
|
||||
}
|
||||
@ -4837,7 +4837,7 @@ void transform_ipo(int mode)
|
||||
force_draw_plus(SPACE_VIEW3D, 0);
|
||||
}
|
||||
else if(G.sipo->blocktype==ID_AC) {
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
force_draw_all(0);
|
||||
}
|
||||
else if(G.sipo->blocktype==ID_OB) {
|
||||
|
@ -509,10 +509,10 @@ static void do_update_for_newframe(int mute)
|
||||
clear_all_constraints();
|
||||
do_all_keys();
|
||||
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
rebuild_all_armature_displists();
|
||||
/* so nice, better do it twice */
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
rebuild_all_armature_displists();
|
||||
|
||||
do_all_ikas();
|
||||
|
@ -409,7 +409,7 @@ void persptoetsen(unsigned short event)
|
||||
countall();
|
||||
do_all_ipos();
|
||||
do_all_keys();
|
||||
do_all_actions();
|
||||
do_all_actions(NULL);
|
||||
do_all_ikas();
|
||||
test_all_displists();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user