diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 16:50:13 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-01-28 17:10:44 +0300 |
commit | 40a9b5ebc77953a3f0b47def39438beed681aac0 (patch) | |
tree | 7c59d584e43ea837a40e064a73859909f08ca84b /source/blender/depsgraph/intern/builder | |
parent | 01a348274218103ecdbaddc699a97e86f0c4ce18 (diff) |
Cleanup: changed NULL to nullptr in depsgraph C++ code
No functional changes.
Diffstat (limited to 'source/blender/depsgraph/intern/builder')
17 files changed, 335 insertions, 335 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder.cc b/source/blender/depsgraph/intern/builder/deg_builder.cc index 440d9dd07f6..7eca04112e7 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder.cc @@ -59,14 +59,14 @@ namespace DEG { bool deg_check_id_in_depsgraph(const Depsgraph *graph, ID *id_orig) { IDNode *id_node = graph->find_id_node(id_orig); - return id_node != NULL; + return id_node != nullptr; } bool deg_check_base_in_depsgraph(const Depsgraph *graph, Base *base) { Object *object_orig = base->base_orig->object; IDNode *id_node = graph->find_id_node(&object_orig->id); - if (id_node == NULL) { + if (id_node == nullptr) { return false; } return id_node->has_base; @@ -114,7 +114,7 @@ bool DepsgraphBuilder::need_pull_base_into_graph(Base *base) bool DepsgraphBuilder::check_pchan_has_bbone(Object *object, const bPoseChannel *pchan) { BLI_assert(object->type == OB_ARMATURE); - if (pchan == NULL || pchan->bone == NULL) { + if (pchan == nullptr || pchan->bone == nullptr) { return false; } /* We don't really care whether segments are higher than 1 due to static user input (as in, @@ -134,7 +134,7 @@ bool DepsgraphBuilder::check_pchan_has_bbone(Object *object, const bPoseChannel bool DepsgraphBuilder::check_pchan_has_bbone_segments(Object *object, const bPoseChannel *pchan) { /* Proxies don't have BONE_SEGMENTS */ - if (ID_IS_LINKED(object) && object->proxy_from != NULL) { + if (ID_IS_LINKED(object) && object->proxy_from != nullptr) { return false; } return check_pchan_has_bbone(object, pchan); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc index 3cfb4f95e5e..fe1886c67e8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc @@ -37,7 +37,7 @@ namespace DEG { /* Animated property storage. */ -AnimatedPropertyID::AnimatedPropertyID() : data(NULL), property_rna(NULL) +AnimatedPropertyID::AnimatedPropertyID() : data(nullptr), property_rna(nullptr) { } @@ -89,13 +89,13 @@ struct AnimatedPropertyCallbackData { void animated_property_cb(ID * /*id*/, FCurve *fcurve, void *data_v) { - if (fcurve->rna_path == NULL || fcurve->rna_path[0] == '\0') { + if (fcurve->rna_path == nullptr || fcurve->rna_path[0] == '\0') { return; } AnimatedPropertyCallbackData *data = static_cast<AnimatedPropertyCallbackData *>(data_v); /* Resolve property. */ PointerRNA pointer_rna; - PropertyRNA *property_rna = NULL; + PropertyRNA *property_rna = nullptr; if (!RNA_path_resolve_property( &data->pointer_rna, fcurve->rna_path, &pointer_rna, &property_rna)) { return; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc index f18583beb9c..e0d162a49c5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cycle.cc @@ -100,8 +100,8 @@ void schedule_node_to_stack(CyclesSolverState *state, OperationNode *node) { StackEntry entry; entry.node = node; - entry.from = NULL; - entry.via_relation = NULL; + entry.from = nullptr; + entry.via_relation = nullptr; BLI_stack_push(state->traversal_stack, &entry); set_node_visited_state(node, NODE_IN_STACK); } @@ -187,7 +187,7 @@ void solve_cycles(CyclesSolverState *state) node->full_identifier() + " via '" + rel->name + "'\n"; StackEntry *current = entry; while (current->node != to) { - BLI_assert(current != NULL); + BLI_assert(current != nullptr); cycle_str += " " + current->from->node->full_identifier() + " via '" + current->via_relation->name + "'\n"; current = current->from; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index b260df6fa06..6382772c8db 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -122,7 +122,7 @@ namespace { void free_copy_on_write_datablock(void *id_info_v) { DepsgraphNodeBuilder::IDInfo *id_info = (DepsgraphNodeBuilder::IDInfo *)id_info_v; - if (id_info->id_cow != NULL) { + if (id_info->id_cow != nullptr) { deg_free_copy_on_write_datablock(id_info->id_cow); MEM_freeN(id_info->id_cow); } @@ -140,37 +140,37 @@ DepsgraphNodeBuilder::DepsgraphNodeBuilder(Main *bmain, Depsgraph *graph, DepsgraphBuilderCache *cache) : DepsgraphBuilder(bmain, graph, cache), - scene_(NULL), - view_layer_(NULL), + scene_(nullptr), + view_layer_(nullptr), view_layer_index_(-1), - collection_(NULL), + collection_(nullptr), is_parent_collection_visible_(true), - id_info_hash_(NULL) + id_info_hash_(nullptr) { } DepsgraphNodeBuilder::~DepsgraphNodeBuilder() { - if (id_info_hash_ != NULL) { - BLI_ghash_free(id_info_hash_, NULL, free_copy_on_write_datablock); + if (id_info_hash_ != nullptr) { + BLI_ghash_free(id_info_hash_, nullptr, free_copy_on_write_datablock); } } IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) { - IDNode *id_node = NULL; - ID *id_cow = NULL; + IDNode *id_node = nullptr; + ID *id_cow = nullptr; IDComponentsMask previously_visible_components_mask = 0; uint32_t previous_eval_flags = 0; DEGCustomDataMeshMasks previous_customdata_masks; IDInfo *id_info = (IDInfo *)BLI_ghash_lookup(id_info_hash_, id); - if (id_info != NULL) { + if (id_info != nullptr) { id_cow = id_info->id_cow; previously_visible_components_mask = id_info->previously_visible_components_mask; previous_eval_flags = id_info->previous_eval_flags; previous_customdata_masks = id_info->previous_customdata_masks; /* Tag ID info to not free the CoW ID pointer. */ - id_info->id_cow = NULL; + id_info->id_cow = nullptr; } id_node = graph_->add_id_node(id, id_cow); id_node->previously_visible_components_mask = previously_visible_components_mask; @@ -218,7 +218,7 @@ OperationNode *DepsgraphNodeBuilder::add_operation_node(ComponentNode *comp_node int name_tag) { OperationNode *op_node = comp_node->find_operation(opcode, name, name_tag); - if (op_node == NULL) { + if (op_node == nullptr) { op_node = comp_node->add_operation(op, opcode, name, name_tag); graph_->operations.push_back(op_node); } @@ -263,7 +263,7 @@ OperationNode *DepsgraphNodeBuilder::ensure_operation_node(ID *id, int name_tag) { OperationNode *operation = find_operation_node(id, comp_type, opcode, name, name_tag); - if (operation != NULL) { + if (operation != nullptr) { return operation; } return add_operation_node(id, comp_type, opcode, op, name, name_tag); @@ -276,7 +276,7 @@ bool DepsgraphNodeBuilder::has_operation_node(ID *id, const char *name, int name_tag) { - return find_operation_node(id, comp_type, comp_name, opcode, name, name_tag) != NULL; + return find_operation_node(id, comp_type, comp_name, opcode, name, name_tag) != nullptr; } OperationNode *DepsgraphNodeBuilder::find_operation_node(ID *id, @@ -324,13 +324,13 @@ void DepsgraphNodeBuilder::begin_build() id_info->id_cow = id_node->id_cow; } else { - id_info->id_cow = NULL; + id_info->id_cow = nullptr; } id_info->previously_visible_components_mask = id_node->visible_components_mask; id_info->previous_eval_flags = id_node->eval_flags; id_info->previous_customdata_masks = id_node->customdata_masks; BLI_ghash_insert(id_info_hash_, id_node->id_orig, id_info); - id_node->id_cow = NULL; + id_node->id_cow = nullptr; } GSET_FOREACH_BEGIN (OperationNode *, op_node, graph_->entry_tags) { @@ -350,23 +350,23 @@ void DepsgraphNodeBuilder::begin_build() /* Make sure graph has no nodes left from previous state. */ graph_->clear_all_nodes(); graph_->operations.clear(); - BLI_gset_clear(graph_->entry_tags, NULL); + BLI_gset_clear(graph_->entry_tags, nullptr); } void DepsgraphNodeBuilder::end_build() { for (const SavedEntryTag &entry_tag : saved_entry_tags_) { IDNode *id_node = find_id_node(entry_tag.id_orig); - if (id_node == NULL) { + if (id_node == nullptr) { continue; } ComponentNode *comp_node = id_node->find_component(entry_tag.component_type); - if (comp_node == NULL) { + if (comp_node == nullptr) { continue; } OperationNode *op_node = comp_node->find_operation( entry_tag.opcode, entry_tag.name.c_str(), entry_tag.name_tag); - if (op_node == NULL) { + if (op_node == nullptr) { continue; } /* Since the tag is coming from a saved copy of entry tags, this means @@ -377,7 +377,7 @@ void DepsgraphNodeBuilder::end_build() void DepsgraphNodeBuilder::build_id(ID *id) { - if (id == NULL) { + if (id == nullptr) { return; } switch (GS(id->name)) { @@ -391,7 +391,7 @@ void DepsgraphNodeBuilder::build_id(ID *id) build_camera((Camera *)id); break; case ID_GR: - build_collection(NULL, (Collection *)id); + build_collection(nullptr, (Collection *)id); break; case ID_OB: /* TODO(sergey): Get visibility from a "parent" somehow. @@ -487,7 +487,7 @@ void DepsgraphNodeBuilder::build_collection(LayerCollection *from_layer_collecti * objects are poked with the new visibility flag, since they * might become visible too. */ } - else if (from_layer_collection == NULL && !id_node->is_collection_fully_expanded) { + else if (from_layer_collection == nullptr && !id_node->is_collection_fully_expanded) { /* Initially collection was built from layer now, and was requested * to not recurs into object. But nw it's asked to recurs into all * objects. */ @@ -501,7 +501,7 @@ void DepsgraphNodeBuilder::build_collection(LayerCollection *from_layer_collecti id_node = add_id_node(&collection->id); id_node->is_directly_visible = is_collection_visible; } - if (from_layer_collection != NULL) { + if (from_layer_collection != nullptr) { /* If we came from layer collection we don't go deeper, view layer * builder takes care of going deeper. */ return; @@ -518,7 +518,7 @@ void DepsgraphNodeBuilder::build_collection(LayerCollection *from_layer_collecti } /* Build child collections. */ LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { - build_collection(NULL, child->collection); + build_collection(nullptr, child->collection); } /* Restore state. */ collection_ = current_state_collection; @@ -531,7 +531,7 @@ void DepsgraphNodeBuilder::build_object(int base_index, eDepsNode_LinkedState_Type linked_state, bool is_visible) { - if (object->proxy != NULL) { + if (object->proxy != nullptr) { object->proxy->proxy_from = object; } const bool has_object = built_map_.checkIsBuiltAndTag(object); @@ -554,10 +554,10 @@ void DepsgraphNodeBuilder::build_object(int base_index, IDNode *id_node = add_id_node(&object->id); Object *object_cow = get_cow_datablock(object); id_node->linked_state = linked_state; - /* NOTE: Scene is NULL when building dependency graph for render pipeline. - * Probably need to assign that to something non-NULL, but then the logic here will still be + /* NOTE: Scene is nullptr when building dependency graph for render pipeline. + * Probably need to assign that to something non-nullptr, but then the logic here will still be * somewhat weird. */ - if (scene_ != NULL && object == scene_->camera) { + if (scene_ != nullptr && object == scene_->camera) { id_node->is_directly_visible = true; } else { @@ -569,32 +569,32 @@ void DepsgraphNodeBuilder::build_object(int base_index, /* Transform. */ build_object_transform(object); /* Parent. */ - if (object->parent != NULL) { + if (object->parent != nullptr) { build_object(-1, object->parent, DEG_ID_LINKED_INDIRECTLY, is_visible); } /* Modifiers. */ - if (object->modifiers.first != NULL) { + if (object->modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; data.is_parent_visible = is_visible; modifiers_foreachIDLink(object, modifier_walk, &data); } /* Grease Pencil Modifiers. */ - if (object->greasepencil_modifiers.first != NULL) { + if (object->greasepencil_modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; data.is_parent_visible = is_visible; BKE_gpencil_modifiers_foreachIDLink(object, modifier_walk, &data); } /* Shader FX. */ - if (object->shader_fx.first != NULL) { + if (object->shader_fx.first != nullptr) { BuilderWalkUserData data; data.builder = this; data.is_parent_visible = is_visible; BKE_shaderfx_foreachIDLink(object, modifier_walk, &data); } /* Constraints. */ - if (object->constraints.first != NULL) { + if (object->constraints.first != nullptr) { BuilderWalkUserData data; data.builder = this; data.is_parent_visible = is_visible; @@ -612,17 +612,17 @@ void DepsgraphNodeBuilder::build_object(int base_index, * pose for proxy. */ build_animdata(&object->id); /* Particle systems. */ - if (object->particlesystem.first != NULL) { + if (object->particlesystem.first != nullptr) { build_particle_systems(object, is_visible); } /* Proxy object to copy from. */ build_object_proxy_from(object, is_visible); build_object_proxy_group(object, is_visible); /* Object dupligroup. */ - if (object->instance_collection != NULL) { + if (object->instance_collection != nullptr) { const bool is_current_parent_collection_visible = is_parent_collection_visible_; is_parent_collection_visible_ = is_visible; - build_collection(NULL, object->instance_collection); + build_collection(nullptr, object->instance_collection); is_parent_collection_visible_ = is_current_parent_collection_visible; add_operation_node(&object->id, NodeType::DUPLI, OperationCode::DUPLI); } @@ -658,7 +658,7 @@ void DepsgraphNodeBuilder::build_object_flags(int base_index, void DepsgraphNodeBuilder::build_object_proxy_from(Object *object, bool is_visible) { - if (object->proxy_from == NULL) { + if (object->proxy_from == nullptr) { return; } build_object(-1, object->proxy_from, DEG_ID_LINKED_INDIRECTLY, is_visible); @@ -666,7 +666,7 @@ void DepsgraphNodeBuilder::build_object_proxy_from(Object *object, bool is_visib void DepsgraphNodeBuilder::build_object_proxy_group(Object *object, bool is_visible) { - if (object->proxy_group == NULL) { + if (object->proxy_group == nullptr) { return; } build_object(-1, object->proxy_group, DEG_ID_LINKED_INDIRECTLY, is_visible); @@ -674,7 +674,7 @@ void DepsgraphNodeBuilder::build_object_proxy_group(Object *object, bool is_visi void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visible) { - if (object->data == NULL) { + if (object->data == nullptr) { return; } /* type-specific data. */ @@ -689,7 +689,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visi build_object_data_geometry(object, is_object_visible); break; case OB_ARMATURE: - if (ID_IS_LINKED(object) && object->proxy_from != NULL) { + if (ID_IS_LINKED(object) && object->proxy_from != nullptr) { build_proxy_rig(object); } else { @@ -718,7 +718,7 @@ void DepsgraphNodeBuilder::build_object_data(Object *object, bool is_object_visi } /* Materials. */ Material ***materials_ptr = give_matarar(object); - if (materials_ptr != NULL) { + if (materials_ptr != nullptr) { short *num_materials_ptr = give_totcolp(object); build_materials(*materials_ptr, *num_materials_ptr); } @@ -763,14 +763,14 @@ void DepsgraphNodeBuilder::build_object_transform(Object *object) OperationCode::TRANSFORM_LOCAL, function_bind(BKE_object_eval_local_transform, _1, ob_cow)); /* Object parent. */ - if (object->parent != NULL) { + if (object->parent != nullptr) { add_operation_node(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_PARENT, function_bind(BKE_object_eval_parent, _1, ob_cow)); } /* Object constraints. */ - if (object->constraints.first != NULL) { + if (object->constraints.first != nullptr) { build_object_constraints(object); } /* Rest of transformation update. */ @@ -840,16 +840,16 @@ void DepsgraphNodeBuilder::build_animdata(ID *id) build_animation_images(id); /* Regular animation. */ AnimData *adt = BKE_animdata_from_id(id); - if (adt == NULL) { + if (adt == nullptr) { return; } - if (adt->action != NULL) { + if (adt->action != nullptr) { build_action(adt->action); } /* Make sure ID node exists. */ (void)add_id_node(id); ID *id_cow = get_cow_id(id); - if (adt->action != NULL || !BLI_listbase_is_empty(&adt->nla_tracks)) { + if (adt->action != nullptr || !BLI_listbase_is_empty(&adt->nla_tracks)) { OperationNode *operation_node; /* Explicit entry operation. */ operation_node = add_operation_node(id, NodeType::ANIMATION, OperationCode::ANIMATION_ENTRY); @@ -878,10 +878,10 @@ void DepsgraphNodeBuilder::build_animdata(ID *id) void DepsgraphNodeBuilder::build_animdata_nlastrip_targets(ListBase *strips) { LISTBASE_FOREACH (NlaStrip *, strip, strips) { - if (strip->act != NULL) { + if (strip->act != nullptr) { build_action(strip->act); } - else if (strip->strips.first != NULL) { + else if (strip->strips.first != nullptr) { build_animdata_nlastrip_targets(&strip->strips); } } @@ -938,13 +938,13 @@ void DepsgraphNodeBuilder::build_driver_variables(ID *id, FCurve *fcurve) build_driver_id_property(id, fcurve->rna_path); LISTBASE_FOREACH (DriverVar *, dvar, &fcurve->driver->variables) { DRIVER_TARGETS_USED_LOOPER_BEGIN (dvar) { - if (dtar->id == NULL) { + if (dtar->id == nullptr) { continue; } build_id(dtar->id); build_driver_id_property(dtar->id, dtar->rna_path); /* Corresponds to dtar_id_ensure_proxy_from(). */ - if ((GS(dtar->id->name) == ID_OB) && (((Object *)dtar->id)->proxy_from != NULL)) { + if ((GS(dtar->id->name) == ID_OB) && (((Object *)dtar->id)->proxy_from != nullptr)) { Object *proxy_from = ((Object *)dtar->id)->proxy_from; build_id(&proxy_from->id); build_driver_id_property(&proxy_from->id, dtar->rna_path); @@ -956,7 +956,7 @@ void DepsgraphNodeBuilder::build_driver_variables(ID *id, FCurve *fcurve) void DepsgraphNodeBuilder::build_driver_id_property(ID *id, const char *rna_path) { - if (id == NULL || rna_path == NULL) { + if (id == nullptr || rna_path == nullptr) { return; } PointerRNA id_ptr, ptr; @@ -966,7 +966,7 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id, const char *rna_path if (!RNA_path_resolve_full(&id_ptr, rna_path, &ptr, &prop, &index)) { return; } - if (prop == NULL) { + if (prop == nullptr) { return; } if (!RNA_property_is_idprop(prop)) { @@ -974,7 +974,7 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id, const char *rna_path } const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); ensure_operation_node( - id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, NULL, prop_identifier); + id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, prop_identifier); } void DepsgraphNodeBuilder::build_parameters(ID *id) @@ -1053,8 +1053,8 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) sim_node->set_as_exit(); sim_node->owner->entry_operation = sim_node; /* Objects - simulation participants. */ - if (rbw->group != NULL) { - build_collection(NULL, rbw->group); + if (rbw->group != nullptr) { + build_collection(nullptr, rbw->group); FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, object) { if (object->type != OB_MESH) { continue; @@ -1072,11 +1072,11 @@ void DepsgraphNodeBuilder::build_rigidbody(Scene *scene) FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } /* Constraints. */ - if (rbw->constraints != NULL) { + if (rbw->constraints != nullptr) { FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, object) { RigidBodyCon *rbc = object->rigidbody_constraint; - if (rbc == NULL || rbc->ob1 == NULL || rbc->ob2 == NULL) { - /* When either ob1 or ob2 is NULL, the constraint doesn't work. */ + if (rbc == nullptr || rbc->ob1 == nullptr || rbc->ob2 == nullptr) { + /* When either ob1 or ob2 is nullptr, the constraint doesn't work. */ continue; } /* Make sure indirectly linked objects are fully built. */ @@ -1120,11 +1120,11 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, bool is_object * NOTE: The call itself ensures settings are only build once. */ build_particle_settings(part); /* Particle system evaluation. */ - add_operation_node(psys_comp, OperationCode::PARTICLE_SYSTEM_EVAL, NULL, psys->name); + add_operation_node(psys_comp, OperationCode::PARTICLE_SYSTEM_EVAL, nullptr, psys->name); /* Keyed particle targets. */ if (part->phystype == PART_PHYS_KEYED) { LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) { - if (particle_target->ob == NULL || particle_target->ob == object) { + if (particle_target->ob == nullptr || particle_target->ob == object) { continue; } build_object(-1, particle_target->ob, DEG_ID_LINKED_INDIRECTLY, is_object_visible); @@ -1133,13 +1133,13 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, bool is_object /* Visualization of particle system. */ switch (part->ren_as) { case PART_DRAW_OB: - if (part->instance_object != NULL) { + if (part->instance_object != nullptr) { build_object(-1, part->instance_object, DEG_ID_LINKED_INDIRECTLY, is_object_visible); } break; case PART_DRAW_GR: - if (part->instance_collection != NULL) { - build_collection(NULL, part->instance_collection); + if (part->instance_collection != nullptr) { + build_collection(nullptr, part->instance_collection); } break; } @@ -1174,7 +1174,7 @@ void DepsgraphNodeBuilder::build_particle_settings(ParticleSettings *particle_se /* Texture slots. */ for (int mtex_index = 0; mtex_index < MAX_MTEX; mtex_index++) { MTex *mtex = particle_settings->mtex[mtex_index]; - if (mtex == NULL || mtex->tex == NULL) { + if (mtex == nullptr || mtex->tex == nullptr) { continue; } build_texture(mtex->tex); @@ -1196,7 +1196,7 @@ void DepsgraphNodeBuilder::build_shapekeys(Key *key) * drivers evaluation. */ LISTBASE_FOREACH (KeyBlock *, key_block, &key->block) { add_operation_node( - &key->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, NULL, key_block->name); + &key->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, key_block->name); } } @@ -1274,13 +1274,13 @@ void DepsgraphNodeBuilder::build_object_data_geometry_datablock(ID *obdata, bool /* Make sure objects used for bevel.taper are in the graph. * NOTE: This objects might be not linked to the scene. */ Curve *cu = (Curve *)obdata; - if (cu->bevobj != NULL) { + if (cu->bevobj != nullptr) { build_object(-1, cu->bevobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); } - if (cu->taperobj != NULL) { + if (cu->taperobj != nullptr) { build_object(-1, cu->taperobj, DEG_ID_LINKED_INDIRECTLY, is_object_visible); } - if (cu->textoncurve != NULL) { + if (cu->textoncurve != nullptr) { build_object(-1, cu->textoncurve, DEG_ID_LINKED_INDIRECTLY, is_object_visible); } break; @@ -1338,7 +1338,7 @@ void DepsgraphNodeBuilder::build_camera(Camera *camera) } build_animdata(&camera->id); build_parameters(&camera->id); - if (camera->dof.focus_object != NULL) { + if (camera->dof.focus_object != nullptr) { build_object(-1, camera->dof.focus_object, DEG_ID_LINKED_INDIRECTLY, false); } } @@ -1356,7 +1356,7 @@ void DepsgraphNodeBuilder::build_light(Light *lamp) void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) { - if (ntree == NULL) { + if (ntree == nullptr) { return; } if (built_map_.checkIsBuiltAndTag(ntree)) { @@ -1380,7 +1380,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { ID *id = bnode->id; - if (id == NULL) { + if (id == nullptr) { continue; } ID_Type id_type = GS(id->name); @@ -1404,7 +1404,7 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree) * * On the one hand it's annoying to always pull it in, but on another hand it's also annoying * to have hardcoded node-type exception here. */ - if (node_scene->camera != NULL) { + if (node_scene->camera != nullptr) { /* TODO(sergey): Use visibility of owner of the node tree. */ build_object(-1, node_scene->camera, DEG_ID_LINKED_INDIRECTLY, true); } @@ -1454,7 +1454,7 @@ void DepsgraphNodeBuilder::build_material(Material *material) void DepsgraphNodeBuilder::build_materials(Material **materials, int num_materials) { for (int i = 0; i < num_materials; i++) { - if (materials[i] == NULL) { + if (materials[i] == nullptr) { continue; } build_material(materials[i]); @@ -1474,7 +1474,7 @@ void DepsgraphNodeBuilder::build_texture(Tex *texture) build_nodetree(texture->nodetree); /* Special cases for different IDs which texture uses. */ if (texture->type == TEX_IMAGE) { - if (texture->ima != NULL) { + if (texture->ima != nullptr) { build_image(texture->ima); } } @@ -1552,7 +1552,7 @@ void DepsgraphNodeBuilder::build_mask(Mask *mask) for (int i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; MaskParent *parent = &point->parent; - if (parent == NULL || parent->id == NULL) { + if (parent == nullptr || parent->id == nullptr) { continue; } build_id(parent->id); @@ -1615,7 +1615,7 @@ void DepsgraphNodeBuilder::build_speaker(Speaker *speaker) add_operation_node(&speaker->id, NodeType::AUDIO, OperationCode::SPEAKER_EVAL); build_animdata(&speaker->id); build_parameters(&speaker->id); - if (speaker->sound != NULL) { + if (speaker->sound != nullptr) { build_sound(speaker->sound); } } @@ -1637,7 +1637,7 @@ void DepsgraphNodeBuilder::build_sound(bSound *sound) void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) { - if (scene->ed == NULL) { + if (scene->ed == nullptr) { return; } build_scene_audio(scene); @@ -1649,13 +1649,13 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene) /* Make sure data for sequences is in the graph. */ Sequence *seq; SEQ_BEGIN (scene->ed, seq) { - if (seq->sound != NULL) { + if (seq->sound != nullptr) { build_sound(seq->sound); } - if (seq->scene != NULL) { + if (seq->scene != nullptr) { build_scene_parameters(seq->scene); } - if (seq->type == SEQ_TYPE_SCENE && seq->scene != NULL) { + if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) { if (seq->flag & SEQ_SCENE_STRIPS) { build_scene_sequencer(seq->scene); } @@ -1696,7 +1696,7 @@ void DepsgraphNodeBuilder::modifier_walk(void *user_data, { BuilderWalkUserData *data = (BuilderWalkUserData *)user_data; ID *id = *idpoin; - if (id == NULL) { + if (id == nullptr) { return; } switch (GS(id->name)) { @@ -1719,7 +1719,7 @@ void DepsgraphNodeBuilder::constraint_walk(bConstraint * /*con*/, { BuilderWalkUserData *data = (BuilderWalkUserData *)user_data; ID *id = *idpoin; - if (id == NULL) { + if (id == nullptr) { return; } switch (GS(id->name)) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 7cb74ea8bc5..54a4768d12a 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -106,27 +106,27 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { OperationNode *add_operation_node(ComponentNode *comp_node, OperationCode opcode, - const DepsEvalOperationCb &op = NULL, + const DepsEvalOperationCb &op = nullptr, const char *name = "", int name_tag = -1); OperationNode *add_operation_node(ID *id, NodeType comp_type, const char *comp_name, OperationCode opcode, - const DepsEvalOperationCb &op = NULL, + const DepsEvalOperationCb &op = nullptr, const char *name = "", int name_tag = -1); OperationNode *add_operation_node(ID *id, NodeType comp_type, OperationCode opcode, - const DepsEvalOperationCb &op = NULL, + const DepsEvalOperationCb &op = nullptr, const char *name = "", int name_tag = -1); OperationNode *ensure_operation_node(ID *id, NodeType comp_type, OperationCode opcode, - const DepsEvalOperationCb &op = NULL, + const DepsEvalOperationCb &op = nullptr, const char *name = "", int name_tag = -1); 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 979e1a02e71..07010a5cbef 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_rig.cc @@ -87,7 +87,7 @@ void DepsgraphNodeBuilder::build_ik_pose(Object *object, bPoseChannel *pchan, bC /* Find the chain's root. */ bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data); - if (rootchan == NULL) { + if (rootchan == nullptr) { return; } @@ -154,12 +154,12 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) /* Armature. */ build_armature(armature); /* Rebuild pose if not up to date. */ - if (object->pose == NULL || (object->pose->flag & POSE_RECALC)) { - /* By definition, no need to tag depsgraph as dirty from here, so we can pass NULL bmain. */ - BKE_pose_rebuild(NULL, object, armature, true); + if (object->pose == nullptr || (object->pose->flag & POSE_RECALC)) { + /* By definition, no need to tag depsgraph as dirty from here, so we can pass nullptr bmain. */ + BKE_pose_rebuild(nullptr, object, armature, true); } /* Speed optimization for animation lookups. */ - if (object->pose != NULL) { + if (object->pose != nullptr) { BKE_pose_channels_hash_make(object->pose); if (object->pose->flag & POSE_CONSTRAINTS_NEED_UPDATE_FLAGS) { BKE_pose_update_constraint_flags(object->pose); @@ -243,12 +243,12 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) op_node->set_as_exit(); /* Custom properties. */ - if (pchan->prop != NULL) { + if (pchan->prop != nullptr) { add_operation_node( - &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, NULL, pchan->name); + &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, pchan->name); } /* Build constraints. */ - if (pchan->constraints.first != NULL) { + if (pchan->constraints.first != nullptr) { build_pose_constraints(object, pchan, pchan_index, is_object_visible); } /** @@ -277,7 +277,7 @@ void DepsgraphNodeBuilder::build_rig(Object *object, bool is_object_visible) } } /* Custom shape. */ - if (pchan->custom != NULL) { + if (pchan->custom != nullptr) { /* TODO(sergey): Use own visibility. */ build_object(-1, pchan->custom, DEG_ID_LINKED_INDIRECTLY, is_object_visible); } @@ -291,7 +291,7 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) OperationNode *op_node; Object *object_cow = get_cow_datablock(object); /* Sanity check. */ - BLI_assert(object->pose != NULL); + BLI_assert(object->pose != nullptr); /* Armature. */ build_armature(armature); /* speed optimization for animation lookups */ @@ -322,9 +322,9 @@ void DepsgraphNodeBuilder::build_proxy_rig(Object *object) op_node->set_as_exit(); /* Custom properties. */ - if (pchan->prop != NULL) { + if (pchan->prop != nullptr) { add_operation_node( - &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, NULL, pchan->name); + &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, nullptr, pchan->name); } pchan_index++; diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index 777512acf89..1edf9826208 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -46,7 +46,7 @@ void DepsgraphNodeBuilder::build_scene_render(Scene *scene, ViewLayer *view_laye build_scene_sequencer(scene); build_scene_speakers(scene, view_layer); } - if (scene->camera != NULL) { + if (scene->camera != nullptr) { build_object(-1, scene->camera, DEG_ID_LINKED_DIRECTLY, true); } } @@ -76,7 +76,7 @@ void DepsgraphNodeBuilder::build_scene_compositor(Scene *scene) if (built_map_.checkIsBuiltAndTag(scene, BuilderMap::TAG_SCENE_COMPOSITOR)) { return; } - if (scene->nodetree == NULL) { + if (scene->nodetree == nullptr) { return; } build_nodetree(scene->nodetree); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc index 82a65c3129b..d5e9c024812 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_view_layer.cc @@ -77,10 +77,10 @@ void DepsgraphNodeBuilder::build_layer_collections(ListBase *lb) void DepsgraphNodeBuilder::build_freestyle_lineset(FreestyleLineSet *fls) { - if (fls->group != NULL) { - build_collection(NULL, fls->group); + if (fls->group != nullptr) { + build_collection(nullptr, fls->group); } - if (fls->linestyle != NULL) { + if (fls->linestyle != nullptr) { build_freestyle_linestyle(fls->linestyle); } } @@ -120,19 +120,19 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene, } } build_layer_collections(&view_layer->layer_collections); - if (scene->camera != NULL) { + if (scene->camera != nullptr) { build_object(-1, scene->camera, DEG_ID_LINKED_INDIRECTLY, true); } /* Rigidbody. */ - if (scene->rigidbody_world != NULL) { + if (scene->rigidbody_world != nullptr) { build_rigidbody(scene); } /* Scene's animation and drivers. */ - if (scene->adt != NULL) { + if (scene->adt != nullptr) { build_animdata(&scene->id); } /* World. */ - if (scene->world != NULL) { + if (scene->world != nullptr) { build_world(scene->world); } /* Cache file. */ @@ -148,7 +148,7 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene, build_movieclip(clip); } /* Material override. */ - if (view_layer->mat_override != NULL) { + if (view_layer->mat_override != nullptr) { build_material(view_layer->mat_override); } /* Freestyle linesets. */ @@ -170,7 +170,7 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene, build_scene_compositor(scene); build_scene_parameters(scene); /* Build all set scenes. */ - if (scene->set != NULL) { + if (scene->set != nullptr) { ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set); build_view_layer(scene->set, set_view_layer, DEG_ID_LINKED_VIA_SET); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc index 95c50c4f44e..61c23becfda 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_pchanmap.cc @@ -35,7 +35,7 @@ static void free_rootpchanmap_valueset(void *val) { /* Just need to free the set itself - the names stored are all references. */ GSet *values = (GSet *)val; - BLI_gset_free(values, NULL); + BLI_gset_free(values, nullptr); } RootPChanMap::RootPChanMap() @@ -47,7 +47,7 @@ RootPChanMap::RootPChanMap() RootPChanMap::~RootPChanMap() { /* Free the map, and all the value sets. */ - BLI_ghash_free(map_, NULL, free_rootpchanmap_valueset); + BLI_ghash_free(map_, nullptr, free_rootpchanmap_valueset); } /* Debug contents of map */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index f6a6b6f77da..0b3e6aedac0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -127,7 +127,7 @@ namespace { bool driver_target_depends_on_time(const DriverTarget *target) { if (target->idtype == ID_SCE && - (target->rna_path != NULL && STREQ(target->rna_path, "frame_current"))) { + (target->rna_path != nullptr && STREQ(target->rna_path, "frame_current"))) { return true; } return false; @@ -195,10 +195,10 @@ bool object_particles_depends_on_time(Object *object) bool check_id_has_anim_component(ID *id) { AnimData *adt = BKE_animdata_from_id(id); - if (adt == NULL) { + if (adt == nullptr) { return false; } - return (adt->action != NULL) || (!BLI_listbase_is_empty(&adt->nla_tracks)); + return (adt->action != nullptr) || (!BLI_listbase_is_empty(&adt->nla_tracks)); } OperationCode bone_target_opcode(ID *target, @@ -232,7 +232,7 @@ bool object_have_geometry_component(const Object *object) DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, Depsgraph *graph, DepsgraphBuilderCache *cache) - : DepsgraphBuilder(bmain, graph, cache), scene_(NULL), rna_node_query_(graph, this) + : DepsgraphBuilder(bmain, graph, cache), scene_(nullptr), rna_node_query_(graph, this) { } @@ -240,7 +240,7 @@ TimeSourceNode *DepsgraphRelationBuilder::get_node(const TimeSourceKey &key) con { if (key.id) { /* XXX TODO */ - return NULL; + return nullptr; } else { return graph_->time_source; @@ -253,8 +253,8 @@ ComponentNode *DepsgraphRelationBuilder::get_node(const ComponentKey &key) const if (!id_node) { fprintf(stderr, "find_node component: Could not find ID %s\n", - (key.id != NULL) ? key.id->name : "<null>"); - return NULL; + (key.id != nullptr) ? key.id->name : "<null>"); + return nullptr; } ComponentNode *node = id_node->find_component(key.type, key.name); @@ -264,7 +264,7 @@ ComponentNode *DepsgraphRelationBuilder::get_node(const ComponentKey &key) const OperationNode *DepsgraphRelationBuilder::get_node(const OperationKey &key) const { OperationNode *op_node = find_node(key); - if (op_node == NULL) { + if (op_node == nullptr) { fprintf(stderr, "find_node_operation: Failed for (%s, '%s')\n", operationCodeAsString(key.opcode), @@ -282,18 +282,18 @@ OperationNode *DepsgraphRelationBuilder::find_node(const OperationKey &key) cons { IDNode *id_node = graph_->find_id_node(key.id); if (!id_node) { - return NULL; + return nullptr; } ComponentNode *comp_node = id_node->find_component(key.component_type, key.component_name); if (!comp_node) { - return NULL; + return nullptr; } return comp_node->find_operation(key.opcode, key.name, key.name_tag); } bool DepsgraphRelationBuilder::has_node(const OperationKey &key) const { - return find_node(key) != NULL; + return find_node(key) != nullptr; } void DepsgraphRelationBuilder::add_modifier_to_transform_relation(const DepsNodeHandle *handle, @@ -309,10 +309,10 @@ void DepsgraphRelationBuilder::add_modifier_to_transform_relation(const DepsNode void DepsgraphRelationBuilder::add_customdata_mask(Object *object, const DEGCustomDataMeshMasks &customdata_masks) { - if (customdata_masks != DEGCustomDataMeshMasks() && object != NULL && object->type == OB_MESH) { + if (customdata_masks != DEGCustomDataMeshMasks() && object != nullptr && object->type == OB_MESH) { DEG::IDNode *id_node = graph_->find_id_node(&object->id); - if (id_node == NULL) { + if (id_node == nullptr) { BLI_assert(!"ID should always be valid"); } else { @@ -324,7 +324,7 @@ void DepsgraphRelationBuilder::add_customdata_mask(Object *object, void DepsgraphRelationBuilder::add_special_eval_flag(ID *id, uint32_t flag) { DEG::IDNode *id_node = graph_->find_id_node(id); - if (id_node == NULL) { + if (id_node == nullptr) { BLI_assert(!"ID should always be valid"); } else { @@ -350,7 +350,7 @@ Relation *DepsgraphRelationBuilder::add_time_relation(TimeSourceNode *timesrc, (node_to) ? node_to->identifier().c_str() : "<None>", description); } - return NULL; + return nullptr; } Relation *DepsgraphRelationBuilder::add_operation_relation(OperationNode *node_from, @@ -371,7 +371,7 @@ Relation *DepsgraphRelationBuilder::add_operation_relation(OperationNode *node_f (node_to) ? node_to->identifier().c_str() : "<None>", description); } - return NULL; + return nullptr; } void DepsgraphRelationBuilder::add_particle_collision_relations(const OperationKey &key, @@ -431,7 +431,7 @@ void DepsgraphRelationBuilder::add_particle_forcefield_relations(const Operation /* Absorption forces need collision relation. */ if (add_absorption && (relation->pd->flag & PFIELD_VISIBILITY)) { - add_particle_collision_relations(key, object, NULL, "Force Absorption"); + add_particle_collision_relations(key, object, nullptr, "Force Absorption"); } } @@ -468,7 +468,7 @@ void DepsgraphRelationBuilder::begin_build() void DepsgraphRelationBuilder::build_id(ID *id) { - if (id == NULL) { + if (id == nullptr) { return; } switch (GS(id->name)) { @@ -482,10 +482,10 @@ void DepsgraphRelationBuilder::build_id(ID *id) build_camera((Camera *)id); break; case ID_GR: - build_collection(NULL, NULL, (Collection *)id); + build_collection(nullptr, nullptr, (Collection *)id); break; case ID_OB: - build_object(NULL, (Object *)id); + build_object(nullptr, (Object *)id); break; case ID_KE: build_shapekeys((Key *)id); @@ -552,7 +552,7 @@ void DepsgraphRelationBuilder::build_collection(LayerCollection *from_layer_coll Object *object, Collection *collection) { - if (from_layer_collection != NULL) { + if (from_layer_collection != nullptr) { /* If we came from layer collection we don't go deeper, view layer * builder takes care of going deeper. * @@ -563,17 +563,17 @@ void DepsgraphRelationBuilder::build_collection(LayerCollection *from_layer_coll } const bool group_done = built_map_.checkIsBuiltAndTag(collection); OperationKey object_transform_final_key( - object != NULL ? &object->id : NULL, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL); - ComponentKey duplicator_key(object != NULL ? &object->id : NULL, NodeType::DUPLI); + object != nullptr ? &object->id : nullptr, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL); + ComponentKey duplicator_key(object != nullptr ? &object->id : nullptr, NodeType::DUPLI); if (!group_done) { LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) { - build_object(NULL, cob->ob); + build_object(nullptr, cob->ob); } LISTBASE_FOREACH (CollectionChild *, child, &collection->children) { - build_collection(NULL, NULL, child->collection); + build_collection(nullptr, nullptr, child->collection); } } - if (object != NULL) { + if (object != nullptr) { FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (collection, ob, graph_->mode) { ComponentKey dupli_transform_key(&ob->id, NodeType::TRANSFORM); add_relation(dupli_transform_key, object_transform_final_key, "Dupligroup"); @@ -593,7 +593,7 @@ void DepsgraphRelationBuilder::build_collection(LayerCollection *from_layer_coll void DepsgraphRelationBuilder::build_object(Base *base, Object *object) { if (built_map_.checkIsBuiltAndTag(object)) { - if (base != NULL) { + if (base != nullptr) { build_object_flags(base, object); } return; @@ -615,34 +615,34 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) /* Various flags, flushing from bases/collections. */ build_object_flags(base, object); /* Parenting. */ - if (object->parent != NULL) { + if (object->parent != nullptr) { /* Make sure parent object's relations are built. */ - build_object(NULL, object->parent); + build_object(nullptr, object->parent); /* Parent relationship. */ build_object_parent(object); /* Local -> parent. */ add_relation(local_transform_key, parent_transform_key, "ObLocal -> ObParent"); } /* Modifiers. */ - if (object->modifiers.first != NULL) { + if (object->modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; modifiers_foreachIDLink(object, modifier_walk, &data); } /* Grease Pencil Modifiers. */ - if (object->greasepencil_modifiers.first != NULL) { + if (object->greasepencil_modifiers.first != nullptr) { BuilderWalkUserData data; data.builder = this; BKE_gpencil_modifiers_foreachIDLink(object, modifier_walk, &data); } /* Shader FX. */ - if (object->shader_fx.first != NULL) { + if (object->shader_fx.first != nullptr) { BuilderWalkUserData data; data.builder = this; BKE_shaderfx_foreachIDLink(object, modifier_walk, &data); } /* Constraints. */ - if (object->constraints.first != NULL) { + if (object->constraints.first != nullptr) { BuilderWalkUserData data; data.builder = this; BKE_constraints_id_loop(&object->constraints, constraint_walk, &data); @@ -650,11 +650,11 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) /* Object constraints. */ OperationKey object_transform_simulation_init_key( &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_SIMULATION_INIT); - if (object->constraints.first != NULL) { + if (object->constraints.first != nullptr) { OperationKey constraint_key( &object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_CONSTRAINTS); /* Constraint relations. */ - build_constraints(&object->id, NodeType::TRANSFORM, "", &object->constraints, NULL); + build_constraints(&object->id, NodeType::TRANSFORM, "", &object->constraints, nullptr); /* operation order */ add_relation(base_op_key, constraint_key, "ObBase-> Constraint Stack"); add_relation(constraint_key, final_transform_key, "ObConstraints -> Done"); @@ -678,15 +678,15 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) /* Object data. */ build_object_data(object); /* Particle systems. */ - if (object->particlesystem.first != NULL) { + if (object->particlesystem.first != nullptr) { build_particle_systems(object); } /* Proxy object to copy from. */ build_object_proxy_from(object); build_object_proxy_group(object); /* Object dupligroup. */ - if (object->instance_collection != NULL) { - build_collection(NULL, object, object->instance_collection); + if (object->instance_collection != nullptr) { + build_collection(nullptr, object, object->instance_collection); } /* Point caches. */ build_object_pointcache(object); @@ -700,11 +700,11 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object) void DepsgraphRelationBuilder::build_object_proxy_from(Object *object) { - if (object->proxy_from == NULL) { + if (object->proxy_from == nullptr) { return; } /* Object is linked here (comes from the library). */ - build_object(NULL, object->proxy_from); + build_object(nullptr, object->proxy_from); ComponentKey ob_transform_key(&object->proxy_from->id, NodeType::TRANSFORM); ComponentKey proxy_transform_key(&object->id, NodeType::TRANSFORM); add_relation(ob_transform_key, proxy_transform_key, "Proxy Transform"); @@ -712,11 +712,11 @@ void DepsgraphRelationBuilder::build_object_proxy_from(Object *object) void DepsgraphRelationBuilder::build_object_proxy_group(Object *object) { - if (object->proxy_group == NULL || object->proxy_group == object->proxy) { + if (object->proxy_group == nullptr || object->proxy_group == object->proxy) { return; } /* Object is local here (local in .blend file, users interacts with it). */ - build_object(NULL, object->proxy_group); + build_object(nullptr, object->proxy_group); OperationKey proxy_group_eval_key( &object->proxy_group->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); OperationKey transform_eval_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); @@ -725,7 +725,7 @@ void DepsgraphRelationBuilder::build_object_proxy_group(Object *object) void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) { - if (base == NULL) { + if (base == nullptr) { return; } OperationKey view_layer_done_key( @@ -741,7 +741,7 @@ void DepsgraphRelationBuilder::build_object_flags(Base *base, Object *object) void DepsgraphRelationBuilder::build_object_data(Object *object) { - if (object->data == NULL) { + if (object->data == nullptr) { return; } ID *obdata_id = (ID *)object->data; @@ -770,7 +770,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) break; } case OB_ARMATURE: - if (ID_IS_LINKED(object) && object->proxy_from != NULL) { + if (ID_IS_LINKED(object) && object->proxy_from != nullptr) { build_proxy_rig(object); } else { @@ -791,7 +791,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) break; } Key *key = BKE_key_from_object(object); - if (key != NULL) { + if (key != nullptr) { ComponentKey geometry_key((ID *)object->data, NodeType::GEOMETRY); ComponentKey key_key(&key->id, NodeType::GEOMETRY); add_relation(key_key, geometry_key, "Shapekeys"); @@ -799,7 +799,7 @@ void DepsgraphRelationBuilder::build_object_data(Object *object) } /* Materials. */ Material ***materials_ptr = give_matarar(object); - if (materials_ptr != NULL) { + if (materials_ptr != nullptr) { short *num_materials_ptr = give_totcolp(object); build_materials(*materials_ptr, *num_materials_ptr); } @@ -1021,7 +1021,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, for (bConstraint *con = (bConstraint *)constraints->first; con; con = con->next) { const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con); /* Invalid constraint type. */ - if (cti == NULL) { + if (cti == nullptr) { continue; } /* Special case for camera tracking -- it doesn't use targets to @@ -1048,7 +1048,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, else if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) { depends_on_camera = true; } - if (depends_on_camera && scene_->camera != NULL) { + if (depends_on_camera && scene_->camera != nullptr) { ComponentKey camera_key(&scene_->camera->id, NodeType::TRANSFORM); add_relation(camera_key, constraint_op_key, cti->name); } @@ -1069,10 +1069,10 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, } } else if (cti->get_constraint_targets) { - ListBase targets = {NULL, NULL}; + ListBase targets = {nullptr, nullptr}; cti->get_constraint_targets(con, &targets); LISTBASE_FOREACH (bConstraintTarget *, ct, &targets) { - if (ct->tar == NULL) { + if (ct->tar == nullptr) { continue; } if (ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK)) { @@ -1200,13 +1200,13 @@ void DepsgraphRelationBuilder::build_animdata(ID *id) void DepsgraphRelationBuilder::build_animdata_curves(ID *id) { AnimData *adt = BKE_animdata_from_id(id); - if (adt == NULL) { + if (adt == nullptr) { return; } - if (adt->action != NULL) { + if (adt->action != nullptr) { build_action(adt->action); } - if (adt->action == NULL && BLI_listbase_is_empty(&adt->nla_tracks)) { + if (adt->action == nullptr && BLI_listbase_is_empty(&adt->nla_tracks)) { return; } /* Ensure evaluation order from entry to exit. */ @@ -1218,20 +1218,20 @@ void DepsgraphRelationBuilder::build_animdata_curves(ID *id) /* Wire up dependency from action. */ ComponentKey adt_key(id, NodeType::ANIMATION); /* Relation from action itself. */ - if (adt->action != NULL) { + if (adt->action != nullptr) { ComponentKey action_key(&adt->action->id, NodeType::ANIMATION); add_relation(action_key, adt_key, "Action -> Animation"); } /* Get source operations. */ Node *node_from = get_node(adt_key); - BLI_assert(node_from != NULL); - if (node_from == NULL) { + BLI_assert(node_from != nullptr); + if (node_from == nullptr) { return; } OperationNode *operation_from = node_from->get_exit_operation(); - BLI_assert(operation_from != NULL); + BLI_assert(operation_from != nullptr); /* Build relations from animation operation to properties it changes. */ - if (adt->action != NULL) { + if (adt->action != nullptr) { build_animdata_curves_targets(id, adt_key, operation_from, &adt->action->curves); } LISTBASE_FOREACH (NlaTrack *, nlt, &adt->nla_tracks) { @@ -1255,7 +1255,7 @@ void DepsgraphRelationBuilder::build_animdata_curves_targets(ID *id, continue; } Node *node_to = rna_node_query_.find_node(&ptr, prop, RNAPointerSource::ENTRY); - if (node_to == NULL) { + if (node_to == nullptr) { continue; } OperationNode *operation_to = node_to->get_entry_operation(); @@ -1289,7 +1289,7 @@ void DepsgraphRelationBuilder::build_animdata_nlastrip_targets(ID *id, ListBase *strips) { LISTBASE_FOREACH (NlaStrip *, strip, strips) { - if (strip->act != NULL) { + if (strip->act != nullptr) { build_action(strip->act); ComponentKey action_key(&strip->act->id, NodeType::ANIMATION); @@ -1297,7 +1297,7 @@ void DepsgraphRelationBuilder::build_animdata_nlastrip_targets(ID *id, build_animdata_curves_targets(id, adt_key, operation_from, &strip->act->curves); } - else if (strip->strips.first != NULL) { + else if (strip->strips.first != nullptr) { build_animdata_nlastrip_targets(id, adt_key, operation_from, &strip->strips); } } @@ -1306,7 +1306,7 @@ void DepsgraphRelationBuilder::build_animdata_nlastrip_targets(ID *id, void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) { AnimData *adt = BKE_animdata_from_id(id); - if (adt == NULL) { + if (adt == nullptr) { return; } ComponentKey adt_key(id, NodeType::ANIMATION); @@ -1331,7 +1331,7 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) * * TODO(sergey): Avoid liner lookup somehow. */ if (fcu->array_index > 0) { - FCurve *fcu_prev = NULL; + FCurve *fcu_prev = nullptr; LISTBASE_FOREACH (FCurve *, fcu_candidate, &adt->drivers) { /* Writing to different RNA paths is */ const char *rna_path = fcu->rna_path ? fcu->rna_path : ""; @@ -1343,11 +1343,11 @@ void DepsgraphRelationBuilder::build_animdata_drivers(ID *id) continue; } /* Choose fcurve with highest possible array index. */ - if (fcu_prev == NULL || fcu_candidate->array_index > fcu_prev->array_index) { + if (fcu_prev == nullptr || fcu_candidate->array_index > fcu_prev->array_index) { fcu_prev = fcu_candidate; } } - if (fcu_prev != NULL) { + if (fcu_prev != nullptr) { OperationKey prev_driver_key(id, NodeType::PARAMETERS, OperationCode::DRIVER, @@ -1417,7 +1417,7 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) { /* Validate the RNA path pointer just in case. */ const char *rna_path = fcu->rna_path; - if (rna_path == NULL || rna_path[0] == '\0') { + if (rna_path == nullptr || rna_path[0] == '\0') { return; } /* Parse the RNA path to find the target property pointer. */ @@ -1447,16 +1447,16 @@ 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 != NULL) { + 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 != NULL) { + if (object->data == id_ptr && object->pose != nullptr) { bPoseChannel *pchan = BKE_pose_channel_find_name(object->pose, bone->name); - if (pchan != NULL) { + 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"); @@ -1484,14 +1484,14 @@ void DepsgraphRelationBuilder::build_driver_data(ID *id, FCurve *fcu) PointerRNA id_ptr; PointerRNA ptr; RNA_id_pointer_create(id, &id_ptr); - if (RNA_path_resolve_full(&id_ptr, fcu->rna_path, &ptr, NULL, NULL)) { + if (RNA_path_resolve_full(&id_ptr, fcu->rna_path, &ptr, nullptr, nullptr)) { if (id_ptr.owner_id != ptr.owner_id) { ComponentKey cow_key(ptr.owner_id, NodeType::COPY_ON_WRITE); add_relation(cow_key, driver_key, "Driven CoW -> Driver", RELATION_CHECK_BEFORE_ADD); } } } - if (property_entry_key.prop != NULL && RNA_property_is_idprop(property_entry_key.prop)) { + if (property_entry_key.prop != nullptr && RNA_property_is_idprop(property_entry_key.prop)) { RNAPathKey property_exit_key(id, rna_path, RNAPointerSource::EXIT); OperationKey parameters_key(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); add_relation(property_exit_key, parameters_key, "Driven Property -> Properties"); @@ -1513,16 +1513,16 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) /* Only used targets. */ DRIVER_TARGETS_USED_LOOPER_BEGIN (dvar) { ID *target_id = dtar->id; - if (target_id == NULL) { + if (target_id == nullptr) { continue; } build_id(target_id); build_driver_id_property(target_id, dtar->rna_path); /* Look up the proxy - matches dtar_id_ensure_proxy_from during evaluation. */ - Object *object = NULL; + Object *object = nullptr; if (GS(target_id->name) == ID_OB) { object = (Object *)target_id; - if (object->proxy_from != NULL) { + if (object->proxy_from != nullptr) { /* Redirect the target to the proxy, like in evaluation. */ object = object->proxy_from; target_id = &object->id; @@ -1535,7 +1535,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) if ((dtar->flag & DTAR_FLAG_STRUCT_REF) && (object && object->type == OB_ARMATURE) && (dtar->pchan_name[0])) { bPoseChannel *target_pchan = BKE_pose_channel_find_name(object->pose, dtar->pchan_name); - if (target_pchan == NULL) { + if (target_pchan == nullptr) { continue; } OperationKey variable_key( @@ -1556,7 +1556,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) OperationKey target_key(target_id, NodeType::TRANSFORM, OperationCode::TRANSFORM_FINAL); add_relation(target_key, driver_key, "Target -> Driver"); } - else if (dtar->rna_path != NULL && dtar->rna_path[0] != '\0') { + else if (dtar->rna_path != nullptr && dtar->rna_path[0] != '\0') { RNAPathKey variable_exit_key(target_id, dtar->rna_path, RNAPointerSource::EXIT); if (RNA_pointer_is_null(&variable_exit_key.ptr)) { continue; @@ -1568,7 +1568,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) add_relation(variable_exit_key, driver_key, "RNA Target -> Driver"); } else { - /* If rna_path is NULL, and DTAR_FLAG_STRUCT_REF isn't set, this + /* If rna_path is nullptr, and DTAR_FLAG_STRUCT_REF isn't set, this * is an incomplete target reference, so nothing to do here. */ } } @@ -1578,7 +1578,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu) void DepsgraphRelationBuilder::build_driver_id_property(ID *id, const char *rna_path) { - if (id == NULL || rna_path == NULL) { + if (id == nullptr || rna_path == nullptr) { return; } PointerRNA id_ptr, ptr; @@ -1588,7 +1588,7 @@ void DepsgraphRelationBuilder::build_driver_id_property(ID *id, const char *rna_ if (!RNA_path_resolve_full(&id_ptr, rna_path, &ptr, &prop, &index)) { return; } - if (prop == NULL) { + if (prop == nullptr) { return; } if (!RNA_property_is_idprop(prop)) { @@ -1620,7 +1620,7 @@ void DepsgraphRelationBuilder::build_world(World *world) build_animdata(&world->id); build_parameters(&world->id); /* world's nodetree */ - if (world->nodetree != NULL) { + if (world->nodetree != nullptr) { build_nodetree(world->nodetree); OperationKey ntree_key( &world->nodetree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); @@ -1650,7 +1650,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) LISTBASE_FOREACH (EffectorRelation *, effector_relation, effector_relations) { ComponentKey effector_transform_key(&effector_relation->ob->id, NodeType::TRANSFORM); add_relation(effector_transform_key, rb_init_key, "RigidBody Field"); - if (effector_relation->pd != NULL) { + if (effector_relation->pd != nullptr) { const short shape = effector_relation->pd->shape; if (ELEM(shape, PFIELD_SHAPE_SURFACE, PFIELD_SHAPE_POINTS)) { ComponentKey effector_geometry_key(&effector_relation->ob->id, NodeType::GEOMETRY); @@ -1659,8 +1659,8 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) } } /* Objects. */ - if (rbw->group != NULL) { - build_collection(NULL, NULL, rbw->group); + if (rbw->group != nullptr) { + build_collection(nullptr, nullptr, rbw->group); FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->group, object) { if (object->type != OB_MESH) { continue; @@ -1680,7 +1680,7 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) /* Geometry must be known to create the rigid body. RBO_MESH_BASE * uses the non-evaluated mesh, so then the evaluation is * unnecessary. */ - if (object->rigidbody_object != NULL && + if (object->rigidbody_object != nullptr && object->rigidbody_object->mesh_source != RBO_MESH_BASE) { /* NOTE: We prefer this relation to be never killed, to avoid * access partially evaluated mesh from solver. */ @@ -1699,18 +1699,18 @@ void DepsgraphRelationBuilder::build_rigidbody(Scene *scene) FOREACH_COLLECTION_OBJECT_RECURSIVE_END; } /* Constraints. */ - if (rbw->constraints != NULL) { + if (rbw->constraints != nullptr) { FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (rbw->constraints, object) { RigidBodyCon *rbc = object->rigidbody_constraint; - if (rbc == NULL || rbc->ob1 == NULL || rbc->ob2 == NULL) { - /* When either ob1 or ob2 is NULL, the constraint doesn't + if (rbc == nullptr || rbc->ob1 == nullptr || rbc->ob2 == nullptr) { + /* When either ob1 or ob2 is nullptr, the constraint doesn't * work. */ continue; } /* Make sure indirectly linked objects are fully built. */ - build_object(NULL, object); - build_object(NULL, rbc->ob1); - build_object(NULL, rbc->ob2); + build_object(nullptr, object); + build_object(nullptr, rbc->ob1); + build_object(nullptr, rbc->ob2); /* final result of the constraint object's transform controls how * the constraint affects the physics sim for these objects. */ ComponentKey trans_key(&object->id, NodeType::TRANSFORM); @@ -1766,8 +1766,8 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) add_particle_collision_relations( psys_key, object, part->collision_group, "Particle Collision"); } - else if ((psys->flag & PSYS_HAIR_DYNAMICS) && psys->clmd != NULL && - psys->clmd->coll_parms != NULL) { + else if ((psys->flag & PSYS_HAIR_DYNAMICS) && psys->clmd != nullptr && + psys->clmd->coll_parms != nullptr) { add_particle_collision_relations( psys_key, object, psys->clmd->coll_parms->group, "Hair Collision"); } @@ -1775,17 +1775,17 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) add_particle_forcefield_relations( psys_key, object, psys, part->effector_weights, part->type == PART_HAIR, "Particle Field"); /* Boids .*/ - if (part->boids != NULL) { + if (part->boids != nullptr) { LISTBASE_FOREACH (BoidState *, state, &part->boids->states) { LISTBASE_FOREACH (BoidRule *, rule, &state->rules) { - Object *ruleob = NULL; + Object *ruleob = nullptr; if (rule->type == eBoidRuleType_Avoid) { ruleob = ((BoidRuleGoalAvoid *)rule)->ob; } else if (rule->type == eBoidRuleType_FollowLeader) { ruleob = ((BoidRuleFollowLeader *)rule)->ob; } - if (ruleob != NULL) { + if (ruleob != nullptr) { ComponentKey ruleob_key(&ruleob->id, NodeType::TRANSFORM); add_relation(ruleob_key, psys_key, "Boid Rule"); } @@ -1795,11 +1795,11 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) /* Keyed particle targets. */ if (part->phystype == PART_PHYS_KEYED) { LISTBASE_FOREACH (ParticleTarget *, particle_target, &psys->targets) { - if (particle_target->ob == NULL || particle_target->ob == object) { + if (particle_target->ob == nullptr || particle_target->ob == object) { continue; } /* Make sure target object is pulled into the graph. */ - build_object(NULL, particle_target->ob); + build_object(nullptr, particle_target->ob); /* Use geometry component, since that's where particles are * actually evaluated. */ ComponentKey target_key(&particle_target->ob->id, NodeType::GEOMETRY); @@ -1809,16 +1809,16 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) /* Visualization. */ switch (part->ren_as) { case PART_DRAW_OB: - if (part->instance_object != NULL) { + if (part->instance_object != nullptr) { /* Make sure object's relations are all built. */ - build_object(NULL, part->instance_object); + build_object(nullptr, part->instance_object); /* Build relation for the particle visualization. */ build_particle_system_visualization_object(object, psys, part->instance_object); } break; case PART_DRAW_GR: - if (part->instance_collection != NULL) { - build_collection(NULL, NULL, part->instance_collection); + if (part->instance_collection != nullptr) { + build_collection(nullptr, nullptr, part->instance_collection); LISTBASE_FOREACH (CollectionObject *, go, &part->instance_collection->gobject) { build_particle_system_visualization_object(object, psys, go->ob); } @@ -1851,7 +1851,7 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) /* Texture slots. */ for (int mtex_index = 0; mtex_index < MAX_MTEX; mtex_index++) { MTex *mtex = part->mtex[mtex_index]; - if (mtex == NULL || mtex->tex == NULL) { + if (mtex == nullptr || mtex->tex == nullptr) { continue; } build_texture(mtex->tex); @@ -1862,7 +1862,7 @@ void DepsgraphRelationBuilder::build_particle_settings(ParticleSettings *part) RELATION_FLAG_FLUSH_USER_EDIT_ONLY); /* TODO(sergey): Consider moving texture space handling to an own * function. */ - if (mtex->texco == TEXCO_OBJECT && mtex->object != NULL) { + if (mtex->texco == TEXCO_OBJECT && mtex->object != nullptr) { ComponentKey object_key(&mtex->object->id, NodeType::TRANSFORM); add_relation(object_key, particle_settings_eval_key, "Particle Texture Space"); } @@ -1946,7 +1946,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) Relation *rel = add_relation(scene_key, obdata_ubereval_key, "CoW Relation"); rel->flag |= RELATION_FLAG_NO_FLUSH; /* Modifiers */ - if (object->modifiers.first != NULL) { + if (object->modifiers.first != nullptr) { ModifierUpdateDepsgraphContext ctx = {}; ctx.scene = scene_; ctx.object = object; @@ -1964,7 +1964,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) } } /* Grease Pencil Modifiers. */ - if (object->greasepencil_modifiers.first != NULL) { + if (object->greasepencil_modifiers.first != nullptr) { ModifierUpdateDepsgraphContext ctx = {}; ctx.scene = scene_; ctx.object = object; @@ -1983,7 +1983,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) } } /* Shader FX. */ - if (object->shader_fx.first != NULL) { + if (object->shader_fx.first != nullptr) { ModifierUpdateDepsgraphContext ctx = {}; ctx.scene = scene_; ctx.object = object; @@ -2043,8 +2043,8 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object) /* Object data data-block. */ build_object_data_geometry_datablock((ID *)object->data); Key *key = BKE_key_from_object(object); - if (key != NULL) { - if (key->adt != NULL) { + if (key != nullptr) { + if (key->adt != nullptr) { if (key->adt->action || key->adt->nla_tracks.first) { ComponentKey obdata_key((ID *)object->data, NodeType::GEOMETRY); ComponentKey adt_key(&key->id, NodeType::ANIMATION); @@ -2077,7 +2077,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) build_parameters(obdata); /* ShapeKeys. */ Key *key = BKE_key_from_id(obdata); - if (key != NULL) { + if (key != nullptr) { build_shapekeys(key); } /* Link object data evaluation node to exit operation. */ @@ -2093,22 +2093,22 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) break; case ID_CU: { Curve *cu = (Curve *)obdata; - if (cu->bevobj != NULL) { + if (cu->bevobj != nullptr) { ComponentKey bevob_geom_key(&cu->bevobj->id, NodeType::GEOMETRY); add_relation(bevob_geom_key, obdata_geom_eval_key, "Curve Bevel Geometry"); ComponentKey bevob_key(&cu->bevobj->id, NodeType::TRANSFORM); add_relation(bevob_key, obdata_geom_eval_key, "Curve Bevel Transform"); - build_object(NULL, cu->bevobj); + build_object(nullptr, cu->bevobj); } - if (cu->taperobj != NULL) { + if (cu->taperobj != nullptr) { ComponentKey taperob_key(&cu->taperobj->id, NodeType::GEOMETRY); add_relation(taperob_key, obdata_geom_eval_key, "Curve Taper"); - build_object(NULL, cu->taperobj); + build_object(nullptr, cu->taperobj); } - if (cu->textoncurve != NULL) { + if (cu->textoncurve != nullptr) { ComponentKey textoncurve_key(&cu->textoncurve->id, NodeType::GEOMETRY); add_relation(textoncurve_key, obdata_geom_eval_key, "Text on Curve"); - build_object(NULL, cu->textoncurve); + build_object(nullptr, cu->textoncurve); } break; } @@ -2131,7 +2131,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry_datablock(ID *obdata) * we need to rebuild the bGPDstroke->triangles caches). */ for (int i = 0; i < gpd->totcol; i++) { Material *ma = gpd->mat[i]; - if ((ma != NULL) && (ma->gp_style != NULL)) { + if ((ma != nullptr) && (ma->gp_style != nullptr)) { OperationKey material_key(&ma->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); add_relation(material_key, geometry_key, "Material -> GP Data"); } @@ -2160,8 +2160,8 @@ void DepsgraphRelationBuilder::build_camera(Camera *camera) } build_animdata(&camera->id); build_parameters(&camera->id); - if (camera->dof.focus_object != NULL) { - build_object(NULL, camera->dof.focus_object); + if (camera->dof.focus_object != nullptr) { + build_object(nullptr, camera->dof.focus_object); ComponentKey camera_parameters_key(&camera->id, NodeType::PARAMETERS); ComponentKey dof_ob_key(&camera->dof.focus_object->id, NodeType::TRANSFORM); add_relation(dof_ob_key, camera_parameters_key, "Camera DOF"); @@ -2177,7 +2177,7 @@ void DepsgraphRelationBuilder::build_light(Light *lamp) build_animdata(&lamp->id); build_parameters(&lamp->id); /* light's nodetree */ - if (lamp->nodetree != NULL) { + if (lamp->nodetree != nullptr) { build_nodetree(lamp->nodetree); ComponentKey lamp_parameters_key(&lamp->id, NodeType::PARAMETERS); ComponentKey nodetree_key(&lamp->nodetree->id, NodeType::SHADING); @@ -2188,7 +2188,7 @@ void DepsgraphRelationBuilder::build_light(Light *lamp) void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) { - if (ntree == NULL) { + if (ntree == nullptr) { return; } if (built_map_.checkIsBuiltAndTag(ntree)) { @@ -2200,7 +2200,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) /* nodetree's nodes... */ LISTBASE_FOREACH (bNode *, bnode, &ntree->nodes) { ID *id = bnode->id; - if (id == NULL) { + if (id == nullptr) { continue; } ID_Type id_type = GS(id->name); @@ -2220,7 +2220,7 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) add_relation(image_key, shading_key, "Image -> Node"); } else if (id_type == ID_OB) { - build_object(NULL, (Object *)id); + build_object(nullptr, (Object *)id); ComponentKey object_transform_key(id, NodeType::TRANSFORM); add_relation(object_transform_key, shading_key, "Object Transform -> Node"); if (object_have_geometry_component(reinterpret_cast<Object *>(id))) { @@ -2235,8 +2235,8 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) * * On the one hand it's annoying to always pull it in, but on another hand it's also annoying * to have hardcoded node-type exception here. */ - if (node_scene->camera != NULL) { - build_object(NULL, node_scene->camera); + if (node_scene->camera != nullptr) { + build_object(nullptr, node_scene->camera); } } else if (id_type == ID_TXT) { @@ -2286,7 +2286,7 @@ void DepsgraphRelationBuilder::build_material(Material *material) build_animdata(&material->id); build_parameters(&material->id); /* material's nodetree */ - if (material->nodetree != NULL) { + if (material->nodetree != nullptr) { build_nodetree(material->nodetree); OperationKey ntree_key( &material->nodetree->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE); @@ -2299,7 +2299,7 @@ void DepsgraphRelationBuilder::build_material(Material *material) void DepsgraphRelationBuilder::build_materials(Material **materials, int num_materials) { for (int i = 0; i < num_materials; i++) { - if (materials[i] == NULL) { + if (materials[i] == nullptr) { continue; } build_material(materials[i]); @@ -2319,7 +2319,7 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture) build_nodetree(texture->nodetree); /* Special cases for different IDs which texture uses. */ if (texture->type == TEX_IMAGE) { - if (texture->ima != NULL) { + if (texture->ima != nullptr) { build_image(texture->ima); } } @@ -2396,7 +2396,7 @@ void DepsgraphRelationBuilder::build_mask(Mask *mask) for (int i = 0; i < spline->tot_point; i++) { MaskSplinePoint *point = &spline->points[i]; MaskParent *parent = &point->parent; - if (parent == NULL || parent->id == NULL) { + if (parent == nullptr || parent->id == nullptr) { continue; } build_id(parent->id); @@ -2448,7 +2448,7 @@ void DepsgraphRelationBuilder::build_speaker(Speaker *speaker) } build_animdata(&speaker->id); build_parameters(&speaker->id); - if (speaker->sound != NULL) { + if (speaker->sound != nullptr) { build_sound(speaker->sound); ComponentKey speaker_key(&speaker->id, NodeType::AUDIO); ComponentKey sound_key(&speaker->sound->id, NodeType::AUDIO); @@ -2467,7 +2467,7 @@ void DepsgraphRelationBuilder::build_sound(bSound *sound) void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene) { - if (scene->ed == NULL) { + if (scene->ed == nullptr) { return; } build_scene_audio(scene); @@ -2477,18 +2477,18 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene) Sequence *seq; bool has_audio_strips = false; SEQ_BEGIN (scene->ed, seq) { - if (seq->sound != NULL) { + if (seq->sound != nullptr) { build_sound(seq->sound); ComponentKey sound_key(&seq->sound->id, NodeType::AUDIO); add_relation(sound_key, sequencer_key, "Sound -> Sequencer"); has_audio_strips = true; } - if (seq->scene != NULL) { + if (seq->scene != nullptr) { build_scene_parameters(seq->scene); /* This is to support 3D audio. */ has_audio_strips = true; } - if (seq->type == SEQ_TYPE_SCENE && seq->scene != NULL) { + if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) { if (seq->flag & SEQ_SCENE_STRIPS) { build_scene_sequencer(seq->scene); ComponentKey sequence_scene_audio_key(&seq->scene->id, NodeType::AUDIO); @@ -2518,7 +2518,7 @@ void DepsgraphRelationBuilder::build_scene_speakers(Scene * /*scene*/, ViewLayer if (object->type != OB_SPEAKER || !need_pull_base_into_graph(base)) { continue; } - build_object(NULL, base->object); + build_object(nullptr, base->object); } } @@ -2544,7 +2544,7 @@ void DepsgraphRelationBuilder::build_nested_datablock(ID *owner, ID *id) void DepsgraphRelationBuilder::build_nested_nodetree(ID *owner, bNodeTree *ntree) { - if (ntree == NULL) { + if (ntree == nullptr) { return; } build_nested_datablock(owner, &ntree->id); @@ -2552,7 +2552,7 @@ void DepsgraphRelationBuilder::build_nested_nodetree(ID *owner, bNodeTree *ntree void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) { - if (key == NULL) { + if (key == nullptr) { return; } build_nested_datablock(owner, &key->id); @@ -2609,7 +2609,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) /* All entry operations of each component should wait for a proper * copy of ID. */ OperationNode *op_entry = comp_node->get_entry_operation(); - if (op_entry != NULL) { + if (op_entry != nullptr) { Relation *rel = graph_->add_new_relation(op_cow, op_entry, "CoW Dependency"); rel->flag |= rel_flag; } @@ -2655,7 +2655,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) if (GS(id_orig->name) == ID_OB) { Object *object = (Object *)id_orig; ID *object_data_id = (ID *)object->data; - if (object_data_id != NULL) { + if (object_data_id != nullptr) { if (deg_copy_on_write_is_needed(object_data_id)) { OperationKey data_copy_on_write_key( object_data_id, NodeType::COPY_ON_WRITE, OperationCode::COPY_ON_WRITE); @@ -2676,8 +2676,8 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) * to their RNA path. This means that action must be copied prior to the ID's copy-on-write, * otherwise depsgraph might try to access freed data. */ AnimData *animation_data = BKE_animdata_from_id(id_orig); - if (animation_data != NULL) { - if (animation_data->action != NULL) { + if (animation_data != nullptr) { + if (animation_data->action != nullptr) { OperationKey action_copy_on_write_key( &animation_data->action->id, NodeType::COPY_ON_WRITE, OperationCode::COPY_ON_WRITE); add_relation(action_copy_on_write_key, @@ -2698,7 +2698,7 @@ void DepsgraphRelationBuilder::modifier_walk(void *user_data, { BuilderWalkUserData *data = (BuilderWalkUserData *)user_data; ID *id = *idpoin; - if (id == NULL) { + if (id == nullptr) { return; } data->builder->build_id(id); @@ -2711,7 +2711,7 @@ void DepsgraphRelationBuilder::constraint_walk(bConstraint * /*con*/, { BuilderWalkUserData *data = (BuilderWalkUserData *)user_data; ID *id = *idpoin; - if (id == NULL) { + if (id == nullptr) { return; } data->builder->build_id(id); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 81bc82c036a..ed656354e30 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -364,7 +364,7 @@ struct DepsNodeHandle { const char *default_name = "") : builder(builder), node(node), default_name(default_name) { - BLI_assert(node != NULL); + BLI_assert(node != nullptr); } DepsgraphRelationBuilder *builder; 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 4412fa3fca3..eeeb58100b0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -36,7 +36,7 @@ template<typename KeyType> OperationNode *DepsgraphRelationBuilder::find_operation_node(const KeyType &key) { Node *node = get_node(key); - return node != NULL ? node->get_exit_operation() : NULL; + return node != nullptr ? node->get_exit_operation() : nullptr; } template<typename KeyFrom, typename KeyTo> @@ -47,8 +47,8 @@ Relation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, { 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; + OperationNode *op_from = node_from ? node_from->get_exit_operation() : nullptr; + OperationNode *op_to = node_to ? node_to->get_entry_operation() : nullptr; if (op_from && op_to) { return add_operation_relation(op_from, op_to, description, flags); } @@ -80,7 +80,7 @@ Relation *DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from, key_to.identifier().c_str()); } } - return NULL; + return nullptr; } template<typename KeyTo> @@ -91,11 +91,11 @@ Relation *DepsgraphRelationBuilder::add_relation(const TimeSourceKey &key_from, { 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) { + OperationNode *op_to = node_to ? node_to->get_entry_operation() : nullptr; + if (time_from != nullptr && op_to != nullptr) { return add_time_relation(time_from, op_to, description, flags); } - return NULL; + return nullptr; } template<typename KeyType> @@ -105,9 +105,9 @@ Relation *DepsgraphRelationBuilder::add_node_handle_relation(const KeyType &key_ int flags) { Node *node_from = get_node(key_from); - OperationNode *op_from = node_from ? node_from->get_exit_operation() : NULL; + OperationNode *op_from = node_from ? node_from->get_exit_operation() : nullptr; OperationNode *op_to = handle->node->get_entry_operation(); - if (op_from != NULL && op_to != NULL) { + if (op_from != nullptr && op_to != nullptr) { return add_operation_relation(op_from, op_to, description, flags); } else { @@ -124,7 +124,7 @@ Relation *DepsgraphRelationBuilder::add_node_handle_relation(const KeyType &key_ key_from.identifier().c_str()); } } - return NULL; + return nullptr; } template<typename KeyTo> @@ -135,7 +135,7 @@ Relation *DepsgraphRelationBuilder::add_depends_on_transform_relation(ID *id, { if (GS(id->name) == ID_OB) { Object *object = reinterpret_cast<Object *>(id); - if (object->rigidbody_object != NULL) { + if (object->rigidbody_object != nullptr) { OperationKey transform_key(&object->id, NodeType::TRANSFORM, OperationCode::TRANSFORM_EVAL); return add_relation(transform_key, key_to, description, flags); } @@ -162,12 +162,12 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom &key_from, /* 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) { + if (node_from == nullptr || node_to == nullptr) { 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) { + if (op_from == nullptr || op_to == nullptr) { return false; } /* Different armatures, bone can't be the same. */ @@ -193,12 +193,12 @@ bool DepsgraphRelationBuilder::is_same_nodetree_node_dependency(const KeyFrom &k /* 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) { + if (node_from == nullptr || node_to == nullptr) { 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) { + if (op_from == nullptr || op_to == nullptr) { return false; } /* Check if this is actually a node tree. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc index 35af968d46e..6c449900f03 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc @@ -30,7 +30,7 @@ namespace DEG { //////////////////////////////////////////////////////////////////////////////// // Time source. -TimeSourceKey::TimeSourceKey() : id(NULL) +TimeSourceKey::TimeSourceKey() : id(nullptr) { } @@ -46,7 +46,7 @@ string TimeSourceKey::identifier() const //////////////////////////////////////////////////////////////////////////////// // Component. -ComponentKey::ComponentKey() : id(NULL), type(NodeType::UNDEFINED), name("") +ComponentKey::ComponentKey() : id(nullptr), type(NodeType::UNDEFINED), name("") { } @@ -72,7 +72,7 @@ string ComponentKey::identifier() const // Operation. OperationKey::OperationKey() - : id(NULL), + : id(nullptr), component_type(NodeType::UNDEFINED), component_name(""), opcode(OperationCode::OPERATION), @@ -176,7 +176,7 @@ RNAPathKey::RNAPathKey(ID *id, const char *path, RNAPointerSource source) : id(i int index; if (!RNA_path_resolve_full(&id_ptr, path, &ptr, &prop, &index)) { ptr = PointerRNA_NULL; - prop = NULL; + prop = nullptr; } } 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 484a4d828e3..55c14fc9b2d 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -71,7 +71,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, bKinematicConstraint *data = (bKinematicConstraint *)con->data; /* Attach owner to IK Solver to. */ bPoseChannel *rootchan = BKE_armature_ik_solver_find_root(pchan, data); - if (rootchan == NULL) { + if (rootchan == nullptr) { return; } OperationKey pchan_local_key( @@ -91,7 +91,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, OperationKey target_dependent_key = is_itasc ? init_ik_key : solver_key; /* IK target */ /* TODO(sergey): This should get handled as part of the constraint code. */ - if (data->tar != NULL) { + if (data->tar != nullptr) { /* Different object - requires its transform. */ if (data->tar != object) { ComponentKey target_key(&data->tar->id, NodeType::TRANSFORM); @@ -120,7 +120,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, } /* Pole Target. */ /* TODO(sergey): This should get handled as part of the constraint code. */ - if (data->poletar != NULL) { + if (data->poletar != nullptr) { /* Different object - requires its transform. */ if (data->poletar != object) { ComponentKey target_key(&data->poletar->id, NodeType::TRANSFORM); @@ -147,7 +147,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, "\nStarting IK Build: pchan = %s, target = (%s, %s), " "segcount = %d\n", pchan->name, - data->tar ? data->tar->id.name : "NULL", + data->tar ? data->tar->id.name : "nullptr", data->subtarget, data->rootbone); bPoseChannel *parchan = pchan; @@ -161,7 +161,7 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, add_relation(parchan_transforms_key, solver_key, "IK Solver Owner"); /* Walk to the chain's root. */ int segcount = 0; - while (parchan != NULL) { + while (parchan != nullptr) { /* Make IK-solver dependent on this bone's result, since it can only run * after the standard results of the bone are know. Validate links step * on the bone will ensure that users of this bone only grab the result @@ -215,7 +215,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, /* Attach owner to IK Solver. */ add_relation(transforms_key, solver_key, "Spline IK Solver Owner", RELATION_FLAG_GODMODE); /* Attach path dependency to solver. */ - if (data->tar != NULL) { + if (data->tar != nullptr) { ComponentKey target_geometry_key(&data->tar->id, NodeType::GEOMETRY); add_relation(target_geometry_key, solver_key, "Curve.Path -> Spline IK"); ComponentKey target_transform_key(&data->tar->id, NodeType::TRANSFORM); @@ -229,7 +229,7 @@ void DepsgraphRelationBuilder::build_splineik_pose(Object *object, root_map->add_bone(pchan->name, rootchan->name); /* Walk to the chain's root/ */ int segcount = 1; - for (bPoseChannel *parchan = pchan->parent; parchan != NULL && segcount < data->chainlen; + for (bPoseChannel *parchan = pchan->parent; parchan != nullptr && segcount < data->chainlen; parchan = parchan->parent, segcount++) { /* Make Spline IK solver dependent on this bone's result, since it can * only run after the standard results of the bone are know. Validate @@ -333,7 +333,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) /* Local to pose parenting operation. */ add_relation(bone_local_key, bone_pose_key, "Bone Local - Bone Pose"); /* Parent relation. */ - if (pchan->parent != NULL) { + if (pchan->parent != nullptr) { OperationCode parent_key_opcode; /* NOTE: this difference in handling allows us to prevent lockups * while ensuring correct poses for separate chains. */ @@ -348,7 +348,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) add_relation(parent_key, bone_pose_key, "Parent Bone -> Child Bone"); } /* Build constraints. */ - if (pchan->constraints.first != NULL) { + if (pchan->constraints.first != nullptr) { /* Build relations for indirectly linked objects. */ BuilderWalkUserData data; data.builder = this; @@ -413,8 +413,8 @@ void DepsgraphRelationBuilder::build_rig(Object *object) add_relation(bone_ready_key, pose_cleanup_key, "Ready -> Cleanup"); } /* Custom shape. */ - if (pchan->custom != NULL) { - build_object(NULL, pchan->custom); + if (pchan->custom != nullptr) { + build_object(nullptr, pchan->custom); } } } @@ -457,13 +457,13 @@ void DepsgraphRelationBuilder::build_proxy_rig(Object *object) * the parent bone, some users expect the parent to be ready if the * bone itself is (e.g. for computing the local space matrix). */ - if (pchan->parent != NULL) { + if (pchan->parent != nullptr) { OperationKey parent_key( &object->id, NodeType::BONE, pchan->parent->name, OperationCode::BONE_DONE); add_relation(parent_key, bone_done_key, "Parent Bone -> Child Bone"); } - if (pchan->prop != NULL) { + if (pchan->prop != nullptr) { OperationKey bone_parameters( &object->id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL, pchan->name); OperationKey from_bone_parameters( diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc index 4e0c2cbba0c..08191bcecc8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -42,8 +42,8 @@ void DepsgraphRelationBuilder::build_scene_render(Scene *scene, ViewLayer *view_ build_scene_sequencer(scene); build_scene_speakers(scene, view_layer); } - if (scene->camera != NULL) { - build_object(NULL, scene->camera); + if (scene->camera != nullptr) { + build_object(nullptr, scene->camera); } } @@ -64,7 +64,7 @@ void DepsgraphRelationBuilder::build_scene_compositor(Scene *scene) if (built_map_.checkIsBuiltAndTag(scene, BuilderMap::TAG_SCENE_COMPOSITOR)) { return; } - if (scene->nodetree == NULL) { + if (scene->nodetree == nullptr) { return; } build_nodetree(scene->nodetree); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc index e81ed8b410c..41e91ba7286 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_view_layer.cc @@ -70,7 +70,7 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb) continue; } if ((lc->flag & LAYER_COLLECTION_EXCLUDE) == 0) { - build_collection(lc, NULL, lc->collection); + build_collection(lc, nullptr, lc->collection); } build_layer_collections(&lc->layer_collections); } @@ -78,10 +78,10 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb) void DepsgraphRelationBuilder::build_freestyle_lineset(FreestyleLineSet *fls) { - if (fls->group != NULL) { - build_collection(NULL, NULL, fls->group); + if (fls->group != nullptr) { + build_collection(nullptr, nullptr, fls->group); } - if (fls->linestyle != NULL) { + if (fls->linestyle != nullptr) { build_freestyle_linestyle(fls->linestyle); } } @@ -95,7 +95,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, /* Scene objects. */ /* NOTE: Nodes builder requires us to pass CoW base because it's being * passed to the evaluation functions. During relations builder we only - * do NULL-pointer check of the base, so it's fine to pass original one. */ + * do nullptr-pointer check of the base, so it's fine to pass original one. */ LISTBASE_FOREACH (Base *, base, &view_layer->object_bases) { if (need_pull_base_into_graph(base)) { build_object(base, base->object); @@ -104,19 +104,19 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, build_layer_collections(&view_layer->layer_collections); - if (scene->camera != NULL) { - build_object(NULL, scene->camera); + if (scene->camera != nullptr) { + build_object(nullptr, scene->camera); } /* Rigidbody. */ - if (scene->rigidbody_world != NULL) { + if (scene->rigidbody_world != nullptr) { build_rigidbody(scene); } /* Scene's animation and drivers. */ - if (scene->adt != NULL) { + if (scene->adt != nullptr) { build_animdata(&scene->id); } /* World. */ - if (scene->world != NULL) { + if (scene->world != nullptr) { build_world(scene->world); } /* Masks. */ @@ -128,7 +128,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, build_movieclip(clip); } /* Material override. */ - if (view_layer->mat_override != NULL) { + if (view_layer->mat_override != nullptr) { build_material(view_layer->mat_override); } /* Freestyle linesets. */ @@ -149,7 +149,7 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, build_scene_sequencer(scene); } /* Build all set scenes. */ - if (scene->set != NULL) { + if (scene->set != nullptr) { ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set); build_view_layer(scene->set, set_view_layer, DEG_ID_LINKED_VIA_SET); } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index d092240e665..853f8995d68 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -57,14 +57,14 @@ namespace DEG { class RNANodeQueryIDData { public: - explicit RNANodeQueryIDData(const ID *id) : id_(id), contraint_to_pchan_map_(NULL) + explicit RNANodeQueryIDData(const ID *id) : id_(id), contraint_to_pchan_map_(nullptr) { } ~RNANodeQueryIDData() { - if (contraint_to_pchan_map_ != NULL) { - BLI_ghash_free(contraint_to_pchan_map_, NULL, NULL); + if (contraint_to_pchan_map_ != nullptr) { + BLI_ghash_free(contraint_to_pchan_map_, nullptr, nullptr); } } @@ -76,13 +76,13 @@ class RNANodeQueryIDData { void ensure_constraint_to_pchan_map() { - if (contraint_to_pchan_map_ != NULL) { + if (contraint_to_pchan_map_ != nullptr) { return; } BLI_assert(GS(id_->name) == ID_OB); const Object *object = reinterpret_cast<const Object *>(id_); contraint_to_pchan_map_ = BLI_ghash_ptr_new("id data pchan constraint map"); - if (object->pose != NULL) { + if (object->pose != nullptr) { LISTBASE_FOREACH (const bPoseChannel *, pchan, &object->pose->chanbase) { LISTBASE_FOREACH (const bConstraint *, constraint, &pchan->constraints) { BLI_ghash_insert(contraint_to_pchan_map_, @@ -105,7 +105,7 @@ class RNANodeQueryIDData { /* ***************************** Node Identifier **************************** */ RNANodeIdentifier::RNANodeIdentifier() - : id(NULL), + : id(nullptr), type(NodeType::UNDEFINED), component_name(""), operation_code(OperationCode::OPERATION), @@ -116,7 +116,7 @@ RNANodeIdentifier::RNANodeIdentifier() bool RNANodeIdentifier::is_valid() const { - return id != NULL && type != NodeType::UNDEFINED; + return id != nullptr && type != NodeType::UNDEFINED; } /* ********************************** Query ********************************* */ @@ -140,7 +140,7 @@ RNANodeQuery::RNANodeQuery(Depsgraph *depsgraph, DepsgraphBuilder *builder) RNANodeQuery::~RNANodeQuery() { - BLI_ghash_free(id_data_map_, NULL, ghash_id_data_free_func); + BLI_ghash_free(id_data_map_, nullptr, ghash_id_data_free_func); } Node *RNANodeQuery::find_node(const PointerRNA *ptr, @@ -149,16 +149,16 @@ Node *RNANodeQuery::find_node(const PointerRNA *ptr, { const RNANodeIdentifier node_identifier = construct_node_identifier(ptr, prop, source); if (!node_identifier.is_valid()) { - return NULL; + return nullptr; } IDNode *id_node = depsgraph_->find_id_node(node_identifier.id); - if (id_node == NULL) { - return NULL; + if (id_node == nullptr) { + return nullptr; } ComponentNode *comp_node = id_node->find_component(node_identifier.type, node_identifier.component_name); - if (comp_node == NULL) { - return NULL; + if (comp_node == nullptr) { + return nullptr; } if (node_identifier.operation_code == OperationCode::OPERATION) { return comp_node; @@ -173,7 +173,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, RNAPointerSource source) { RNANodeIdentifier node_identifier; - if (ptr->type == NULL) { + if (ptr->type == nullptr) { return node_identifier; } /* Set default values for returns. */ @@ -183,7 +183,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, node_identifier.operation_name = ""; node_identifier.operation_name_tag = -1; /* Handling of commonly known scenarios. */ - if (prop != NULL && RNA_property_is_idprop(prop)) { + if (prop != nullptr && RNA_property_is_idprop(prop)) { node_identifier.type = NodeType::PARAMETERS; node_identifier.operation_code = OperationCode::ID_PROPERTY; node_identifier.operation_name = RNA_property_identifier( @@ -196,7 +196,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, node_identifier.type = NodeType::BONE; node_identifier.component_name = pchan->name; /* However check property name for special handling. */ - if (prop != NULL) { + if (prop != nullptr) { Object *object = reinterpret_cast<Object *>(node_identifier.id); const char *prop_name = RNA_property_identifier(prop); /* B-Bone properties should connect to the final operation. */ @@ -245,7 +245,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, * at a given constraint, but for rigging one might use constraint * influence to be used to drive some corrective shape keys or so. */ const bPoseChannel *pchan = id_data->get_pchan_for_constraint(constraint); - if (pchan == NULL) { + if (pchan == nullptr) { node_identifier.type = NodeType::TRANSFORM; node_identifier.operation_code = OperationCode::TRANSFORM_LOCAL; } @@ -260,10 +260,10 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, Object *object = reinterpret_cast<Object *>(ptr->owner_id); bConstraintTarget *tgt = (bConstraintTarget *)ptr->data; /* Check whether is object or bone constraint. */ - bPoseChannel *pchan = NULL; + bPoseChannel *pchan = nullptr; bConstraint *con = BKE_constraint_find_from_target(object, tgt, &pchan); - if (con != NULL) { - if (pchan != NULL) { + if (con != nullptr) { + if (pchan != nullptr) { node_identifier.type = NodeType::BONE; node_identifier.operation_code = OperationCode::BONE_LOCAL; node_identifier.component_name = pchan->name; @@ -299,7 +299,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, } else if (ptr->type == &RNA_Object) { /* Transforms props? */ - if (prop != NULL) { + if (prop != nullptr) { const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); /* TODO(sergey): How to optimize this? */ if (strstr(prop_identifier, "location") || strstr(prop_identifier, "rotation") || @@ -370,7 +370,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, node_identifier.type = NodeType::GEOMETRY; return node_identifier; } - if (prop != NULL) { + if (prop != nullptr) { /* All unknown data effectively falls under "parameter evaluation". */ node_identifier.type = NodeType::PARAMETERS; node_identifier.operation_code = OperationCode::PARAMETERS_EVAL; |