diff options
author | Aaron Carlisle <Blendify> | 2021-12-25 19:11:05 +0300 |
---|---|---|
committer | Aaron Carlisle <carlisle.b3d@gmail.com> | 2021-12-25 19:12:08 +0300 |
commit | c5862da5ad990bd72a6f713c52f7d74416bce16a (patch) | |
tree | 055efaae74f4d48c44f9f08485343a2c599ad82e /source | |
parent | 9085b4a731fd5315eb97c00fc4bbf7c163698ebc (diff) |
Cleanup: use new c++ guarded allocator API in nodes
Also simplify the allocation name to `__func__`
Reviewed By: JacquesLucke
Differential Revision: https://developer.blender.org/D13665
Diffstat (limited to 'source')
59 files changed, 64 insertions, 91 deletions
diff --git a/source/blender/nodes/composite/node_composite_tree.cc b/source/blender/nodes/composite/node_composite_tree.cc index 96e6b699d8b..8de9b851c43 100644 --- a/source/blender/nodes/composite/node_composite_tree.cc +++ b/source/blender/nodes/composite/node_composite_tree.cc @@ -198,8 +198,7 @@ bNodeTreeType *ntreeType_Composite; void register_node_tree_type_cmp() { - bNodeTreeType *tt = ntreeType_Composite = (bNodeTreeType *)MEM_callocN( - sizeof(bNodeTreeType), "compositor node tree type"); + bNodeTreeType *tt = ntreeType_Composite = MEM_cnew<bNodeTreeType>(__func__); tt->type = NTREE_COMPOSIT; strcpy(tt->idname, "CompositorNodeTree"); diff --git a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc index 5e6d59edfd5..f02842b2c66 100644 --- a/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc +++ b/source/blender/nodes/composite/nodes/node_composite_alphaOver.cc @@ -42,7 +42,7 @@ static void cmp_node_alphaover_declare(NodeDeclarationBuilder &b) static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node) { - node->storage = MEM_callocN(sizeof(NodeTwoFloats), "NodeTwoFloats"); + node->storage = MEM_cnew<NodeTwoFloats>(__func__); } static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) diff --git a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc index 02b2652ed6a..55bfbadf5b2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc +++ b/source/blender/nodes/composite/nodes/node_composite_antialiasing.cc @@ -42,8 +42,7 @@ static void cmp_node_antialiasing_declare(NodeDeclarationBuilder &b) static void node_composit_init_antialiasing(bNodeTree *UNUSED(ntree), bNode *node) { - NodeAntiAliasingData *data = (NodeAntiAliasingData *)MEM_callocN(sizeof(NodeAntiAliasingData), - "node antialiasing data"); + NodeAntiAliasingData *data = MEM_cnew<NodeAntiAliasingData>(__func__); data->threshold = CMP_DEFAULT_SMAA_THRESHOLD; data->contrast_limit = CMP_DEFAULT_SMAA_CONTRAST_LIMIT; diff --git a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc index 3f107a13a44..9c133e1a00c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bilateralblur.cc @@ -41,8 +41,7 @@ static void cmp_node_bilateralblur_declare(NodeDeclarationBuilder &b) static void node_composit_init_bilateralblur(bNodeTree *UNUSED(ntree), bNode *node) { - NodeBilateralBlurData *nbbd = (NodeBilateralBlurData *)MEM_callocN(sizeof(NodeBilateralBlurData), - "node bilateral blur data"); + NodeBilateralBlurData *nbbd = MEM_cnew<NodeBilateralBlurData>(__func__); node->storage = nbbd; nbbd->iter = 1; nbbd->sigma_color = 0.3; diff --git a/source/blender/nodes/composite/nodes/node_composite_blur.cc b/source/blender/nodes/composite/nodes/node_composite_blur.cc index bcc8c786ae5..16eac697da1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_blur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_blur.cc @@ -44,7 +44,7 @@ static void cmp_node_blur_declare(NodeDeclarationBuilder &b) static void node_composit_init_blur(bNodeTree *UNUSED(ntree), bNode *node) { - NodeBlurData *data = (NodeBlurData *)MEM_callocN(sizeof(NodeBlurData), "node blur data"); + NodeBlurData *data = MEM_cnew<NodeBlurData>(__func__); data->filtertype = R_FILTER_GAUSS; node->storage = data; } diff --git a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc index 8817a07a422..43ce6d485c5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc +++ b/source/blender/nodes/composite/nodes/node_composite_bokehimage.cc @@ -39,7 +39,7 @@ static void cmp_node_bokehimage_declare(NodeDeclarationBuilder &b) static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node) { - NodeBokehImage *data = (NodeBokehImage *)MEM_callocN(sizeof(NodeBokehImage), "NodeBokehImage"); + NodeBokehImage *data = MEM_cnew<NodeBokehImage>(__func__); data->angle = 0.0f; data->flaps = 5; data->rounding = 0.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc index 40859922154..a42242809eb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_boxmask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_boxmask.cc @@ -41,7 +41,7 @@ static void cmp_node_boxmask_declare(NodeDeclarationBuilder &b) static void node_composit_init_boxmask(bNodeTree *UNUSED(ntree), bNode *node) { - NodeBoxMask *data = (NodeBoxMask *)MEM_callocN(sizeof(NodeBoxMask), "NodeBoxMask"); + NodeBoxMask *data = MEM_cnew<NodeBoxMask>(__func__); data->x = 0.5; data->y = 0.5; data->width = 0.2; diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc index 1b4be78c71b..a0d673a327d 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.cc @@ -43,7 +43,7 @@ static void cmp_node_channel_matte_declare(NodeDeclarationBuilder &b) static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + NodeChroma *c = MEM_cnew<NodeChroma>(__func__); node->storage = c; c->t1 = 1.0f; c->t2 = 0.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc index a7e3a1c148f..c85580b40c0 100644 --- a/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_chromaMatte.cc @@ -42,7 +42,7 @@ static void cmp_node_chroma_matte_declare(NodeDeclarationBuilder &b) static void node_composit_init_chroma_matte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + NodeChroma *c = MEM_cnew<NodeChroma>(__func__); node->storage = c; c->t1 = DEG2RADF(30.0f); c->t2 = DEG2RADF(10.0f); diff --git a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc index 367b046f3f6..181d2741477 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorMatte.cc @@ -42,7 +42,7 @@ static void cmp_node_color_matte_declare(NodeDeclarationBuilder &b) static void node_composit_init_color_matte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node color"); + NodeChroma *c = MEM_cnew<NodeChroma>(__func__); node->storage = c; c->t1 = 0.01f; c->t2 = 0.1f; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc index e136041cf6e..da11dbd4474 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorSpill.cc @@ -43,7 +43,7 @@ static void cmp_node_color_spill_declare(NodeDeclarationBuilder &b) static void node_composit_init_color_spill(bNodeTree *UNUSED(ntree), bNode *node) { - NodeColorspill *ncs = (NodeColorspill *)MEM_callocN(sizeof(NodeColorspill), "node colorspill"); + NodeColorspill *ncs = MEM_cnew<NodeColorspill>(__func__); node->storage = ncs; node->custom1 = 2; /* green channel */ node->custom2 = 0; /* simple limit algorithm */ diff --git a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc index a35b3d813e6..9d385a49f2e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorbalance.cc @@ -71,8 +71,7 @@ void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *UNUSED(ntree), bNode *node) static void node_composit_init_colorbalance(bNodeTree *UNUSED(ntree), bNode *node) { - NodeColorBalance *n = (NodeColorBalance *)MEM_callocN(sizeof(NodeColorBalance), - "node colorbalance"); + NodeColorBalance *n = MEM_cnew<NodeColorBalance>(__func__); n->lift[0] = n->lift[1] = n->lift[2] = 1.0f; n->gamma[0] = n->gamma[1] = n->gamma[2] = 1.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc index e3bba3b6c4f..49680e4e4cf 100644 --- a/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc +++ b/source/blender/nodes/composite/nodes/node_composite_colorcorrection.cc @@ -41,8 +41,7 @@ static void cmp_node_colorcorrection_declare(NodeDeclarationBuilder &b) static void node_composit_init_colorcorrection(bNodeTree *UNUSED(ntree), bNode *node) { - NodeColorCorrection *n = (NodeColorCorrection *)MEM_callocN(sizeof(NodeColorCorrection), - "node colorcorrection"); + NodeColorCorrection *n = MEM_cnew<NodeColorCorrection>(__func__); n->startmidtones = 0.2f; n->endmidtones = 0.7f; n->master.contrast = 1.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_crop.cc b/source/blender/nodes/composite/nodes/node_composite_crop.cc index fa33caa4c0e..5b1641ce8d6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_crop.cc +++ b/source/blender/nodes/composite/nodes/node_composite_crop.cc @@ -42,7 +42,7 @@ static void cmp_node_crop_declare(NodeDeclarationBuilder &b) static void node_composit_init_crop(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTwoXYs *nxy = (NodeTwoXYs *)MEM_callocN(sizeof(NodeTwoXYs), "node xy data"); + NodeTwoXYs *nxy = MEM_cnew<NodeTwoXYs>(__func__); node->storage = nxy; nxy->x1 = 0; nxy->x2 = 0; diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index 65b1f6799d7..8e05f7fb131 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -136,8 +136,7 @@ static void cryptomatte_add(const Scene &scene, return; } - CryptomatteEntry *entry = static_cast<CryptomatteEntry *>( - MEM_callocN(sizeof(CryptomatteEntry), __func__)); + CryptomatteEntry *entry = MEM_cnew<CryptomatteEntry>(__func__); entry->encoded_hash = encoded_hash; blender::bke::cryptomatte::CryptomatteSessionPtr session = cryptomatte_init_from_node( scene, node, true); @@ -199,8 +198,7 @@ void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node) if (session) { for (blender::StringRef layer_name : blender::bke::cryptomatte::BKE_cryptomatte_layer_names_get(*session)) { - CryptomatteLayer *layer = static_cast<CryptomatteLayer *>( - MEM_callocN(sizeof(CryptomatteLayer), __func__)); + CryptomatteLayer *layer = MEM_cnew<CryptomatteLayer>(__func__); layer_name.copy(layer->name); BLI_addtail(&n->runtime.layers, layer); } @@ -245,8 +243,7 @@ CryptomatteSession *ntreeCompositCryptomatteSession(const Scene *scene, bNode *n static void node_init_cryptomatte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeCryptomatte *user = static_cast<NodeCryptomatte *>( - MEM_callocN(sizeof(NodeCryptomatte), __func__)); + NodeCryptomatte *user = MEM_cnew<NodeCryptomatte>(__func__); node->storage = user; } diff --git a/source/blender/nodes/composite/nodes/node_composite_defocus.cc b/source/blender/nodes/composite/nodes/node_composite_defocus.cc index 0ee8a8da1e8..a9b4ac066e5 100644 --- a/source/blender/nodes/composite/nodes/node_composite_defocus.cc +++ b/source/blender/nodes/composite/nodes/node_composite_defocus.cc @@ -46,7 +46,7 @@ static void cmp_node_defocus_declare(NodeDeclarationBuilder &b) static void node_composit_init_defocus(bNodeTree *UNUSED(ntree), bNode *node) { /* defocus node */ - NodeDefocus *nbd = (NodeDefocus *)MEM_callocN(sizeof(NodeDefocus), "node defocus data"); + NodeDefocus *nbd = MEM_cnew<NodeDefocus>(__func__); nbd->bktype = 0; nbd->rotation = 0.0f; nbd->preview = 1; diff --git a/source/blender/nodes/composite/nodes/node_composite_denoise.cc b/source/blender/nodes/composite/nodes/node_composite_denoise.cc index 17bad211dec..06049d01431 100644 --- a/source/blender/nodes/composite/nodes/node_composite_denoise.cc +++ b/source/blender/nodes/composite/nodes/node_composite_denoise.cc @@ -48,7 +48,7 @@ static void cmp_node_denoise_declare(NodeDeclarationBuilder &b) static void node_composit_init_denonise(bNodeTree *UNUSED(ntree), bNode *node) { - NodeDenoise *ndg = (NodeDenoise *)MEM_callocN(sizeof(NodeDenoise), "node denoise data"); + NodeDenoise *ndg = MEM_cnew<NodeDenoise>(__func__); ndg->hdr = true; ndg->prefilter = CMP_NODE_DENOISE_PREFILTER_ACCURATE; node->storage = ndg; diff --git a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc index a9e3258c8fb..2987e7dc82c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_diffMatte.cc @@ -42,7 +42,7 @@ static void cmp_node_diff_matte_declare(NodeDeclarationBuilder &b) static void node_composit_init_diff_matte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + NodeChroma *c = MEM_cnew<NodeChroma>(__func__); node->storage = c; c->t1 = 0.1f; c->t2 = 0.1f; diff --git a/source/blender/nodes/composite/nodes/node_composite_dilate.cc b/source/blender/nodes/composite/nodes/node_composite_dilate.cc index 1af2bb0433b..1e7d92b3abb 100644 --- a/source/blender/nodes/composite/nodes/node_composite_dilate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_dilate.cc @@ -42,8 +42,7 @@ static void cmp_node_dilate_declare(NodeDeclarationBuilder &b) static void node_composit_init_dilateerode(bNodeTree *UNUSED(ntree), bNode *node) { - NodeDilateErode *data = (NodeDilateErode *)MEM_callocN(sizeof(NodeDilateErode), - "NodeDilateErode"); + NodeDilateErode *data = MEM_cnew<NodeDilateErode>(__func__); data->falloff = PROP_SMOOTH; node->storage = data; } diff --git a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc index 36b130d55a4..4a1a7019b1e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_directionalblur.cc @@ -38,7 +38,7 @@ static void cmp_node_directional_blur_declare(NodeDeclarationBuilder &b) static void node_composit_init_dblur(bNodeTree *UNUSED(ntree), bNode *node) { - NodeDBlurData *ndbd = (NodeDBlurData *)MEM_callocN(sizeof(NodeDBlurData), "node dblur data"); + NodeDBlurData *ndbd = MEM_cnew<NodeDBlurData>(__func__); node->storage = ndbd; ndbd->iter = 1; ndbd->center_x = 0.5; diff --git a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc index 47a48ed141e..ef2ab9617bd 100644 --- a/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_distanceMatte.cc @@ -42,7 +42,7 @@ static void cmp_node_distance_matte_declare(NodeDeclarationBuilder &b) static void node_composit_init_distance_matte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + NodeChroma *c = MEM_cnew<NodeChroma>(__func__); node->storage = c; c->channel = 1; c->t1 = 0.1f; diff --git a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc index 8eb89e53790..b08aa8e2326 100644 --- a/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_ellipsemask.cc @@ -41,8 +41,7 @@ static void cmp_node_ellipsemask_declare(NodeDeclarationBuilder &b) static void node_composit_init_ellipsemask(bNodeTree *UNUSED(ntree), bNode *node) { - NodeEllipseMask *data = (NodeEllipseMask *)MEM_callocN(sizeof(NodeEllipseMask), - "NodeEllipseMask"); + NodeEllipseMask *data = MEM_cnew<NodeEllipseMask>(__func__); data->x = 0.5; data->y = 0.5; data->width = 0.2; diff --git a/source/blender/nodes/composite/nodes/node_composite_glare.cc b/source/blender/nodes/composite/nodes/node_composite_glare.cc index adaf22395c3..7ec04b323b3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_glare.cc +++ b/source/blender/nodes/composite/nodes/node_composite_glare.cc @@ -40,7 +40,7 @@ static void cmp_node_glare_declare(NodeDeclarationBuilder &b) static void node_composit_init_glare(bNodeTree *UNUSED(ntree), bNode *node) { - NodeGlare *ndg = (NodeGlare *)MEM_callocN(sizeof(NodeGlare), "node glare data"); + NodeGlare *ndg = MEM_cnew<NodeGlare>(__func__); ndg->quality = 1; ndg->type = 2; ndg->iter = 3; diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 8e3cc9bcd95..8d81fe2c99b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -108,8 +108,7 @@ static void cmp_node_image_add_pass_output(bNodeTree *ntree, sock = nodeAddStaticSocket(ntree, node, SOCK_OUT, type, PROP_NONE, name, name); } /* extra socket info */ - NodeImageLayer *sockdata = (NodeImageLayer *)MEM_callocN(sizeof(NodeImageLayer), - "node image layer"); + NodeImageLayer *sockdata = MEM_cnew<NodeImageLayer>(__func__); sock->storage = sockdata; } @@ -412,7 +411,7 @@ static void cmp_node_image_update(bNodeTree *ntree, bNode *node) static void node_composit_init_image(bNodeTree *ntree, bNode *node) { - ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user"); + ImageUser *iuser = MEM_cnew<ImageUser>(__func__); node->storage = iuser; iuser->frames = 1; iuser->sfra = 1; @@ -489,8 +488,7 @@ static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr) for (bNodeSocket *sock = (bNodeSocket *)node->outputs.first; sock; sock = sock->next, sock_index++) { - NodeImageLayer *sockdata = (NodeImageLayer *)MEM_callocN(sizeof(NodeImageLayer), - "node image layer"); + NodeImageLayer *sockdata = MEM_cnew<NodeImageLayer>(__func__); sock->storage = sockdata; BLI_strncpy(sockdata->pass_name, diff --git a/source/blender/nodes/composite/nodes/node_composite_keying.cc b/source/blender/nodes/composite/nodes/node_composite_keying.cc index de1da3289f9..e9daa84491a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keying.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keying.cc @@ -51,7 +51,7 @@ static void cmp_node_keying_declare(NodeDeclarationBuilder &b) static void node_composit_init_keying(bNodeTree *UNUSED(ntree), bNode *node) { - NodeKeyingData *data = (NodeKeyingData *)MEM_callocN(sizeof(NodeKeyingData), "node keying data"); + NodeKeyingData *data = MEM_cnew<NodeKeyingData>(__func__); data->screen_balance = 0.5f; data->despill_balance = 0.5f; diff --git a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc index d90fbe05211..31c505f3c0b 100644 --- a/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc +++ b/source/blender/nodes/composite/nodes/node_composite_keyingscreen.cc @@ -46,8 +46,7 @@ static void cmp_node_keyingscreen_declare(NodeDeclarationBuilder &b) static void node_composit_init_keyingscreen(bNodeTree *UNUSED(ntree), bNode *node) { - NodeKeyingScreenData *data = (NodeKeyingScreenData *)MEM_callocN(sizeof(NodeKeyingScreenData), - "node keyingscreen data"); + NodeKeyingScreenData *data = MEM_cnew<NodeKeyingScreenData>(__func__); node->storage = data; } diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index 11ee0cf0aa3..ce8f9e8fa2e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -42,7 +42,7 @@ static void cmp_node_lensdist_declare(NodeDeclarationBuilder &b) static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) { - NodeLensDist *nld = (NodeLensDist *)MEM_callocN(sizeof(NodeLensDist), "node lensdist data"); + NodeLensDist *nld = MEM_cnew<NodeLensDist>(__func__); nld->jit = nld->proj = nld->fit = 0; node->storage = nld; } diff --git a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc index f5193bd5df2..68758b08988 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lummaMatte.cc @@ -41,7 +41,7 @@ static void cmp_node_luma_matte_declare(NodeDeclarationBuilder &b) static void node_composit_init_luma_matte(bNodeTree *UNUSED(ntree), bNode *node) { - NodeChroma *c = (NodeChroma *)MEM_callocN(sizeof(NodeChroma), "node chroma"); + NodeChroma *c = MEM_cnew<NodeChroma>(__func__); node->storage = c; c->t1 = 1.0f; c->t2 = 0.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc index 8cbf526a289..b9e95af2532 100644 --- a/source/blender/nodes/composite/nodes/node_composite_mask.cc +++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc @@ -41,7 +41,7 @@ static void cmp_node_mask_declare(NodeDeclarationBuilder &b) static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node) { - NodeMask *data = (NodeMask *)MEM_callocN(sizeof(NodeMask), "NodeMask"); + NodeMask *data = MEM_cnew<NodeMask>(__func__); data->size_x = data->size_y = 256; node->storage = data; diff --git a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc index 47a2c89a2f9..09c4c705149 100644 --- a/source/blender/nodes/composite/nodes/node_composite_movieclip.cc +++ b/source/blender/nodes/composite/nodes/node_composite_movieclip.cc @@ -49,8 +49,7 @@ static void init(const bContext *C, PointerRNA *ptr) { bNode *node = (bNode *)ptr->data; Scene *scene = CTX_data_scene(C); - MovieClipUser *user = (MovieClipUser *)MEM_callocN(sizeof(MovieClipUser), - "node movie clip user"); + MovieClipUser *user = MEM_cnew<MovieClipUser>(__func__); node->id = (ID *)scene->clip; id_us_plus(node->id); diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc index 79074375a23..9bc30d7fd73 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.cc +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.cc @@ -135,8 +135,7 @@ bNodeSocket *ntreeCompositOutputFileAddSocket(bNodeTree *ntree, ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, nullptr, name); /* create format data for the input socket */ - NodeImageMultiFileSocket *sockdata = (NodeImageMultiFileSocket *)MEM_callocN( - sizeof(NodeImageMultiFileSocket), "socket image format"); + NodeImageMultiFileSocket *sockdata = MEM_cnew<NodeImageMultiFileSocket>(__func__); sock->storage = sockdata; BLI_strncpy_utf8(sockdata->path, name, sizeof(sockdata->path)); @@ -203,8 +202,7 @@ static void init_output_file(const bContext *C, PointerRNA *ptr) Scene *scene = CTX_data_scene(C); bNodeTree *ntree = (bNodeTree *)ptr->owner_id; bNode *node = (bNode *)ptr->data; - NodeImageMultiFile *nimf = (NodeImageMultiFile *)MEM_callocN(sizeof(NodeImageMultiFile), - "node image multi file"); + NodeImageMultiFile *nimf = MEM_cnew<NodeImageMultiFile>(__func__); ImageFormatData *format = nullptr; node->storage = nimf; diff --git a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc index d9d362f5175..9b15581a017 100644 --- a/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc +++ b/source/blender/nodes/composite/nodes/node_composite_planetrackdeform.cc @@ -41,8 +41,7 @@ static void cmp_node_planetrackdeform_declare(NodeDeclarationBuilder &b) static void init(bNodeTree *UNUSED(ntree), bNode *node) { - NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)MEM_callocN( - sizeof(NodePlaneTrackDeformData), "node plane track deform data"); + NodePlaneTrackDeformData *data = MEM_cnew<NodePlaneTrackDeformData>(__func__); data->motion_blur_samples = 16; data->motion_blur_shutter = 0.5f; node->storage = data; diff --git a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc index 3e66f884efd..be47ed7df7e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_setalpha.cc +++ b/source/blender/nodes/composite/nodes/node_composite_setalpha.cc @@ -41,7 +41,7 @@ static void cmp_node_setalpha_declare(NodeDeclarationBuilder &b) static void node_composit_init_setalpha(bNodeTree *UNUSED(ntree), bNode *node) { - NodeSetAlpha *settings = (NodeSetAlpha *)MEM_callocN(sizeof(NodeSetAlpha), __func__); + NodeSetAlpha *settings = MEM_cnew<NodeSetAlpha>(__func__); node->storage = settings; settings->mode = CMP_NODE_SETALPHA_MODE_APPLY; } diff --git a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc index 63772a52840..0a449d95576 100644 --- a/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_splitViewer.cc @@ -43,7 +43,7 @@ static void cmp_node_split_viewer_declare(NodeDeclarationBuilder &b) static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node) { - ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user"); + ImageUser *iuser = MEM_cnew<ImageUser>(__func__); node->storage = iuser; iuser->sfra = 1; node->custom1 = 50; /* default 50% split */ diff --git a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc index f5d69c7d17b..462cc4b9961 100644 --- a/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc +++ b/source/blender/nodes/composite/nodes/node_composite_sunbeams.cc @@ -38,7 +38,7 @@ static void cmp_node_sunbeams_declare(NodeDeclarationBuilder &b) static void init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeSunBeams *data = (NodeSunBeams *)MEM_callocN(sizeof(NodeSunBeams), "sun beams node"); + NodeSunBeams *data = MEM_cnew<NodeSunBeams>(__func__); data->source[0] = 0.5f; data->source[1] = 0.5f; diff --git a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc index c6015eda08c..9497f4486a6 100644 --- a/source/blender/nodes/composite/nodes/node_composite_tonemap.cc +++ b/source/blender/nodes/composite/nodes/node_composite_tonemap.cc @@ -40,7 +40,7 @@ static void cmp_node_tonemap_declare(NodeDeclarationBuilder &b) static void node_composit_init_tonemap(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTonemap *ntm = (NodeTonemap *)MEM_callocN(sizeof(NodeTonemap), "node tonemap data"); + NodeTonemap *ntm = MEM_cnew<NodeTonemap>(__func__); ntm->type = 1; ntm->key = 0.18; ntm->offset = 1; diff --git a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc index 3be52820f15..dde03e3a484 100644 --- a/source/blender/nodes/composite/nodes/node_composite_trackpos.cc +++ b/source/blender/nodes/composite/nodes/node_composite_trackpos.cc @@ -41,8 +41,7 @@ static void cmp_node_trackpos_declare(NodeDeclarationBuilder &b) static void init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTrackPosData *data = (NodeTrackPosData *)MEM_callocN(sizeof(NodeTrackPosData), - "node track position data"); + NodeTrackPosData *data = MEM_cnew<NodeTrackPosData>(__func__); node->storage = data; } diff --git a/source/blender/nodes/composite/nodes/node_composite_translate.cc b/source/blender/nodes/composite/nodes/node_composite_translate.cc index ce29cc55ca2..df688b45f6c 100644 --- a/source/blender/nodes/composite/nodes/node_composite_translate.cc +++ b/source/blender/nodes/composite/nodes/node_composite_translate.cc @@ -42,8 +42,7 @@ static void cmp_node_translate_declare(NodeDeclarationBuilder &b) static void node_composit_init_translate(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTranslateData *data = (NodeTranslateData *)MEM_callocN(sizeof(NodeTranslateData), - "node translate data"); + NodeTranslateData *data = MEM_cnew<NodeTranslateData>(__func__); node->storage = data; } diff --git a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc index c4bea269670..9c9bb05a084 100644 --- a/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc +++ b/source/blender/nodes/composite/nodes/node_composite_vecBlur.cc @@ -46,7 +46,7 @@ static void cmp_node_vec_blur_declare(NodeDeclarationBuilder &b) static void node_composit_init_vecblur(bNodeTree *UNUSED(ntree), bNode *node) { - NodeBlurData *nbd = (NodeBlurData *)MEM_callocN(sizeof(NodeBlurData), "node blur data"); + NodeBlurData *nbd = MEM_cnew<NodeBlurData>(__func__); node->storage = nbd; nbd->samples = 32; nbd->fac = 1.0f; diff --git a/source/blender/nodes/composite/nodes/node_composite_viewer.cc b/source/blender/nodes/composite/nodes/node_composite_viewer.cc index fcebda3b8a4..6cc6f822279 100644 --- a/source/blender/nodes/composite/nodes/node_composite_viewer.cc +++ b/source/blender/nodes/composite/nodes/node_composite_viewer.cc @@ -46,7 +46,7 @@ static void cmp_node_viewer_declare(NodeDeclarationBuilder &b) static void node_composit_init_viewer(bNodeTree *UNUSED(ntree), bNode *node) { - ImageUser *iuser = (ImageUser *)MEM_callocN(sizeof(ImageUser), "node image user"); + ImageUser *iuser = MEM_cnew<ImageUser>(__func__); node->storage = iuser; iuser->sfra = 1; node->custom3 = 0.5f; diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc index e773563ca5f..e1c15ac2be1 100644 --- a/source/blender/nodes/function/nodes/node_fn_compare.cc +++ b/source/blender/nodes/function/nodes/node_fn_compare.cc @@ -97,8 +97,7 @@ static void node_compare_update(bNodeTree *ntree, bNode *node) static void node_compare_init(bNodeTree *UNUSED(tree), bNode *node) { - NodeFunctionCompare *data = (NodeFunctionCompare *)MEM_callocN(sizeof(NodeFunctionCompare), - __func__); + NodeFunctionCompare *data = MEM_cnew<NodeFunctionCompare>(__func__); data->operation = NODE_COMPARE_GREATER_THAN; data->data_type = SOCK_FLOAT; data->mode = NODE_COMPARE_MODE_ELEMENT; diff --git a/source/blender/nodes/function/nodes/node_fn_input_bool.cc b/source/blender/nodes/function/nodes/node_fn_input_bool.cc index 1358bf8a223..5623a6df357 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_bool.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_bool.cc @@ -43,7 +43,7 @@ static void fn_node_input_bool_build_multi_function(NodeMultiFunctionBuilder &bu static void fn_node_input_bool_init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeInputBool *data = (NodeInputBool *)MEM_callocN(sizeof(NodeInputBool), __func__); + NodeInputBool *data = MEM_cnew<NodeInputBool>(__func__); node->storage = data; } diff --git a/source/blender/nodes/function/nodes/node_fn_input_color.cc b/source/blender/nodes/function/nodes/node_fn_input_color.cc index 43bb654b776..cb8d95fc63a 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_color.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_color.cc @@ -43,7 +43,7 @@ static void fn_node_input_color_build_multi_function( static void fn_node_input_color_init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeInputColor *data = (NodeInputColor *)MEM_callocN(sizeof(NodeInputColor), __func__); + NodeInputColor *data = MEM_cnew<NodeInputColor>(__func__); copy_v4_fl4(data->color, 0.5f, 0.5f, 0.5f, 1.0f); node->storage = data; } diff --git a/source/blender/nodes/function/nodes/node_fn_input_int.cc b/source/blender/nodes/function/nodes/node_fn_input_int.cc index ddbb86e2661..b82dc06395d 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_int.cc @@ -43,7 +43,7 @@ static void fn_node_input_int_build_multi_function(NodeMultiFunctionBuilder &bui static void fn_node_input_int_init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeInputInt *data = (NodeInputInt *)MEM_callocN(sizeof(NodeInputInt), __func__); + NodeInputInt *data = MEM_cnew<NodeInputInt>(__func__); node->storage = data; } diff --git a/source/blender/nodes/function/nodes/node_fn_input_vector.cc b/source/blender/nodes/function/nodes/node_fn_input_vector.cc index 1e5fd186b5a..352e834ee5b 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_vector.cc @@ -44,8 +44,7 @@ static void fn_node_input_vector_build_multi_function(NodeMultiFunctionBuilder & static void fn_node_input_vector_init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeInputVector *data = (NodeInputVector *)MEM_callocN(sizeof(NodeInputVector), - "input vector node"); + NodeInputVector *data = MEM_cnew<NodeInputVector>(__func__); node->storage = data; } diff --git a/source/blender/nodes/function/nodes/node_fn_random_value.cc b/source/blender/nodes/function/nodes/node_fn_random_value.cc index b053482c99d..24814047dda 100644 --- a/source/blender/nodes/function/nodes/node_fn_random_value.cc +++ b/source/blender/nodes/function/nodes/node_fn_random_value.cc @@ -63,7 +63,7 @@ static void fn_node_random_value_layout(uiLayout *layout, bContext *UNUSED(C), P static void fn_node_random_value_init(bNodeTree *UNUSED(tree), bNode *node) { - NodeRandomValue *data = (NodeRandomValue *)MEM_callocN(sizeof(NodeRandomValue), __func__); + NodeRandomValue *data = MEM_cnew<NodeRandomValue>(__func__); data->data_type = CD_PROP_FLOAT; node->storage = data; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc index 6b8c895879d..42f4a6cb9aa 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_collection_info.cc @@ -51,8 +51,7 @@ static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) static void node_node_init(bNodeTree *UNUSED(tree), bNode *node) { - NodeGeometryCollectionInfo *data = (NodeGeometryCollectionInfo *)MEM_callocN( - sizeof(NodeGeometryCollectionInfo), __func__); + NodeGeometryCollectionInfo *data = MEM_cnew<NodeGeometryCollectionInfo>(__func__); data->transform_space = GEO_NODE_TRANSFORM_SPACE_ORIGINAL; node->storage = data; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc index 4cb99ae4e0d..35737f74499 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc @@ -55,8 +55,7 @@ static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) static void node_type_init(bNodeTree *UNUSED(tree), bNode *node) { - NodeGeometryCurveSample *data = (NodeGeometryCurveSample *)MEM_callocN( - sizeof(NodeGeometryCurveSample), __func__); + NodeGeometryCurveSample *data = MEM_cnew<NodeGeometryCurveSample>(__func__); data->mode = GEO_NODE_CURVE_SAMPLE_LENGTH; node->storage = data; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc index 38c3b9cbcd9..aeef6730b47 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_object_info.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_object_info.cc @@ -102,8 +102,7 @@ static void node_geo_exec(GeoNodeExecParams params) static void node_node_init(bNodeTree *UNUSED(tree), bNode *node) { - NodeGeometryObjectInfo *data = (NodeGeometryObjectInfo *)MEM_callocN( - sizeof(NodeGeometryObjectInfo), __func__); + NodeGeometryObjectInfo *data = MEM_cnew<NodeGeometryObjectInfo>(__func__); data->transform_space = GEO_NODE_TRANSFORM_SPACE_ORIGINAL; node->storage = data; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc index aa3383e68be..45086918ef4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc @@ -48,8 +48,7 @@ static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) static void geo_proximity_init(bNodeTree *UNUSED(ntree), bNode *node) { - NodeGeometryProximity *node_storage = (NodeGeometryProximity *)MEM_callocN( - sizeof(NodeGeometryProximity), __func__); + NodeGeometryProximity *node_storage = MEM_cnew<NodeGeometryProximity>(__func__); node_storage->target_element = GEO_NODE_PROX_TARGET_FACES; node->storage = node_storage; } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc index 7925c96db3d..0f859af1b93 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -61,7 +61,7 @@ static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexBrick *tex = (NodeTexBrick *)MEM_callocN(sizeof(NodeTexBrick), "NodeTexBrick"); + NodeTexBrick *tex = MEM_cnew<NodeTexBrick>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc index 6d2d199aec8..a4249efcff0 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -40,7 +40,7 @@ static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexChecker *tex = (NodeTexChecker *)MEM_callocN(sizeof(NodeTexChecker), "NodeTexChecker"); + NodeTexChecker *tex = MEM_cnew<NodeTexChecker>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc index 48199968547..df4dffac5d5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -33,8 +33,7 @@ static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexGradient *tex = (NodeTexGradient *)MEM_callocN(sizeof(NodeTexGradient), - "NodeTexGradient"); + NodeTexGradient *tex = MEM_cnew<NodeTexGradient>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); tex->gradient_type = SHD_BLEND_LINEAR; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc index d139707c6d7..281cf020270 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc @@ -33,7 +33,7 @@ static void sh_node_tex_image_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexImage *tex = (NodeTexImage *)MEM_callocN(sizeof(NodeTexImage), "NodeTexImage"); + NodeTexImage *tex = MEM_cnew<NodeTexImage>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); BKE_imageuser_default(&tex->iuser); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc index 9bd5c335cee..b89a07425c4 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -35,7 +35,7 @@ static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexMagic *tex = (NodeTexMagic *)MEM_callocN(sizeof(NodeTexMagic), "NodeTexMagic"); + NodeTexMagic *tex = MEM_cnew<NodeTexMagic>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); tex->depth = 2; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc index 97ac199bc03..314428a139b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -46,8 +46,7 @@ static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexMusgrave *tex = (NodeTexMusgrave *)MEM_callocN(sizeof(NodeTexMusgrave), - "NodeTexMusgrave"); + NodeTexMusgrave *tex = MEM_cnew<NodeTexMusgrave>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); tex->musgrave_type = SHD_MUSGRAVE_FBM; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc index d7f21853a01..d2572e09d3c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -49,7 +49,7 @@ static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexNoise *tex = (NodeTexNoise *)MEM_callocN(sizeof(NodeTexNoise), "NodeTexNoise"); + NodeTexNoise *tex = MEM_cnew<NodeTexNoise>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); tex->dimensions = 3; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc index 8a1170de304..a4d60628726 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -66,7 +66,7 @@ static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexVoronoi *tex = (NodeTexVoronoi *)MEM_callocN(sizeof(NodeTexVoronoi), "NodeTexVoronoi"); + NodeTexVoronoi *tex = MEM_cnew<NodeTexVoronoi>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); tex->dimensions = 3; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc index d3e25b533e5..bd5264d4916 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -45,7 +45,7 @@ static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b) static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node) { - NodeTexWave *tex = (NodeTexWave *)MEM_callocN(sizeof(NodeTexWave), "NodeTexWave"); + NodeTexWave *tex = MEM_cnew<NodeTexWave>(__func__); BKE_texture_mapping_default(&tex->base.tex_mapping, TEXMAP_TYPE_POINT); BKE_texture_colormapping_default(&tex->base.color_mapping); tex->wave_type = SHD_WAVE_BANDS; |