Cleanup: Depsgraph, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/depsgraph` module. No functional changes.
This commit is contained in:
@@ -254,9 +254,8 @@ TimeSourceNode *DepsgraphRelationBuilder::get_node(const TimeSourceKey &key) con
|
||||
/* XXX TODO */
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
return graph_->time_source;
|
||||
}
|
||||
|
||||
return graph_->time_source;
|
||||
}
|
||||
|
||||
ComponentNode *DepsgraphRelationBuilder::get_node(const ComponentKey &key) const
|
||||
@@ -353,16 +352,16 @@ Relation *DepsgraphRelationBuilder::add_time_relation(TimeSourceNode *timesrc,
|
||||
if (timesrc && node_to) {
|
||||
return graph_->add_new_relation(timesrc, node_to, description, flags);
|
||||
}
|
||||
else {
|
||||
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
|
||||
BUILD,
|
||||
"add_time_relation(%p = %s, %p = %s, %s) Failed\n",
|
||||
timesrc,
|
||||
(timesrc) ? timesrc->identifier().c_str() : "<None>",
|
||||
node_to,
|
||||
(node_to) ? node_to->identifier().c_str() : "<None>",
|
||||
description);
|
||||
}
|
||||
|
||||
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
|
||||
BUILD,
|
||||
"add_time_relation(%p = %s, %p = %s, %s) Failed\n",
|
||||
timesrc,
|
||||
(timesrc) ? timesrc->identifier().c_str() : "<None>",
|
||||
node_to,
|
||||
(node_to) ? node_to->identifier().c_str() : "<None>",
|
||||
description);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -374,16 +373,16 @@ Relation *DepsgraphRelationBuilder::add_operation_relation(OperationNode *node_f
|
||||
if (node_from && node_to) {
|
||||
return graph_->add_new_relation(node_from, node_to, description, flags);
|
||||
}
|
||||
else {
|
||||
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
|
||||
BUILD,
|
||||
"add_operation_relation(%p = %s, %p = %s, %s) Failed\n",
|
||||
node_from,
|
||||
(node_from) ? node_from->identifier().c_str() : "<None>",
|
||||
node_to,
|
||||
(node_to) ? node_to->identifier().c_str() : "<None>",
|
||||
description);
|
||||
}
|
||||
|
||||
DEG_DEBUG_PRINTF((::Depsgraph *)graph_,
|
||||
BUILD,
|
||||
"add_operation_relation(%p = %s, %p = %s, %s) Failed\n",
|
||||
node_from,
|
||||
(node_from) ? node_from->identifier().c_str() : "<None>",
|
||||
node_to,
|
||||
(node_to) ? node_to->identifier().c_str() : "<None>",
|
||||
description);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
|
||||
reinterpret_cast<const PropertyRNA *>(prop));
|
||||
return node_identifier;
|
||||
}
|
||||
else if (ptr->type == &RNA_PoseBone) {
|
||||
if (ptr->type == &RNA_PoseBone) {
|
||||
const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data);
|
||||
/* Bone - generally, we just want the bone component. */
|
||||
node_identifier.type = NodeType::BONE;
|
||||
@@ -222,7 +222,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
|
||||
}
|
||||
return node_identifier;
|
||||
}
|
||||
else if (ptr->type == &RNA_Bone) {
|
||||
if (ptr->type == &RNA_Bone) {
|
||||
/* Armature-level bone mapped to Armature Eval, and thus Pose Init.
|
||||
* Drivers have special code elsewhere that links them to the pose
|
||||
* bone components, instead of using this generic code. */
|
||||
@@ -236,7 +236,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
|
||||
}
|
||||
return node_identifier;
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
|
||||
if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
|
||||
const Object *object = reinterpret_cast<const Object *>(ptr->owner_id);
|
||||
const bConstraint *constraint = static_cast<const bConstraint *>(ptr->data);
|
||||
RNANodeQueryIDData *id_data = ensure_id_data(&object->id);
|
||||
@@ -256,7 +256,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
|
||||
}
|
||||
return node_identifier;
|
||||
}
|
||||
else if (ELEM(ptr->type, &RNA_ConstraintTarget, &RNA_ConstraintTargetBone)) {
|
||||
if (ELEM(ptr->type, &RNA_ConstraintTarget, &RNA_ConstraintTargetBone)) {
|
||||
Object *object = reinterpret_cast<Object *>(ptr->owner_id);
|
||||
bConstraintTarget *tgt = (bConstraintTarget *)ptr->data;
|
||||
/* Check whether is object or bone constraint. */
|
||||
@@ -315,17 +315,17 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
|
||||
node_identifier.type = NodeType::TRANSFORM;
|
||||
return node_identifier;
|
||||
}
|
||||
else if (contains(prop_identifier, "data")) {
|
||||
if (contains(prop_identifier, "data")) {
|
||||
/* We access object.data, most likely a geometry.
|
||||
* Might be a bone tho. */
|
||||
node_identifier.type = NodeType::GEOMETRY;
|
||||
return node_identifier;
|
||||
}
|
||||
else if (STREQ(prop_identifier, "hide_viewport") || STREQ(prop_identifier, "hide_render")) {
|
||||
if (STREQ(prop_identifier, "hide_viewport") || STREQ(prop_identifier, "hide_render")) {
|
||||
node_identifier.type = NodeType::OBJECT_FROM_LAYER;
|
||||
return node_identifier;
|
||||
}
|
||||
else if (STREQ(prop_identifier, "dimensions")) {
|
||||
if (STREQ(prop_identifier, "dimensions")) {
|
||||
node_identifier.type = NodeType::PARAMETERS;
|
||||
node_identifier.operation_code = OperationCode::DIMENSIONS;
|
||||
return node_identifier;
|
||||
|
||||
@@ -96,7 +96,7 @@ void deg_graph_transitive_reduction(Depsgraph *graph)
|
||||
* need modifying. */
|
||||
continue;
|
||||
}
|
||||
else if (rel->from->custom_flags & OP_REACHABLE) {
|
||||
if (rel->from->custom_flags & OP_REACHABLE) {
|
||||
relations_to_remove.append(rel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,15 +282,14 @@ void DEG_iterator_objects_next(BLI_Iterator *iter)
|
||||
if (deg_objects_dupli_iterator_next(iter)) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
verify_id_properties_freed(data);
|
||||
free_object_duplilist(data->dupli_list);
|
||||
data->dupli_parent = nullptr;
|
||||
data->dupli_list = nullptr;
|
||||
data->dupli_object_next = nullptr;
|
||||
data->dupli_object_current = nullptr;
|
||||
deg_invalidate_iterator_work_data(data);
|
||||
}
|
||||
|
||||
verify_id_properties_freed(data);
|
||||
free_object_duplilist(data->dupli_list);
|
||||
data->dupli_parent = nullptr;
|
||||
data->dupli_list = nullptr;
|
||||
data->dupli_object_next = nullptr;
|
||||
data->dupli_object_current = nullptr;
|
||||
deg_invalidate_iterator_work_data(data);
|
||||
}
|
||||
|
||||
++data->id_node_index;
|
||||
@@ -324,7 +323,7 @@ static void DEG_iterator_ids_step(BLI_Iterator *iter, deg::IDNode *id_node, bool
|
||||
iter->skip = true;
|
||||
return;
|
||||
}
|
||||
else if (only_updated && !(id_cow->recalc & ID_RECALC_ALL)) {
|
||||
if (only_updated && !(id_cow->recalc & ID_RECALC_ALL)) {
|
||||
bNodeTree *ntree = ntreeFromID(id_cow);
|
||||
|
||||
/* Nodetree is considered part of the datablock. */
|
||||
|
||||
@@ -372,7 +372,7 @@ void graph_id_tag_update_single_flag(Main *bmain,
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (tag == ID_RECALC_TIME) {
|
||||
if (tag == ID_RECALC_TIME) {
|
||||
if (graph != nullptr) {
|
||||
graph->need_update_time = true;
|
||||
}
|
||||
|
||||
@@ -353,9 +353,8 @@ static TaskPool *deg_evaluate_task_pool_create(DepsgraphEvalState *state)
|
||||
if (G.debug & G_DEBUG_DEPSGRAPH_NO_THREADS) {
|
||||
return BLI_task_pool_create_no_threads(state);
|
||||
}
|
||||
else {
|
||||
return BLI_task_pool_create_suspended(state, TASK_PRIORITY_HIGH);
|
||||
}
|
||||
|
||||
return BLI_task_pool_create_suspended(state, TASK_PRIORITY_HIGH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -348,7 +348,7 @@ ViewLayer *get_original_view_layer(const Depsgraph *depsgraph, const IDNode *id_
|
||||
if (id_node->linked_state == DEG_ID_LINKED_DIRECTLY) {
|
||||
return depsgraph->view_layer;
|
||||
}
|
||||
else if (id_node->linked_state == DEG_ID_LINKED_VIA_SET) {
|
||||
if (id_node->linked_state == DEG_ID_LINKED_VIA_SET) {
|
||||
Scene *scene_orig = reinterpret_cast<Scene *>(id_node->id_orig);
|
||||
return BKE_view_layer_default_render(scene_orig);
|
||||
}
|
||||
@@ -382,7 +382,7 @@ void scene_remove_unused_view_layers(const Depsgraph *depsgraph,
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) {
|
||||
if (id_node->linked_state == DEG_ID_LINKED_INDIRECTLY) {
|
||||
/* Indirectly linked scenes means it's not an input scene and not a set scene, and is pulled
|
||||
* via some driver. Such scenes should not have view layers after copy. */
|
||||
view_layer_input = nullptr;
|
||||
|
||||
@@ -317,12 +317,11 @@ NodeClass Node::get_class() const
|
||||
if (type == NodeType::OPERATION) {
|
||||
return NodeClass::OPERATION;
|
||||
}
|
||||
else if (type < NodeType::PARAMETERS) {
|
||||
if (type < NodeType::PARAMETERS) {
|
||||
return NodeClass::GENERIC;
|
||||
}
|
||||
else {
|
||||
return NodeClass::COMPONENT;
|
||||
}
|
||||
|
||||
return NodeClass::COMPONENT;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
@@ -251,7 +251,7 @@ OperationNode *ComponentNode::get_entry_operation()
|
||||
if (entry_operation) {
|
||||
return entry_operation;
|
||||
}
|
||||
else if (operations_map != nullptr && operations_map->size() == 1) {
|
||||
if (operations_map != nullptr && operations_map->size() == 1) {
|
||||
OperationNode *op_node = nullptr;
|
||||
/* TODO(sergey): This is somewhat slow. */
|
||||
for (OperationNode *tmp : operations_map->values()) {
|
||||
@@ -261,7 +261,7 @@ OperationNode *ComponentNode::get_entry_operation()
|
||||
entry_operation = op_node;
|
||||
return op_node;
|
||||
}
|
||||
else if (operations.size() == 1) {
|
||||
if (operations.size() == 1) {
|
||||
return operations[0];
|
||||
}
|
||||
return nullptr;
|
||||
@@ -272,7 +272,7 @@ OperationNode *ComponentNode::get_exit_operation()
|
||||
if (exit_operation) {
|
||||
return exit_operation;
|
||||
}
|
||||
else if (operations_map != nullptr && operations_map->size() == 1) {
|
||||
if (operations_map != nullptr && operations_map->size() == 1) {
|
||||
OperationNode *op_node = nullptr;
|
||||
/* TODO(sergey): This is somewhat slow. */
|
||||
for (OperationNode *tmp : operations_map->values()) {
|
||||
@@ -282,7 +282,7 @@ OperationNode *ComponentNode::get_exit_operation()
|
||||
exit_operation = op_node;
|
||||
return op_node;
|
||||
}
|
||||
else if (operations.size() == 1) {
|
||||
if (operations.size() == 1) {
|
||||
return operations[0];
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user