diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h | 304 |
1 files changed, 153 insertions, 151 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h index 86a17ae4a47..4412fa3fca3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -32,187 +32,189 @@ extern "C" { namespace DEG { -template <typename KeyType> -OperationNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key) +template<typename KeyType> +OperationNode *DepsgraphRelationBuilder::find_operation_node(const KeyType &key) { - Node *node = get_node(key); - return node != NULL ? node->get_exit_operation() : NULL; + Node *node = get_node(key); + return node != NULL ? node->get_exit_operation() : NULL; } -template <typename KeyFrom, typename KeyTo> +template<typename KeyFrom, typename KeyTo> Relation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, const KeyTo &key_to, const char *description, int flags) { - Node *node_from = get_node(key_from); - Node *node_to = get_node(key_to); - OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; - OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL; - if (op_from && op_to) { - return add_operation_relation(op_from, op_to, description, flags); - } - else { - if (!op_from) { - /* XXX TODO handle as error or report if needed */ - fprintf(stderr, "add_relation(%s) - Could not find op_from (%s)\n", - description, key_from.identifier().c_str()); - } - else { - fprintf(stderr, "add_relation(%s) - Failed, but op_from (%s) was ok\n", - description, key_from.identifier().c_str()); - } - if (!op_to) { - /* XXX TODO handle as error or report if needed */ - fprintf(stderr, "add_relation(%s) - Could not find op_to (%s)\n", - description, key_to.identifier().c_str()); - } - else { - fprintf(stderr, "add_relation(%s) - Failed, but op_to (%s) was ok\n", - description, key_to.identifier().c_str()); - } - } - return NULL; + Node *node_from = get_node(key_from); + Node *node_to = get_node(key_to); + OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; + OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL; + if (op_from && op_to) { + return add_operation_relation(op_from, op_to, description, flags); + } + else { + if (!op_from) { + /* XXX TODO handle as error or report if needed */ + fprintf(stderr, + "add_relation(%s) - Could not find op_from (%s)\n", + description, + key_from.identifier().c_str()); + } + else { + fprintf(stderr, + "add_relation(%s) - Failed, but op_from (%s) was ok\n", + description, + key_from.identifier().c_str()); + } + if (!op_to) { + /* XXX TODO handle as error or report if needed */ + fprintf(stderr, + "add_relation(%s) - Could not find op_to (%s)\n", + description, + key_to.identifier().c_str()); + } + else { + fprintf(stderr, + "add_relation(%s) - Failed, but op_to (%s) was ok\n", + description, + key_to.identifier().c_str()); + } + } + return NULL; } -template <typename KeyTo> -Relation *DepsgraphRelationBuilder::add_relation( - const TimeSourceKey &key_from, - const KeyTo &key_to, - const char *description, - int flags) +template<typename KeyTo> +Relation *DepsgraphRelationBuilder::add_relation(const TimeSourceKey &key_from, + const KeyTo &key_to, + const char *description, + int flags) { - TimeSourceNode *time_from = get_node(key_from); - Node *node_to = get_node(key_to); - OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL; - if (time_from != NULL && op_to != NULL) { - return add_time_relation( - time_from, op_to, description, flags); - } - return NULL; + TimeSourceNode *time_from = get_node(key_from); + Node *node_to = get_node(key_to); + OperationNode *op_to = node_to ? node_to->get_entry_operation() : NULL; + if (time_from != NULL && op_to != NULL) { + return add_time_relation(time_from, op_to, description, flags); + } + return NULL; } -template <typename KeyType> -Relation *DepsgraphRelationBuilder::add_node_handle_relation( - const KeyType &key_from, - const DepsNodeHandle *handle, - const char *description, - int flags) +template<typename KeyType> +Relation *DepsgraphRelationBuilder::add_node_handle_relation(const KeyType &key_from, + const DepsNodeHandle *handle, + const char *description, + int flags) { - Node *node_from = get_node(key_from); - OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; - OperationNode *op_to = handle->node->get_entry_operation(); - if (op_from != NULL && op_to != NULL) { - return add_operation_relation(op_from, op_to, description, flags); - } - else { - if (!op_from) { - fprintf(stderr, "add_node_handle_relation(%s) - Could not find op_from (%s)\n", - description, key_from.identifier().c_str()); - } - if (!op_to) { - fprintf(stderr, "add_node_handle_relation(%s) - Could not find op_to (%s)\n", - description, key_from.identifier().c_str()); - } - } - return NULL; + Node *node_from = get_node(key_from); + OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; + OperationNode *op_to = handle->node->get_entry_operation(); + if (op_from != NULL && op_to != NULL) { + return add_operation_relation(op_from, op_to, description, flags); + } + else { + if (!op_from) { + fprintf(stderr, + "add_node_handle_relation(%s) - Could not find op_from (%s)\n", + description, + key_from.identifier().c_str()); + } + if (!op_to) { + fprintf(stderr, + "add_node_handle_relation(%s) - Could not find op_to (%s)\n", + description, + key_from.identifier().c_str()); + } + } + return NULL; } -template <typename KeyTo> -Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation( - ID *id, - const KeyTo& key_to, - const char *description, - int flags) +template<typename KeyTo> +Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation(ID *id, + const KeyTo &key_to, + const char *description, + int flags) { - if (GS(id->name) == ID_OB) { - Object *object = reinterpret_cast<Object *>(id); - if (object->rigidbody_object != NULL) { - OperationKey transform_key(&object->id, - NodeType::TRANSFORM, - OperationCode::TRANSFORM_EVAL); - return add_relation(transform_key, key_to, description, flags); - } - } - ComponentKey transform_key(id, NodeType::TRANSFORM); - return add_relation(transform_key, key_to, description, flags); + if (GS(id->name) == ID_OB) { + Object *object = reinterpret_cast<Object *>(id); + if (object->rigidbody_object != NULL) { + OperationKey transform_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); + return add_relation(transform_key, key_to, description, flags); + } + } + ComponentKey transform_key(id, NodeType::TRANSFORM); + return add_relation(transform_key, key_to, description, flags); } -template <typename KeyType> -DepsNodeHandle DepsgraphRelationBuilder::create_node_handle( - const KeyType &key, - const char *default_name) +template<typename KeyType> +DepsNodeHandle DepsgraphRelationBuilder::create_node_handle(const KeyType &key, + const char *default_name) { - return DepsNodeHandle(this, get_node(key), default_name); + return DepsNodeHandle(this, get_node(key), default_name); } /* Rig compatibility: we check if bone is using local transform as a variable * for driver on itself and ignore those relations to avoid "false-positive" * dependency cycles. */ -template <typename KeyFrom, typename KeyTo> -bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom& key_from, - const KeyTo& key_to) +template<typename KeyFrom, typename KeyTo> +bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom &key_from, + const KeyTo &key_to) { - /* Get operations for requested keys. */ - Node *node_from = get_node(key_from); - Node *node_to = get_node(key_to); - if (node_from == NULL || node_to == NULL) { - return false; - } - OperationNode *op_from = node_from->get_exit_operation(); - OperationNode *op_to = node_to->get_entry_operation(); - if (op_from == NULL || op_to == NULL) { - return false; - } - /* Different armatures, bone can't be the same. */ - if (op_from->owner->owner != op_to->owner->owner) { - return false; - } - /* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */ - if (!(op_from->opcode == OperationCode::BONE_DONE && - op_to->opcode == OperationCode::BONE_LOCAL)) - { - return false; - } - /* ... BUT, we also need to check if it's same bone. */ - if (op_from->owner->name != op_to->owner->name) { - return false; - } - return true; + /* Get operations for requested keys. */ + Node *node_from = get_node(key_from); + Node *node_to = get_node(key_to); + if (node_from == NULL || node_to == NULL) { + return false; + } + OperationNode *op_from = node_from->get_exit_operation(); + OperationNode *op_to = node_to->get_entry_operation(); + if (op_from == NULL || op_to == NULL) { + return false; + } + /* Different armatures, bone can't be the same. */ + if (op_from->owner->owner != op_to->owner->owner) { + return false; + } + /* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */ + if (!(op_from->opcode == OperationCode::BONE_DONE && + op_to->opcode == OperationCode::BONE_LOCAL)) { + return false; + } + /* ... BUT, we also need to check if it's same bone. */ + if (op_from->owner->name != op_to->owner->name) { + return false; + } + return true; } -template <typename KeyFrom, typename KeyTo> -bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency( - const KeyFrom& key_from, - const KeyTo& key_to) +template<typename KeyFrom, typename KeyTo> +bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency(const KeyFrom &key_from, + const KeyTo &key_to) { - /* Get operations for requested keys. */ - Node *node_from = get_node(key_from); - Node *node_to = get_node(key_to); - if (node_from == NULL || node_to == NULL) { - return false; - } - OperationNode *op_from = node_from->get_exit_operation(); - OperationNode *op_to = node_to->get_entry_operation(); - if (op_from == NULL || op_to == NULL) { - return false; - } - /* Check if this is actually a node tree. */ - if (GS(op_from->owner->owner->id_orig->name) != ID_NT) { - return false; - } - /* Different node trees. */ - if (op_from->owner->owner != op_to->owner->owner) { - return false; - } - /* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */ - if (!(op_from->opcode == OperationCode::PARAMETERS_EVAL && - op_to->opcode == OperationCode::PARAMETERS_EVAL)) - { - return false; - } - return true; + /* Get operations for requested keys. */ + Node *node_from = get_node(key_from); + Node *node_to = get_node(key_to); + if (node_from == NULL || node_to == NULL) { + return false; + } + OperationNode *op_from = node_from->get_exit_operation(); + OperationNode *op_to = node_to->get_entry_operation(); + if (op_from == NULL || op_to == NULL) { + return false; + } + /* Check if this is actually a node tree. */ + if (GS(op_from->owner->owner->id_orig->name) != ID_NT) { + return false; + } + /* Different node trees. */ + if (op_from->owner->owner != op_to->owner->owner) { + return false; + } + /* We are only interested in relations like BONE_DONE -> BONE_LOCAL... */ + if (!(op_from->opcode == OperationCode::PARAMETERS_EVAL && + op_to->opcode == OperationCode::PARAMETERS_EVAL)) { + return false; + } + return true; } } // namespace DEG |