[Bf-blender-cvs] [e49aa6beac7] blender2.8: Depsgraph: Add missing expansion od custom bone shapes
Sergey Sharybin
noreply at git.blender.org
Wed Jul 19 17:34:07 CEST 2017
Commit: e49aa6beac74d62bc01bdcf02bf100af5655f50a
Author: Sergey Sharybin
Date: Wed Jul 19 12:44:27 2017 +0200
Branches: blender2.8
https://developer.blender.org/rBe49aa6beac74d62bc01bdcf02bf100af5655f50a
Depsgraph: Add missing expansion od custom bone shapes
===================================================================
M source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
M source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M source/blender/depsgraph/intern/builder/deg_builder_relations.h
M source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
M source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M source/blender/depsgraph/intern/nodes/deg_node.cc
===================================================================
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 8535ce6188e..9a3cc60d3c8 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -72,14 +72,21 @@ struct DepsgraphNodeBuilder {
DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph);
~DepsgraphNodeBuilder();
- void begin_build(Main *bmain);
-
ID *get_cow_id(const ID *id_orig) const;
-
template<typename T>
T *get_cow_datablock(const T *orig) const {
return (T *)get_cow_id(&orig->id);
}
+ template<typename T>
+ T *get_orig_datablock(const T *cow) const {
+#ifdef WITH_COPY_ON_WRITE
+ return (T *)cow->id.newid;
+#else
+ return cow;
+#endif
+ }
+
+ void begin_build(Main *bmain);
IDDepsNode *add_id_node(ID *id);
TimeSourceDepsNode *add_time_source();
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
index d567dd02740..20374d6ec70 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc
@@ -259,14 +259,12 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *object)
function_bind(BKE_pose_bone_done, _1, pchan),
DEG_OPCODE_BONE_DONE);
op_node->set_as_exit();
-
- /* constraints */
+ /* Build constraints. */
if (pchan->constraints.first != NULL) {
build_pose_constraints(scene, object, pchan);
}
-
/**
- * IK Solvers...
+ * IK Solvers.
*
* - These require separate processing steps are pose-level
* to be executed between chains of bones (i.e. once the
@@ -291,6 +289,11 @@ void DepsgraphNodeBuilder::build_rig(Scene *scene, Object *object)
break;
}
}
+ /* Custom shape. */
+ /* NOTE: Custom shape datablock is already remapped to CoW version. */
+ if (pchan->custom != NULL) {
+ build_object(scene, get_orig_datablock(pchan->custom));
+ }
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index dd457f4b21c..4c1d010d0cc 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -521,7 +521,7 @@ void DepsgraphRelationBuilder::build_object(Main *bmain, Scene *scene, Object *o
build_proxy_rig(ob);
}
else {
- build_rig(scene, ob);
+ build_rig(bmain, scene, ob);
}
break;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
index 7a0f9934f9d..e8bdc662bd6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h
@@ -210,7 +210,7 @@ struct DepsgraphRelationBuilder
bPoseChannel *pchan,
bConstraint *con,
RootPChanMap *root_map);
- void build_rig(Scene *scene, Object *ob);
+ void build_rig(Main *bmain, Scene *scene, Object *ob);
void build_proxy_rig(Object *ob);
void build_shapekeys(ID *obdata, Key *key);
void build_obdata_geom(Main *bmain, Scene *scene, Object *ob);
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
index be666165a0b..2c2aa5d6651 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc
@@ -291,7 +291,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *ob,
}
/* Pose/Armature Bones Graph */
-void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob)
+void DepsgraphRelationBuilder::build_rig(Main *bmain, Scene *scene, Object *ob)
{
/* Armature-Data */
bArmature *arm = (bArmature *)ob->data;
@@ -379,16 +379,12 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob)
OperationKey bone_pose_key(&ob->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_POSE_PARENT);
OperationKey bone_ready_key(&ob->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_READY);
OperationKey bone_done_key(&ob->id, DEG_NODE_TYPE_BONE, pchan->name, DEG_OPCODE_BONE_DONE);
-
pchan->flag &= ~POSE_DONE;
-
- /* pose init to bone local */
+ /* Pose init to bone local. */
add_relation(init_key, bone_local_key, "PoseEval Source-Bone Link");
-
- /* local to pose parenting operation */
+ /* Local to pose parenting operation. */
add_relation(bone_local_key, bone_pose_key, "Bone Local - PoseSpace Link");
-
- /* parent relation */
+ /* Parent relation. */
if (pchan->parent != NULL) {
eDepsOperation_Code parent_key_opcode;
@@ -403,8 +399,7 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob)
OperationKey parent_key(&ob->id, DEG_NODE_TYPE_BONE, pchan->parent->name, parent_key_opcode);
add_relation(parent_key, bone_pose_key, "[Parent Bone -> Child Bone]");
}
-
- /* constraints */
+ /* Buil constraints. */
if (pchan->constraints.first != NULL) {
/* constraints stack and constraint dependencies */
build_constraints(scene, &ob->id, DEG_NODE_TYPE_BONE, pchan->name, &pchan->constraints, &root_map);
@@ -431,6 +426,10 @@ void DepsgraphRelationBuilder::build_rig(Scene *scene, Object *ob)
/* assume that all bones must be done for the pose to be ready (for deformers) */
add_relation(bone_done_key, flush_key, "PoseEval Result-Bone Link");
+ /* Custom shape. */
+ if (pchan->custom != NULL) {
+ build_object(bmain, scene, pchan->custom);
+ }
}
}
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 23d61e5c2c8..77b67ffa71e 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -312,7 +312,8 @@ static bool check_datablocks_copy_on_writable(const ID *id_orig)
return !ELEM(id_type, ID_BR,
ID_TE,
ID_IM,
- ID_LS);
+ ID_LS,
+ ID_AC);
}
/* Callback for BKE_library_foreach_ID_link which remaps original ID pointer
@@ -605,6 +606,8 @@ ID *deg_expand_copy_on_write_datablock(Depsgraph *depsgraph,
MEM_freeN(newid);
}
id_cow->tag |= LIB_TAG_COPY_ON_WRITE;
+ /* TODO(sergey): Is it safe to re-use newid for original ID link? */
+ id_cow->newid = (ID *)id_orig;
return id_cow;
}
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
index 889d1dc4243..8506a93d6ca 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node.cc
@@ -183,6 +183,8 @@ void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
DEG_COW_PRINT("Create shallow copy for %s: id_orig=%p id_cow=%p\n",
id_orig->name, id_orig, id_cow);
id_cow->tag |= LIB_TAG_COPY_ON_WRITE;
+ /* TODO(sergey): Is it safe to re-use newid for original ID link? */
+ id_cow->newid = (ID *)id_orig;
#else
id_cow = id_orig;
#endif
More information about the Bf-blender-cvs
mailing list