Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-10-06 14:13:42 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-10-06 14:47:57 +0300
commitf3fce877b34154224ff0d1e7789b28382fa8f0ea (patch)
tree6fafd82c9a1153d58135cb641de1064657e87dba
parent1b9de4fa3379cd74cb138c2f78960ce9831daf66 (diff)
Cleanup: Depsgraph, reduce nesting of driver relations code
Reduce nesting of `DepsgraphRelationBuilder::build_driver_data()` by flipping conditions and `return`/`continue` early. No functional changes.
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc48
1 files changed, 26 insertions, 22 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 525f9e304cb..26839c67324 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -1484,31 +1484,35 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu)
/* Drivers on armature-level bone settings (i.e. bbone stuff),
* which will affect the evaluation of corresponding pose bones. */
Bone *bone = (Bone *)property_entry_key.ptr.data;
- if (bone != nullptr) {
- /* Find objects which use this, and make their eval callbacks
- * depend on this. */
- for (IDNode *to_node : graph_->id_nodes) {
- if (GS(to_node->id_orig->name) == ID_OB) {
- Object *object = (Object *)to_node->id_orig;
- /* We only care about objects with pose data which use this. */
- if (object->data == id_ptr && object->pose != nullptr) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone->name);
- if (pchan != nullptr) {
- OperationKey bone_key(
- &object->id, NodeType::BONE, pchan->name, OperationCode::BONE_LOCAL);
- add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
- }
- }
- }
+ if (bone == nullptr) {
+ fprintf(stderr, "Couldn't find armature bone name for driver path - '%s'\n", rna_path);
+ return;
+ }
+
+ /* Find objects which use this, and make their eval callbacks depend on this. */
+ for (IDNode *to_node : graph_->id_nodes) {
+ if (GS(to_node->id_orig->name) != ID_OB) {
+ continue;
}
- /* Make the driver depend on COW, similar to the generic case below. */
- if (id_ptr != id) {
- ComponentKey cow_key(id_ptr, NodeType::COPY_ON_WRITE);
- add_relation(cow_key, driver_key, "Driven CoW -> Driver", RELATION_CHECK_BEFORE_ADD);
+
+ /* We only care about objects with pose data which use this. */
+ Object *object = (Object *)to_node->id_orig;
+ if (object->data != id_ptr || object->pose == nullptr) {
+ continue;
+ }
+
+ bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone->name);
+ if (pchan == nullptr) {
+ continue;
}
+
+ OperationKey bone_key(&object->id, NodeType::BONE, pchan->name, OperationCode::BONE_LOCAL);
+ add_relation(driver_key, bone_key, "Arm Bone -> Driver -> Bone");
}
- else {
- fprintf(stderr, "Couldn't find armature bone name for driver path - '%s'\n", rna_path);
+ /* Make the driver depend on COW, similar to the generic case below. */
+ if (id_ptr != id) {
+ ComponentKey cow_key(id_ptr, NodeType::COPY_ON_WRITE);
+ add_relation(cow_key, driver_key, "Driven CoW -> Driver", RELATION_CHECK_BEFORE_ADD);
}
}
else {