Bugfix #20041: Drivers don't work on bone visiblity
- Drivers on added to the 'armature' datablock (i.e. keyframing some settings for a "Bone" as opposed to "PoseBone") now evaluate correctly. Added proper recalcs for this case too. - Also fixed some memory leaks and loading problems I encountered with the test file provided. After having problems loading the test file, I ended up reproducing and finding the error.
This commit is contained in:
@@ -37,6 +37,7 @@
|
||||
#include "BLI_math.h"
|
||||
#include "BLI_blenlib.h"
|
||||
|
||||
#include "DNA_anim_types.h"
|
||||
#include "DNA_armature_types.h"
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_curve_types.h"
|
||||
@@ -49,6 +50,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
|
||||
#include "BKE_animsys.h"
|
||||
#include "BKE_armature.h"
|
||||
#include "BKE_action.h"
|
||||
#include "BKE_anim.h"
|
||||
@@ -127,6 +129,12 @@ void free_armature(bArmature *arm)
|
||||
freeSketch(arm->sketch);
|
||||
arm->sketch = NULL;
|
||||
}
|
||||
|
||||
/* free animation data */
|
||||
if (arm->adt) {
|
||||
BKE_free_animdata(&arm->id);
|
||||
arm->adt= NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2364,6 +2364,9 @@ void object_handle_update(Scene *scene, Object *ob)
|
||||
}
|
||||
|
||||
if(ob->recalc & OB_RECALC_DATA) {
|
||||
ID *data_id= (ID *)ob->data;
|
||||
AnimData *adt= BKE_animdata_from_id(data_id);
|
||||
float ctime= (float)scene->r.cfra; // XXX this is bad...
|
||||
|
||||
if (G.f & G_DEBUG)
|
||||
printf("recalcdata %s\n", ob->id.name+2);
|
||||
@@ -2386,10 +2389,6 @@ void object_handle_update(Scene *scene, Object *ob)
|
||||
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);
|
||||
}
|
||||
@@ -2402,6 +2401,9 @@ void object_handle_update(Scene *scene, Object *ob)
|
||||
if(ob->pose==NULL || (ob->pose->flag & POSE_RECALC))
|
||||
armature_rebuild_pose(ob, ob->data);
|
||||
|
||||
/* evaluate drivers */
|
||||
BKE_animsys_evaluate_animdata(data_id, adt, ctime, ADT_RECALC_DRIVERS);
|
||||
|
||||
if(ob->id.lib && ob->proxy_from) {
|
||||
copy_pose_result(ob->pose, ob->proxy_from->pose);
|
||||
// printf("pose proxy copy, lib ob %s proxy %s\n", ob->id.name, ob->proxy_from->id.name);
|
||||
|
||||
@@ -2397,7 +2397,9 @@ static void direct_link_armature(FileData *fd, bArmature *arm)
|
||||
link_list(fd, &arm->bonebase);
|
||||
arm->edbo= NULL;
|
||||
arm->sketch = NULL;
|
||||
|
||||
arm->adt= newdataadr(fd, arm->adt);
|
||||
direct_link_animdata(fd, arm->adt);
|
||||
|
||||
bone=arm->bonebase.first;
|
||||
while (bone) {
|
||||
|
||||
Reference in New Issue
Block a user