diff options
-rw-r--r-- | source/blender/blenkernel/BKE_constraint.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 22 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 2 | ||||
-rw-r--r-- | source/blender/renderconverter/intern/convertBlenderScene.c | 2 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 39 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 47 | ||||
-rw-r--r-- | source/blender/src/headerbuttons.c | 8 |
7 files changed, 68 insertions, 54 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index 6570f547e48..273b9d2a0a5 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -51,6 +51,8 @@ struct bConstraintChannel *clone_constraint_channels (struct ListBase *dst, stru void relink_constraints (struct ListBase *list); void free_constraint_data (struct bConstraint *con); void clear_object_constraint_status (struct Object *ob); +void clear_all_constraints(void); +void rebuild_all_armature_displists(void); void do_constraint_channels (struct ListBase *conbase, struct ListBase *chanbase, float ctime); short get_constraint_target (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); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index a37980b041d..053034d9620 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -45,6 +45,7 @@ #include "DNA_object_types.h" #include "DNA_action_types.h" #include "DNA_curve_types.h" +#include "DNA_scene_types.h" #include "BKE_utildefines.h" #include "BKE_action.h" @@ -407,6 +408,27 @@ void clear_object_constraint_status (Object *ob) } } +void clear_all_constraints(void) +{ + Base *base; + + /* Clear the constraint "done" flags -- this must be done + * before displists are calculated for objects that are + * deformed by armatures */ + for (base = G.scene->base.first; base; base=base->next){ + clear_object_constraint_status(base->object); + } +} + +void rebuild_all_armature_displists(void) { + Base *base; + + for (base = G.scene->base.first; base; base=base->next){ + clear_object_constraint_status(base->object); + make_displists_by_armature(base->object); + } +} + short get_constraint_target (bConstraint *con, short ownertype, void* ownerdata, float mat[][4], float size[3], float ctime) { short valid=0; diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 7f47042be76..3dd9ad2180c 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -75,6 +75,7 @@ #include "BKE_global.h" #include "BKE_main.h" #include "BKE_anim.h" +#include "BKE_constraint.h" #include "BKE_library.h" @@ -407,6 +408,7 @@ void set_scene_bg(Scene *sce) do_all_keys(); #ifdef __NLA do_all_actions(); + rebuild_all_armature_displists(); #endif do_all_ikas(); diff --git a/source/blender/renderconverter/intern/convertBlenderScene.c b/source/blender/renderconverter/intern/convertBlenderScene.c index d752a958925..c1eb91cce76 100644 --- a/source/blender/renderconverter/intern/convertBlenderScene.c +++ b/source/blender/renderconverter/intern/convertBlenderScene.c @@ -2813,6 +2813,7 @@ void RE_rotateBlenderScene(void) do_all_keys(); #ifdef __NLA do_all_actions(); + rebuild_all_armature_displists(); #endif do_all_ikas(); test_all_displists(); @@ -2831,7 +2832,6 @@ void RE_rotateBlenderScene(void) clear_object_constraint_status(base->object); if (base->object->type==OB_ARMATURE) { where_is_armature (base->object); - make_displists_by_armature(base->object); } else diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index ef2145edfcd..285ad44769f 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1390,7 +1390,6 @@ void do_viewbuts(unsigned short event) bPoseChannel *chan; bArmature *arm; Bone *bone; - Base *base; arm = get_armature(OBACT); if (!arm) return; @@ -1411,10 +1410,7 @@ void do_viewbuts(unsigned short event) set_pose_channel (G.obpose->pose, chan); - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - make_displists_by_armature(base->object); - } + rebuild_all_armature_displists(); allqueue(REDRAWVIEW3D, 1); } @@ -1688,10 +1684,7 @@ void drawview3dspace(ScrArea *sa, void *spacedata) * or else armatures/poses/displists get recalculated all of the * time */ - /* Clear the constraint "done" flags */ - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - } + clear_all_constraints(); #endif /* draw set first */ @@ -1897,12 +1890,7 @@ void drawview3d_render(struct View3D *v3d) /* abuse! to make sure it doesnt draw the helpstuff */ G.f |= G_SIMULATION; - /* Clear the constraint "done" flags -- this must be done - * before displists are calculated for objects that are - * deformed by armatures */ - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - } + clear_all_constraints(); do_all_ipos(); BPY_do_all_scripts(SCRIPT_FRAMECHANGED); do_all_keys(); @@ -1955,9 +1943,9 @@ void drawview3d_render(struct View3D *v3d) G.f &= ~G_PICKSEL; } - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - } + + clear_all_constraints(); + /* first not selected and duplis */ base= G.scene->base.first; while(base) { @@ -2383,12 +2371,7 @@ void inner_play_anim_loop(int init, int mode) set_timecursor(CFRA); - /* Clear the constraint "done" flags -- this must be done - * before displists are calculated for objects that are - * deformed by armatures */ - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - } + clear_all_constraints(); do_all_ipos(); BPY_do_all_scripts(SCRIPT_FRAMECHANGED); do_all_keys(); @@ -2489,13 +2472,7 @@ int play_anim(int mode) if(event==SPACEKEY); else CFRA= cfraont; - /* Clear the constraint "done" flags -- this must be done - * before displists are calculated for objects that are - * deformed by armatures */ - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - } - + clear_all_constraints(); do_all_ipos(); do_all_keys(); do_all_actions(); diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index 7335fd07ea9..217e629009a 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -2629,21 +2629,23 @@ static void clear_pose_update_flag(Object *ob) { } } -static void pose_flags_reset_done(Object *ob) { +static int pose_flags_reset_done(Object *ob) { /* Clear the constraint done status for every pose channe; * that has been flagged as needing constant updating */ bPoseChannel *chan; + int numreset = 0; if (ob->pose) { for (chan = ob->pose->chanbase.first; chan; chan=chan->next){ if (chan->flag & PCHAN_TRANS_UPDATE) { chan->flag &= ~PCHAN_DONE; + numreset++; } } } - + return numreset; } static int is_ob_constraint_target(Object *ob, ListBase *conlist) { @@ -2998,6 +3000,22 @@ static int pose_do_update_flag(Object *ob) { return do_update; } +void figure_pose_updating(void) +{ + Base *base; + + flag_moving_objects(); + + for (base= FIRSTBASE; base; base= base->next) { + /* Recalculate the pose if necessary, regardless of + * whether the layer is visible or not. + */ + if (pose_do_update_flag(base->object)) + base->flag |= BA_WHERE_UPDATE; + } + +} + /*** POSE FIGURIN' -- END ***/ @@ -3014,18 +3032,10 @@ static void setbaseflags_for_editing(int mode) /* 0,'g','r','s' */ Base *base; copy_baseflags(); - flag_moving_objects(); - for (base= FIRSTBASE; base; base= base->next) { base->flag &= ~(BA_PARSEL+BA_WASSEL); - /* Recalculate the pose if necessary, regardless of - * whether the layer is visible or not. - */ - if (pose_do_update_flag(base->object)) - base->flag |= BA_WHERE_UPDATE; - if( (base->lay & G.vd->lay) && base->object->id.lib==0) { Object *ob= base->object; Object *parsel= is_a_parent_selected(ob); @@ -3700,10 +3710,6 @@ void special_trans_update(int keyflags) base->object->partype |= PARSLOW; } else if(base->flag & BA_WHERE_UPDATE) { - /* deal with the armature case */ - pose_flags_reset_done(base->object); - make_displists_by_armature(base->object); - where_is_object(base->object); if(base->object->type==OB_IKA) { itterate_ika(base->object); @@ -3724,6 +3730,16 @@ void special_trans_update(int keyflags) } + base= FIRSTBASE; + while(base) { + if (pose_flags_reset_done(base->object)) { + if (!is_delay_deform()) + make_displists_by_armature(base->object); + } + + base= base->next; + } + #if 1 if (G.obpose && G.obpose->type == OB_ARMATURE) clear_pose_constraint_status(G.obpose); @@ -4486,6 +4502,7 @@ void transform(int mode) case OB_ARMATURE: /* figure out which bones need calculating */ figure_bone_nocalc(G.obpose); + figure_pose_updating(); make_trans_bones(mode); break; } @@ -4497,7 +4514,7 @@ void transform(int mode) else if (mode=='s' || mode=='S') opt= 's'; setbaseflags_for_editing(opt); - + figure_pose_updating(); make_trans_objects(); } diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index 7f023f37916..2bd1ea98d3d 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -509,13 +509,7 @@ void do_update_for_newframe(int mute) allqueue(REDRAWBUTSSHADING, 0); allqueue(REDRAWBUTSOBJECT, 0); - /* Clear the constraint "done" flags -- this must be done - * before displists are calculated for objects that are - * deformed by armatures */ - for (base = G.scene->base.first; base; base=base->next){ - clear_object_constraint_status(base->object); - } - + clear_all_constraints(); /* layers/materials, object ipos are calculted in where_is_object (too) */ do_all_ipos(); BPY_do_all_scripts(SCRIPT_FRAMECHANGED); |