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/deg_builder_relations.cc | |
parent | 01a348274218103ecdbaddc699a97e86f0c4ce18 (diff) |
Cleanup: changed NULL to nullptr in depsgraph C++ code
No functional changes.
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 286 |
1 files changed, 143 insertions, 143 deletions
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); |