Depsgraph: Use proper scene to get frame from for pose constraints evaluaiton
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Apr 2017 09:31:45 +0000 (11:31 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 18 Apr 2017 09:31:45 +0000 (11:31 +0200)
Spotted by Luca, thanks!

source/blender/blenkernel/BKE_armature.h
source/blender/blenkernel/intern/armature_update.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.h
source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc

index 78d6f6c7cb975544ffca33c7bccc2e7b4b528138..23bb526073b4953ca1fe8d48c3de19f8f59bc521 100644 (file)
@@ -177,6 +177,7 @@ void BKE_pose_eval_bone(struct EvaluationContext *eval_ctx,
                         struct bPoseChannel *pchan);
 
 void BKE_pose_constraints_evaluate(struct EvaluationContext *eval_ctx,
+                                   struct Scene *scene,
                                    struct Object *ob,
                                    struct bPoseChannel *pchan);
 
index 3bc81a69c867fb579891c4946cbacfbf9c702ff5..df0bddede3b806c11a2c4d90f72cefcba8a218e1 100644 (file)
@@ -628,10 +628,10 @@ void BKE_pose_eval_bone(EvaluationContext *UNUSED(eval_ctx),
 }
 
 void BKE_pose_constraints_evaluate(EvaluationContext *UNUSED(eval_ctx),
+                                   Scene *scene,
                                    Object *ob,
                                    bPoseChannel *pchan)
 {
-       Scene *scene = G.main->scene.first;
        DEBUG_PRINT("%s on %s pchan %s\n", __func__, ob->id.name, pchan->name);
        bArmature *arm = (bArmature *)ob->data;
        if (arm->flag & ARM_RESTPOS) {
index 10b586342ddf89bbc86d8ebe3a80b166b2e435e1..745f8283328145b43ca4eb2c60428d6c47f26a60 100644 (file)
@@ -130,7 +130,7 @@ struct DepsgraphNodeBuilder {
        void build_object(Scene *scene, Base *base, Object *ob);
        void build_object_transform(Scene *scene, Object *ob);
        void build_object_constraints(Scene *scene, Object *ob);
-       void build_pose_constraints(Object *ob, bPoseChannel *pchan);
+       void build_pose_constraints(Scene *scene, Object *ob, bPoseChannel *pchan);
        void build_rigidbody(Scene *scene);
        void build_particles(Scene *scene, Object *ob);
        void build_cloth(Scene *scene, Object *object);
index f2437ce1fac110e08fad687aa011473ee0cdad2c..e307909cb1140ab829ccd7cb45ba646a7e13a552 100644 (file)
@@ -64,11 +64,12 @@ extern "C" {
 
 namespace DEG {
 
-void DepsgraphNodeBuilder::build_pose_constraints(Object *ob, bPoseChannel *pchan)
+void DepsgraphNodeBuilder::build_pose_constraints(Scene *scene, Object *ob, bPoseChannel *pchan)
 {
        /* create node for constraint stack */
        add_operation_node(&ob->id, DEPSNODE_TYPE_BONE, pchan->name,
-                          DEPSOP_TYPE_EXEC, function_bind(BKE_pose_constraints_evaluate, _1, ob, pchan),
+                          DEPSOP_TYPE_EXEC,
+                          function_bind(BKE_pose_constraints_evaluate, _1, scene, ob, pchan),
                           DEG_OPCODE_BONE_CONSTRAINTS);
 }
 
@@ -201,7 +202,7 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *ob)
 
                /* constraints */
                if (pchan->constraints.first != NULL) {
-                       build_pose_constraints(ob, pchan);
+                       build_pose_constraints(scene, ob, pchan);
                }
 
                /**