diff options
Diffstat (limited to 'source/blender/editors/space_node')
6 files changed, 25 insertions, 26 deletions
diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 78683a69db3..c30e8b92d6b 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -130,7 +130,7 @@ static bNodeSocketLink *add_reroute_insert_socket_link(ListBase *lb, { bNodeSocketLink *socklink, *prev; - socklink = (bNodeSocketLink *)MEM_callocN(sizeof(bNodeSocketLink), "socket link"); + socklink = MEM_cnew<bNodeSocketLink>("socket link"); socklink->sock = sock; socklink->link = link; copy_v2_v2(socklink->point, point); diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 3b34d0b386e..e83bfb43847 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -344,7 +344,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS, WM_JOB_TYPE_COMPOSITE); - CompoJob *cj = (CompoJob *)MEM_callocN(sizeof(CompoJob), "compo job"); + CompoJob *cj = MEM_cnew<CompoJob>("compo job"); /* customdata for preview thread */ cj->bmain = bmain; @@ -908,7 +908,7 @@ static void node_resize_init(bContext *C, { SpaceNode *snode = CTX_wm_space_node(C); - NodeSizeWidget *nsw = (NodeSizeWidget *)MEM_callocN(sizeof(NodeSizeWidget), __func__); + NodeSizeWidget *nsw = MEM_cnew<NodeSizeWidget>(__func__); op->customdata = nsw; nsw->mxstart = snode->runtime->cursor[0] * UI_DPI_FAC; @@ -1308,7 +1308,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) */ if (link->tonode && (link->tonode->flag & NODE_SELECT) && (keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT)))) { - bNodeLink *newlink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "bNodeLink"); + bNodeLink *newlink = MEM_cnew<bNodeLink>("bNodeLink"); newlink->flag = link->flag; newlink->tonode = node_map.lookup(link->tonode); newlink->tosock = socket_map.lookup(link->tosock); @@ -2138,7 +2138,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) BLI_assert(link->tonode); BLI_assert(link->fromnode); if (link->tonode->flag & NODE_SELECT && link->fromnode->flag & NODE_SELECT) { - bNodeLink *newlink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), __func__); + bNodeLink *newlink = MEM_cnew<bNodeLink>(__func__); newlink->flag = link->flag; newlink->tonode = node_map.lookup(link->tonode); newlink->tosock = socket_map.lookup(link->tosock); diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 663b3a4c89a..4055dfdbf9e 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -102,7 +102,7 @@ static void clear_picking_highlight(ListBase *links) static bNodeLink *create_drag_link(bNode &node, bNodeSocket &sock) { - bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), __func__); + bNodeLink *oplink = MEM_cnew<bNodeLink>(__func__); if (sock.in_out == SOCK_OUT) { oplink->fromnode = &node; oplink->fromsock = &sock; @@ -1123,7 +1123,7 @@ static std::unique_ptr<bNodeLinkDrag> node_link_init(SpaceNode &snode, /* detach current links and store them in the operator data */ LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode.edittree->links) { if (link->fromsock == sock) { - bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); + bNodeLink *oplink = MEM_cnew<bNodeLink>("drag link op link"); *oplink = *link; oplink->next = oplink->prev = nullptr; oplink->flag |= NODE_LINK_VALID; @@ -1166,7 +1166,7 @@ static std::unique_ptr<bNodeLinkDrag> node_link_init(SpaceNode &snode, } if (link_to_pick != nullptr && !nldrag->from_multi_input_socket) { - bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); + bNodeLink *oplink = MEM_cnew<bNodeLink>("drag link op link"); *oplink = *link_to_pick; oplink->next = oplink->prev = nullptr; oplink->flag |= NODE_LINK_VALID; @@ -2465,8 +2465,7 @@ void ED_node_link_insert(Main *bmain, ScrArea *area) /* set up insert offset data, it needs stuff from here */ if ((snode->flag & SNODE_SKIP_INSOFFSET) == 0) { - NodeInsertOfsData *iofsd = (NodeInsertOfsData *)MEM_callocN(sizeof(NodeInsertOfsData), - __func__); + NodeInsertOfsData *iofsd = MEM_cnew<NodeInsertOfsData>(__func__); iofsd->insert = select; iofsd->prev = link->fromnode; diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc index defb1e82c3e..492237477c1 100644 --- a/source/blender/editors/space_node/node_templates.cc +++ b/source/blender/editors/space_node/node_templates.cc @@ -699,7 +699,7 @@ void uiTemplateNodeLink( uiBut *but; float socket_col[4]; - arg = (NodeLinkArg *)MEM_callocN(sizeof(NodeLinkArg), "NodeLinkArg"); + arg = MEM_new<NodeLinkArg>("NodeLinkArg"); arg->ntree = ntree; arg->node = node; arg->sock = input; diff --git a/source/blender/editors/space_node/node_view.cc b/source/blender/editors/space_node/node_view.cc index df629a983e3..12f390c47cd 100644 --- a/source/blender/editors/space_node/node_view.cc +++ b/source/blender/editors/space_node/node_view.cc @@ -255,7 +255,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent * return OPERATOR_CANCELLED; } - nvm = (NodeViewMove *)MEM_callocN(sizeof(NodeViewMove), "NodeViewMove struct"); + nvm = MEM_cnew<NodeViewMove>("NodeViewMove struct"); op->customdata = nvm; nvm->mvalo[0] = event->mval[0]; nvm->mvalo[1] = event->mval[1]; @@ -643,7 +643,7 @@ static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; } - info = (ImageSampleInfo *)MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo"); + info = MEM_cnew<ImageSampleInfo>("ImageSampleInfo"); info->art = region->type; info->draw_handle = ED_region_draw_cb_activate( region->type, sample_draw, info, REGION_DRAW_POST_PIXEL); diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index 96c6dd89447..54a72a4b53d 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -63,7 +63,7 @@ void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from) BLI_listbase_clear(&snode->treepath); if (ntree) { - bNodeTreePath *path = (bNodeTreePath *)MEM_callocN(sizeof(bNodeTreePath), "node tree path"); + bNodeTreePath *path = MEM_cnew<bNodeTreePath>("node tree path"); path->nodetree = ntree; path->parent_key = NODE_INSTANCE_KEY_BASE; @@ -96,7 +96,7 @@ void ED_node_tree_start(SpaceNode *snode, bNodeTree *ntree, ID *id, ID *from) void ED_node_tree_push(SpaceNode *snode, bNodeTree *ntree, bNode *gnode) { - bNodeTreePath *path = (bNodeTreePath *)MEM_callocN(sizeof(bNodeTreePath), "node tree path"); + bNodeTreePath *path = MEM_cnew<bNodeTreePath>("node tree path"); bNodeTreePath *prev_path = (bNodeTreePath *)snode->treepath.last; path->nodetree = ntree; if (gnode) { @@ -220,7 +220,7 @@ float2 space_node_group_offset(const SpaceNode &snode) static SpaceLink *node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) { - SpaceNode *snode = (SpaceNode *)MEM_callocN(sizeof(SpaceNode), "initnode"); + SpaceNode *snode = MEM_cnew<SpaceNode>("initnode"); snode->spacetype = SPACE_NODE; snode->flag = SNODE_SHOW_GPENCIL | SNODE_USE_ALPHA; @@ -238,21 +238,21 @@ static SpaceLink *node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(s NODE_TREE_TYPES_END; /* header */ - ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), "header for node"); + ARegion *region = MEM_cnew<ARegion>("header for node"); BLI_addtail(&snode->regionbase, region); region->regiontype = RGN_TYPE_HEADER; region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP; /* buttons/list view */ - region = (ARegion *)MEM_callocN(sizeof(ARegion), "buttons for node"); + region = MEM_cnew<ARegion>("buttons for node"); BLI_addtail(&snode->regionbase, region); region->regiontype = RGN_TYPE_UI; region->alignment = RGN_ALIGN_RIGHT; /* toolbar */ - region = (ARegion *)MEM_callocN(sizeof(ARegion), "node tools"); + region = MEM_cnew<ARegion>("node tools"); BLI_addtail(&snode->regionbase, region); region->regiontype = RGN_TYPE_TOOLS; @@ -261,7 +261,7 @@ static SpaceLink *node_create(const ScrArea *UNUSED(area), const Scene *UNUSED(s region->flag = RGN_FLAG_HIDDEN; /* main region */ - region = (ARegion *)MEM_callocN(sizeof(ARegion), "main region for node"); + region = MEM_cnew<ARegion>("main region for node"); BLI_addtail(&snode->regionbase, region); region->regiontype = RGN_TYPE_WINDOW; @@ -309,7 +309,7 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *area) SpaceNode *snode = (SpaceNode *)area->spacedata.first; if (snode->runtime == nullptr) { - snode->runtime = (SpaceNode_Runtime *)MEM_callocN(sizeof(SpaceNode_Runtime), __func__); + snode->runtime = MEM_new<SpaceNode_Runtime>(__func__); } } @@ -983,7 +983,7 @@ static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item, void ED_spacetype_node() { - SpaceType *st = (SpaceType *)MEM_callocN(sizeof(SpaceType), "spacetype node"); + SpaceType *st = MEM_cnew<SpaceType>("spacetype node"); ARegionType *art; st->spaceid = SPACE_NODE; @@ -1006,7 +1006,7 @@ void ED_spacetype_node() st->space_subtype_set = node_space_subtype_set; /* regions: main window */ - art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype node region"); + art = MEM_cnew<ARegionType>("spacetype node region"); art->regionid = RGN_TYPE_WINDOW; art->init = node_main_region_init; art->draw = node_main_region_draw; @@ -1020,7 +1020,7 @@ void ED_spacetype_node() BLI_addhead(&st->regiontypes, art); /* regions: header */ - art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype node region"); + art = MEM_cnew<ARegionType>("spacetype node region"); art->regionid = RGN_TYPE_HEADER; art->prefsizey = HEADERY; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER; @@ -1031,7 +1031,7 @@ void ED_spacetype_node() BLI_addhead(&st->regiontypes, art); /* regions: listview/buttons */ - art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype node region"); + art = MEM_cnew<ARegionType>("spacetype node region"); art->regionid = RGN_TYPE_UI; art->prefsizex = UI_SIDEBAR_PANEL_WIDTH; art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES; @@ -1042,7 +1042,7 @@ void ED_spacetype_node() BLI_addhead(&st->regiontypes, art); /* regions: toolbar */ - art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spacetype view3d tools region"); + art = MEM_cnew<ARegionType>("spacetype view3d tools region"); art->regionid = RGN_TYPE_TOOLS; art->prefsizex = 58; /* XXX */ art->prefsizey = 50; /* XXX */ |