From 16732def37c5a66f3ea28dbe247b09cc6bca6677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 6 Nov 2020 17:49:09 +0100 Subject: Cleanup: Clang-Tidy modernize-use-nullptr Replace `NULL` with `nullptr` in C++ code. No functional changes. --- source/blender/ikplugin/intern/itasc_plugin.cpp | 70 ++++++++++++------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'source/blender/ikplugin') diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index fd671fabc1b..61f2153cf6c 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -101,13 +101,13 @@ struct IK_Target { IK_Target() { - bldepsgraph = NULL; - blscene = NULL; - target = NULL; - constraint = NULL; - blenderConstraint = NULL; - rootChannel = NULL; - owner = NULL; + bldepsgraph = nullptr; + blscene = nullptr; + target = nullptr; + constraint = nullptr; + blenderConstraint = nullptr; + rootChannel = nullptr; + owner = nullptr; controlType = 0; channel = 0; ee = 0; @@ -138,12 +138,12 @@ struct IK_Channel { IK_Channel() { - pchan = NULL; + pchan = nullptr; parent = -1; jointType = 0; ndof = 0; jointValid = 0; - owner = NULL; + owner = nullptr; jointValue[0] = 0.0; jointValue[1] = 0.0; jointValue[2] = 0.0; @@ -174,20 +174,20 @@ struct IK_Scene { IK_Scene() { - bldepsgraph = NULL; - blscene = NULL; - next = NULL; - channels = NULL; - armature = NULL; - cache = NULL; - scene = NULL; - base = NULL; - solver = NULL; + bldepsgraph = nullptr; + blscene = nullptr; + next = nullptr; + channels = nullptr; + armature = nullptr; + cache = nullptr; + scene = nullptr; + base = nullptr; + solver = nullptr; blScale = blInvScale = 1.0f; - blArmature = NULL; + blArmature = nullptr; numchan = 0; numjoint = 0; - polarConstraint = NULL; + polarConstraint = nullptr; } ~IK_Scene() @@ -228,7 +228,7 @@ enum IK_SegmentAxis { static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *con) { - bPoseChannel *curchan, *pchan_root = NULL, *chanlist[256], **oldchan; + bPoseChannel *curchan, *pchan_root = nullptr, *chanlist[256], **oldchan; PoseTree *tree; PoseTarget *target; bKinematicConstraint *data; @@ -290,7 +290,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co * and each channel can be part of at most one tree. */ tree = (PoseTree *)pchan_root->iktree.first; - if (tree == NULL) { + if (tree == nullptr) { /* make new tree */ tree = (PoseTree *)MEM_callocN(sizeof(PoseTree), "posetree"); @@ -398,7 +398,7 @@ static bool constraint_valid(bConstraint *con) } if (is_cartesian_constraint(con)) { /* cartesian space constraint */ - if (data->tar == NULL) { + if (data->tar == nullptr) { return false; } if (data->tar->type == OB_ARMATURE && data->subtarget[0] == 0) { @@ -1163,7 +1163,7 @@ static IK_Scene *convert_tree( float start[3]; if (tree->totchannel == 0) { - return NULL; + return nullptr; } ikscene = new IK_Scene; @@ -1196,7 +1196,7 @@ static IK_Scene *convert_tree( break; default: delete ikscene; - return NULL; + return nullptr; } ikscene->blArmature = ob; /* assume uniform scaling and take Y scale as general scale for the armature */ @@ -1438,10 +1438,10 @@ static IK_Scene *convert_tree( } if (!ret) { delete ikscene; - return NULL; + return nullptr; } /* for each target, we need to add an end effector in the armature */ - for (numtarget = 0, polarcon = NULL, ret = true, target = (PoseTarget *)tree->targets.first; + for (numtarget = 0, polarcon = nullptr, ret = true, target = (PoseTarget *)tree->targets.first; target; target = (PoseTarget *)target->next) { condata = (bKinematicConstraint *)target->con->data; @@ -1496,7 +1496,7 @@ static IK_Scene *convert_tree( } if (!ret) { delete ikscene; - return NULL; + return nullptr; } /* set the weight */ e_matrix &Wq = arm->getWq(); @@ -1638,7 +1638,7 @@ static IK_Scene *convert_tree( if (!ret || !scene->addCache(ikscene->cache) || !scene->addSolver(ikscene->solver) || !scene->initialize()) { delete ikscene; - ikscene = NULL; + ikscene = nullptr; } return ikscene; } @@ -1688,7 +1688,7 @@ static int init_scene(Object *ob) IK_Scene *scene; if (ob->pose->ikdata) { - for (scene = ((IK_Data *)ob->pose->ikdata)->first; scene != NULL; scene = scene->next) { + for (scene = ((IK_Data *)ob->pose->ikdata)->first; scene != nullptr; scene = scene->next) { if (fabs(scene->blScale - scale) > KDL::epsilon) { return 1; } @@ -1768,7 +1768,7 @@ static void execute_scene(struct Depsgraph *depsgraph, if (ikscene->cache && !reiterate && simulation) { iTaSC::CacheTS sts, cts; sts = cts = (iTaSC::CacheTS)std::round(timestamp * 1000.0); - if (ikscene->cache->getPreviousCacheItem(ikscene->armature, 0, &cts) == NULL || cts == 0) { + if (ikscene->cache->getPreviousCacheItem(ikscene->armature, 0, &cts) == nullptr || cts == 0) { /* the cache is empty before this time, reiterate */ if (ikparam->flag & ITASC_INITIAL_REITERATION) { reiterate = true; @@ -1887,7 +1887,7 @@ void itasc_initialize_tree(struct Depsgraph *depsgraph, bPoseChannel *pchan; int count = 0; - if (ob->pose->ikdata != NULL && !(ob->pose->flag & POSE_WAS_REBUILT)) { + if (ob->pose->ikdata != nullptr && !(ob->pose->flag & POSE_WAS_REBUILT)) { if (!init_scene(ob)) { return; } @@ -1950,7 +1950,7 @@ void itasc_clear_data(struct bPose *pose) delete scene; } MEM_freeN(ikdata); - pose->ikdata = NULL; + pose->ikdata = nullptr; } } @@ -1961,7 +1961,7 @@ void itasc_clear_cache(struct bPose *pose) for (IK_Scene *scene = ikdata->first; scene; scene = scene->next) { if (scene->cache) { /* clear all cache but leaving the timestamp 0 (=rest pose) */ - scene->cache->clearCacheFrom(NULL, 1); + scene->cache->clearCacheFrom(nullptr, 1); } } } @@ -2001,7 +2001,7 @@ void itasc_test_constraint(struct Object *ob, struct bConstraint *cons) struct bKinematicConstraint *data = (struct bKinematicConstraint *)cons->data; /* only for IK constraint */ - if (cons->type != CONSTRAINT_TYPE_KINEMATIC || data == NULL) { + if (cons->type != CONSTRAINT_TYPE_KINEMATIC || data == nullptr) { return; } -- cgit v1.2.3