Commit: 819756c6d1f9dba171dc8704fdd45a34410de17b
Author: Sergey Sharybin
Date:   Thu Feb 12 15:23:18 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB819756c6d1f9dba171dc8704fdd45a34410de17b

Depsgraph: Fix for proxy source object operation nodes

It should in fact just copy result from the local proxy object instead
of doing pose solution again.

===================================================================

M       source/blender/blenkernel/BKE_armature.h
M       source/blender/blenkernel/intern/armature_update.c
M       source/blender/depsgraph/intern/depsgraph_build.h
M       source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M       source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M       source/blender/depsgraph/intern/depsnode_opcodes.h

===================================================================

diff --git a/source/blender/blenkernel/BKE_armature.h 
b/source/blender/blenkernel/BKE_armature.h
index ac409ae..9f38e0e 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -188,6 +188,9 @@ void BKE_pose_eval_flush(struct EvaluationContext *eval_ctx,
                          struct Object *ob,
                          struct bPose *pose);
 
+void BKE_pose_eval_proxy_copy(struct EvaluationContext *UNUSED(eval_ctx),
+                              struct Object *ob);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/armature_update.c 
b/source/blender/blenkernel/intern/armature_update.c
index 4344c56..d651e13 100644
--- a/source/blender/blenkernel/intern/armature_update.c
+++ b/source/blender/blenkernel/intern/armature_update.c
@@ -37,6 +37,7 @@
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
+#include "BKE_action.h"
 #include "BKE_anim.h"
 #include "BKE_armature.h"
 #include "BKE_curve.h"
@@ -707,3 +708,13 @@ void BKE_pose_eval_flush(EvaluationContext 
*UNUSED(eval_ctx),
        /* 6. release the IK tree */
        BIK_release_tree(scene, ob, ctime);
 }
+
+void BKE_pose_eval_proxy_copy(EvaluationContext *UNUSED(eval_ctx), Object *ob)
+{
+       BLI_assert(ob->id.lib != NULL && ob->proxy_from != NULL);
+       DEBUG_PRINT("%s on %s\n", __func__, ob->id.name);
+       if (BKE_pose_copy_result(ob->pose, ob->proxy_from->pose) == false) {
+               printf("Proxy copy error, lib Object: %s proxy Object: %s\n",
+                      ob->id.name + 2, ob->proxy_from->id.name + 2);
+       }
+}
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h 
b/source/blender/depsgraph/intern/depsgraph_build.h
index 7e9a033..1d29d97 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -91,6 +91,7 @@ struct DepsgraphNodeBuilder {
        void build_ik_pose(Scene *scene, Object *ob, bPoseChannel *pchan, 
bConstraint *con);
        void build_splineik_pose(Scene *scene, Object *ob, bPoseChannel *pchan, 
bConstraint *con);
        void build_rig(Scene *scene, Object *ob);
+       void build_proxy_rig(Scene *scene, Object *ob);
        void build_shapekeys(Key *key);
        void build_obdata_geom(Scene *scene, Object *ob);
        void build_camera(Object *ob);
@@ -245,6 +246,7 @@ struct DepsgraphRelationBuilder
        void build_ik_pose(Object *ob, bPoseChannel *pchan, bConstraint *con, 
RootPChanMap *root_map);
        void build_splineik_pose(Object *ob, bPoseChannel *pchan, bConstraint 
*con, RootPChanMap *root_map);
        void build_rig(Scene *scene, Object *ob);
+       void build_proxy_rig(Scene *scene, Object *ob);
        void build_shapekeys(ID *obdata, Key *key);
        void build_obdata_geom(Scene *scene, Object *ob);
        void build_camera(Object *ob);
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp 
b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 3b1c5b1..21db0f0 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -250,7 +250,12 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base 
*base, Object *ob)
                        break;
                        
                        case OB_ARMATURE: /* Pose */
-                               build_rig(scene, ob);
+                               if (ob->id.lib != NULL && ob->proxy_from != 
NULL) {
+                                       build_proxy_rig(scene, ob);
+                               }
+                               else {
+                                       build_rig(scene, ob);
+                               }
                                break;
                        
                        case OB_LAMP:   /* Lamp */
@@ -647,6 +652,15 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object 
*ob)
        }
 }
 
+void DepsgraphNodeBuilder::build_proxy_rig(Scene *scene, Object *ob)
+{
+       add_operation_node(&ob->id,
+                          DEPSNODE_TYPE_EVAL_POSE,
+                          DEPSOP_TYPE_EXEC,
+                          function_bind(BKE_pose_eval_proxy_copy, _1, ob),
+                          DEG_OPCODE_POSE_PROXY_COPY);
+}
+
 /* Shapekeys */
 void DepsgraphNodeBuilder::build_shapekeys(Key *key)
 {
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp 
b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 6ee22f2..0208066 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -176,7 +176,7 @@ void DepsgraphRelationBuilder::build_scene(Scene *scene)
                         * behavior and need to be investigated if it still 
need to be inverted.
                         */
                        ComponentKey ob_pose_key(&ob->id, 
DEPSNODE_TYPE_EVAL_POSE);
-                       ComponentKey proxy_pose_key(&ob->proxy->id, 
DEPSNODE_TYPE_TRANSFORM);
+                       ComponentKey proxy_pose_key(&ob->proxy->id, 
DEPSNODE_TYPE_EVAL_POSE);
                        add_relation(ob_pose_key, proxy_pose_key, 
DEPSREL_TYPE_TRANSFORM, "Proxy");
                }
 
@@ -310,7 +310,12 @@ void DepsgraphRelationBuilder::build_object(Scene *scene, 
Object *ob)
                        
                        
                        case OB_ARMATURE: /* Pose */
-                               build_rig(scene, ob);
+                               if (ob->id.lib != NULL && ob->proxy_from != 
NULL) {
+                                       build_proxy_rig(scene, ob);
+                               }
+                               else {
+                                       build_rig(scene, ob);
+                               }
                                break;
                        
                        case OB_LAMP:   /* Lamp */
@@ -1291,6 +1296,10 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, 
Object *ob)
        }
 }
 
+void DepsgraphRelationBuilder::build_proxy_rig(Scene *scene, Object *ob)
+{
+}
+
 /* Shapekeys */
 void DepsgraphRelationBuilder::build_shapekeys(ID *obdata, Key *key)
 {
diff --git a/source/blender/depsgraph/intern/depsnode_opcodes.h 
b/source/blender/depsgraph/intern/depsnode_opcodes.h
index ed0955e..c05e9c5 100644
--- a/source/blender/depsgraph/intern/depsnode_opcodes.h
+++ b/source/blender/depsgraph/intern/depsnode_opcodes.h
@@ -111,6 +111,9 @@ DEF_DEG_OPCODE(POSE_DONE)
 DEF_DEG_OPCODE(POSE_IK_SOLVER)
 DEF_DEG_OPCODE(POSE_SPLINE_IK_SOLVER)
 
+/* Copy proxy eval result */
+DEF_DEG_OPCODE(POSE_PROXY_COPY)
+
 /* Bone -------------------------------------------- */
 
 /* Bone local transforms - Entrypoint */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to