diff options
author | Jacques Lucke <jacques@blender.org> | 2021-06-02 18:19:36 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-06-02 18:20:46 +0300 |
commit | 4f8edc8e7fc9389b03543bc9a20f6c936e32b531 (patch) | |
tree | 4f0185c4a58585a730f86586b7e5c1fee78e5cab /source/blender/editors/space_node | |
parent | b8ae30e9e33312da1f38f4187800002eaa957295 (diff) |
Nodes: move some files to C++
This just moves a couple of files in `space_node` to C++ and fixes
related errors.
The goal is to be able to use C++ data structures to simplify the code.
Differential Revision: https://developer.blender.org/D11451
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/CMakeLists.txt | 18 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.cc (renamed from source/blender/editors/space_node/drawnode.c) | 937 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_add.cc (renamed from source/blender/editors/space_node/node_add.c) | 68 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.cc (renamed from source/blender/editors/space_node/node_edit.c) | 249 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_group.cc (renamed from source/blender/editors/space_node/node_group.c) | 66 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_relationships.cc (renamed from source/blender/editors/space_node/node_relationships.c) | 229 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_select.cc (renamed from source/blender/editors/space_node/node_select.c) | 151 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_templates.cc (renamed from source/blender/editors/space_node/node_templates.c) | 111 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_toolbar.cc (renamed from source/blender/editors/space_node/node_toolbar.c) | 0 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_view.cc (renamed from source/blender/editors/space_node/node_view.c) | 68 |
10 files changed, 1011 insertions, 886 deletions
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt index bc043a4e665..6e234c5b2ce 100644 --- a/source/blender/editors/space_node/CMakeLists.txt +++ b/source/blender/editors/space_node/CMakeLists.txt @@ -37,20 +37,20 @@ set(INC set(SRC - drawnode.c - node_add.c + drawnode.cc + node_add.cc node_buttons.c node_draw.cc - node_edit.c + node_edit.cc node_geometry_attribute_search.cc node_gizmo.c - node_group.c + node_group.cc node_ops.c - node_relationships.c - node_select.c - node_templates.c - node_toolbar.c - node_view.c + node_relationships.cc + node_select.cc + node_templates.cc + node_toolbar.cc + node_view.cc space_node.c node_intern.h diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.cc index f11f1c01019..982af78dfde 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.cc @@ -95,9 +95,9 @@ static void node_socket_button_label(bContext *UNUSED(C), static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; /* first output stores value */ - bNodeSocket *output = node->outputs.first; + bNodeSocket *output = (bNodeSocket *)node->outputs.first; PointerRNA sockptr; RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output, &sockptr); @@ -106,15 +106,15 @@ static void node_buts_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *p static void node_buts_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; /* first output stores value */ - bNodeSocket *output = node->outputs.first; + bNodeSocket *output = (bNodeSocket *)node->outputs.first; PointerRNA sockptr; uiLayout *col; RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output, &sockptr); col = uiLayoutColumn(layout, false); - uiTemplateColorPicker(col, &sockptr, "default_value", 1, 0, 0, 0); + uiTemplateColorPicker(col, &sockptr, "default_value", true, false, false, false); uiItemR(col, &sockptr, "default_value", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); } @@ -129,14 +129,14 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA uiItemR(row, ptr, "use_alpha", DEFAULT_FLAGS, "", ICON_IMAGE_RGB_ALPHA); } - uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { #if 0 /* XXX no context access here .. */ - bNode *node = ptr->data; + bNode *node = (bNode*)ptr->data; CurveMapping *cumap = node->storage; if (cumap) { @@ -156,7 +156,7 @@ static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt static void node_buts_colorramp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiTemplateColorRamp(layout, ptr, "color_ramp", 0); + uiTemplateColorRamp(layout, ptr, "color_ramp", false); } static void node_buts_curvevec(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -179,8 +179,8 @@ void ED_node_sample_set(const float col[4]) static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; - CurveMapping *cumap = node->storage; + bNode *node = (bNode *)ptr->data; + CurveMapping *cumap = (CurveMapping *)node->storage; if (_sample_col[0] != SAMPLE_FLT_ISNONE) { cumap->flag |= CUMA_DRAW_SAMPLE; @@ -198,9 +198,9 @@ static void node_buts_curvecol(uiLayout *layout, bContext *UNUSED(C), PointerRNA static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; /* first output stores normal */ - bNodeSocket *output = node->outputs.first; + bNodeSocket *output = (bNodeSocket *)node->outputs.first; PointerRNA sockptr; RNA_pointer_create(ptr->owner_id, &RNA_NodeSocket, output, &sockptr); @@ -209,7 +209,7 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA * static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; short multi = (node->id && ((Tex *)node->id)->use_nodes && (node->type != CMP_NODE_TEXTURE) && (node->type != TEX_NODE_TEXTURE)); @@ -233,14 +233,14 @@ static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), Po if (!ELEM(RNA_enum_get(ptr, "interpolation_type"), NODE_MAP_RANGE_SMOOTHSTEP, NODE_MAP_RANGE_SMOOTHERSTEP)) { - uiItemR(layout, ptr, "clamp", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); } } static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "use_clamp", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); } static int node_resize_area_default(bNode *node, int x, int y) @@ -274,7 +274,7 @@ static int node_resize_area_default(bNode *node, int x, int y) static void node_draw_buttons_group(uiLayout *layout, bContext *C, PointerRNA *ptr) { uiTemplateIDBrowse( - layout, C, ptr, "node_tree", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, NULL); + layout, C, ptr, "node_tree", nullptr, nullptr, nullptr, UI_TEMPLATE_ID_FILTER_ALL, nullptr); } /* XXX Does a bounding box update by iterating over all children. @@ -311,7 +311,7 @@ static void node_draw_frame_prepare(const bContext *UNUSED(C), bNodeTree *ntree, /* first child initializes frame */ if (bbinit) { - bbinit = 0; + bbinit = false; rect = noderect; data->flag &= ~NODE_FRAME_RESIZEABLE; } @@ -418,9 +418,9 @@ static void node_draw_frame(const bContext *C, { /* skip if out of view */ - if (BLI_rctf_isect(&node->totr, ®ion->v2d.cur, NULL) == false) { + if (BLI_rctf_isect(&node->totr, ®ion->v2d.cur, nullptr) == false) { UI_block_end(C, node->block); - node->block = NULL; + node->block = nullptr; return; } @@ -462,7 +462,7 @@ static void node_draw_frame(const bContext *C, UI_block_end(C, node->block); UI_block_draw(C, node->block); - node->block = NULL; + node->block = nullptr; } static int node_resize_area_frame(bNode *node, int x, int y) @@ -497,7 +497,7 @@ static void node_buts_frame_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA { uiItemR(layout, ptr, "label_size", DEFAULT_FLAGS, IFACE_("Label Size"), ICON_NONE); uiItemR(layout, ptr, "shrink", DEFAULT_FLAGS, IFACE_("Shrink"), ICON_NONE); - uiItemR(layout, ptr, "text", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "text", DEFAULT_FLAGS, nullptr, ICON_NONE); } #define NODE_REROUTE_SIZE 8.0f @@ -511,11 +511,11 @@ static void node_draw_reroute_prepare(const bContext *UNUSED(C), node_to_view(node, 0.0f, 0.0f, &locx, &locy); /* reroute node has exactly one input and one output, both in the same place */ - bNodeSocket *nsock = node->outputs.first; + bNodeSocket *nsock = (bNodeSocket *)node->outputs.first; nsock->locx = locx; nsock->locy = locy; - nsock = node->inputs.first; + nsock = (bNodeSocket *)node->inputs.first; nsock->locx = locx; nsock->locy = locy; @@ -541,7 +541,7 @@ static void node_draw_reroute(const bContext *C, if (node->totr.xmax < region->v2d.cur.xmin || node->totr.xmin > region->v2d.cur.xmax || node->totr.ymax < region->v2d.cur.ymin || node->totr.ymin > region->v2d.cur.ymax) { UI_block_end(C, node->block); - node->block = NULL; + node->block = nullptr; return; } @@ -586,12 +586,12 @@ static void node_draw_reroute(const bContext *C, (int)(rct->ymax), (short)512, (short)NODE_DY, - NULL, + nullptr, 0, 0, 0, 0, - NULL); + nullptr); } /* only draw input socket. as they all are placed on the same position. @@ -601,7 +601,7 @@ static void node_draw_reroute(const bContext *C, UI_block_end(C, node->block); UI_block_draw(C, node->block); - node->block = NULL; + node->block = nullptr; } /* Special tweak area for reroute node. @@ -612,7 +612,7 @@ static int node_tweak_area_reroute(bNode *node, int x, int y) /* square of tweak radius */ const float tweak_radius_sq = square_f(24.0f); - bNodeSocket *sock = node->inputs.first; + bNodeSocket *sock = (bNodeSocket *)node->inputs.first; float dx = sock->locx - x; float dy = sock->locy - y; return (dx * dx + dy * dy <= tweak_radius_sq); @@ -662,28 +662,28 @@ static void node_buts_image_user(uiLayout *layout, /* don't use iuser->framenr directly * because it may not be updated if auto-refresh is off */ Scene *scene = CTX_data_scene(C); - ImageUser *iuser = iuserptr->data; + ImageUser *iuser = (ImageUser *)iuserptr->data; /* Image *ima = imaptr->data; */ /* UNUSED */ char numstr[32]; - const int framenr = BKE_image_user_frame_get(iuser, CFRA, NULL); + const int framenr = BKE_image_user_frame_get(iuser, CFRA, nullptr); BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr); uiItemL(layout, numstr, ICON_NONE); } if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) { col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "frame_duration", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "frame_start", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "frame_offset", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "use_cyclic", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "use_auto_refresh", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "frame_duration", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "frame_start", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "frame_offset", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_cyclic", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_auto_refresh", DEFAULT_FLAGS, nullptr, ICON_NONE); } if (show_layer_selection && RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER && RNA_boolean_get(ptr, "has_layers")) { col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "layer", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "layer", DEFAULT_FLAGS, nullptr, ICON_NONE); } if (show_color_management) { @@ -693,7 +693,7 @@ static void node_buts_image_user(uiLayout *layout, uiItemR(split, &colorspace_settings_ptr, "name", DEFAULT_FLAGS, "", ICON_NONE); /* Avoid losing changes image is painted. */ - if (BKE_image_is_dirty(imaptr->data)) { + if (BKE_image_is_dirty((Image *)imaptr->data)) { uiLayoutSetEnabled(split, false); } } @@ -701,13 +701,13 @@ static void node_buts_image_user(uiLayout *layout, static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "rotation_type", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "rotation_type", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, 0); } static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -717,7 +717,7 @@ static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), Po static void node_shader_buts_vect_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiItemR(layout, ptr, "convert_from", DEFAULT_FLAGS, "", ICON_NONE); uiItemR(layout, ptr, "convert_to", DEFAULT_FLAGS, "", ICON_NONE); } @@ -730,7 +730,7 @@ static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), Po static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_pixel_size", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "use_pixel_size", DEFAULT_FLAGS, nullptr, 0); } static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -745,10 +745,10 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA "image", "IMAGE_OT_new", "IMAGE_OT_open", - NULL, + nullptr, UI_TEMPLATE_ID_FILTER_ALL, false, - NULL); + nullptr); uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, "", ICON_NONE); uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, "", ICON_NONE); @@ -767,7 +767,7 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_tex_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user"); - uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0, 0); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false); } static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -782,10 +782,10 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin "image", "IMAGE_OT_new", "IMAGE_OT_open", - NULL, + nullptr, UI_TEMPLATE_ID_FILTER_ALL, false, - NULL); + nullptr); uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, "", ICON_NONE); uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, "", ICON_NONE); @@ -796,7 +796,7 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA iuserptr = RNA_pointer_get(ptr, "image_user"); - uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0, 0); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false); uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, IFACE_("Interpolation"), ICON_NONE); uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, IFACE_("Projection"), ICON_NONE); @@ -808,33 +808,33 @@ static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), Poin if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_PREETHAM) { uiItemR(layout, ptr, "sun_direction", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, nullptr, ICON_NONE); } if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_HOSEK) { uiItemR(layout, ptr, "sun_direction", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "ground_albedo", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "ground_albedo", DEFAULT_FLAGS, nullptr, ICON_NONE); } if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_NISHITA) { - uiItemR(layout, ptr, "sun_disc", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "sun_disc", DEFAULT_FLAGS, nullptr, 0); uiLayout *col; if (RNA_boolean_get(ptr, "sun_disc")) { col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "sun_size", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "sun_intensity", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "sun_size", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "sun_intensity", DEFAULT_FLAGS, nullptr, ICON_NONE); } col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "sun_elevation", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "sun_rotation", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "sun_elevation", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "sun_rotation", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "altitude", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "altitude", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "air_density", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "dust_density", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "ozone_density", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "air_density", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "dust_density", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "ozone_density", DEFAULT_FLAGS, nullptr, ICON_NONE); } } @@ -845,7 +845,7 @@ static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "turbulence_depth", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "turbulence_depth", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -901,32 +901,33 @@ static void node_shader_buts_tex_pointdensity(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; - NodeShaderTexPointDensity *shader_point_density = node->storage; + bNode *node = (bNode *)ptr->data; + NodeShaderTexPointDensity *shader_point_density = (NodeShaderTexPointDensity *)node->storage; Object *ob = (Object *)node->id; PointerRNA ob_ptr, obdata_ptr; RNA_id_pointer_create((ID *)ob, &ob_ptr); - RNA_id_pointer_create(ob ? (ID *)ob->data : NULL, &obdata_ptr); + RNA_id_pointer_create(ob ? (ID *)ob->data : nullptr, &obdata_ptr); - uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiItemR(layout, ptr, "object", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + uiItemR(layout, ptr, "object", DEFAULT_FLAGS, nullptr, ICON_NONE); if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { PointerRNA dataptr; RNA_id_pointer_create((ID *)node->id, &dataptr); - uiItemPointerR(layout, ptr, "particle_system", &dataptr, "particle_systems", NULL, ICON_NONE); + uiItemPointerR( + layout, ptr, "particle_system", &dataptr, "particle_systems", nullptr, ICON_NONE); } - uiItemR(layout, ptr, "space", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "radius", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "resolution", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "space", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "radius", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "resolution", DEFAULT_FLAGS, nullptr, ICON_NONE); if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { - uiItemR(layout, ptr, "particle_color_source", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "particle_color_source", DEFAULT_FLAGS, nullptr, ICON_NONE); } else { - uiItemR(layout, ptr, "vertex_color_source", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "vertex_color_source", DEFAULT_FLAGS, nullptr, ICON_NONE); if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) { if (ob_ptr.data) { uiItemPointerR( @@ -944,18 +945,18 @@ static void node_shader_buts_tex_pointdensity(uiLayout *layout, static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "object", DEFAULT_FLAGS, NULL, 0); - uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "object", DEFAULT_FLAGS, nullptr, 0); + uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, nullptr, 0); } static void node_shader_buts_bump(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, 0); } static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *ptr) { - uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, nullptr, 0); if (!RNA_boolean_get(ptr, "from_instancer")) { PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); @@ -989,7 +990,7 @@ static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, Pointer static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_tips", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "use_tips", DEFAULT_FLAGS, nullptr, 0); } static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -1036,7 +1037,7 @@ static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA * } } else { - uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, 0); + uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, 0); } } @@ -1083,7 +1084,7 @@ static void node_shader_buts_ies(uiLayout *layout, bContext *UNUSED(C), PointerR uiLayout *row; row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(layout, true); @@ -1100,7 +1101,7 @@ static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), Point uiLayout *row; row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(layout, true); @@ -1122,7 +1123,7 @@ static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA #if 0 /* not implemented yet */ if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) { - uiItemR(layout, ptr, "use_auto_update", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_auto_update", DEFAULT_FLAGS, nullptr, ICON_NONE); } #endif } @@ -1139,21 +1140,21 @@ static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), Po col = uiLayoutColumn(layout, false); row = uiLayoutRow(col, true); uiItemR(row, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_shader_buts_bevel(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_shader_buts_ambient_occlusion(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "inside", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "only_local", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "inside", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "only_local", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1163,7 +1164,7 @@ static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), static void node_shader_buts_output_aov(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "name", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "name", DEFAULT_FLAGS, nullptr, ICON_NONE); } /* only once called */ @@ -1348,17 +1349,17 @@ static void node_buts_image_views(uiLayout *layout, if (RNA_boolean_get(ptr, "has_views")) { if (RNA_enum_get(ptr, "view") == 0) { - uiItemR(col, ptr, "view", DEFAULT_FLAGS, NULL, ICON_CAMERA_STEREO); + uiItemR(col, ptr, "view", DEFAULT_FLAGS, nullptr, ICON_CAMERA_STEREO); } else { - uiItemR(col, ptr, "view", DEFAULT_FLAGS, NULL, ICON_SCENE); + uiItemR(col, ptr, "view", DEFAULT_FLAGS, nullptr, ICON_SCENE); } } } static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; PointerRNA iuserptr; RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage, &iuserptr); @@ -1369,10 +1370,10 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * "image", "IMAGE_OT_new", "IMAGE_OT_open", - NULL, + nullptr, UI_TEMPLATE_ID_FILTER_ALL, false, - NULL); + nullptr); if (!node->id) { return; } @@ -1386,20 +1387,29 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA * static void node_composit_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; PointerRNA iuserptr; RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage, &iuserptr); uiLayoutSetContextPointer(layout, "image_user", &iuserptr); - uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0, 1); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, true); } static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; uiLayout *col, *row; - uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "scene", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (!node->id) { return; @@ -1423,7 +1433,7 @@ static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, Pointer PointerRNA op_ptr; uiItemFullO( - row, "RENDER_OT_render", "", ICON_RENDER_STILL, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); + row, "RENDER_OT_render", "", ICON_RENDER_STILL, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); RNA_string_set(&op_ptr, "layer", layer_name); RNA_string_set(&op_ptr, "scene", scene_name); } @@ -1438,19 +1448,19 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point uiItemR(col, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); if (filter != R_FILTER_FAST_GAUSS) { - uiItemR(col, ptr, "use_variable_size", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_variable_size", DEFAULT_FLAGS, nullptr, ICON_NONE); if (!reference) { - uiItemR(col, ptr, "use_bokeh", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_bokeh", DEFAULT_FLAGS, nullptr, ICON_NONE); } - uiItemR(col, ptr, "use_gamma_correction", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_gamma_correction", DEFAULT_FLAGS, nullptr, ICON_NONE); } - uiItemR(col, ptr, "use_relative", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_relative", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_boolean_get(ptr, "use_relative")) { uiItemL(col, IFACE_("Aspect Correction"), ICON_NONE); row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "aspect_correction", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "aspect_correction", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); uiItemR(col, ptr, "factor_x", DEFAULT_FLAGS, IFACE_("X"), ICON_NONE); @@ -1461,15 +1471,15 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point uiItemR(col, ptr, "size_x", DEFAULT_FLAGS, IFACE_("X"), ICON_NONE); uiItemR(col, ptr, "size_y", DEFAULT_FLAGS, IFACE_("Y"), ICON_NONE); } - uiItemR(col, ptr, "use_extended_bounds", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_extended_bounds", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; - uiItemR(layout, ptr, "iterations", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "use_wrap", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "iterations", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_wrap", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); uiItemL(col, IFACE_("Center:"), ICON_NONE); @@ -1479,13 +1489,13 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *UNUSED(C), Poin uiItemS(layout); col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "distance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "angle", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "distance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "angle", DEFAULT_FLAGS, nullptr, ICON_NONE); uiItemS(layout); - uiItemR(layout, ptr, "spin", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "zoom", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "spin", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "zoom", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_bilateralblur(uiLayout *layout, @@ -1495,9 +1505,9 @@ static void node_composit_buts_bilateralblur(uiLayout *layout, uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "iterations", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "sigma_color", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "sigma_space", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "iterations", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "sigma_color", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "sigma_space", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA *ptr) @@ -1507,27 +1517,36 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA col = uiLayoutColumn(layout, false); uiItemL(col, IFACE_("Bokeh Type:"), ICON_NONE); uiItemR(col, ptr, "bokeh", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(col, ptr, "angle", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "angle", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "use_gamma_correction", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_gamma_correction", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, false); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_zbuffer") == true); - uiItemR(col, ptr, "f_stop", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "f_stop", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "blur_max", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "threshold", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "blur_max", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_preview", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_preview", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiTemplateID(layout, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "scene", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_zbuffer", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_zbuffer", DEFAULT_FLAGS, nullptr, ICON_NONE); sub = uiLayoutColumn(col, false); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_zbuffer") == false); - uiItemR(sub, ptr, "z_scale", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(sub, ptr, "z_scale", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_antialiasing(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1536,9 +1555,9 @@ static void node_composit_buts_antialiasing(uiLayout *layout, bContext *UNUSED(C col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "threshold", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "contrast_limit", 0, NULL, ICON_NONE); - uiItemR(col, ptr, "corner_rounding", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "threshold", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "contrast_limit", 0, nullptr, ICON_NONE); + uiItemR(col, ptr, "corner_rounding", 0, nullptr, ICON_NONE); } /* qdn: glare node */ @@ -1548,29 +1567,30 @@ static void node_composit_buts_glare(uiLayout *layout, bContext *UNUSED(C), Poin uiItemR(layout, ptr, "quality", DEFAULT_FLAGS, "", ICON_NONE); if (RNA_enum_get(ptr, "glare_type") != 1) { - uiItemR(layout, ptr, "iterations", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "iterations", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "glare_type") != 0) { - uiItemR(layout, ptr, "color_modulation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR( + layout, ptr, "color_modulation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } } - uiItemR(layout, ptr, "mix", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "threshold", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "mix", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "glare_type") == 2) { - uiItemR(layout, ptr, "streaks", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "angle_offset", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "streaks", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "angle_offset", DEFAULT_FLAGS, nullptr, ICON_NONE); } if (RNA_enum_get(ptr, "glare_type") == 0 || RNA_enum_get(ptr, "glare_type") == 2) { - uiItemR(layout, ptr, "fade", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(layout, ptr, "fade", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "glare_type") == 0) { - uiItemR(layout, ptr, "use_rotate_45", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_rotate_45", DEFAULT_FLAGS, nullptr, ICON_NONE); } } if (RNA_enum_get(ptr, "glare_type") == 1) { - uiItemR(layout, ptr, "size", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "size", DEFAULT_FLAGS, nullptr, ICON_NONE); } } @@ -1581,15 +1601,15 @@ static void node_composit_buts_tonemap(uiLayout *layout, bContext *UNUSED(C), Po col = uiLayoutColumn(layout, false); uiItemR(col, ptr, "tonemap_type", DEFAULT_FLAGS, "", ICON_NONE); if (RNA_enum_get(ptr, "tonemap_type") == 0) { - uiItemR(col, ptr, "key", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "offset", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "gamma", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "key", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "gamma", DEFAULT_FLAGS, nullptr, ICON_NONE); } else { - uiItemR(col, ptr, "intensity", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "adaptation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "correction", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "intensity", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "adaptation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "correction", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } } @@ -1598,12 +1618,12 @@ static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), P uiLayout *col; col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "use_projector", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_projector", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(col, false); uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_projector") == false); - uiItemR(col, ptr, "use_jitter", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "use_fit", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_jitter", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_fit", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1611,7 +1631,7 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), Po uiLayout *col; col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "samples", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE); uiItemR(col, ptr, "factor", DEFAULT_FLAGS, IFACE_("Blur"), ICON_NONE); col = uiLayoutColumn(layout, true); @@ -1619,7 +1639,7 @@ static void node_composit_buts_vecblur(uiLayout *layout, bContext *UNUSED(C), Po uiItemR(col, ptr, "speed_min", DEFAULT_FLAGS, IFACE_("Min"), ICON_NONE); uiItemR(col, ptr, "speed_max", DEFAULT_FLAGS, IFACE_("Max"), ICON_NONE); - uiItemR(layout, ptr, "use_curved", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_curved", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_filter(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1636,8 +1656,8 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *UNUSED(C), Point { uiLayout *col; - uiItemR(layout, ptr, "use_crop_size", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "relative", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_crop_size", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "relative", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); if (RNA_boolean_get(ptr, "relative")) { @@ -1660,8 +1680,8 @@ static void node_composit_buts_splitviewer(uiLayout *layout, bContext *UNUSED(C) col = uiLayoutColumn(layout, false); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); - uiItemR(col, ptr, "factor", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + uiItemR(col, ptr, "factor", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_double_edge_mask(uiLayout *layout, @@ -1683,7 +1703,7 @@ static void node_composit_buts_map_range(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1691,17 +1711,17 @@ static void node_composit_buts_map_value(uiLayout *layout, bContext *UNUSED(C), uiLayout *sub, *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "offset", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "size", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "size", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_min", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_min", DEFAULT_FLAGS, nullptr, ICON_NONE); sub = uiLayoutColumn(col, false); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_min")); uiItemR(sub, ptr, "min", DEFAULT_FLAGS, "", ICON_NONE); col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_max", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_max", DEFAULT_FLAGS, nullptr, ICON_NONE); sub = uiLayoutColumn(col, false); uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_max")); uiItemR(sub, ptr, "max", DEFAULT_FLAGS, "", ICON_NONE); @@ -1712,8 +1732,8 @@ static void node_composit_buts_alphaover(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_premultiply", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "premul", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_premultiply", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "premul", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1721,27 +1741,27 @@ static void node_composit_buts_zcombine(uiLayout *layout, bContext *UNUSED(C), P uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "use_alpha", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "use_antialias_z", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_antialias_z", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_dilateerode(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, nullptr, ICON_NONE); switch (RNA_enum_get(ptr, "mode")) { case CMP_NODE_DILATEERODE_DISTANCE_THRESH: - uiItemR(layout, ptr, "edge", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "edge", DEFAULT_FLAGS, nullptr, ICON_NONE); break; case CMP_NODE_DILATEERODE_DISTANCE_FEATHER: - uiItemR(layout, ptr, "falloff", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "falloff", DEFAULT_FLAGS, nullptr, ICON_NONE); break; } } static void node_composit_buts_inpaint(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_despeckle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1749,8 +1769,8 @@ static void node_composit_buts_despeckle(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "threshold_neighbor", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "threshold_neighbor", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1758,8 +1778,8 @@ static void node_composit_buts_diff_matte(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "falloff", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "falloff", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_distance_matte(uiLayout *layout, @@ -1772,10 +1792,10 @@ static void node_composit_buts_distance_matte(uiLayout *layout, uiItemL(layout, IFACE_("Color Space:"), ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "falloff", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "falloff", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1784,23 +1804,23 @@ static void node_composit_buts_color_spill(uiLayout *layout, bContext *UNUSED(C) uiItemL(layout, IFACE_("Despill Channel:"), ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "limit_method", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "limit_method", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "limit_method") == 0) { uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "limit_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "limit_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); } - uiItemR(col, ptr, "ratio", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "use_unspill", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "ratio", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_unspill", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_boolean_get(ptr, "use_unspill") == true) { - uiItemR(col, ptr, "unspill_red", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "unspill_green", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "unspill_blue", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "unspill_red", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "unspill_green", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "unspill_blue", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } } @@ -1809,13 +1829,13 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C uiLayout *col; col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "tolerance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); - /*uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, NULL, ICON_NONE); Removed for now */ - uiItemR(col, ptr, "gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, NULL, ICON_NONE); Removed for now*/ + /*uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); Removed for now */ + uiItemR(col, ptr, "gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); Removed for now*/ } static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1823,9 +1843,9 @@ static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C) uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "color_hue", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "color_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "color_value", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "color_hue", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "color_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "color_value", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_channel_matte(uiLayout *layout, @@ -1836,24 +1856,24 @@ static void node_composit_buts_channel_matte(uiLayout *layout, uiItemL(layout, IFACE_("Color Space:"), ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "color_space", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "color_space", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); col = uiLayoutColumn(layout, false); uiItemL(col, IFACE_("Key Channel:"), ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "matte_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "matte_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "limit_method", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "limit_method", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "limit_method") == 0) { uiItemL(col, IFACE_("Limiting Channel:"), ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "limit_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "limit_channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); } - uiItemR(col, ptr, "limit_max", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "limit_min", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "limit_max", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "limit_min", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1861,19 +1881,19 @@ static void node_composit_buts_luma_matte(uiLayout *layout, bContext *UNUSED(C), uiLayout *col; col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "limit_max", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(col, ptr, "limit_min", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(col, ptr, "limit_max", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(col, ptr, "limit_min", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_map_uv(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "alpha", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_id_mask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "index", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "use_antialiasing", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "index", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_antialiasing", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_file_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -1905,7 +1925,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi /* disable stereo output for multilayer, too much work for something that no one will use */ /* if someone asks for that we can implement it */ if (is_multiview) { - uiTemplateImageFormatViews(layout, &imfptr, NULL); + uiTemplateImageFormatViews(layout, &imfptr, nullptr); } uiItemS(layout); @@ -1926,7 +1946,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi "layer_slots", ptr, "active_input_index", - NULL, + nullptr, 0, 0, 0, @@ -1945,7 +1965,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi "file_slots", ptr, "active_input_index", - NULL, + nullptr, 0, 0, 0, @@ -1961,9 +1981,9 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi col = uiLayoutColumn(row, true); wmOperatorType *ot = WM_operatortype_find("NODE_OT_output_file_move_active_socket", false); - uiItemFullO_ptr(col, ot, "", ICON_TRIA_UP, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); + uiItemFullO_ptr(col, ot, "", ICON_TRIA_UP, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); RNA_enum_set(&op_ptr, "direction", 1); - uiItemFullO_ptr(col, ot, "", ICON_TRIA_DOWN, NULL, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); + uiItemFullO_ptr(col, ot, "", ICON_TRIA_DOWN, nullptr, WM_OP_INVOKE_DEFAULT, 0, &op_ptr); RNA_enum_set(&op_ptr, "direction", 2); if (active_input_ptr.data) { @@ -1977,10 +1997,10 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi "NODE_OT_output_file_remove_active_socket", "", ICON_X, - NULL, + nullptr, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY, - NULL); + nullptr); } else { col = uiLayoutColumn(layout, true); @@ -1992,23 +2012,23 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi "NODE_OT_output_file_remove_active_socket", "", ICON_X, - NULL, + nullptr, WM_OP_EXEC_DEFAULT, UI_ITEM_R_ICON_ONLY, - NULL); + nullptr); /* format details for individual files */ imfptr = RNA_pointer_get(&active_input_ptr, "format"); col = uiLayoutColumn(layout, true); uiItemL(col, IFACE_("Format:"), ICON_NONE); - uiItemR(col, &active_input_ptr, "use_node_format", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, &active_input_ptr, "use_node_format", DEFAULT_FLAGS, nullptr, ICON_NONE); const bool is_socket_exr = RNA_enum_get(&imfptr, "file_format") == R_IMF_IMTYPE_OPENEXR; const bool use_node_format = RNA_boolean_get(&active_input_ptr, "use_node_format"); if ((!is_exr && use_node_format) || (!is_socket_exr && !use_node_format)) { - uiItemR(col, &active_input_ptr, "save_as_render", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, &active_input_ptr, "save_as_render", DEFAULT_FLAGS, nullptr, ICON_NONE); } col = uiLayoutColumn(layout, false); @@ -2016,7 +2036,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi uiTemplateImageSettings(col, &imfptr, false); if (is_multiview) { - uiTemplateImageFormatViews(layout, &imfptr, NULL); + uiTemplateImageFormatViews(layout, &imfptr, nullptr); } } } @@ -2028,7 +2048,7 @@ static void node_composit_buts_scale(uiLayout *layout, bContext *UNUSED(C), Poin if (RNA_enum_get(ptr, "space") == CMP_SCALE_RENDERPERCENT) { uiLayout *row; - uiItemR(layout, ptr, "frame_method", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "frame_method", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(layout, true); uiItemR(row, ptr, "offset_x", DEFAULT_FLAGS, "X", ICON_NONE); uiItemR(row, ptr, "offset_y", DEFAULT_FLAGS, "Y", ICON_NONE); @@ -2045,8 +2065,8 @@ static void node_composit_buts_invert(uiLayout *layout, bContext *UNUSED(C), Poi uiLayout *col; col = uiLayoutColumn(layout, false); - uiItemR(col, ptr, "invert_rgb", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "invert_alpha", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "invert_rgb", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "invert_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -2056,86 +2076,86 @@ static void node_composit_buts_premulkey(uiLayout *layout, bContext *UNUSED(C), static void node_composit_buts_view_levels(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(layout, ptr, "channel", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); } static void node_composit_buts_colorbalance(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *split, *col, *row; - uiItemR(layout, ptr, "correction_method", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "correction_method", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "correction_method") == 0) { split = uiLayoutSplit(layout, 0.0f, false); col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "lift", 1, 1, 0, 1); + uiTemplateColorPicker(col, ptr, "lift", true, true, false, true); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "lift", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "lift", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "gamma", 1, 1, 1, 1); + uiTemplateColorPicker(col, ptr, "gamma", true, true, true, true); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "gamma", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "gamma", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "gain", 1, 1, 1, 1); + uiTemplateColorPicker(col, ptr, "gain", true, true, true, true); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "gain", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "gain", DEFAULT_FLAGS, nullptr, ICON_NONE); } else { split = uiLayoutSplit(layout, 0.0f, false); col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "offset", 1, 1, 0, 1); + uiTemplateColorPicker(col, ptr, "offset", true, true, false, true); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "offset", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "offset_basis", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "offset_basis", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "power", 1, 1, 0, 1); + uiTemplateColorPicker(col, ptr, "power", true, true, false, true); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "power", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "power", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(split, false); - uiTemplateColorPicker(col, ptr, "slope", 1, 1, 0, 1); + uiTemplateColorPicker(col, ptr, "slope", true, true, false, true); row = uiLayoutRow(col, false); - uiItemR(row, ptr, "slope", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "slope", DEFAULT_FLAGS, nullptr, ICON_NONE); } } static void node_composit_buts_colorbalance_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "correction_method", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "correction_method", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "correction_method") == 0) { - uiTemplateColorPicker(layout, ptr, "lift", 1, 1, 0, 1); - uiItemR(layout, ptr, "lift", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateColorPicker(layout, ptr, "lift", true, true, false, true); + uiItemR(layout, ptr, "lift", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiTemplateColorPicker(layout, ptr, "gamma", 1, 1, 1, 1); - uiItemR(layout, ptr, "gamma", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateColorPicker(layout, ptr, "gamma", true, true, true, true); + uiItemR(layout, ptr, "gamma", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiTemplateColorPicker(layout, ptr, "gain", 1, 1, 1, 1); - uiItemR(layout, ptr, "gain", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateColorPicker(layout, ptr, "gain", true, true, true, true); + uiItemR(layout, ptr, "gain", DEFAULT_FLAGS, nullptr, ICON_NONE); } else { - uiTemplateColorPicker(layout, ptr, "offset", 1, 1, 0, 1); - uiItemR(layout, ptr, "offset", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateColorPicker(layout, ptr, "offset", true, true, false, true); + uiItemR(layout, ptr, "offset", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiTemplateColorPicker(layout, ptr, "power", 1, 1, 0, 1); - uiItemR(layout, ptr, "power", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateColorPicker(layout, ptr, "power", true, true, false, true); + uiItemR(layout, ptr, "power", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiTemplateColorPicker(layout, ptr, "slope", 1, 1, 0, 1); - uiItemR(layout, ptr, "slope", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateColorPicker(layout, ptr, "slope", true, true, false, true); + uiItemR(layout, ptr, "slope", DEFAULT_FLAGS, nullptr, ICON_NONE); } } static void node_composit_buts_huecorrect(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - bNode *node = ptr->data; - CurveMapping *cumap = node->storage; + bNode *node = (bNode *)ptr->data; + CurveMapping *cumap = (CurveMapping *)node->storage; if (_sample_col[0] != SAMPLE_FLT_ISNONE) { cumap->flag |= CUMA_DRAW_SAMPLE; @@ -2155,17 +2175,33 @@ static void node_composit_buts_ycc(uiLayout *layout, bContext *UNUSED(C), Pointe static void node_composit_buts_movieclip(uiLayout *layout, bContext *C, PointerRNA *ptr) { - uiTemplateID( - layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); } static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; PointerRNA clipptr; - uiTemplateID( - layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (!node->id) { return; @@ -2178,23 +2214,31 @@ static void node_composit_buts_movieclip_ex(uiLayout *layout, bContext *C, Point static void node_composit_buts_stabilize2d(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; - uiTemplateID( - layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (!node->id) { return; } uiItemR(layout, ptr, "filter_type", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_translate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_relative", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "wrap_axis", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_relative", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "wrap_axis", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -2204,10 +2248,18 @@ static void node_composit_buts_transform(uiLayout *layout, bContext *UNUSED(C), static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; - uiTemplateID( - layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (!node->id) { return; @@ -2223,9 +2275,9 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, uiLayout *row; row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "red", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "green", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "blue", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "red", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "green", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "blue", DEFAULT_FLAGS, nullptr, ICON_NONE); row = uiLayoutRow(layout, false); uiItemL(row, "", ICON_NONE); @@ -2268,8 +2320,8 @@ static void node_composit_buts_colorcorrection(uiLayout *layout, uiItemR(row, ptr, "shadows_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, "", ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "midtones_start", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_end", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_start", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_end", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_colorcorrection_ex(uiLayout *layout, @@ -2279,53 +2331,53 @@ static void node_composit_buts_colorcorrection_ex(uiLayout *layout, uiLayout *row; row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "red", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "green", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "blue", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "red", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "green", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "blue", DEFAULT_FLAGS, nullptr, ICON_NONE); row = layout; uiItemL(row, IFACE_("Saturation"), ICON_NONE); - uiItemR(row, ptr, "master_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "highlights_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "shadows_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "highlights_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "shadows_saturation", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); uiItemL(row, IFACE_("Contrast"), ICON_NONE); - uiItemR(row, ptr, "master_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "highlights_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "shadows_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "highlights_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "shadows_contrast", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); uiItemL(row, IFACE_("Gamma"), ICON_NONE); - uiItemR(row, ptr, "master_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "highlights_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "shadows_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "highlights_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "shadows_gamma", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); uiItemL(row, IFACE_("Gain"), ICON_NONE); - uiItemR(row, ptr, "master_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "highlights_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "shadows_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "highlights_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "shadows_gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); uiItemL(row, IFACE_("Lift"), ICON_NONE); - uiItemR(row, ptr, "master_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "highlights_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "shadows_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "master_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "highlights_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "shadows_lift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "midtones_start", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "midtones_end", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "midtones_start", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "midtones_end", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_set_alpha(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "mode", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_switch(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "check", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "check", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_switch_view_ex(uiLayout *layout, @@ -2336,10 +2388,10 @@ static void node_composit_buts_switch_view_ex(uiLayout *layout, "NODE_OT_switch_view_update", "Update Views", ICON_FILE_REFRESH, - NULL, + nullptr, WM_OP_INVOKE_DEFAULT, 0, - NULL); + nullptr); } static void node_composit_buts_boxmask(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -2347,32 +2399,32 @@ static void node_composit_buts_boxmask(uiLayout *layout, bContext *UNUSED(C), Po uiLayout *row; row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "x", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "y", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "x", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "y", DEFAULT_FLAGS, nullptr, ICON_NONE); row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "width", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "height", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "width", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "height", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(layout, ptr, "rotation", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "mask_type", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "rotation", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "mask_type", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "flaps", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "angle", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "rounding", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(layout, ptr, "catadioptric", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(layout, ptr, "shift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(layout, ptr, "flaps", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "angle", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "rounding", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(layout, ptr, "catadioptric", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(layout, ptr, "shift", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_bokehblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_variable_size", DEFAULT_FLAGS, NULL, ICON_NONE); - // uiItemR(layout, ptr, "f_stop", DEFAULT_FLAGS, NULL, ICON_NONE); /* UNUSED */ - uiItemR(layout, ptr, "blur_max", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "use_extended_bounds", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_variable_size", DEFAULT_FLAGS, nullptr, ICON_NONE); + // uiItemR(layout, ptr, "f_stop", DEFAULT_FLAGS, nullptr, ICON_NONE); /* UNUSED */ + uiItemR(layout, ptr, "blur_max", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_extended_bounds", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_backdrop_viewer( @@ -2407,7 +2459,7 @@ static void node_composit_backdrop_viewer( static void node_composit_backdrop_boxmask( SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y) { - NodeBoxMask *boxmask = node->storage; + NodeBoxMask *boxmask = (NodeBoxMask *)node->storage; const float backdropWidth = backdrop->x; const float backdropHeight = backdrop->y; const float aspect = backdropWidth / backdropHeight; @@ -2452,7 +2504,7 @@ static void node_composit_backdrop_boxmask( static void node_composit_backdrop_ellipsemask( SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y) { - NodeEllipseMask *ellipsemask = node->storage; + NodeEllipseMask *ellipsemask = (NodeEllipseMask *)node->storage; const float backdropWidth = backdrop->x; const float backdropHeight = backdrop->y; const float aspect = backdropWidth / backdropHeight; @@ -2498,65 +2550,83 @@ static void node_composit_buts_ellipsemask(uiLayout *layout, bContext *UNUSED(C) { uiLayout *row; row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "x", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(row, ptr, "y", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(row, ptr, "x", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(row, ptr, "y", DEFAULT_FLAGS, nullptr, ICON_NONE); row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "width", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); - uiItemR(row, ptr, "height", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(row, ptr, "width", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); + uiItemR(row, ptr, "height", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - uiItemR(layout, ptr, "rotation", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "mask_type", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "rotation", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "mask_type", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_composite(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_viewer(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_viewer_ex(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiLayout *col; - uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "tile_order", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_alpha", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "tile_order", DEFAULT_FLAGS, nullptr, ICON_NONE); if (RNA_enum_get(ptr, "tile_order") == 0) { col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "center_x", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(col, ptr, "center_y", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, ptr, "center_x", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(col, ptr, "center_y", DEFAULT_FLAGS, nullptr, ICON_NONE); } } static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; - uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); - uiItemR(layout, ptr, "use_feather", DEFAULT_FLAGS, NULL, ICON_NONE); + uiTemplateID(layout, + C, + ptr, + "mask", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); + uiItemR(layout, ptr, "use_feather", DEFAULT_FLAGS, nullptr, ICON_NONE); uiItemR(layout, ptr, "size_source", DEFAULT_FLAGS, "", ICON_NONE); if (node->custom1 & (CMP_NODEFLAG_MASK_FIXED | CMP_NODEFLAG_MASK_FIXED_SCENE)) { - uiItemR(layout, ptr, "size_x", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "size_y", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "size_x", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "size_y", DEFAULT_FLAGS, nullptr, ICON_NONE); } - uiItemR(layout, ptr, "use_motion_blur", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_motion_blur", DEFAULT_FLAGS, nullptr, ICON_NONE); if (node->custom1 & CMP_NODEFLAG_MASK_MOTION_BLUR) { - uiItemR(layout, ptr, "motion_blur_samples", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "motion_blur_shutter", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_samples", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_shutter", DEFAULT_FLAGS, nullptr, ICON_NONE); } } static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; - uiTemplateID(layout, C, ptr, "clip", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (node->id) { MovieClip *clip = (MovieClip *)node->id; @@ -2572,28 +2642,36 @@ static void node_composit_buts_keyingscreen(uiLayout *layout, bContext *C, Point static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - /* bNode *node = ptr->data; */ /* UNUSED */ + /* bNode *node = (bNode*)ptr->data; */ /* UNUSED */ - uiItemR(layout, ptr, "blur_pre", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "screen_balance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "despill_factor", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "despill_balance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "edge_kernel_radius", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "edge_kernel_tolerance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "clip_black", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "clip_white", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "dilate_distance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "feather_falloff", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "feather_distance", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "blur_post", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "blur_pre", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "screen_balance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "despill_factor", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "despill_balance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "edge_kernel_radius", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "edge_kernel_tolerance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "clip_black", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "clip_white", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "dilate_distance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "feather_falloff", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "feather_distance", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "blur_post", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; - uiTemplateID( - layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (node->id) { MovieClip *clip = (MovieClip *)node->id; @@ -2601,7 +2679,7 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN MovieTrackingObject *object; uiLayout *col; PointerRNA tracking_ptr; - NodeTrackPosData *data = node->storage; + NodeTrackPosData *data = (NodeTrackPosData *)node->storage; RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr); @@ -2620,21 +2698,29 @@ static void node_composit_buts_trackpos(uiLayout *layout, bContext *C, PointerRN uiItemR(layout, ptr, "track_name", DEFAULT_FLAGS, "", ICON_ANIM_DATA); } - uiItemR(layout, ptr, "position", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "position", DEFAULT_FLAGS, nullptr, ICON_NONE); if (ELEM(node->custom1, CMP_TRACKPOS_RELATIVE_FRAME, CMP_TRACKPOS_ABSOLUTE_FRAME)) { - uiItemR(layout, ptr, "frame_relative", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "frame_relative", DEFAULT_FLAGS, nullptr, ICON_NONE); } } } static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; - NodePlaneTrackDeformData *data = node->storage; + bNode *node = (bNode *)ptr->data; + NodePlaneTrackDeformData *data = (NodePlaneTrackDeformData *)node->storage; - uiTemplateID( - layout, C, ptr, "clip", NULL, "CLIP_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(layout, + C, + ptr, + "clip", + nullptr, + "CLIP_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); if (node->id) { MovieClip *clip = (MovieClip *)node->id; @@ -2662,10 +2748,10 @@ static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, P } } - uiItemR(layout, ptr, "use_motion_blur", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_motion_blur", DEFAULT_FLAGS, nullptr, ICON_NONE); if (data->flag & CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR) { - uiItemR(layout, ptr, "motion_blur_samples", DEFAULT_FLAGS, NULL, ICON_NONE); - uiItemR(layout, ptr, "motion_blur_shutter", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_samples", DEFAULT_FLAGS, nullptr, ICON_NONE); + uiItemR(layout, ptr, "motion_blur_shutter", DEFAULT_FLAGS, nullptr, ICON_NONE); } } @@ -2678,7 +2764,7 @@ static void node_composit_buts_cornerpin(uiLayout *UNUSED(layout), static void node_composit_buts_sunbeams(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, "", ICON_NONE); - uiItemR(layout, ptr, "ray_length", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, NULL, ICON_NONE); + uiItemR(layout, ptr, "ray_length", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_cryptomatte_legacy(uiLayout *layout, @@ -2706,18 +2792,35 @@ static void node_composit_buts_cryptomatte_legacy_ex(uiLayout *layout, static void node_composit_buts_cryptomatte(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; uiLayout *row = uiLayoutRow(layout, true); - uiItemR(row, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, ptr, "source", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiLayout *col = uiLayoutColumn(layout, false); if (node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER) { - uiTemplateID(col, C, ptr, "scene", NULL, NULL, NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(col, + C, + ptr, + "scene", + nullptr, + nullptr, + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); } else { - uiTemplateID( - col, C, ptr, "image", NULL, "IMAGE_OT_open", NULL, UI_TEMPLATE_ID_FILTER_ALL, false, NULL); + uiTemplateID(col, + C, + ptr, + "image", + nullptr, + "IMAGE_OT_open", + nullptr, + UI_TEMPLATE_ID_FILTER_ALL, + false, + nullptr); NodeCryptomatte *crypto = (NodeCryptomatte *)node->storage; PointerRNA imaptr = RNA_pointer_get(ptr, "image"); @@ -2743,7 +2846,7 @@ static void node_composit_buts_brightcontrast(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { - uiItemR(layout, ptr, "use_premultiply", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_premultiply", DEFAULT_FLAGS, nullptr, ICON_NONE); } static void node_composit_buts_denoise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -2759,7 +2862,7 @@ static void node_composit_buts_denoise(uiLayout *layout, bContext *UNUSED(C), Po # endif #endif - uiItemR(layout, ptr, "use_hdr", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_hdr", DEFAULT_FLAGS, nullptr, ICON_NONE); } /* only once called */ @@ -3029,7 +3132,7 @@ static void node_texture_buts_bricks(uiLayout *layout, bContext *UNUSED(C), Poin static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { PointerRNA tex_ptr; - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; ID *id = ptr->owner_id; Tex *tex = (Tex *)node->storage; uiLayout *col, *row; @@ -3042,29 +3145,31 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe case TEX_BLEND: uiItemR(col, &tex_ptr, "progression", DEFAULT_FLAGS, "", ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "use_flip_axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR( + row, &tex_ptr, "use_flip_axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); break; case TEX_MARBLE: row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "marble_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "marble_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(col, false); uiItemR(row, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR( + row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); break; case TEX_MAGIC: - uiItemR(col, &tex_ptr, "noise_depth", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, &tex_ptr, "noise_depth", DEFAULT_FLAGS, nullptr, ICON_NONE); break; case TEX_STUCCI: row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "stucci_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "stucci_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE); break; @@ -3072,18 +3177,19 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE); uiItemR(col, &tex_ptr, "wood_type", DEFAULT_FLAGS, "", ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR( + row, &tex_ptr, "noise_basis_2", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(col, false); uiLayoutSetActive(row, !(ELEM(tex->stype, TEX_BAND, TEX_RING))); - uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); break; case TEX_CLOUDS: uiItemR(col, &tex_ptr, "noise_basis", DEFAULT_FLAGS, "", ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "cloud_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "cloud_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); row = uiLayoutRow(col, false); - uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, NULL, ICON_NONE); + uiItemR(row, &tex_ptr, "noise_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); uiItemR(col, &tex_ptr, "noise_depth", @@ -3104,7 +3210,7 @@ static void node_texture_buts_proc(uiLayout *layout, bContext *UNUSED(C), Pointe case TEX_VORONOI: uiItemR(col, &tex_ptr, "distance_metric", DEFAULT_FLAGS, "", ICON_NONE); if (tex->vn_distm == TEX_MINKOVSKY) { - uiItemR(col, &tex_ptr, "minkovsky_exponent", DEFAULT_FLAGS, NULL, ICON_NONE); + uiItemR(col, &tex_ptr, "minkovsky_exponent", DEFAULT_FLAGS, nullptr, ICON_NONE); } uiItemR(col, &tex_ptr, "color_mode", DEFAULT_FLAGS, "", ICON_NONE); break; @@ -3119,19 +3225,19 @@ static void node_texture_buts_image(uiLayout *layout, bContext *C, PointerRNA *p "image", "IMAGE_OT_new", "IMAGE_OT_open", - NULL, + nullptr, UI_TEMPLATE_ID_FILTER_ALL, false, - NULL); + nullptr); } static void node_texture_buts_image_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) { - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; PointerRNA iuserptr; RNA_pointer_create(ptr->owner_id, &RNA_ImageUser, node->storage, &iuserptr); - uiTemplateImage(layout, C, ptr, "image", &iuserptr, 0, 0); + uiTemplateImage(layout, C, ptr, "image", &iuserptr, false, false); } static void node_texture_buts_output(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -3193,7 +3299,7 @@ static void node_texture_set_butfunc(bNodeType *ntype) static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { bNodeTree *ntree = (bNodeTree *)ptr->owner_id; - bNode *node = ptr->data; + bNode *node = (bNode *)ptr->data; ED_node_tag_update_nodetree(bmain, ntree, node); } @@ -3203,7 +3309,7 @@ static void node_socket_template_properties_update(bNodeType *ntype, bNodeSocket PropertyRNA *prop = RNA_struct_type_find_property(srna, stemp->identifier); if (prop) { - RNA_def_property_update_runtime(prop, node_property_update_default); + RNA_def_property_update_runtime(prop, (const void *)node_property_update_default); } } @@ -3271,8 +3377,8 @@ void ED_node_init_butfuncs(void) NodeTypeUndefined.draw_nodetype_prepare = node_update_default; NodeTypeUndefined.select_area_func = node_select_area_default; NodeTypeUndefined.tweak_area_func = node_tweak_area_default; - NodeTypeUndefined.draw_buttons = NULL; - NodeTypeUndefined.draw_buttons_ex = NULL; + NodeTypeUndefined.draw_buttons = nullptr; + NodeTypeUndefined.draw_buttons_ex = nullptr; NodeTypeUndefined.resize_area_func = node_resize_area_default; NodeSocketTypeUndefined.draw = node_socket_undefined_draw; @@ -3349,7 +3455,7 @@ static void std_node_socket_draw_color(bContext *UNUSED(C), PointerRNA *UNUSED(node_ptr), float *r_color) { - bNodeSocket *sock = ptr->data; + bNodeSocket *sock = (bNodeSocket *)ptr->data; int type = sock->typeinfo->type; copy_v4_v4(r_color, std_node_socket_colors[type]); } @@ -3357,7 +3463,7 @@ static void std_node_socket_interface_draw_color(bContext *UNUSED(C), PointerRNA *ptr, float *r_color) { - bNodeSocket *sock = ptr->data; + bNodeSocket *sock = (bNodeSocket *)ptr->data; int type = sock->typeinfo->type; copy_v4_v4(r_color, std_node_socket_colors[type]); } @@ -3370,7 +3476,7 @@ static void node_file_output_socket_draw(bContext *C, PointerRNA *node_ptr) { bNodeTree *ntree = (bNodeTree *)ptr->owner_id; - bNodeSocket *sock = ptr->data; + bNodeSocket *sock = (bNodeSocket *)ptr->data; uiLayout *row; PointerRNA inputptr; @@ -3380,13 +3486,13 @@ static void node_file_output_socket_draw(bContext *C, int imtype = RNA_enum_get(&imfptr, "file_format"); if (imtype == R_IMF_IMTYPE_MULTILAYER) { - NodeImageMultiFileSocket *input = sock->storage; + NodeImageMultiFileSocket *input = (NodeImageMultiFileSocket *)sock->storage; RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotLayer, input, &inputptr); uiItemL(row, input->layer, ICON_NONE); } else { - NodeImageMultiFileSocket *input = sock->storage; + NodeImageMultiFileSocket *input = (NodeImageMultiFileSocket *)sock->storage; uiBlock *block; RNA_pointer_create(&ntree->id, &RNA_NodeOutputFileSlotFile, input, &inputptr); @@ -3413,8 +3519,8 @@ static void node_file_output_socket_draw(bContext *C, static void std_node_socket_draw( bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text) { - bNode *node = node_ptr->data; - bNodeSocket *sock = ptr->data; + bNode *node = (bNode *)node_ptr->data; + bNodeSocket *sock = (bNodeSocket *)ptr->data; int type = sock->typeinfo->type; /*int subtype = sock->typeinfo->subtype;*/ @@ -3482,7 +3588,8 @@ static void std_node_socket_draw( break; } case SOCK_TEXTURE: { - uiTemplateID(layout, C, ptr, "default_value", "texture.new", NULL, NULL, 0, ICON_NONE, NULL); + uiTemplateID( + layout, C, ptr, "default_value", "texture.new", nullptr, nullptr, 0, ICON_NONE, nullptr); break; } case SOCK_MATERIAL: { @@ -3497,7 +3604,7 @@ static void std_node_socket_draw( static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout, PointerRNA *ptr) { - bNodeSocket *sock = ptr->data; + bNodeSocket *sock = (bNodeSocket *)ptr->data; int type = sock->typeinfo->type; uiLayout *col = uiLayoutColumn(layout, false); @@ -3532,7 +3639,7 @@ static void std_node_socket_interface_draw(bContext *UNUSED(C), uiLayout *layout } } - uiItemR(layout, ptr, "hide_value", DEFAULT_FLAGS, NULL, 0); + uiItemR(layout, ptr, "hide_value", DEFAULT_FLAGS, nullptr, 0); } void ED_init_standard_node_socket_type(bNodeSocketType *stype) @@ -3599,7 +3706,7 @@ void draw_nodespace_back_pix(const bContext *C, void *lock; Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); if (ibuf) { /* somehow the offset has to be calculated inverse */ wmOrtho2_region_pixelspace(region); @@ -3608,7 +3715,7 @@ void draw_nodespace_back_pix(const bContext *C, /** \note draw selected info on backdrop */ if (snode->edittree) { - bNode *node = snode->edittree->nodes.first; + bNode *node = (bNode *)snode->edittree->nodes.first; rctf *viewer_border = &snode->nodetree->viewer_border; while (node) { if (node->flag & NODE_SELECT) { @@ -3645,7 +3752,7 @@ void draw_nodespace_back_pix(const bContext *C, GPU_matrix_pop(); } -/* return quadratic beziers points for a given nodelink and clip if v2d is not NULL. */ +/* return quadratic beziers points for a given nodelink and clip if v2d is not nullptr. */ bool node_link_bezier_handles(const View2D *v2d, const SpaceNode *snode, const bNodeLink *link, @@ -3675,7 +3782,7 @@ bool node_link_bezier_handles(const View2D *v2d, fromreroute = (link->fromnode && link->fromnode->type == NODE_REROUTE); } else { - if (snode == NULL) { + if (snode == nullptr) { return false; } copy_v2_v2(vec[0], cursor); @@ -3694,7 +3801,7 @@ bool node_link_bezier_handles(const View2D *v2d, toreroute = (link->tonode && link->tonode->type == NODE_REROUTE); } else { - if (snode == NULL) { + if (snode == nullptr) { return false; } copy_v2_v2(vec[3], cursor); @@ -3754,7 +3861,7 @@ bool node_link_bezier_handles(const View2D *v2d, return true; } -/* if v2d not NULL, it clips and returns 0 if not visible */ +/* if v2d not nullptr, it clips and returns 0 if not visible */ bool node_link_bezier_points(const View2D *v2d, const SpaceNode *snode, const bNodeLink *link, @@ -3787,6 +3894,7 @@ static float arrow_expand_axis[3][2] = {{0.7071f, 0.7071f}, {M_SQRT2, 0.0f}, {0. static float mute_verts[3][2] = {{0.7071f, 1.0f}, {0.7071f, 0.0f}, {0.7071f, -1.0f}}; static float mute_expand_axis[3][2] = {{1.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, -0.0f}}; +/* Is zero initialized because it is static data. */ static struct { GPUBatch *batch; /* for batching line together */ GPUBatch *batch_single; /* for single line */ @@ -3797,9 +3905,9 @@ static struct { GPUVertBufRaw colid_step, muted_step; uint count; bool enabled; -} g_batch_link = {0}; +} g_batch_link; -static void nodelink_batch_reset(void) +static void nodelink_batch_reset() { GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p0_id, &g_batch_link.p0_step); GPU_vertbuf_attr_get_raw_data(g_batch_link.inst_vbo, g_batch_link.p1_id, &g_batch_link.p1_step); @@ -3826,7 +3934,7 @@ static void set_nodelink_vertex(GPUVertBuf *vbo, GPU_vertbuf_attr_set(vbo, exp_id, v, exp); } -static void nodelink_batch_init(void) +static void nodelink_batch_init() { GPUVertFormat format = {0}; uint uv_id = GPU_vertformat_attr_add(&format, "uv", GPU_COMP_U8, 2, GPU_FETCH_INT_TO_FLOAT_UNIT); @@ -3905,10 +4013,11 @@ static void nodelink_batch_init(void) } } - g_batch_link.batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, GPU_BATCH_OWNS_VBO); + g_batch_link.batch = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_OWNS_VBO); gpu_batch_presets_register(g_batch_link.batch); - g_batch_link.batch_single = GPU_batch_create_ex(GPU_PRIM_TRI_STRIP, vbo, NULL, 0); + g_batch_link.batch_single = GPU_batch_create_ex( + GPU_PRIM_TRI_STRIP, vbo, nullptr, GPU_BATCH_INVALID); gpu_batch_presets_register(g_batch_link.batch_single); /* Instances data */ @@ -4008,16 +4117,16 @@ static void nodelink_batch_add_link(const SpaceNode *snode, BLI_assert(ELEM(th_col3, TH_WIRE, TH_REDALERT, -1)); g_batch_link.count++; - copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p0_step), p0); - copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p1_step), p1); - copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p2_step), p2); - copy_v2_v2(GPU_vertbuf_raw_step(&g_batch_link.p3_step), p3); - char *colid = GPU_vertbuf_raw_step(&g_batch_link.colid_step); + copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p0_step), p0); + copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p1_step), p1); + copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p2_step), p2); + copy_v2_v2((float *)GPU_vertbuf_raw_step(&g_batch_link.p3_step), p3); + char *colid = (char *)GPU_vertbuf_raw_step(&g_batch_link.colid_step); colid[0] = nodelink_get_color_id(th_col1); colid[1] = nodelink_get_color_id(th_col2); colid[2] = nodelink_get_color_id(th_col3); colid[3] = drawarrow; - char *muted = GPU_vertbuf_raw_step(&g_batch_link.muted_step); + char *muted = (char *)GPU_vertbuf_raw_step(&g_batch_link.muted_step); muted[0] = drawmuted; if (g_batch_link.count == NODELINK_GROUP_SIZE) { @@ -4039,7 +4148,7 @@ void node_draw_link_bezier(const View2D *v2d, int drawarrow = ((link->tonode && (link->tonode->type == NODE_REROUTE)) && (link->fromnode && (link->fromnode->type == NODE_REROUTE))); int drawmuted = (link->flag & NODE_LINK_MUTED); - if (g_batch_link.batch == NULL) { + if (g_batch_link.batch == nullptr) { nodelink_batch_init(); } @@ -4081,7 +4190,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) { int th_col1 = TH_WIRE_INNER, th_col2 = TH_WIRE_INNER, th_col3 = TH_WIRE; - if (link->fromsock == NULL && link->tosock == NULL) { + if (link->fromsock == nullptr && link->tosock == nullptr) { return; } diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.cc index a28d467df2e..7276688e986 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.cc @@ -65,13 +65,13 @@ /** * XXX Does some additional initialization on top of #nodeAddNode * Can be used with both custom and static nodes, - * if `idname == NULL` the static int type will be used instead. + * if `idname == nullptr` the static int type will be used instead. */ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx, float locy) { SpaceNode *snode = CTX_wm_space_node(C); Main *bmain = CTX_data_main(C); - bNode *node = NULL; + bNode *node = nullptr; node_deselect_all(snode); @@ -90,7 +90,7 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx nodeSetSelected(node, true); ntreeUpdateTree(bmain, snode->edittree); - ED_node_set_active(bmain, snode->edittree, node, NULL); + ED_node_set_active(bmain, snode->edittree, node, nullptr); snode_update(snode, node); @@ -114,7 +114,7 @@ static bool add_reroute_intersect_check(bNodeLink *link, { float coord_array[NODE_LINK_RESOL + 1][2]; - if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) { + if (node_link_bezier_points(nullptr, nullptr, link, coord_array, NODE_LINK_RESOL)) { for (int i = 0; i < tot - 1; i++) { for (int b = 0; b < NODE_LINK_RESOL; b++) { if (isect_seg_seg_v2_point( @@ -127,13 +127,13 @@ static bool add_reroute_intersect_check(bNodeLink *link, return false; } -typedef struct bNodeSocketLink { +struct bNodeSocketLink { struct bNodeSocketLink *next, *prev; struct bNodeSocket *sock; struct bNodeLink *link; float point[2]; -} bNodeSocketLink; +}; static bNodeSocketLink *add_reroute_insert_socket_link(ListBase *lb, bNodeSocket *sock, @@ -142,12 +142,12 @@ static bNodeSocketLink *add_reroute_insert_socket_link(ListBase *lb, { bNodeSocketLink *socklink, *prev; - socklink = MEM_callocN(sizeof(bNodeSocketLink), "socket link"); + socklink = (bNodeSocketLink *)MEM_callocN(sizeof(bNodeSocketLink), "socket link"); socklink->sock = sock; socklink->link = link; copy_v2_v2(socklink->point, point); - for (prev = lb->last; prev; prev = prev->prev) { + for (prev = (bNodeSocketLink *)lb->last; prev; prev = prev->prev) { if (prev->sock == sock) { break; } @@ -162,7 +162,7 @@ static bNodeSocketLink *add_reroute_do_socket_section(bContext *C, { SpaceNode *snode = CTX_wm_space_node(C); bNodeTree *ntree = snode->edittree; - bNode *reroute_node = NULL; + bNode *reroute_node = nullptr; bNodeSocket *cursock = socklink->sock; float insert_point[2]; int num_links; @@ -184,12 +184,12 @@ static bNodeSocketLink *add_reroute_do_socket_section(bContext *C, socklink->link->fromnode, socklink->link->fromsock, reroute_node, - reroute_node->inputs.first); + (bNodeSocket *)reroute_node->inputs.first); } else { nodeAddLink(ntree, reroute_node, - reroute_node->outputs.first, + (bNodeSocket *)reroute_node->outputs.first, socklink->link->tonode, socklink->link->tosock); } @@ -198,11 +198,11 @@ static bNodeSocketLink *add_reroute_do_socket_section(bContext *C, /* insert the reroute node into the link */ if (in_out == SOCK_OUT) { socklink->link->fromnode = reroute_node; - socklink->link->fromsock = reroute_node->outputs.first; + socklink->link->fromsock = (bNodeSocket *)reroute_node->outputs.first; } else { socklink->link->tonode = reroute_node; - socklink->link->tosock = reroute_node->inputs.first; + socklink->link->tosock = (bNodeSocket *)reroute_node->inputs.first; } add_v2_v2(insert_point, socklink->point); @@ -259,7 +259,7 @@ static int add_reroute_exec(bContext *C, wmOperator *op) BLI_listbase_clear(&output_links); BLI_listbase_clear(&input_links); - for (link = ntree->links.first; link; link = link->next) { + for (link = (bNodeLink *)ntree->links.first; link; link = link->next) { if (nodeLinkIsHidden(link)) { continue; } @@ -275,11 +275,11 @@ static int add_reroute_exec(bContext *C, wmOperator *op) /* Create reroute nodes for intersected links. * Only one reroute if links share the same input/output socket. */ - socklink = output_links.first; + socklink = (bNodeSocketLink *)output_links.first; while (socklink) { socklink = add_reroute_do_socket_section(C, socklink, SOCK_OUT); } - socklink = input_links.first; + socklink = (bNodeSocketLink *)input_links.first; while (socklink) { socklink = add_reroute_do_socket_section(C, socklink, SOCK_IN); } @@ -317,7 +317,7 @@ void NODE_OT_add_reroute(wmOperatorType *ot) /* properties */ PropertyRNA *prop; prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); /* internal */ RNA_def_int(ot->srna, "cursor", WM_CURSOR_CROSS, 0, INT_MAX, "Cursor", "", 0, INT_MAX); } @@ -337,10 +337,10 @@ static bNodeTree *node_add_group_get_and_poll_group_node_tree(Main *bmain, bNodeTree *node_group = (bNodeTree *)BKE_libblock_find_name(bmain, ID_NT, name); if (!node_group) { - return NULL; + return nullptr; } - const char *disabled_hint = NULL; + const char *disabled_hint = nullptr; if ((node_group->type != ntree->type) || !nodeGroupPoll(ntree, node_group, &disabled_hint)) { if (disabled_hint) { BKE_reportf(op->reports, @@ -358,7 +358,7 @@ static bNodeTree *node_add_group_get_and_poll_group_node_tree(Main *bmain, ntree->id.name + 2); } - return NULL; + return nullptr; } return node_group; @@ -450,7 +450,7 @@ static Object *node_add_object_get_and_poll_object_node_tree(Main *bmain, wmOper Object *object = (Object *)BKE_libblock_find_name(bmain, ID_OB, name); if (!object) { - return NULL; + return nullptr; } return object; @@ -470,7 +470,7 @@ static int node_add_object_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); bNode *object_node = node_add_node( - C, NULL, GEO_NODE_OBJECT_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]); + C, nullptr, GEO_NODE_OBJECT_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]); if (!object_node) { BKE_report(op->reports, RPT_WARNING, "Could not add node object"); return OPERATOR_CANCELLED; @@ -482,7 +482,7 @@ static int node_add_object_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - bNodeSocketValueObject *socket_data = sock->default_value; + bNodeSocketValueObject *socket_data = (bNodeSocketValueObject *)sock->default_value; socket_data->value = object; id_us_plus(&object->id); @@ -554,7 +554,7 @@ static Tex *node_add_texture_get_and_poll_texture_node_tree(Main *bmain, wmOpera Tex *texture = (Tex *)BKE_libblock_find_name(bmain, ID_TE, name); if (!texture) { - return NULL; + return nullptr; } return texture; @@ -574,7 +574,7 @@ static int node_add_texture_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); bNode *texture_node = node_add_node(C, - NULL, + nullptr, GEO_NODE_ATTRIBUTE_SAMPLE_TEXTURE, snode->runtime->cursor[0], snode->runtime->cursor[1]); @@ -655,7 +655,7 @@ static Collection *node_add_collection_get_and_poll_collection_node_tree(Main *b Collection *collection = (Collection *)BKE_libblock_find_name(bmain, ID_GR, name); if (!collection) { - return NULL; + return nullptr; } return collection; @@ -675,7 +675,7 @@ static int node_add_collection_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); bNode *collection_node = node_add_node( - C, NULL, GEO_NODE_COLLECTION_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]); + C, nullptr, GEO_NODE_COLLECTION_INFO, snode->runtime->cursor[0], snode->runtime->cursor[1]); if (!collection_node) { BKE_report(op->reports, RPT_WARNING, "Could not add node collection"); return OPERATOR_CANCELLED; @@ -687,7 +687,7 @@ static int node_add_collection_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - bNodeSocketValueCollection *socket_data = sock->default_value; + bNodeSocketValueCollection *socket_data = (bNodeSocketValueCollection *)sock->default_value; socket_data->value = collection; id_us_plus(&collection->id); @@ -788,7 +788,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - node = node_add_node(C, NULL, type, snode->runtime->cursor[0], snode->runtime->cursor[1]); + node = node_add_node(C, nullptr, type, snode->runtime->cursor[0], snode->runtime->cursor[1]); if (!node) { BKE_report(op->reports, RPT_WARNING, "Could not add an image node"); @@ -801,7 +801,7 @@ static int node_add_file_exec(bContext *C, wmOperator *op) * to get proper image source. */ if (RNA_struct_property_is_set(op->ptr, "filepath")) { - BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_RELOAD); + BKE_image_signal(bmain, ima, nullptr, IMA_SIGNAL_RELOAD); WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, ima); } @@ -876,7 +876,7 @@ static int node_add_mask_exec(bContext *C, wmOperator *op) Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); bNode *node; - ID *mask = NULL; + ID *mask = nullptr; /* check input variables */ char name[MAX_ID_NAME - 2]; @@ -890,7 +890,7 @@ static int node_add_mask_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); node = node_add_node( - C, NULL, CMP_NODE_MASK, snode->runtime->cursor[0], snode->runtime->cursor[1]); + C, nullptr, CMP_NODE_MASK, snode->runtime->cursor[0], snode->runtime->cursor[1]); if (!node) { BKE_report(op->reports, RPT_WARNING, "Could not add a mask node"); @@ -976,7 +976,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) id_us_min(&ntree->id); RNA_id_pointer_create(&ntree->id, &idptr); - RNA_property_pointer_set(&ptr, prop, idptr, NULL); + RNA_property_pointer_set(&ptr, prop, idptr, nullptr); RNA_property_update(C, &ptr, prop); } else if (snode) { @@ -993,7 +993,7 @@ static const EnumPropertyItem *new_node_tree_type_itemf(bContext *UNUSED(C), PropertyRNA *UNUSED(prop), bool *r_free) { - return rna_node_tree_type_itemf(NULL, NULL, r_free); + return rna_node_tree_type_itemf(nullptr, nullptr, r_free); } void NODE_OT_new_node_tree(wmOperatorType *ot) diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.cc index 50fa8b28468..b98a3fcd59b 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.cc @@ -83,7 +83,7 @@ enum { COM_RECALC_VIEWER = 2, }; -typedef struct CompoJob { +struct CompoJob { /* Input parameters. */ Main *bmain; Scene *scene; @@ -97,7 +97,7 @@ typedef struct CompoJob { const short *stop; short *do_update; float *progress; -} CompoJob; +}; float node_socket_calculate_height(const bNodeSocket *socket) { @@ -150,7 +150,7 @@ static int compo_get_recalc_flags(const bContext *C) LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { if (area->spacetype == SPACE_IMAGE) { - SpaceImage *sima = area->spacedata.first; + SpaceImage *sima = (SpaceImage *)area->spacedata.first; if (sima->image) { if (sima->image->type == IMA_TYPE_R_RESULT) { recalc_flags |= COM_RECALC_COMPOSITE; @@ -161,7 +161,7 @@ static int compo_get_recalc_flags(const bContext *C) } } else if (area->spacetype == SPACE_NODE) { - SpaceNode *snode = area->spacedata.first; + SpaceNode *snode = (SpaceNode *)area->spacedata.first; if (snode->flag & SNODE_BACKDRAW) { recalc_flags |= COM_RECALC_VIEWER; } @@ -175,7 +175,7 @@ static int compo_get_recalc_flags(const bContext *C) /* called by compo, only to check job 'stop' value */ static int compo_breakjob(void *cjv) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; /* without G.is_break 'ESC' wont quit - which annoys users */ return (*(cj->stop) @@ -188,7 +188,7 @@ static int compo_breakjob(void *cjv) /* called by compo, wmJob sends notifier */ static void compo_statsdrawjob(void *cjv, const char *UNUSED(str)) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; *(cj->do_update) = true; } @@ -196,19 +196,19 @@ static void compo_statsdrawjob(void *cjv, const char *UNUSED(str)) /* called by compo, wmJob sends notifier */ static void compo_redrawjob(void *cjv) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; *(cj->do_update) = true; } static void compo_freejob(void *cjv) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; if (cj->localtree) { ntreeLocalMerge(cj->bmain, cj->localtree, cj->ntree); } - if (cj->compositor_depsgraph != NULL) { + if (cj->compositor_depsgraph != nullptr) { DEG_graph_free(cj->compositor_depsgraph); } MEM_freeN(cj); @@ -218,7 +218,7 @@ static void compo_freejob(void *cjv) * sliding buttons doesn't frustrate */ static void compo_initjob(void *cjv) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; Main *bmain = cj->bmain; Scene *scene = cj->scene; ViewLayer *view_layer = cj->view_layer; @@ -243,12 +243,12 @@ static void compo_initjob(void *cjv) /* called before redraw notifiers, it moves finished previews over */ static void compo_updatejob(void *UNUSED(cjv)) { - WM_main_add_notifier(NC_SCENE | ND_COMPO_RESULT, NULL); + WM_main_add_notifier(NC_SCENE | ND_COMPO_RESULT, nullptr); } static void compo_progressjob(void *cjv, float progress) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; *(cj->progress) = progress; } @@ -261,7 +261,7 @@ static void compo_startjob(void *cjv, short *do_update, float *progress) { - CompoJob *cj = cjv; + CompoJob *cj = (CompoJob *)cjv; bNodeTree *ntree = cj->localtree; Scene *scene = cj->scene; @@ -311,9 +311,9 @@ static void compo_startjob(void *cjv, } } - ntree->test_break = NULL; - ntree->stats_draw = NULL; - ntree->progress = NULL; + ntree->test_break = nullptr; + ntree->stats_draw = nullptr; + ntree->progress = nullptr; } /** @@ -347,7 +347,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 = MEM_callocN(sizeof(CompoJob), "compo job"); + CompoJob *cj = (CompoJob *)MEM_callocN(sizeof(CompoJob), "compo job"); /* customdata for preview thread */ cj->bmain = bmain; @@ -359,7 +359,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene /* setup job */ WM_jobs_customdata_set(wm_job, cj, compo_freejob); WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_COMPO_RESULT, NC_SCENE | ND_COMPO_RESULT); - WM_jobs_callbacks(wm_job, compo_startjob, compo_initjob, compo_updatejob, NULL); + WM_jobs_callbacks(wm_job, compo_startjob, compo_initjob, compo_updatejob, nullptr); WM_jobs_start(CTX_wm_manager(C), wm_job); } @@ -412,7 +412,7 @@ void snode_notify(bContext *C, SpaceNode *snode) { ID *id = snode->id; - WM_event_add_notifier(C, NC_NODE | NA_EDITED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_EDITED, nullptr); if (ED_node_is_shader(snode)) { if (GS(id->name) == ID_MA) { @@ -490,15 +490,15 @@ void ED_node_shader_default(const bContext *C, ID *id) } else if (ELEM(GS(id->name), ID_WO, ID_LA)) { /* Emission */ - bNodeTree *ntree = ntreeAddTree(NULL, "Shader Nodetree", ntreeType_Shader->idname); + bNodeTree *ntree = ntreeAddTree(nullptr, "Shader Nodetree", ntreeType_Shader->idname); bNode *shader, *output; if (GS(id->name) == ID_WO) { World *world = (World *)id; world->nodetree = ntree; - shader = nodeAddStaticNode(NULL, ntree, SH_NODE_BACKGROUND); - output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_WORLD); + shader = nodeAddStaticNode(nullptr, ntree, SH_NODE_BACKGROUND); + output = nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_WORLD); nodeAddLink(ntree, shader, nodeFindSocket(shader, SOCK_OUT, "Background"), @@ -512,8 +512,8 @@ void ED_node_shader_default(const bContext *C, ID *id) Light *light = (Light *)id; light->nodetree = ntree; - shader = nodeAddStaticNode(NULL, ntree, SH_NODE_EMISSION); - output = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_LIGHT); + shader = nodeAddStaticNode(nullptr, ntree, SH_NODE_EMISSION); + output = nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_LIGHT); nodeAddLink(ntree, shader, nodeFindSocket(shader, SOCK_OUT, "Emission"), @@ -546,7 +546,7 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce) return; } - sce->nodetree = ntreeAddTree(NULL, "Compositing Nodetree", ntreeType_Composite->idname); + sce->nodetree = ntreeAddTree(nullptr, "Compositing Nodetree", ntreeType_Composite->idname); sce->nodetree->chunksize = 256; sce->nodetree->edit_quality = NTREE_QUALITY_HIGH; @@ -562,8 +562,8 @@ void ED_node_composit_default(const bContext *C, struct Scene *sce) nodeSetActive(sce->nodetree, in); /* links from color to color */ - bNodeSocket *fromsock = in->outputs.first; - bNodeSocket *tosock = out->inputs.first; + bNodeSocket *fromsock = (bNodeSocket *)in->outputs.first; + bNodeSocket *tosock = (bNodeSocket *)out->inputs.first; nodeAddLink(sce->nodetree, in, fromsock, out, tosock); ntreeUpdateTree(CTX_data_main(C), sce->nodetree); @@ -581,7 +581,7 @@ void ED_node_texture_default(const bContext *C, Tex *tex) return; } - tex->nodetree = ntreeAddTree(NULL, "Texture Nodetree", ntreeType_Texture->idname); + tex->nodetree = ntreeAddTree(nullptr, "Texture Nodetree", ntreeType_Texture->idname); bNode *out = nodeAddStaticNode(C, tex->nodetree, TEX_NODE_OUTPUT); out->locx = 300.0f; @@ -592,8 +592,8 @@ void ED_node_texture_default(const bContext *C, Tex *tex) in->locy = 300.0f; nodeSetActive(tex->nodetree, in); - bNodeSocket *fromsock = in->outputs.first; - bNodeSocket *tosock = out->inputs.first; + bNodeSocket *fromsock = (bNodeSocket *)in->outputs.first; + bNodeSocket *tosock = (bNodeSocket *)out->inputs.first; nodeAddLink(tex->nodetree, in, fromsock, out, tosock); ntreeUpdateTree(CTX_data_main(C), tex->nodetree); @@ -618,24 +618,24 @@ void snode_set_context(const bContext *C) if (snode->nodetree && !STREQ(snode->nodetree->idname, snode->tree_idname)) { /* current tree does not match selected type, clear tree path */ - ntree = NULL; - id = NULL; - from = NULL; + ntree = nullptr; + id = nullptr; + from = nullptr; } - if (!(snode->flag & SNODE_PIN) || ntree == NULL) { + if (!(snode->flag & SNODE_PIN) || ntree == nullptr) { if (treetype->get_from_context) { /* reset and update from context */ - ntree = NULL; - id = NULL; - from = NULL; + ntree = nullptr; + id = nullptr; + from = nullptr; treetype->get_from_context(C, treetype, &ntree, &id, &from); } } if (snode->nodetree != ntree || snode->id != id || snode->from != from || - (snode->treepath.last == NULL && ntree)) { + (snode->treepath.last == nullptr && ntree)) { ED_node_tree_start(snode, ntree, id, from); } } @@ -648,7 +648,7 @@ void snode_update(SpaceNode *snode, bNode *node) */ /* update all edited group nodes */ - bNodeTreePath *path = snode->treepath.last; + bNodeTreePath *path = (bNodeTreePath *)snode->treepath.last; if (path) { bNodeTree *ngroup = path->nodetree; for (path = path->prev; path; path = path->prev) { @@ -685,7 +685,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node, bool *r_acti node->flag |= NODE_DO_OUTPUT; if (!was_output) { - do_update = 1; + do_update = true; } } @@ -734,7 +734,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node, bool *r_acti *r_active_texture_changed = true; } ED_node_tag_update_nodetree(bmain, ntree, node); - WM_main_add_notifier(NC_IMAGE, NULL); + WM_main_add_notifier(NC_IMAGE, nullptr); } WM_main_add_notifier(NC_MATERIAL | ND_NODES, node->id); @@ -806,7 +806,7 @@ static bool edit_node_poll(bContext *C) static void edit_node_properties(wmOperatorType *ot) { /* XXX could node be a context pointer? */ - RNA_def_string(ot->srna, "node", NULL, MAX_NAME, "Node", ""); + RNA_def_string(ot->srna, "node", nullptr, MAX_NAME, "Node", ""); RNA_def_int(ot->srna, "socket", 0, 0, MAX_SOCKET, "Socket", "", 0, MAX_SOCKET); RNA_def_enum(ot->srna, "in_out", rna_enum_node_socket_in_out_items, SOCK_IN, "Socket Side", ""); } @@ -838,7 +838,7 @@ static void edit_node_properties_get( wmOperator *op, bNodeTree *ntree, bNode **r_node, bNodeSocket **r_sock, int *r_in_out) { bNode *node; - bNodeSocket *sock = NULL; + bNodeSocket *sock = nullptr; char nodename[MAX_NAME]; int sockindex; int in_out; @@ -876,29 +876,30 @@ static void edit_node_properties_get( static bNode *visible_node(SpaceNode *snode, const rctf *rct) { LISTBASE_FOREACH_BACKWARD (bNode *, node, &snode->edittree->nodes) { - if (BLI_rctf_isect(&node->totr, rct, NULL)) { + if (BLI_rctf_isect(&node->totr, rct, nullptr)) { return node; } } - return NULL; + return nullptr; } /* ********************** size widget operator ******************** */ -typedef struct NodeSizeWidget { +struct NodeSizeWidget { float mxstart, mystart; float oldlocx, oldlocy; float oldoffsetx, oldoffsety; float oldwidth, oldheight; int directions; -} NodeSizeWidget; +}; static void node_resize_init( bContext *C, wmOperator *op, const wmEvent *UNUSED(event), bNode *node, int dir) { SpaceNode *snode = CTX_wm_space_node(C); - NodeSizeWidget *nsw = MEM_callocN(sizeof(NodeSizeWidget), "size widget op data"); + NodeSizeWidget *nsw = (NodeSizeWidget *)MEM_callocN(sizeof(NodeSizeWidget), + "size widget op data"); op->customdata = nsw; nsw->mxstart = snode->runtime->cursor[0] * UI_DPI_FAC; @@ -926,7 +927,7 @@ static void node_resize_exit(bContext *C, wmOperator *op, bool cancel) if (cancel) { SpaceNode *snode = CTX_wm_space_node(C); bNode *node = nodeGetActive(snode->edittree); - NodeSizeWidget *nsw = op->customdata; + NodeSizeWidget *nsw = (NodeSizeWidget *)op->customdata; node->locx = nsw->oldlocx; node->locy = nsw->oldlocy; @@ -937,7 +938,7 @@ static void node_resize_exit(bContext *C, wmOperator *op, bool cancel) } MEM_freeN(op->customdata); - op->customdata = NULL; + op->customdata = nullptr; } static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event) @@ -945,7 +946,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event) SpaceNode *snode = CTX_wm_space_node(C); ARegion *region = CTX_wm_region(C); bNode *node = nodeGetActive(snode->edittree); - NodeSizeWidget *nsw = op->customdata; + NodeSizeWidget *nsw = (NodeSizeWidget *)op->customdata; switch (event->type) { case MOUSEMOVE: { @@ -1112,7 +1113,7 @@ void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set) else { /* hide unused sockets */ LISTBASE_FOREACH (bNodeSocket *, sock, &node->inputs) { - if (sock->link == NULL) { + if (sock->link == nullptr) { sock->flag |= SOCK_HIDDEN; } } @@ -1128,17 +1129,17 @@ void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set) static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSocket *socket) { const float node_socket_height = node_socket_calculate_height(socket); - const rctf multi_socket_rect = { - .xmin = socket->locx - NODE_SOCKSIZE * 4.0f, - .xmax = socket->locx + NODE_SOCKSIZE * 2.0f, - /*.xmax = socket->locx + NODE_SOCKSIZE * 5.5f - * would be the same behavior as for regular sockets. - * But keep it smaller because for multi-input socket you - * sometimes want to drag the link to the other side, if you may - * accidentally pick the wrong link otherwise. */ - .ymin = socket->locy - node_socket_height, - .ymax = socket->locy + node_socket_height, - }; + rctf multi_socket_rect; + /*.xmax = socket->locx + NODE_SOCKSIZE * 5.5f + * would be the same behavior as for regular sockets. + * But keep it smaller because for multi-input socket you + * sometimes want to drag the link to the other side, if you may + * accidentally pick the wrong link otherwise. */ + BLI_rctf_init(&multi_socket_rect, + socket->locx - NODE_SOCKSIZE * 4.0f, + socket->locx + NODE_SOCKSIZE * 2.0f, + socket->locy - node_socket_height, + socket->locy + node_socket_height); if (BLI_rctf_isect_pt(&multi_socket_rect, cursor[0], cursor[1])) { return true; } @@ -1151,8 +1152,8 @@ int node_find_indicated_socket( { rctf rect; - *nodep = NULL; - *sockp = NULL; + *nodep = nullptr; + *sockp = nullptr; /* check if we click in a socket */ LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) { @@ -1244,7 +1245,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), bmain); - bNode *lastnode = ntree->nodes.last; + bNode *lastnode = (bNode *)ntree->nodes.last; LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { if (node->flag & SELECT) { BKE_node_copy_store_new_pointers(ntree, node, LIB_ID_COPY_DEFAULT); @@ -1262,14 +1263,14 @@ static int node_duplicate_exec(bContext *C, wmOperator *op) /* copy links between selected nodes * NB: this depends on correct node->new_node and sock->new_sock pointers from above copy! */ - bNodeLink *lastlink = ntree->links.last; + bNodeLink *lastlink = (bNodeLink *)ntree->links.last; LISTBASE_FOREACH (bNodeLink *, link, &ntree->links) { /* This creates new links between copied nodes. - * If keep_inputs is set, also copies input links from unselected (when fromnode==NULL)! + * If keep_inputs is set, also copies input links from unselected (when fromnode==nullptr)! */ if (link->tonode && (link->tonode->flag & NODE_SELECT) && (keep_inputs || (link->fromnode && (link->fromnode->flag & NODE_SELECT)))) { - bNodeLink *newlink = MEM_callocN(sizeof(bNodeLink), "bNodeLink"); + bNodeLink *newlink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "bNodeLink"); newlink->flag = link->flag; newlink->tonode = link->tonode->new_node; newlink->tosock = link->tosock->new_sock; @@ -1353,7 +1354,7 @@ void NODE_OT_duplicate(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean( - ot->srna, "keep_inputs", 0, "Keep Inputs", "Keep the input links to duplicated nodes"); + ot->srna, "keep_inputs", false, "Keep Inputs", "Keep the input links to duplicated nodes"); } bool ED_node_select_check(ListBase *lb) @@ -1414,7 +1415,7 @@ static int node_read_viewlayers_exec(bContext *C, wmOperator *UNUSED(op)) if ((node->type == CMP_NODE_R_LAYERS) || (node->type == CMP_NODE_CRYPTOMATTE && node->custom1 == CMP_CRYPTOMATTE_SRC_RENDER)) { ID *id = node->id; - if (id == NULL) { + if (id == nullptr) { continue; } if (id->tag & LIB_TAG_DOIT) { @@ -1453,7 +1454,7 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op)) /* This is actually a test whether scene is used by the compositor or not. * All the nodes are using same render result, so there is no need to do * anything smart about check how exactly scene is used. */ - bNode *node = NULL; + bNode *node = nullptr; LISTBASE_FOREACH (bNode *, node_iter, &sce->nodetree->nodes) { if (node_iter->id == (ID *)sce) { node = node_iter; @@ -1462,7 +1463,7 @@ int node_render_changed_exec(bContext *C, wmOperator *UNUSED(op)) } if (node) { - ViewLayer *view_layer = BLI_findlink(&sce->view_layers, node->custom1); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, node->custom1); if (view_layer) { PointerRNA op_ptr; @@ -1554,13 +1555,13 @@ static int node_hide_toggle_exec(bContext *C, wmOperator *UNUSED(op)) SpaceNode *snode = CTX_wm_space_node(C); /* sanity checking (poll callback checks this already) */ - if ((snode == NULL) || (snode->edittree == NULL)) { + if ((snode == nullptr) || (snode->edittree == nullptr)) { return OPERATOR_CANCELLED; } node_flag_toggle_exec(snode, NODE_HIDDEN); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1585,7 +1586,7 @@ static int node_preview_toggle_exec(bContext *C, wmOperator *UNUSED(op)) SpaceNode *snode = CTX_wm_space_node(C); /* sanity checking (poll callback checks this already) */ - if ((snode == NULL) || (snode->edittree == NULL)) { + if ((snode == nullptr) || (snode->edittree == nullptr)) { return OPERATOR_CANCELLED; } @@ -1618,13 +1619,13 @@ static int node_options_toggle_exec(bContext *C, wmOperator *UNUSED(op)) SpaceNode *snode = CTX_wm_space_node(C); /* sanity checking (poll callback checks this already) */ - if ((snode == NULL) || (snode->edittree == NULL)) { + if ((snode == nullptr) || (snode->edittree == nullptr)) { return OPERATOR_CANCELLED; } node_flag_toggle_exec(snode, NODE_OPTIONS); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1649,7 +1650,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op)) SpaceNode *snode = CTX_wm_space_node(C); /* sanity checking (poll callback checks this already) */ - if ((snode == NULL) || (snode->edittree == NULL)) { + if ((snode == nullptr) || (snode->edittree == nullptr)) { return OPERATOR_CANCELLED; } @@ -1674,7 +1675,7 @@ static int node_socket_toggle_exec(bContext *C, wmOperator *UNUSED(op)) ntreeUpdateTree(CTX_data_main(C), snode->edittree); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1870,12 +1871,12 @@ static int node_output_file_add_socket_exec(bContext *C, wmOperator *op) Scene *scene = CTX_data_scene(C); SpaceNode *snode = CTX_wm_space_node(C); PointerRNA ptr = CTX_data_pointer_get(C, "node"); - bNodeTree *ntree = NULL; - bNode *node = NULL; + bNodeTree *ntree = nullptr; + bNode *node = nullptr; char file_path[MAX_NAME]; if (ptr.data) { - node = ptr.data; + node = (bNode *)ptr.data; ntree = (bNodeTree *)ptr.owner_id; } else if (snode && snode->edittree) { @@ -1919,11 +1920,11 @@ static int node_output_file_remove_active_socket_exec(bContext *C, wmOperator *U { SpaceNode *snode = CTX_wm_space_node(C); PointerRNA ptr = CTX_data_pointer_get(C, "node"); - bNodeTree *ntree = NULL; - bNode *node = NULL; + bNodeTree *ntree = nullptr; + bNode *node = nullptr; if (ptr.data) { - node = ptr.data; + node = (bNode *)ptr.data; ntree = (bNodeTree *)ptr.owner_id; } else if (snode && snode->edittree) { @@ -1965,10 +1966,10 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); PointerRNA ptr = CTX_data_pointer_get(C, "node"); - bNode *node = NULL; + bNode *node = nullptr; if (ptr.data) { - node = ptr.data; + node = (bNode *)ptr.data; } else if (snode && snode->edittree) { node = nodeGetActive(snode->edittree); @@ -1978,9 +1979,9 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - NodeImageMultiFile *nimf = node->storage; + NodeImageMultiFile *nimf = (NodeImageMultiFile *)node->storage; - bNodeSocket *sock = BLI_findlink(&node->inputs, nimf->active_input); + bNodeSocket *sock = (bNodeSocket *)BLI_findlink(&node->inputs, nimf->active_input); if (!sock) { return OPERATOR_CANCELLED; } @@ -2014,7 +2015,7 @@ static int node_output_file_move_active_socket_exec(bContext *C, wmOperator *op) void NODE_OT_output_file_move_active_socket(wmOperatorType *ot) { static const EnumPropertyItem direction_items[] = { - {1, "UP", 0, "Up", ""}, {2, "DOWN", 0, "Down", ""}, {0, NULL, 0, NULL, NULL}}; + {1, "UP", 0, "Up", ""}, {2, "DOWN", 0, "Down", ""}, {0, nullptr, 0, nullptr, nullptr}}; /* identifiers */ ot->name = "Move File Node Socket"; @@ -2059,7 +2060,7 @@ static int node_copy_color_exec(bContext *C, wmOperator *UNUSED(op)) } ED_node_sort(ntree); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -2097,7 +2098,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) /* No ID refcounting, this node is virtual, * detached from any actual Blender data currently. */ bNode *new_node = BKE_node_copy_store_new_pointers( - NULL, node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN); + nullptr, node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN); BKE_node_clipboard_add_node(new_node); } } @@ -2127,7 +2128,7 @@ static int node_clipboard_copy_exec(bContext *C, wmOperator *UNUSED(op)) /* This creates new links between copied nodes. */ if (link->tonode && (link->tonode->flag & NODE_SELECT) && link->fromnode && (link->fromnode->flag & NODE_SELECT)) { - bNodeLink *newlink = MEM_callocN(sizeof(bNodeLink), "bNodeLink"); + bNodeLink *newlink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "bNodeLink"); newlink->flag = link->flag; newlink->tonode = link->tonode->new_node; newlink->tosock = link->tosock->new_sock; @@ -2188,7 +2189,7 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) /* make sure all clipboard nodes would be valid in the target tree */ bool all_nodes_valid = true; LISTBASE_FOREACH (bNode *, node, clipboard_nodes_lb) { - const char *disabled_hint = NULL; + const char *disabled_hint = nullptr; if (!node->typeinfo->poll_instance || !node->typeinfo->poll_instance(node, ntree, &disabled_hint)) { all_nodes_valid = false; @@ -2286,7 +2287,7 @@ static bNodeSocket *ntree_get_active_interface_socket(ListBase *lb) return socket; } } - return NULL; + return nullptr; } static int ntree_socket_add_exec(bContext *C, wmOperator *op) @@ -2297,7 +2298,7 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op) PointerRNA ntree_ptr; RNA_id_pointer_create((ID *)ntree, &ntree_ptr); - const eNodeSocketInOut in_out = RNA_enum_get(op->ptr, "in_out"); + const eNodeSocketInOut in_out = (eNodeSocketInOut)RNA_enum_get(op->ptr, "in_out"); ListBase *sockets = (in_out == SOCK_IN) ? &ntree->inputs : &ntree->outputs; const char *default_name = (in_out == SOCK_IN) ? "Input" : "Output"; @@ -2328,7 +2329,7 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op) snode_notify(C, snode); snode_dag_update(C, snode); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -2356,11 +2357,11 @@ static int ntree_socket_remove_exec(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); bNodeTree *ntree = snode->edittree; - const eNodeSocketInOut in_out = RNA_enum_get(op->ptr, "in_out"); + const eNodeSocketInOut in_out = (eNodeSocketInOut)RNA_enum_get(op->ptr, "in_out"); bNodeSocket *iosock = ntree_get_active_interface_socket(in_out == SOCK_IN ? &ntree->inputs : &ntree->outputs); - if (iosock == NULL) { + if (iosock == nullptr) { return OPERATOR_CANCELLED; } @@ -2378,7 +2379,7 @@ static int ntree_socket_remove_exec(bContext *C, wmOperator *op) snode_notify(C, snode); snode_dag_update(C, snode); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -2404,7 +2405,7 @@ void NODE_OT_tree_socket_remove(wmOperatorType *ot) static const EnumPropertyItem move_direction_items[] = { {1, "UP", 0, "Up", ""}, {2, "DOWN", 0, "Down", ""}, - {0, NULL, 0, NULL, NULL}, + {0, nullptr, 0, nullptr, nullptr}, }; static int ntree_socket_move_exec(bContext *C, wmOperator *op) @@ -2413,12 +2414,12 @@ static int ntree_socket_move_exec(bContext *C, wmOperator *op) bNodeTree *ntree = snode->edittree; int direction = RNA_enum_get(op->ptr, "direction"); - const eNodeSocketInOut in_out = RNA_enum_get(op->ptr, "in_out"); + const eNodeSocketInOut in_out = (eNodeSocketInOut)RNA_enum_get(op->ptr, "in_out"); ListBase *sockets = in_out == SOCK_IN ? &ntree->inputs : &ntree->outputs; bNodeSocket *iosock = ntree_get_active_interface_socket(sockets); - if (iosock == NULL) { + if (iosock == nullptr) { return OPERATOR_CANCELLED; } @@ -2453,7 +2454,7 @@ static int ntree_socket_move_exec(bContext *C, wmOperator *op) snode_notify(C, snode); snode_dag_update(C, snode); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -2486,18 +2487,18 @@ static bool node_shader_script_update_poll(bContext *C) /* test if we have a render engine that supports shaders scripts */ if (!(type && type->update_script_node)) { - return 0; + return false; } /* see if we have a shader script node in context */ - bNode *node = CTX_data_pointer_get_type(C, "node", &RNA_ShaderNodeScript).data; + bNode *node = (bNode *)CTX_data_pointer_get_type(C, "node", &RNA_ShaderNodeScript).data; if (!node && snode && snode->edittree) { node = nodeGetActive(snode->edittree); } if (node && node->type == SH_NODE_SCRIPT) { - NodeShaderScript *nss = node->storage; + NodeShaderScript *nss = (NodeShaderScript *)node->storage; if (node->id || nss->filepath[0]) { return ED_operator_node_editable(C); @@ -2505,14 +2506,14 @@ static bool node_shader_script_update_poll(bContext *C) } /* see if we have a text datablock in context */ - Text *text = CTX_data_pointer_get_type(C, "edit_text", &RNA_Text).data; + Text *text = (Text *)CTX_data_pointer_get_type(C, "edit_text", &RNA_Text).data; if (text) { - return 1; + return true; } /* we don't check if text datablock is actually in use, too slow for poll */ - return 0; + return false; } /* recursively check for script nodes in groups using this text and update */ @@ -2556,11 +2557,11 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op) engine->reports = op->reports; /* get node */ - bNodeTree *ntree_base = NULL; - bNode *node = NULL; + bNodeTree *ntree_base = nullptr; + bNode *node = nullptr; if (nodeptr.data) { ntree_base = (bNodeTree *)nodeptr.owner_id; - node = nodeptr.data; + node = (bNode *)nodeptr.data; } else if (snode && snode->edittree) { ntree_base = snode->edittree; @@ -2575,7 +2576,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op) } else { /* update all nodes using text datablock */ - Text *text = CTX_data_pointer_get_type(C, "edit_text", &RNA_Text).data; + Text *text = (Text *)CTX_data_pointer_get_type(C, "edit_text", &RNA_Text).data; if (text) { /* clear flags for recursion check */ @@ -2647,7 +2648,7 @@ static int viewer_border_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), bmain); Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); if (ibuf) { ARegion *region = CTX_wm_region(C); @@ -2683,7 +2684,7 @@ static int viewer_border_exec(bContext *C, wmOperator *op) } snode_notify(C, snode); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); } else { btree->flag &= ~NTREE_VIEWER_BORDER; @@ -2723,7 +2724,7 @@ static int clear_viewer_border_exec(bContext *C, wmOperator *UNUSED(op)) btree->flag &= ~NTREE_VIEWER_BORDER; snode_notify(C, snode); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -2749,11 +2750,11 @@ static int node_cryptomatte_add_socket_exec(bContext *C, wmOperator *UNUSED(op)) { SpaceNode *snode = CTX_wm_space_node(C); PointerRNA ptr = CTX_data_pointer_get(C, "node"); - bNodeTree *ntree = NULL; - bNode *node = NULL; + bNodeTree *ntree = nullptr; + bNode *node = nullptr; if (ptr.data) { - node = ptr.data; + node = (bNode *)ptr.data; ntree = (bNodeTree *)ptr.owner_id; } else if (snode && snode->edittree) { @@ -2793,11 +2794,11 @@ static int node_cryptomatte_remove_socket_exec(bContext *C, wmOperator *UNUSED(o { SpaceNode *snode = CTX_wm_space_node(C); PointerRNA ptr = CTX_data_pointer_get(C, "node"); - bNodeTree *ntree = NULL; - bNode *node = NULL; + bNodeTree *ntree = nullptr; + bNode *node = nullptr; if (ptr.data) { - node = ptr.data; + node = (bNode *)ptr.data; ntree = (bNodeTree *)ptr.owner_id; } else if (snode && snode->edittree) { diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.cc index 335e2f93ff3..c4880e1b49a 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.cc @@ -21,7 +21,7 @@ * \ingroup spnode */ -#include <stdlib.h> +#include <cstdlib> #include "MEM_guardedalloc.h" @@ -135,7 +135,7 @@ static bNode *node_group_get_active(bContext *C, const char *node_idname) if (node && STREQ(node->idname, node_idname)) { return node; } - return NULL; + return nullptr; } /** \} */ @@ -165,7 +165,7 @@ static int node_group_edit_exec(bContext *C, wmOperator *op) ED_node_tree_pop(snode); } - WM_event_add_notifier(C, NC_SCENE | ND_NODES, NULL); + WM_event_add_notifier(C, NC_SCENE | ND_NODES, nullptr); return OPERATOR_FINISHED; } @@ -200,7 +200,8 @@ void NODE_OT_group_edit(wmOperatorType *ot) static AnimationBasePathChange *animation_basepath_change_new(const char *src_basepath, const char *dst_basepath) { - AnimationBasePathChange *basepath_change = MEM_callocN(sizeof(*basepath_change), AT); + AnimationBasePathChange *basepath_change = (AnimationBasePathChange *)MEM_callocN( + sizeof(*basepath_change), AT); basepath_change->src_basepath = src_basepath; basepath_change->dst_basepath = dst_basepath; return basepath_change; @@ -220,11 +221,11 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) { /* clear new pointers, set in copytree */ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { - node->new_node = NULL; + node->new_node = nullptr; } - ListBase anim_basepaths = {NULL, NULL}; - LinkNode *nodes_delayed_free = NULL; + ListBase anim_basepaths = {nullptr, nullptr}; + LinkNode *nodes_delayed_free = nullptr; bNodeTree *ngroup = (bNodeTree *)gnode->id; /* wgroup is a temporary copy of the NodeTree we're merging in @@ -247,7 +248,7 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) /* keep track of this node's RNA "base" path (the part of the path identifying the node) * if the old nodetree has animation data which potentially covers this node */ - const char *old_animation_basepath = NULL; + const char *old_animation_basepath = nullptr; if (wgroup->adt) { PointerRNA ptr; RNA_pointer_create(&wgroup->id, &RNA_Node, node, &ptr); @@ -277,7 +278,7 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) node->flag |= NODE_SELECT; } - bNodeLink *glinks_first = ntree->links.last; + bNodeLink *glinks_first = (bNodeLink *)ntree->links.last; /* Add internal links to the ntree */ LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &wgroup->links) { @@ -285,10 +286,10 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) BLI_addtail(&ntree->links, link); } - bNodeLink *glinks_last = ntree->links.last; + bNodeLink *glinks_last = (bNodeLink *)ntree->links.last; /* and copy across the animation, - * note that the animation data's action can be NULL here */ + * note that the animation data's action can be nullptr here */ if (wgroup->adt) { bAction *waction; @@ -307,7 +308,7 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) /* free temp action too */ if (waction) { BKE_id_free(bmain, waction); - wgroup->adt->action = NULL; + wgroup->adt->action = nullptr; } } @@ -317,14 +318,14 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) /* restore external links to and from the gnode */ /* input links */ - if (glinks_first != NULL) { + if (glinks_first != nullptr) { for (bNodeLink *link = glinks_first->next; link != glinks_last->next; link = link->next) { if (link->fromnode->type == NODE_GROUP_INPUT) { const char *identifier = link->fromsock->identifier; int num_external_links = 0; /* find external links to this input */ - for (bNodeLink *tlink = ntree->links.first; tlink != glinks_first->next; + for (bNodeLink *tlink = (bNodeLink *)ntree->links.first; tlink != glinks_first->next; tlink = tlink->next) { if (tlink->tonode == gnode && STREQ(tlink->tosock->identifier, identifier)) { nodeAddLink(ntree, tlink->fromnode, tlink->fromsock, link->tonode, link->tosock); @@ -348,10 +349,11 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) } /* Also iterate over new links to cover passthrough links. */ - glinks_last = ntree->links.last; + glinks_last = (bNodeLink *)ntree->links.last; /* output links */ - for (bNodeLink *link = ntree->links.first; link != glinks_first->next; link = link->next) { + for (bNodeLink *link = (bNodeLink *)ntree->links.first; link != glinks_first->next; + link = link->next) { if (link->fromnode == gnode) { const char *identifier = link->fromsock->identifier; int num_internal_links = 0; @@ -384,7 +386,7 @@ static int node_group_ungroup(Main *bmain, bNodeTree *ntree, bNode *gnode) } while (nodes_delayed_free) { - bNode *node = BLI_linklist_pop(&nodes_delayed_free); + bNode *node = (bNode *)BLI_linklist_pop(&nodes_delayed_free); nodeRemoveNode(bmain, ntree, node, false); } @@ -455,10 +457,10 @@ static int node_group_separate_selected( /* clear new pointers, set in BKE_node_copy_ex(). */ LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) { - node->new_node = NULL; + node->new_node = nullptr; } - ListBase anim_basepaths = {NULL, NULL}; + ListBase anim_basepaths = {nullptr, nullptr}; /* add selected nodes into the ntree */ LISTBASE_FOREACH_MUTABLE (bNode *, node, &ngroup->nodes) { @@ -543,7 +545,7 @@ static int node_group_separate_selected( } /* and copy across the animation, - * note that the animation data's action can be NULL here */ + * note that the animation data's action can be nullptr here */ if (ngroup->adt) { /* now perform the moving */ BKE_animdata_transfer_by_basepath(bmain, &ngroup->id, &ntree->id, &anim_basepaths); @@ -562,16 +564,16 @@ static int node_group_separate_selected( return 1; } -typedef enum eNodeGroupSeparateType { +enum eNodeGroupSeparateType { NODE_GS_COPY, NODE_GS_MOVE, -} eNodeGroupSeparateType; +}; /* Operator Property */ static const EnumPropertyItem node_group_separate_types[] = { {NODE_GS_COPY, "COPY", 0, "Copy", "Copy to parent node tree, keep group intact"}, {NODE_GS_MOVE, "MOVE", 0, "Move", "Move to parent node tree, remove from group"}, - {0, NULL, 0, NULL, NULL}, + {0, nullptr, 0, nullptr, nullptr}, }; static int node_group_separate_exec(bContext *C, wmOperator *op) @@ -628,8 +630,8 @@ static int node_group_separate_invoke(bContext *C, uiLayout *layout = UI_popup_menu_layout(pup); uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); - uiItemEnumO(layout, "NODE_OT_group_separate", NULL, 0, "type", NODE_GS_COPY); - uiItemEnumO(layout, "NODE_OT_group_separate", NULL, 0, "type", NODE_GS_MOVE); + uiItemEnumO(layout, "NODE_OT_group_separate", nullptr, 0, "type", NODE_GS_COPY); + uiItemEnumO(layout, "NODE_OT_group_separate", nullptr, 0, "type", NODE_GS_MOVE); UI_popup_menu_end(C, pup); @@ -674,12 +676,12 @@ static bool node_group_make_test_selected(bNodeTree *ntree, int ok = true; /* make a local pseudo node tree to pass to the node poll functions */ - bNodeTree *ngroup = ntreeAddTree(NULL, "Pseudo Node Group", ntree_idname); + bNodeTree *ngroup = ntreeAddTree(nullptr, "Pseudo Node Group", ntree_idname); /* check poll functions for selected nodes */ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { if (node_group_make_use_node(node, gnode)) { - const char *disabled_hint = NULL; + const char *disabled_hint = nullptr; if (node->typeinfo->poll_instance && !node->typeinfo->poll_instance(node, ngroup, &disabled_hint)) { if (disabled_hint) { @@ -781,7 +783,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, expose_visible = true; } - ListBase anim_basepaths = {NULL, NULL}; + ListBase anim_basepaths = {nullptr, nullptr}; /* move nodes over */ LISTBASE_FOREACH_MUTABLE (bNode *, node, &ntree->nodes) { @@ -995,10 +997,10 @@ static bNode *node_group_make_from_selected(const bContext *C, Main *bmain = CTX_data_main(C); float min[2], max[2]; - const int totselect = node_get_selected_minmax(ntree, NULL, min, max, false); + const int totselect = node_get_selected_minmax(ntree, nullptr, min, max, false); /* don't make empty group */ if (totselect == 0) { - return NULL; + return nullptr; } /* new nodetree */ @@ -1029,7 +1031,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C)); - if (!node_group_make_test_selected(ntree, NULL, ntree_idname, op->reports)) { + if (!node_group_make_test_selected(ntree, nullptr, ntree_idname, op->reports)) { return OPERATOR_CANCELLED; } @@ -1042,7 +1044,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) if (ngroup) { ED_node_tree_push(snode, ngroup, gnode); LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) { - sort_multi_input_socket_links(snode, node, NULL, NULL); + sort_multi_input_socket_links(snode, node, nullptr, nullptr); } ntreeUpdateTree(bmain, ngroup); } diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.cc index 28c660b0632..212724dc39a 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.cc @@ -60,7 +60,7 @@ static bool ntree_has_drivers(bNodeTree *ntree) { const AnimData *adt = BKE_animdata_from_id(&ntree->id); - if (adt == NULL) { + if (adt == nullptr) { return false; } return !BLI_listbase_is_empty(&adt->drivers); @@ -102,7 +102,7 @@ static bool node_group_has_output_dfs(bNode *node) return false; } ntree->id.tag |= LIB_TAG_DOIT; - for (bNode *current_node = ntree->nodes.first; current_node != NULL; + for (bNode *current_node = (bNode *)ntree->nodes.first; current_node != nullptr; current_node = current_node->next) { if (current_node->type == NODE_GROUP) { if (current_node->id && node_group_has_output_dfs(current_node)) { @@ -120,7 +120,7 @@ static bool node_group_has_output(Main *bmain, bNode *node) { BLI_assert(ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP)); bNodeTree *ntree = (bNodeTree *)node->id; - if (ntree == NULL) { + if (ntree == nullptr) { return false; } BKE_main_id_tag_listbase(&bmain->nodetrees, LIB_TAG_DOIT, false); @@ -145,7 +145,7 @@ bool node_connected_to_output(Main *bmain, bNodeTree *ntree, bNode *node) * is connected to and so eventually. */ if (ELEM(current_node->type, NODE_GROUP, NODE_CUSTOM_GROUP)) { - if (current_node->id != NULL && ntree_has_drivers((bNodeTree *)current_node->id)) { + if (current_node->id != nullptr && ntree_has_drivers((bNodeTree *)current_node->id)) { return true; } if (ntree_check_nodes_connected(ntree, node, current_node) && @@ -164,12 +164,12 @@ bool node_connected_to_output(Main *bmain, bNodeTree *ntree, bNode *node) /* ****************** Add *********************** */ -typedef struct bNodeListItem { +struct bNodeListItem { struct bNodeListItem *next, *prev; struct bNode *node; -} bNodeListItem; +}; -typedef struct NodeInsertOfsData { +struct NodeInsertOfsData { bNodeTree *ntree; bNode *insert; /* inserted node */ bNode *prev, *next; /* prev/next node in the chain */ @@ -178,7 +178,7 @@ typedef struct NodeInsertOfsData { wmTimer *anim_timer; float offset_x; /* offset to apply to node chain */ -} NodeInsertOfsData; +}; static void clear_picking_highlight(ListBase *links) { @@ -189,8 +189,8 @@ static void clear_picking_highlight(ListBase *links) static LinkData *create_drag_link(Main *bmain, SpaceNode *snode, bNode *node, bNodeSocket *sock) { - LinkData *linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data"); - bNodeLink *oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link"); + LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); + bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); linkdata->data = oplink; if (sock->in_out == SOCK_OUT) { oplink->fromnode = node; @@ -225,10 +225,10 @@ static void pick_link(const bContext *C, BLI_addtail(&nldrag->links, linkdata); nodeRemLink(snode->edittree, link_to_pick); - BLI_assert(nldrag->last_node_hovered_while_dragging_a_link != NULL); + BLI_assert(nldrag->last_node_hovered_while_dragging_a_link != nullptr); sort_multi_input_socket_links( - snode, nldrag->last_node_hovered_while_dragging_a_link, NULL, NULL); + snode, nldrag->last_node_hovered_while_dragging_a_link, nullptr, nullptr); /* Send changed event to original link->tonode. */ if (node) { @@ -256,7 +256,7 @@ static void pick_input_link_by_link_intersect(const bContext *C, const int resolution = NODE_LINK_RESOL; - bNodeLink *link_to_pick = NULL; + bNodeLink *link_to_pick = nullptr; clear_picking_highlight(&snode->edittree->links); LISTBASE_FOREACH (bNodeLink *, link, &snode->edittree->links) { if (link->tosock == socket) { @@ -305,8 +305,8 @@ static void pick_input_link_by_link_intersect(const bContext *C, static int sort_nodes_locx(const void *a, const void *b) { - const bNodeListItem *nli1 = a; - const bNodeListItem *nli2 = b; + const bNodeListItem *nli1 = (const bNodeListItem *)a; + const bNodeListItem *nli2 = (const bNodeListItem *)b; const bNode *node1 = nli1->node; const bNode *node2 = nli2->node; @@ -319,14 +319,14 @@ static int sort_nodes_locx(const void *a, const void *b) static bool socket_is_available(bNodeTree *UNUSED(ntree), bNodeSocket *sock, const bool allow_used) { if (nodeSocketIsHidden(sock)) { - return 0; + return false; } if (!allow_used && (sock->flag & SOCK_IN_USE)) { - return 0; + return false; } - return 1; + return true; } static bNodeSocket *best_socket_output(bNodeTree *ntree, @@ -374,10 +374,10 @@ static bNodeSocket *best_socket_output(bNodeTree *ntree, /* Always allow linking to an reroute node. The socket type of the reroute sockets might change * after the link has been created. */ if (node->type == NODE_REROUTE) { - return node->outputs.first; + return (bNodeSocket *)node->outputs.first; } - return NULL; + return nullptr; } /* this is a bit complicated, but designed to prioritize finding @@ -409,7 +409,7 @@ static bNodeSocket *best_socket_input(bNodeTree *ntree, bNode *node, int num, in } } - return NULL; + return nullptr; } static bool snode_autoconnect_input(SpaceNode *snode, @@ -430,10 +430,10 @@ static bool snode_autoconnect_input(SpaceNode *snode, return true; } -typedef struct LinkAndPosition { +struct LinkAndPosition { struct bNodeLink *link; float multi_socket_position[2]; -} LinkAndPosition; +}; static int compare_link_by_y_position(const void *a, const void *b) { @@ -457,14 +457,14 @@ void sort_multi_input_socket_links(SpaceNode *snode, } /* The total is calculated in #node_update_nodetree, which runs before this draw step. */ int total_inputs = socket->total_inputs + 1; - struct LinkAndPosition **input_links = MEM_malloc_arrayN( + struct LinkAndPosition **input_links = (LinkAndPosition **)MEM_malloc_arrayN( total_inputs, sizeof(LinkAndPosition *), __func__); int index = 0; LISTBASE_FOREACH (bNodeLink *, link, &snode->edittree->links) { if (link->tosock == socket) { - struct LinkAndPosition *link_and_position = MEM_callocN(sizeof(struct LinkAndPosition), - __func__); + struct LinkAndPosition *link_and_position = (LinkAndPosition *)MEM_callocN( + sizeof(struct LinkAndPosition), __func__); link_and_position->link = link; node_link_calculate_multi_input_position(link->tosock->locx, link->tosock->locy, @@ -477,7 +477,8 @@ void sort_multi_input_socket_links(SpaceNode *snode, } if (drag_link) { - LinkAndPosition *link_and_position = MEM_callocN(sizeof(LinkAndPosition), __func__); + LinkAndPosition *link_and_position = (LinkAndPosition *)MEM_callocN(sizeof(LinkAndPosition), + __func__); link_and_position->link = drag_link; copy_v2_v2(link_and_position->multi_socket_position, cursor); input_links[index] = link_and_position; @@ -505,11 +506,12 @@ static void snode_autoconnect(Main *bmain, const bool replace) { bNodeTree *ntree = snode->edittree; - ListBase *nodelist = MEM_callocN(sizeof(ListBase), "items_list"); + ListBase *nodelist = (ListBase *)MEM_callocN(sizeof(ListBase), "items_list"); LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { if (node->flag & NODE_SELECT) { - bNodeListItem *nli = MEM_mallocN(sizeof(bNodeListItem), "temporary node list item"); + bNodeListItem *nli = (bNodeListItem *)MEM_mallocN(sizeof(bNodeListItem), + "temporary node list item"); nli->node = node; BLI_addtail(nodelist, nli); } @@ -522,7 +524,7 @@ static void snode_autoconnect(Main *bmain, LISTBASE_FOREACH (bNodeListItem *, nli, nodelist) { bool has_selected_inputs = false; - if (nli->next == NULL) { + if (nli->next == nullptr) { break; } @@ -536,7 +538,7 @@ static void snode_autoconnect(Main *bmain, /* if there are selected sockets, connect those */ LISTBASE_FOREACH (bNodeSocket *, sock_to, &node_to->inputs) { if (sock_to->flag & SELECT) { - has_selected_inputs = 1; + has_selected_inputs = true; if (!socket_is_available(ntree, sock_to, replace)) { continue; @@ -595,7 +597,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode) SpaceNode *snode = CTX_wm_space_node(C); /* context check */ - if (tonode == NULL || BLI_listbase_is_empty(&tonode->outputs)) { + if (tonode == nullptr || BLI_listbase_is_empty(&tonode->outputs)) { return OPERATOR_CANCELLED; } if (ELEM(tonode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { @@ -603,7 +605,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode) } /* get viewer */ - bNode *viewer_node = NULL; + bNode *viewer_node = nullptr; LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) { if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { if (node->flag & NODE_DO_OUTPUT) { @@ -613,7 +615,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode) } } /* no viewer, we make one active */ - if (viewer_node == NULL) { + if (viewer_node == nullptr) { LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) { if (ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { node->flag |= NODE_DO_OUTPUT; @@ -623,14 +625,14 @@ static int node_link_viewer(const bContext *C, bNode *tonode) } } - bNodeSocket *sock = NULL; - bNodeLink *link = NULL; + bNodeSocket *sock = nullptr; + bNodeLink *link = nullptr; /* try to find an already connected socket to cycle to the next */ if (viewer_node) { - link = NULL; + link = nullptr; - for (link = snode->edittree->links.first; link; link = link->next) { + for (link = (bNodeLink *)snode->edittree->links.first; link; link = link->next) { if (link->tonode == viewer_node && link->fromnode == tonode) { if (link->tosock == viewer_node->inputs.first) { break; @@ -663,7 +665,7 @@ static int node_link_viewer(const bContext *C, bNode *tonode) /* find a socket starting from the first socket */ if (!sock) { - for (sock = tonode->outputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)tonode->outputs.first; sock; sock = sock->next) { if (!nodeSocketIsHidden(sock)) { break; } @@ -674,24 +676,25 @@ static int node_link_viewer(const bContext *C, bNode *tonode) /* add a new viewer if none exists yet */ if (!viewer_node) { /* XXX location is a quick hack, just place it next to the linked socket */ - viewer_node = node_add_node(C, NULL, CMP_NODE_VIEWER, sock->locx + 100, sock->locy); + viewer_node = node_add_node(C, nullptr, CMP_NODE_VIEWER, sock->locx + 100, sock->locy); if (!viewer_node) { return OPERATOR_CANCELLED; } - link = NULL; + link = nullptr; } else { /* get link to viewer */ - for (link = snode->edittree->links.first; link; link = link->next) { + for (link = (bNodeLink *)snode->edittree->links.first; link; link = link->next) { if (link->tonode == viewer_node && link->tosock == viewer_node->inputs.first) { break; } } } - if (link == NULL) { - nodeAddLink(snode->edittree, tonode, sock, viewer_node, viewer_node->inputs.first); + if (link == nullptr) { + nodeAddLink( + snode->edittree, tonode, sock, viewer_node, (bNodeSocket *)viewer_node->inputs.first); } else { link->fromnode = tonode; @@ -779,7 +782,7 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeLink *link) if (tlink && tlink->fromsock == from) { if (from_count > from_link_limit) { nodeRemLink(ntree, tlink); - tlink = NULL; + tlink = nullptr; from_count--; } } @@ -787,13 +790,13 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeLink *link) if (tlink && tlink->tosock == to) { if (to_count > to_link_limit) { nodeRemLink(ntree, tlink); - tlink = NULL; + tlink = nullptr; to_count--; } else if (tlink->fromsock == from) { /* Also remove link if it comes from the same output. */ nodeRemLink(ntree, tlink); - tlink = NULL; + tlink = nullptr; to_count--; from_count--; } @@ -806,13 +809,13 @@ static void node_link_exit(bContext *C, wmOperator *op, bool apply_links) Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); bNodeTree *ntree = snode->edittree; - bNodeLinkDrag *nldrag = op->customdata; + bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata; bool do_tag_update = false; /* avoid updates while applying links */ ntree->is_updating = true; LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { - bNodeLink *link = linkdata->data; + bNodeLink *link = (bNodeLink *)linkdata->data; /* See note below, but basically TEST flag means that the link * was connected to output (or to a node which affects the @@ -867,14 +870,14 @@ static void node_link_exit(bContext *C, wmOperator *op, bool apply_links) static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2]) { SpaceNode *snode = CTX_wm_space_node(C); - bNodeLinkDrag *nldrag = op->customdata; + bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata; if (nldrag->in_out == SOCK_OUT) { bNode *tnode; - bNodeSocket *tsock = NULL; + bNodeSocket *tsock = nullptr; if (node_find_indicated_socket(snode, &tnode, &tsock, cursor, SOCK_IN)) { LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { - bNodeLink *link = linkdata->data; + bNodeLink *link = (bNodeLink *)linkdata->data; /* skip if socket is on the same node as the fromsock */ if (tnode && link->fromnode == tnode) { @@ -882,7 +885,7 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2]) } /* Skip if tsock is already linked with this output. */ - bNodeLink *existing_link_connected_to_fromsock = NULL; + bNodeLink *existing_link_connected_to_fromsock = nullptr; LISTBASE_FOREACH (bNodeLink *, existing_link, &snode->edittree->links) { if (existing_link->fromsock == link->fromsock && existing_link->tosock == tsock) { existing_link_connected_to_fromsock = existing_link; @@ -906,22 +909,22 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2]) } else { LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { - bNodeLink *link = linkdata->data; + bNodeLink *link = (bNodeLink *)linkdata->data; if (nldrag->last_node_hovered_while_dragging_a_link) { sort_multi_input_socket_links( - snode, nldrag->last_node_hovered_while_dragging_a_link, NULL, cursor); + snode, nldrag->last_node_hovered_while_dragging_a_link, nullptr, cursor); } - link->tonode = NULL; - link->tosock = NULL; + link->tonode = nullptr; + link->tosock = nullptr; } } } else { bNode *tnode; - bNodeSocket *tsock = NULL; + bNodeSocket *tsock = nullptr; if (node_find_indicated_socket(snode, &tnode, &tsock, cursor, SOCK_OUT)) { LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { - bNodeLink *link = linkdata->data; + bNodeLink *link = (bNodeLink *)linkdata->data; /* skip if this is already the target socket */ if (link->fromsock == tsock) { @@ -939,10 +942,10 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2]) } else { LISTBASE_FOREACH (LinkData *, linkdata, &nldrag->links) { - bNodeLink *link = linkdata->data; + bNodeLink *link = (bNodeLink *)linkdata->data; - link->fromnode = NULL; - link->fromsock = NULL; + link->fromnode = nullptr; + link->fromsock = nullptr; } } } @@ -952,7 +955,7 @@ static void node_link_find_socket(bContext *C, wmOperator *op, float cursor[2]) /* in_out = starting socket */ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event) { - bNodeLinkDrag *nldrag = op->customdata; + bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata; ARegion *region = CTX_wm_region(C); float cursor[2]; @@ -977,7 +980,7 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_RELEASE) { node_link_exit(C, op, true); - ED_workspace_status_text(C, NULL); + ED_workspace_status_text(C, nullptr); ED_region_tag_redraw(region); SpaceNode *snode = CTX_wm_space_node(C); clear_picking_highlight(&snode->edittree->links); @@ -993,13 +996,13 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event) /* return 1 when socket clicked */ static bNodeLinkDrag *node_link_init(Main *bmain, SpaceNode *snode, float cursor[2], bool detach) { - bNodeLinkDrag *nldrag = NULL; + bNodeLinkDrag *nldrag = nullptr; /* output indicated? */ bNode *node; bNodeSocket *sock; if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_OUT)) { - nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata"); + nldrag = (bNodeLinkDrag *)MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata"); const int num_links = nodeCountSocketLinks(snode->edittree, sock); int link_limit = nodeSocketLinkLimit(sock); @@ -1009,11 +1012,11 @@ static bNodeLinkDrag *node_link_init(Main *bmain, SpaceNode *snode, float cursor /* detach current links and store them in the operator data */ LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &snode->edittree->links) { if (link->fromsock == sock) { - LinkData *linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data"); - bNodeLink *oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link"); + LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); + bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); linkdata->data = oplink; *oplink = *link; - oplink->next = oplink->prev = NULL; + oplink->next = oplink->prev = nullptr; oplink->flag |= NODE_LINK_VALID; /* The link could be disconnected and in that case we @@ -1043,7 +1046,7 @@ static bNodeLinkDrag *node_link_init(Main *bmain, SpaceNode *snode, float cursor } /* or an input? */ else if (node_find_indicated_socket(snode, &node, &sock, cursor, SOCK_IN)) { - nldrag = MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata"); + nldrag = (bNodeLinkDrag *)MEM_callocN(sizeof(bNodeLinkDrag), "drag link op customdata"); nldrag->last_node_hovered_while_dragging_a_link = node; const int num_links = nodeCountSocketLinks(snode->edittree, sock); @@ -1061,12 +1064,12 @@ static bNodeLinkDrag *node_link_init(Main *bmain, SpaceNode *snode, float cursor } } - if (link_to_pick != NULL && !nldrag->from_multi_input_socket) { - LinkData *linkdata = MEM_callocN(sizeof(LinkData), "drag link op link data"); - bNodeLink *oplink = MEM_callocN(sizeof(bNodeLink), "drag link op link"); + if (link_to_pick != nullptr && !nldrag->from_multi_input_socket) { + LinkData *linkdata = (LinkData *)MEM_callocN(sizeof(LinkData), "drag link op link data"); + bNodeLink *oplink = (bNodeLink *)MEM_callocN(sizeof(bNodeLink), "drag link op link"); linkdata->data = oplink; *oplink = *link_to_pick; - oplink->next = oplink->prev = NULL; + oplink->next = oplink->prev = nullptr; oplink->flag |= NODE_LINK_VALID; oplink->flag &= ~NODE_LINK_TEST; if (node_connected_to_output(bmain, snode->edittree, link_to_pick->tonode)) { @@ -1127,7 +1130,7 @@ static int node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event) static void node_link_cancel(bContext *C, wmOperator *op) { SpaceNode *snode = CTX_wm_space_node(C); - bNodeLinkDrag *nldrag = op->customdata; + bNodeLinkDrag *nldrag = (bNodeLinkDrag *)op->customdata; BLI_remlink(&snode->runtime->linkdrag, nldrag); @@ -1167,7 +1170,7 @@ void NODE_OT_link(wmOperatorType *ot) RNA_def_float_array(ot->srna, "drag_start", 2, - 0, + nullptr, -UI_PRECISION_FLOAT_MAX, UI_PRECISION_FLOAT_MAX, "Drag Start", @@ -1189,11 +1192,11 @@ static int node_make_link_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(CTX_wm_manager(C), bmain); - snode_autoconnect(bmain, snode, 1, replace); + snode_autoconnect(bmain, snode, true, replace); /* deselect sockets after linking */ - node_deselect_all_input_sockets(snode, 0); - node_deselect_all_output_sockets(snode, 0); + node_deselect_all_input_sockets(snode, false); + node_deselect_all_output_sockets(snode, false); ntreeUpdateTree(CTX_data_main(C), snode->edittree); snode_notify(C, snode); @@ -1218,7 +1221,7 @@ void NODE_OT_link_make(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; RNA_def_boolean( - ot->srna, "replace", 0, "Replace", "Replace socket connections with the new links"); + ot->srna, "replace", false, "Replace", "Replace socket connections with the new links"); } /* ********************** Node Link Intersect ***************** */ @@ -1226,16 +1229,16 @@ static bool node_links_intersect(bNodeLink *link, const float mcoords[][2], int { float coord_array[NODE_LINK_RESOL + 1][2]; - if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) { + if (node_link_bezier_points(nullptr, nullptr, link, coord_array, NODE_LINK_RESOL)) { for (int i = 0; i < tot - 1; i++) { for (int b = 0; b < NODE_LINK_RESOL; b++) { if (isect_seg_seg_v2(mcoords[i], mcoords[i + 1], coord_array[b], coord_array[b + 1]) > 0) { - return 1; + return true; } } } } - return 0; + return false; } /* ********************** Cut Link operator ***************** */ @@ -1285,7 +1288,7 @@ static int cut_links_exec(bContext *C, wmOperator *op) snode_update(snode, link->tonode); bNode *to_node = link->tonode; nodeRemLink(snode->edittree, link); - sort_multi_input_socket_links(snode, to_node, NULL, NULL); + sort_multi_input_socket_links(snode, to_node, nullptr, nullptr); } } @@ -1324,7 +1327,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) /* properties */ PropertyRNA *prop; prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); /* internal */ RNA_def_int(ot->srna, "cursor", WM_CURSOR_KNIFE, 0, INT_MAX, "Cursor", "", 0, INT_MAX); @@ -1426,7 +1429,7 @@ void NODE_OT_links_mute(wmOperatorType *ot) /* properties */ PropertyRNA *prop; prop = RNA_def_collection_runtime(ot->srna, "path", &RNA_OperatorMousePath, "Path", ""); - RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); /* internal */ RNA_def_int(ot->srna, "cursor", WM_CURSOR_MUTE, 0, INT_MAX, "Cursor", "", 0, INT_MAX); @@ -1491,7 +1494,7 @@ static int node_parent_set_exec(bContext *C, wmOperator *UNUSED(op)) } ED_node_sort(ntree); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1563,7 +1566,7 @@ static int node_join_exec(bContext *C, wmOperator *UNUSED(op)) } } - bNode *frame = node_add_node(C, NULL, NODE_FRAME, 0.0f, 0.0f); + bNode *frame = node_add_node(C, nullptr, NODE_FRAME, 0.0f, 0.0f); /* reset tags */ LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { @@ -1584,7 +1587,7 @@ static int node_join_exec(bContext *C, wmOperator *UNUSED(op)) } ED_node_sort(ntree); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1624,7 +1627,7 @@ static bNode *node_find_frame_to_attach(ARegion *region, } } - return NULL; + return nullptr; } static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) @@ -1637,7 +1640,7 @@ static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent if (frame) { LISTBASE_FOREACH_BACKWARD (bNode *, node, &ntree->nodes) { if (node->flag & NODE_SELECT) { - if (node->parent == NULL) { + if (node->parent == nullptr) { /* disallow moving a parent into its child */ if (nodeAttachNodeCheck(frame, node) == false) { /* attach all unparented nodes */ @@ -1666,7 +1669,7 @@ static int node_attach_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent } ED_node_sort(ntree); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1738,7 +1741,7 @@ static int node_detach_exec(bContext *C, wmOperator *UNUSED(op)) } ED_node_sort(ntree); - WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, NULL); + WM_event_add_notifier(C, NC_NODE | ND_DISPLAY, nullptr); return OPERATOR_FINISHED; } @@ -1766,13 +1769,13 @@ static bool ed_node_link_conditions(ScrArea *area, SpaceNode **r_snode, bNode **r_select) { - SpaceNode *snode = area ? area->spacedata.first : NULL; + SpaceNode *snode = area ? (SpaceNode *)area->spacedata.first : nullptr; *r_snode = snode; - *r_select = NULL; + *r_select = nullptr; /* no unlucky accidents */ - if (area == NULL || area->spacetype != SPACE_NODE) { + if (area == nullptr || area->spacetype != SPACE_NODE) { return false; } @@ -1782,8 +1785,8 @@ static bool ed_node_link_conditions(ScrArea *area, } bNode *node; - bNode *select = NULL; - for (node = snode->edittree->nodes.first; node; node = node->next) { + bNode *select = nullptr; + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if (node->flag & SELECT) { if (select) { break; @@ -1792,7 +1795,7 @@ static bool ed_node_link_conditions(ScrArea *area, } } /* only one selected */ - if (node || select == NULL) { + if (node || select == nullptr) { return false; } @@ -1835,7 +1838,7 @@ void ED_node_link_intersect_test(ScrArea *area, int test) } /* find link to select/highlight */ - bNodeLink *selink = NULL; + bNodeLink *selink = nullptr; float dist_best = FLT_MAX; LISTBASE_FOREACH (bNodeLink *, link, &snode->edittree->links) { float coord_array[NODE_LINK_RESOL + 1][2]; @@ -1844,7 +1847,7 @@ void ED_node_link_intersect_test(ScrArea *area, int test) continue; } - if (node_link_bezier_points(NULL, NULL, link, coord_array, NODE_LINK_RESOL)) { + if (node_link_bezier_points(nullptr, nullptr, link, coord_array, NODE_LINK_RESOL)) { float dist = FLT_MAX; /* loop over link coords to find shortest dist to @@ -1939,7 +1942,7 @@ static bNodeSocket *get_main_socket(ListBase *sockets) } } - return NULL; + return nullptr; } static bool node_parents_offset_flag_enable_cb(bNode *parent, void *UNUSED(userdata)) @@ -1985,7 +1988,7 @@ static bool node_link_insert_offset_frame_chain_cb(bNode *fromnode, void *userdata, const bool reversed) { - NodeInsertOfsData *data = userdata; + NodeInsertOfsData *data = (NodeInsertOfsData *)userdata; bNode *ofs_node = reversed ? fromnode : tonode; if (ofs_node->parent && ofs_node->parent != data->insert_parent) { @@ -2022,7 +2025,7 @@ static bool node_link_insert_offset_chain_cb(bNode *fromnode, void *userdata, const bool reversed) { - NodeInsertOfsData *data = userdata; + NodeInsertOfsData *data = (NodeInsertOfsData *)userdata; bNode *ofs_node = reversed ? fromnode : tonode; if (data->insert_parent) { @@ -2035,7 +2038,7 @@ static bool node_link_insert_offset_chain_cb(bNode *fromnode, } if (nodeIsChildOf(data->insert_parent, ofs_node) == false) { - data->insert_parent = NULL; + data->insert_parent = nullptr; } } else if (ofs_node->parent) { @@ -2086,7 +2089,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd, rctf totr_frame; /* check nodes front to back */ - for (frame = ntree->nodes.last; frame; frame = frame->prev) { + for (frame = (bNode *)ntree->nodes.last; frame; frame = frame->prev) { /* skip selected, those are the nodes we want to attach */ if ((frame->type != NODE_FRAME) || (frame->flag & NODE_SELECT)) { continue; @@ -2152,7 +2155,7 @@ static void node_link_insert_offset_ntree(NodeInsertOfsData *iofsd, iofsd->offset_x = margin; /* flag all parents of insert as offset to prevent them from being offset */ - nodeParentsIter(insert, node_parents_offset_flag_enable_cb, NULL); + nodeParentsIter(insert, node_parents_offset_flag_enable_cb, nullptr); /* iterate over entire chain and apply offsets */ nodeChainIter(ntree, right_alignment ? next : prev, @@ -2173,7 +2176,8 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w NodeInsertOfsData *iofsd = snode->runtime->iofsd; bool redraw = false; - if (!snode || event->type != TIMER || iofsd == NULL || iofsd->anim_timer != event->customdata) { + if (!snode || event->type != TIMER || iofsd == nullptr || + iofsd->anim_timer != event->customdata) { return OPERATOR_PASS_THROUGH; } @@ -2203,13 +2207,13 @@ static int node_insert_offset_modal(bContext *C, wmOperator *UNUSED(op), const w /* end timer + free insert offset data */ if (duration > NODE_INSOFS_ANIM_DURATION) { - WM_event_remove_timer(CTX_wm_manager(C), NULL, iofsd->anim_timer); + WM_event_remove_timer(CTX_wm_manager(C), nullptr, iofsd->anim_timer); LISTBASE_FOREACH (bNode *, node, &snode->edittree->nodes) { node->anim_init_locx = node->anim_ofsx = 0.0f; } - snode->runtime->iofsd = NULL; + snode->runtime->iofsd = nullptr; MEM_freeN(iofsd); return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH); @@ -2270,7 +2274,7 @@ void ED_node_link_insert(Main *bmain, ScrArea *area) /* get the link */ bNodeLink *link; - for (link = snode->edittree->links.first; link; link = link->next) { + for (link = (bNodeLink *)snode->edittree->links.first; link; link = link->next) { if (link->flag & NODE_LINKFLAG_HILITE) { break; } @@ -2298,7 +2302,8 @@ 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 = MEM_callocN(sizeof(NodeInsertOfsData), __func__); + NodeInsertOfsData *iofsd = (NodeInsertOfsData *)MEM_callocN(sizeof(NodeInsertOfsData), + __func__); iofsd->insert = select; iofsd->prev = link->fromnode; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.cc index de63aa07acb..41820cd813c 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.cc @@ -21,7 +21,8 @@ * \ingroup spnode */ -#include <stdlib.h> +#include <array> +#include <cstdlib> #include "DNA_node_types.h" #include "DNA_windowmanager_types.h" @@ -81,7 +82,7 @@ static bool has_workbench_in_texture_color(const wmWindowManager *wm, const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { if (area->spacetype == SPACE_VIEW3D) { - const View3D *v3d = area->spacedata.first; + const View3D *v3d = (const View3D *)area->spacedata.first; if (ED_view3d_has_workbench_in_texture_color(scene, ob, v3d)) { return true; @@ -100,28 +101,28 @@ static bNode *node_under_mouse_select(bNodeTree *ntree, int mx, int my) { bNode *node; - for (node = ntree->nodes.last; node; node = node->prev) { + for (node = (bNode *)ntree->nodes.last; node; node = node->prev) { if (node->typeinfo->select_area_func) { if (node->typeinfo->select_area_func(node, mx, my)) { return node; } } } - return NULL; + return nullptr; } static bNode *node_under_mouse_tweak(bNodeTree *ntree, int mx, int my) { bNode *node; - for (node = ntree->nodes.last; node; node = node->prev) { + for (node = (bNode *)ntree->nodes.last; node; node = node->prev) { if (node->typeinfo->tweak_area_func) { if (node->typeinfo->tweak_area_func(node, mx, my)) { return node; } } } - return NULL; + return nullptr; } static bool is_position_over_node_or_socket(SpaceNode *snode, float mouse[2]) @@ -168,18 +169,18 @@ void node_socket_deselect(bNode *node, bNodeSocket *sock, const bool deselect_no sock->flag &= ~SELECT; if (node && deselect_node) { - bool sel = 0; + bool sel = false; /* if no selected sockets remain, also deselect the node */ - for (sock = node->inputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { if (sock->flag & SELECT) { - sel = 1; + sel = true; break; } } - for (sock = node->outputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->outputs.first; sock; sock = sock->next) { if (sock->flag & SELECT) { - sel = 1; + sel = true; break; } } @@ -205,7 +206,7 @@ void node_deselect_all(SpaceNode *snode) { bNode *node; - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { nodeSetSelected(node, false); } } @@ -220,16 +221,16 @@ void node_deselect_all_input_sockets(SpaceNode *snode, const bool deselect_nodes * We can do that more efficiently here. */ - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { int sel = 0; - for (sock = node->inputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { sock->flag &= ~SELECT; } /* if no selected sockets remain, also deselect the node */ if (deselect_nodes) { - for (sock = node->outputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->outputs.first; sock; sock = sock->next) { if (sock->flag & SELECT) { sel = 1; break; @@ -253,18 +254,18 @@ void node_deselect_all_output_sockets(SpaceNode *snode, const bool deselect_node * We can do that more efficiently here. */ - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { bool sel = false; - for (sock = node->outputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->outputs.first; sock; sock = sock->next) { sock->flag &= ~SELECT; } /* if no selected sockets remain, also deselect the node */ if (deselect_nodes) { - for (sock = node->inputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { if (sock->flag & SELECT) { - sel = 1; + sel = true; break; } } @@ -289,7 +290,7 @@ static bool node_select_grouped_type(SpaceNode *snode, bNode *node_act) bNode *node; bool changed = false; - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if ((node->flag & SELECT) == 0) { if (node->type == node_act->type) { nodeSetSelected(node, true); @@ -306,7 +307,7 @@ static bool node_select_grouped_color(SpaceNode *snode, bNode *node_act) bNode *node; bool changed = false; - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if ((node->flag & SELECT) == 0) { if (compare_v3v3(node->color, node_act->color, 0.005f)) { nodeSetSelected(node, true); @@ -327,7 +328,7 @@ static bool node_select_grouped_name(SpaceNode *snode, bNode *node_act, const bo const char *sep, *suf_act, *suf_curr; pref_len_act = BLI_str_partition_ex_utf8( - node_act->name, NULL, delims, &sep, &suf_act, from_right); + node_act->name, nullptr, delims, &sep, &suf_act, from_right); /* Note: in case we are searching for suffix, and found none, use whole name as suffix. */ if (from_right && !(sep && suf_act)) { @@ -335,12 +336,12 @@ static bool node_select_grouped_name(SpaceNode *snode, bNode *node_act, const bo suf_act = node_act->name; } - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if (node->flag & SELECT) { continue; } pref_len_curr = BLI_str_partition_ex_utf8( - node->name, NULL, delims, &sep, &suf_curr, from_right); + node->name, nullptr, delims, &sep, &suf_curr, from_right); /* Same as with active node name! */ if (from_right && !(sep && suf_curr)) { @@ -371,7 +372,7 @@ static int node_select_grouped_exec(bContext *C, wmOperator *op) SpaceNode *snode = CTX_wm_space_node(C); bNode *node_act = nodeGetActive(snode->edittree); - if (node_act == NULL) { + if (node_act == nullptr) { return OPERATOR_CANCELLED; } @@ -381,7 +382,7 @@ static int node_select_grouped_exec(bContext *C, wmOperator *op) const int type = RNA_enum_get(op->ptr, "type"); if (!extend) { - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { nodeSetSelected(node, false); } } @@ -406,7 +407,7 @@ static int node_select_grouped_exec(bContext *C, wmOperator *op) if (changed) { ED_node_sort(snode->edittree); - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -420,7 +421,7 @@ void NODE_OT_select_grouped(wmOperatorType *ot) {NODE_SELECT_GROUPED_COLOR, "COLOR", 0, "Color", ""}, {NODE_SELECT_GROUPED_PREFIX, "PREFIX", 0, "Prefix", ""}, {NODE_SELECT_GROUPED_SUFIX, "SUFFIX", 0, "Suffix", ""}, - {0, NULL, 0, NULL, NULL}, + {0, nullptr, 0, nullptr, nullptr}, }; /* identifiers */ @@ -461,7 +462,7 @@ void node_select_single(bContext *C, bNode *node) bool active_texture_changed = false; bNode *tnode; - for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) { + for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) { if (tnode != node) { nodeSetSelected(tnode, false); } @@ -476,7 +477,7 @@ void node_select_single(bContext *C, bNode *node) DEG_id_tag_update(&snode->edittree->id, ID_RECALC_COPY_ON_WRITE); } - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); } static int node_mouse_select(bContext *C, @@ -491,7 +492,7 @@ static int node_mouse_select(bContext *C, const Scene *scene = CTX_data_scene(C); const wmWindowManager *wm = CTX_wm_manager(C); bNode *node, *tnode; - bNodeSocket *sock = NULL; + bNodeSocket *sock = nullptr; bNodeSocket *tsock; float cursor[2]; int ret_value = OPERATOR_CANCELLED; @@ -530,7 +531,7 @@ static int node_mouse_select(bContext *C, /* Only allow one selected output per node, for sensible linking. * Allow selecting outputs from different nodes though, if extend is true. */ if (node) { - for (tsock = node->outputs.first; tsock; tsock = tsock->next) { + for (tsock = (bNodeSocket *)node->outputs.first; tsock; tsock = tsock->next) { if (tsock == sock) { continue; } @@ -538,11 +539,11 @@ static int node_mouse_select(bContext *C, } } if (!extend) { - for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) { + for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) { if (tnode == node) { continue; } - for (tsock = tnode->outputs.first; tsock; tsock = tsock->next) { + for (tsock = (bNodeSocket *)tnode->outputs.first; tsock; tsock = tsock->next) { node_socket_deselect(tnode, tsock, true); } } @@ -558,7 +559,7 @@ static int node_mouse_select(bContext *C, node = node_under_mouse_select(snode->edittree, (int)cursor[0], (int)cursor[1]); if (extend) { - if (node != NULL) { + if (node != nullptr) { /* If node is selected but not active, we want to make it active, * but not toggle (deselect) it. */ if (!((node->flag & SELECT) && (node->flag & NODE_ACTIVE) == 0)) { @@ -567,7 +568,7 @@ static int node_mouse_select(bContext *C, ret_value = OPERATOR_FINISHED; } } - else if (deselect_all && node == NULL) { + else if (deselect_all && node == nullptr) { /* Rather than deselecting others, users may want to drag to box-select (drag from empty * space) or tweak-translate an already selected item. If these cases may apply, delay * deselection. */ @@ -576,13 +577,13 @@ static int node_mouse_select(bContext *C, } else { /* Deselect in empty space. */ - for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) { + for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) { nodeSetSelected(tnode, false); } ret_value = OPERATOR_FINISHED; } } - else if (node != NULL) { + else if (node != nullptr) { /* When clicking on an already selected node, we want to wait to deselect * others and allow the user to start moving the node without that. */ if (wait_to_deselect_others && (node->flag & SELECT)) { @@ -591,7 +592,7 @@ static int node_mouse_select(bContext *C, else { nodeSetSelected(node, true); - for (tnode = snode->edittree->nodes.first; tnode; tnode = tnode->next) { + for (tnode = (bNode *)snode->edittree->nodes.first; tnode; tnode = tnode->next) { if (tnode != node) { nodeSetSelected(tnode, false); } @@ -605,7 +606,7 @@ static int node_mouse_select(bContext *C, /* update node order */ if (ret_value != OPERATOR_CANCELLED) { bool active_texture_changed = false; - if (node != NULL && ret_value != OPERATOR_RUNNING_MODAL) { + if (node != nullptr && ret_value != OPERATOR_RUNNING_MODAL) { ED_node_set_active(bmain, snode->edittree, node, &active_texture_changed); } ED_node_set_active_viewer_key(snode); @@ -614,7 +615,7 @@ static int node_mouse_select(bContext *C, DEG_id_tag_update(&snode->edittree->id, ID_RECALC_COPY_ON_WRITE); } - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); } return ret_value; @@ -681,7 +682,7 @@ static int node_box_select_exec(bContext *C, wmOperator *op) WM_operator_properties_border_to_rctf(op, &rectf); UI_view2d_region_to_view_rctf(®ion->v2d, &rectf, &rectf); - const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); + const eSelectOp sel_op = (eSelectOp)RNA_enum_get(op->ptr, "mode"); const bool select = (sel_op != SEL_OP_SUB); if (SEL_OP_USE_PRE_DESELECT(sel_op)) { ED_node_select_all(&snode->edittree->nodes, SEL_DESELECT); @@ -693,7 +694,7 @@ static int node_box_select_exec(bContext *C, wmOperator *op) is_inside = BLI_rctf_inside_rctf(&rectf, &node->totr); } else { - is_inside = BLI_rctf_isect(&rectf, &node->totr, NULL); + is_inside = BLI_rctf_isect(&rectf, &node->totr, nullptr); } if (is_inside) { @@ -703,7 +704,7 @@ static int node_box_select_exec(bContext *C, wmOperator *op) ED_node_sort(snode->edittree); - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -740,7 +741,7 @@ void NODE_OT_select_box(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "tweak", - 0, + false, "Tweak", "Only activate when mouse is not over a node (useful for tweak gesture)"); @@ -766,8 +767,9 @@ static int node_circleselect_exec(bContext *C, wmOperator *op) float zoom = (float)(BLI_rcti_size_x(®ion->winrct)) / (float)(BLI_rctf_size_x(®ion->v2d.cur)); - const eSelectOp sel_op = ED_select_op_modal(RNA_enum_get(op->ptr, "mode"), - WM_gesture_is_modal_first(op->customdata)); + const eSelectOp sel_op = ED_select_op_modal( + (eSelectOp)RNA_enum_get(op->ptr, "mode"), + WM_gesture_is_modal_first((const wmGesture *)op->customdata)); const bool select = (sel_op != SEL_OP_SUB); if (SEL_OP_USE_PRE_DESELECT(sel_op)) { ED_node_select_all(&snode->edittree->nodes, SEL_DESELECT); @@ -780,13 +782,13 @@ static int node_circleselect_exec(bContext *C, wmOperator *op) UI_view2d_region_to_view(®ion->v2d, x, y, &offset[0], &offset[1]); - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if (BLI_rctf_isect_circle(&node->totr, offset, radius / zoom)) { nodeSetSelected(node, select); } } - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -853,7 +855,7 @@ static bool do_lasso_select_node(bContext *C, BLI_lasso_boundbox(&rect, mcoords, mcoords_len); /* do actual selection */ - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if (select && (node->flag & NODE_SELECT)) { continue; @@ -873,7 +875,7 @@ static bool do_lasso_select_node(bContext *C, } if (changed) { - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); } return changed; @@ -885,7 +887,7 @@ static int node_lasso_select_exec(bContext *C, wmOperator *op) const int(*mcoords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcoords_len); if (mcoords) { - const eSelectOp sel_op = RNA_enum_get(op->ptr, "mode"); + const eSelectOp sel_op = (eSelectOp)RNA_enum_get(op->ptr, "mode"); do_lasso_select_node(C, mcoords, mcoords_len, sel_op); @@ -916,7 +918,7 @@ void NODE_OT_select_lasso(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "tweak", - 0, + false, "Tweak", "Only activate when mouse is not over a node (useful for tweak gesture)"); @@ -940,7 +942,7 @@ static int node_select_all_exec(bContext *C, wmOperator *op) ED_node_sort(snode->edittree); - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -973,11 +975,11 @@ static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op)) bNodeLink *link; bNode *node; - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { node->flag &= ~NODE_TEST; } - for (link = snode->edittree->links.first; link; link = link->next) { + for (link = (bNodeLink *)snode->edittree->links.first; link; link = link->next) { if (nodeLinkIsHidden(link)) { continue; } @@ -986,7 +988,7 @@ static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op)) } } - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if (node->flag & NODE_TEST) { nodeSetSelected(node, true); } @@ -994,7 +996,7 @@ static int node_select_linked_to_exec(bContext *C, wmOperator *UNUSED(op)) ED_node_sort(snode->edittree); - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -1025,11 +1027,11 @@ static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op)) bNodeLink *link; bNode *node; - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { node->flag &= ~NODE_TEST; } - for (link = snode->edittree->links.first; link; link = link->next) { + for (link = (bNodeLink *)snode->edittree->links.first; link; link = link->next) { if (nodeLinkIsHidden(link)) { continue; } @@ -1038,7 +1040,7 @@ static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op)) } } - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if (node->flag & NODE_TEST) { nodeSetSelected(node, true); } @@ -1046,7 +1048,7 @@ static int node_select_linked_from_exec(bContext *C, wmOperator *UNUSED(op)) ED_node_sort(snode->edittree); - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_SELECTED, nullptr); return OPERATOR_FINISHED; } @@ -1079,7 +1081,7 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op) bNode *active = nodeGetActive(snode->edittree); int totnodes; const bool revert = RNA_boolean_get(op->ptr, "prev"); - const bool same_type = 1; + const bool same_type = true; ntreeGetDependencyList(snode->edittree, &node_array, &totnodes); @@ -1093,9 +1095,9 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op) } if (same_type) { - bNode *node = NULL; + bNode *node = nullptr; - while (node == NULL) { + while (node == nullptr) { if (revert) { a--; } @@ -1112,7 +1114,7 @@ static int node_select_same_type_step_exec(bContext *C, wmOperator *op) if (node->type == active->type) { break; } - node = NULL; + node = nullptr; } if (node) { active = node; @@ -1168,7 +1170,7 @@ void NODE_OT_select_same_type_step(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "prev", 0, "Previous", ""); + RNA_def_boolean(ot->srna, "prev", false, "Previous", ""); } /** \} */ @@ -1223,7 +1225,7 @@ static void node_find_update_fn(const struct bContext *C, static void node_find_exec_fn(struct bContext *C, void *UNUSED(arg1), void *arg2) { SpaceNode *snode = CTX_wm_space_node(C); - bNode *active = arg2; + bNode *active = (bNode *)arg2; if (active) { ARegion *region = CTX_wm_region(C); @@ -1261,7 +1263,7 @@ static uiBlock *node_find_menu(bContext *C, ARegion *region, void *arg_op) 0, ""); UI_but_func_search_set( - but, NULL, node_find_update_fn, op->type, false, NULL, node_find_exec_fn, NULL); + but, nullptr, node_find_update_fn, op->type, false, nullptr, node_find_exec_fn, nullptr); UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT); /* fake button, it holds space for search items */ @@ -1273,22 +1275,23 @@ static uiBlock *node_find_menu(bContext *C, ARegion *region, void *arg_op) 10 - UI_searchbox_size_y(), UI_searchbox_size_x(), UI_searchbox_size_y(), - NULL, + nullptr, 0, 0, 0, 0, - NULL); + nullptr); /* Move it downwards, mouse over button. */ - UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, (const int[2]){0, -UI_UNIT_Y}); + std::array<int, 2> bounds_offset = {0, -UI_UNIT_Y}; + UI_block_bounds_set_popup(block, 0.3f * U.widget_unit, bounds_offset.data()); return block; } static int node_find_node_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - UI_popup_block_invoke(C, node_find_menu, op, NULL); + UI_popup_block_invoke(C, node_find_menu, op, nullptr); return OPERATOR_CANCELLED; } @@ -1306,7 +1309,7 @@ void NODE_OT_find_node(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "prev", 0, "Previous", ""); + RNA_def_boolean(ot->srna, "prev", false, "Previous", ""); } /** \} */ diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.cc index c880f3e99d8..fae180ca6c5 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.cc @@ -18,8 +18,8 @@ * \ingroup edinterface */ -#include <stdlib.h> -#include <string.h> +#include <cstdlib> +#include <cstring> #include "MEM_guardedalloc.h" @@ -29,6 +29,7 @@ #include "BLI_array.h" #include "BLI_listbase.h" #include "BLI_string.h" +#include "BLI_vector.hh" #include "BLT_translation.h" @@ -51,7 +52,7 @@ /************************* Node Socket Manipulation **************************/ /* describes an instance of a node type and a specific socket to link */ -typedef struct NodeLinkItem { +struct NodeLinkItem { int socket_index; /* index for linking */ int socket_type; /* socket type for compatibility check */ const char *socket_name; /* ui label of the socket */ @@ -59,7 +60,7 @@ typedef struct NodeLinkItem { /* extra settings */ bNodeTree *ngroup; /* group node tree */ -} NodeLinkItem; +}; /* Compare an existing node to a link item to see if it can be reused. * item must be for the same node type! @@ -98,7 +99,7 @@ static void node_tag_recursive(bNode *node) node->flag |= NODE_TEST; - for (input = node->inputs.first; input; input = input->next) { + for (input = (bNodeSocket *)node->inputs.first; input; input = input->next) { if (input->link) { node_tag_recursive(input->link->fromnode); } @@ -115,7 +116,7 @@ static void node_clear_recursive(bNode *node) node->flag &= ~NODE_TEST; - for (input = node->inputs.first; input; input = input->next) { + for (input = (bNodeSocket *)node->inputs.first; input; input = input->next) { if (input->link) { node_clear_recursive(input->link->fromnode); } @@ -132,16 +133,16 @@ static void node_remove_linked(Main *bmain, bNodeTree *ntree, bNode *rem_node) } /* tag linked nodes to be removed */ - for (node = ntree->nodes.first; node; node = node->next) { + for (node = (bNode *)ntree->nodes.first; node; node = node->next) { node->flag &= ~NODE_TEST; } node_tag_recursive(rem_node); /* clear tags on nodes that are still used by other nodes */ - for (node = ntree->nodes.first; node; node = node->next) { + for (node = (bNode *)ntree->nodes.first; node; node = node->next) { if (!(node->flag & NODE_TEST)) { - for (sock = node->inputs.first; sock; sock = sock->next) { + for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { if (sock->link && sock->link->fromnode != rem_node) { node_clear_recursive(sock->link->fromnode); } @@ -150,7 +151,7 @@ static void node_remove_linked(Main *bmain, bNodeTree *ntree, bNode *rem_node) } /* remove nodes */ - for (node = ntree->nodes.first; node; node = next) { + for (node = (bNode *)ntree->nodes.first; node; node = next) { next = node->next; if (node->flag & NODE_TEST) { @@ -205,7 +206,7 @@ static void node_socket_add_replace(const bContext *C, Main *bmain = CTX_data_main(C); bNode *node_from; bNodeSocket *sock_from_tmp; - bNode *node_prev = NULL; + bNode *node_prev = nullptr; /* unlink existing node */ if (sock_to->link) { @@ -214,7 +215,7 @@ static void node_socket_add_replace(const bContext *C, } /* find existing node that we can use */ - for (node_from = ntree->nodes.first; node_from; node_from = node_from->next) { + for (node_from = (bNode *)ntree->nodes.first; node_from; node_from = node_from->next) { if (node_from->type == type) { break; } @@ -223,7 +224,7 @@ static void node_socket_add_replace(const bContext *C, if (node_from) { if (node_from->inputs.first || node_from->typeinfo->draw_buttons || node_from->typeinfo->draw_buttons_ex) { - node_from = NULL; + node_from = nullptr; } } @@ -233,7 +234,7 @@ static void node_socket_add_replace(const bContext *C, } else if (!node_from) { node_from = nodeAddStaticNode(C, ntree, type); - if (node_prev != NULL) { + if (node_prev != nullptr) { /* If we're replacing existing node, use its location. */ node_from->locx = node_prev->locx; node_from->locy = node_prev->locy; @@ -241,7 +242,7 @@ static void node_socket_add_replace(const bContext *C, node_from->offsety = node_prev->offsety; } else { - sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index); + sock_from_tmp = (bNodeSocket *)BLI_findlink(&node_from->outputs, item->socket_index); nodePositionRelative(node_from, node_to, sock_from_tmp, sock_to); } @@ -251,7 +252,7 @@ static void node_socket_add_replace(const bContext *C, nodeSetActive(ntree, node_from); /* add link */ - sock_from_tmp = BLI_findlink(&node_from->outputs, item->socket_index); + sock_from_tmp = (bNodeSocket *)BLI_findlink(&node_from->outputs, item->socket_index); nodeAddLink(ntree, node_from, sock_from_tmp, node_to, sock_to); sock_to->flag &= ~SOCK_COLLAPSED; @@ -259,8 +260,10 @@ static void node_socket_add_replace(const bContext *C, if (node_prev && node_from != node_prev) { bNodeSocket *sock_prev, *sock_from; - for (sock_prev = node_prev->inputs.first; sock_prev; sock_prev = sock_prev->next) { - for (sock_from = node_from->inputs.first; sock_from; sock_from = sock_from->next) { + for (sock_prev = (bNodeSocket *)node_prev->inputs.first; sock_prev; + sock_prev = sock_prev->next) { + for (sock_from = (bNodeSocket *)node_from->inputs.first; sock_from; + sock_from = sock_from->next) { if (nodeCountSocketLinks(ntree, sock_from) >= nodeSocketLinkLimit(sock_from)) { continue; } @@ -282,7 +285,7 @@ static void node_socket_add_replace(const bContext *C, if (node_from->typeinfo->nclass == NODE_CLASS_TEXTURE && node_prev->typeinfo->nclass == NODE_CLASS_TEXTURE && /* White noise texture node does not have NodeTexBase. */ - node_from->storage != NULL && node_prev->storage != NULL) { + node_from->storage != nullptr && node_prev->storage != nullptr) { memcpy(node_from->storage, node_prev->storage, sizeof(NodeTexBase)); } @@ -303,7 +306,7 @@ static void node_socket_add_replace(const bContext *C, #define UI_NODE_LINK_DISCONNECT -1 #define UI_NODE_LINK_REMOVE -2 -typedef struct NodeLinkArg { +struct NodeLinkArg { Main *bmain; Scene *scene; bNodeTree *ntree; @@ -314,7 +317,7 @@ typedef struct NodeLinkArg { NodeLinkItem item; uiLayout *layout; -} NodeLinkArg; +}; static void ui_node_link_items(NodeLinkArg *arg, int in_out, @@ -322,14 +325,15 @@ static void ui_node_link_items(NodeLinkArg *arg, int *r_totitems) { /* XXX this should become a callback for node types! */ - NodeLinkItem *items = NULL; + NodeLinkItem *items = nullptr; int totitems = 0; if (arg->node_type->type == NODE_GROUP) { bNodeTree *ngroup; int i; - for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { + for (ngroup = (bNodeTree *)arg->bmain->nodetrees.first; ngroup; + ngroup = (bNodeTree *)ngroup->id.next) { const char *disabled_hint; if ((ngroup->type != arg->ntree->type) || !nodeGroupPoll(arg->ntree, ngroup, &disabled_hint)) { @@ -341,10 +345,11 @@ static void ui_node_link_items(NodeLinkArg *arg, } if (totitems > 0) { - items = MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items"); + items = (NodeLinkItem *)MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items"); i = 0; - for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { + for (ngroup = (bNodeTree *)arg->bmain->nodetrees.first; ngroup; + ngroup = (bNodeTree *)ngroup->id.next) { const char *disabled_hint; if ((ngroup->type != arg->ntree->type) || !nodeGroupPoll(arg->ntree, ngroup, &disabled_hint)) { @@ -354,7 +359,8 @@ static void ui_node_link_items(NodeLinkArg *arg, ListBase *lb = (in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs); bNodeSocket *stemp; int index; - for (stemp = lb->first, index = 0; stemp; stemp = stemp->next, index++, i++) { + for (stemp = (bNodeSocket *)lb->first, index = 0; stemp; + stemp = stemp->next, index++, i++) { NodeLinkItem *item = &items[i]; item->socket_index = index; @@ -380,7 +386,7 @@ static void ui_node_link_items(NodeLinkArg *arg, } if (totitems > 0) { - items = MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items"); + items = (NodeLinkItem *)MEM_callocN(sizeof(NodeLinkItem) * totitems, "ui node link items"); i = 0; for (stemp = socket_templates; stemp && stemp->type != -1; stemp++, i++) { @@ -474,15 +480,14 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) bNodeTree *ntree = arg->ntree; bNodeSocket *sock = arg->sock; uiLayout *layout = arg->layout; - uiLayout *column = NULL; + uiLayout *column = nullptr; uiBlock *block = uiLayoutGetBlock(layout); uiBut *but; NodeLinkArg *argN; int first = 1; /* generate array of node types sorted by UI name */ - bNodeType **sorted_ntypes = NULL; - BLI_array_declare(sorted_ntypes); + blender::Vector<bNodeType *> sorted_ntypes; NODE_TYPES_BEGIN (ntype) { const char *disabled_hint; @@ -498,20 +503,20 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) continue; } - BLI_array_append(sorted_ntypes, ntype); + sorted_ntypes.append(ntype); } NODE_TYPES_END; qsort( - sorted_ntypes, BLI_array_len(sorted_ntypes), sizeof(bNodeType *), ui_node_item_name_compare); + sorted_ntypes.data(), sorted_ntypes.size(), sizeof(bNodeType *), ui_node_item_name_compare); /* generate UI */ - for (int j = 0; j < BLI_array_len(sorted_ntypes); j++) { + for (int j = 0; j < sorted_ntypes.size(); j++) { bNodeType *ntype = sorted_ntypes[j]; NodeLinkItem *items; int totitems; char name[UI_MAX_NAME_STR]; - const char *cur_node_name = NULL; + const char *cur_node_name = nullptr; int num = 0; int icon = ICON_NONE; @@ -531,11 +536,11 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) } if (first) { - column = uiLayoutColumn(layout, 0); + column = uiLayoutColumn(layout, false); UI_block_layout_set_current(block, column); uiItemL(column, IFACE_(cname), ICON_NODE); - but = block->buttons.last; + but = (uiBut *)block->buttons.last; first = 0; } @@ -553,7 +558,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) 0, UI_UNIT_X * 4, UI_UNIT_Y, - NULL, + nullptr, 0.0, 0.0, 0.0, @@ -578,24 +583,22 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname) 0, UI_UNIT_X * 4, UI_UNIT_Y, - NULL, + nullptr, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input")); - argN = MEM_dupallocN(arg); + argN = (NodeLinkArg *)MEM_dupallocN(arg); argN->item = items[i]; - UI_but_funcN_set(but, ui_node_link, argN, NULL); + UI_but_funcN_set(but, ui_node_link, argN, nullptr); } if (items) { MEM_freeN(items); } } - - BLI_array_free(sorted_ntypes); } static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *name) @@ -635,7 +638,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ if (sock->link) { uiItemL(column, IFACE_("Link"), ICON_NONE); - but = block->buttons.last; + but = (uiBut *)block->buttons.last; but->drawflag = UI_BUT_TEXT_LEFT; but = uiDefBut(block, @@ -646,7 +649,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ 0, UI_UNIT_X * 4, UI_UNIT_Y, - NULL, + nullptr, 0.0, 0.0, 0.0, @@ -662,7 +665,7 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ 0, UI_UNIT_X * 4, UI_UNIT_Y, - NULL, + nullptr, 0.0, 0.0, 0.0, @@ -683,7 +686,7 @@ void uiTemplateNodeLink( uiBut *but; float socket_col[4]; - arg = MEM_callocN(sizeof(NodeLinkArg), "NodeLinkArg"); + arg = (NodeLinkArg *)MEM_callocN(sizeof(NodeLinkArg), "NodeLinkArg"); arg->ntree = ntree; arg->node = node; arg->sock = input; @@ -698,11 +701,11 @@ void uiTemplateNodeLink( char name[UI_MAX_NAME_STR]; ui_node_sock_name(ntree, input, name); but = uiDefMenuBut( - block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); + block, ui_template_node_link_menu, nullptr, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, ""); } else { but = uiDefIconMenuBut( - block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, ""); + block, ui_template_node_link_menu, nullptr, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, ""); } UI_but_type_set_menu_from_pulldown(but); @@ -739,7 +742,7 @@ static void ui_node_draw_node( } } - for (input = node->inputs.first; input; input = input->next) { + for (input = (bNodeSocket *)node->inputs.first; input; input = input->next) { ui_node_draw_input(layout, C, ntree, node, input, depth + 1); } } @@ -749,7 +752,7 @@ static void ui_node_draw_input( { PointerRNA inputptr, nodeptr; uiBlock *block = uiLayoutGetBlock(layout); - uiLayout *row = NULL; + uiLayout *row = nullptr; bNode *lnode; bool dependency_loop; @@ -759,11 +762,11 @@ static void ui_node_draw_input( /* to avoid eternal loops on cyclic dependencies */ node->flag |= NODE_TEST; - lnode = (input->link) ? input->link->fromnode : NULL; + lnode = (input->link) ? input->link->fromnode : nullptr; dependency_loop = (lnode && (lnode->flag & NODE_TEST)); if (dependency_loop) { - lnode = NULL; + lnode = nullptr; } /* socket RNA pointer */ @@ -862,7 +865,7 @@ static void ui_node_draw_input( } if (add_dummy_decorator) { - uiItemDecoratorR(split_wrapper.decorate_column, NULL, NULL, 0); + uiItemDecoratorR(split_wrapper.decorate_column, nullptr, nullptr, 0); } /* clear */ @@ -879,7 +882,7 @@ void uiTemplateNodeView( } /* clear for cycle check */ - for (tnode = ntree->nodes.first; tnode; tnode = tnode->next) { + for (tnode = (bNode *)ntree->nodes.first; tnode; tnode = tnode->next) { tnode->flag &= ~NODE_TEST; } diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.cc index 2e7d6ab6cd5..2e7d6ab6cd5 100644 --- a/source/blender/editors/space_node/node_toolbar.c +++ b/source/blender/editors/space_node/node_toolbar.cc diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.cc index 8ecab92aa26..f0db0539c4f 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.cc @@ -76,7 +76,7 @@ int space_node_view_flag( BLI_rctf_init_minmax(&cur_new); if (snode->edittree) { - for (node = snode->edittree->nodes.first; node; node = node->next) { + for (node = (bNode *)snode->edittree->nodes.first; node; node = node->next) { if ((node->flag & node_flag) == node_flag) { BLI_rctf_union(&cur_new, &node->totr); tot++; @@ -191,16 +191,16 @@ void NODE_OT_view_selected(wmOperatorType *ot) /** \name Background Image Operators * \{ */ -typedef struct NodeViewMove { +struct NodeViewMove { int mvalo[2]; int xmin, ymin, xmax, ymax; -} NodeViewMove; +}; static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event) { SpaceNode *snode = CTX_wm_space_node(C); ARegion *region = CTX_wm_region(C); - NodeViewMove *nvm = op->customdata; + NodeViewMove *nvm = (NodeViewMove *)op->customdata; switch (event->type) { case MOUSEMOVE: @@ -215,8 +215,8 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e CLAMP(snode->yof, nvm->ymin, nvm->ymax); ED_region_tag_redraw(region); - WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL); - WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, NULL); + WM_main_add_notifier(NC_NODE | ND_DISPLAY, nullptr); + WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, nullptr); break; @@ -225,7 +225,7 @@ static int snode_bg_viewmove_modal(bContext *C, wmOperator *op, const wmEvent *e case RIGHTMOUSE: if (event->val == KM_RELEASE) { MEM_freeN(nvm); - op->customdata = NULL; + op->customdata = nullptr; return OPERATOR_FINISHED; } break; @@ -247,14 +247,14 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent * void *lock; ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); - if (ibuf == NULL) { + if (ibuf == nullptr) { BKE_image_release_ibuf(ima, ibuf, lock); return OPERATOR_CANCELLED; } - nvm = MEM_callocN(sizeof(NodeViewMove), "NodeViewMove struct"); + nvm = (NodeViewMove *)MEM_callocN(sizeof(NodeViewMove), "NodeViewMove struct"); op->customdata = nvm; nvm->mvalo[0] = event->mval[0]; nvm->mvalo[1] = event->mval[1]; @@ -275,7 +275,7 @@ static int snode_bg_viewmove_invoke(bContext *C, wmOperator *op, const wmEvent * static void snode_bg_viewmove_cancel(bContext *UNUSED(C), wmOperator *op) { MEM_freeN(op->customdata); - op->customdata = NULL; + op->customdata = nullptr; } void NODE_OT_backimage_move(wmOperatorType *ot) @@ -309,8 +309,8 @@ static int backimage_zoom_exec(bContext *C, wmOperator *op) snode->zoom *= fac; ED_region_tag_redraw(region); - WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL); - WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, NULL); + WM_main_add_notifier(NC_NODE | ND_DISPLAY, nullptr); + WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, nullptr); return OPERATOR_FINISHED; } @@ -356,9 +356,9 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op)) float facx, facy; ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); - if ((ibuf == NULL) || (ibuf->x == 0) || (ibuf->y == 0)) { + if ((ibuf == nullptr) || (ibuf->x == 0) || (ibuf->y == 0)) { BKE_image_release_ibuf(ima, ibuf, lock); return OPERATOR_CANCELLED; } @@ -374,8 +374,8 @@ static int backimage_fit_exec(bContext *C, wmOperator *UNUSED(op)) snode->yof = 0; ED_region_tag_redraw(region); - WM_main_add_notifier(NC_NODE | ND_DISPLAY, NULL); - WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, NULL); + WM_main_add_notifier(NC_NODE | ND_DISPLAY, nullptr); + WM_main_add_notifier(NC_SPACE | ND_SPACE_NODE_VIEW, nullptr); return OPERATOR_FINISHED; } @@ -402,7 +402,7 @@ void NODE_OT_backimage_fit(wmOperatorType *ot) /** \name Sample Backdrop Operator * \{ */ -typedef struct ImageSampleInfo { +struct ImageSampleInfo { ARegionType *art; void *draw_handle; int x, y; @@ -420,12 +420,12 @@ typedef struct ImageSampleInfo { int draw; int color_manage; -} ImageSampleInfo; +}; static void sample_draw(const bContext *C, ARegion *region, void *arg_info) { Scene *scene = CTX_data_scene(C); - ImageSampleInfo *info = arg_info; + ImageSampleInfo *info = (ImageSampleInfo *)arg_info; if (info->draw) { ED_image_draw_info(scene, @@ -445,7 +445,7 @@ static void sample_draw(const bContext *C, ARegion *region, void *arg_info) /* Returns mouse position in image space. */ bool ED_space_node_get_position( - Main *bmain, SpaceNode *snode, struct ARegion *ar, const int mval[2], float fpos[2]) + Main *bmain, SpaceNode *snode, struct ARegion *region, const int mval[2], float fpos[2]) { if (!ED_node_is_compositor(snode) || (snode->flag & SNODE_BACKDRAW) == 0) { return false; @@ -453,7 +453,7 @@ bool ED_space_node_get_position( void *lock; Image *ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ImBuf *ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); if (!ibuf) { BKE_image_release_ibuf(ima, ibuf, lock); return false; @@ -462,8 +462,10 @@ bool ED_space_node_get_position( /* map the mouse coords to the backdrop image space */ float bufx = ibuf->x * snode->zoom; float bufy = ibuf->y * snode->zoom; - fpos[0] = (bufx > 0.0f ? ((float)mval[0] - 0.5f * ar->winx - snode->xof) / bufx + 0.5f : 0.0f); - fpos[1] = (bufy > 0.0f ? ((float)mval[1] - 0.5f * ar->winy - snode->yof) / bufy + 0.5f : 0.0f); + fpos[0] = (bufx > 0.0f ? ((float)mval[0] - 0.5f * region->winx - snode->xof) / bufx + 0.5f : + 0.0f); + fpos[1] = (bufy > 0.0f ? ((float)mval[1] - 0.5f * region->winy - snode->yof) / bufy + 0.5f : + 0.0f); BKE_image_release_ibuf(ima, ibuf, lock); return true; @@ -489,7 +491,7 @@ bool ED_space_node_color_sample( } ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); if (!ibuf) { return false; } @@ -532,14 +534,14 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) Main *bmain = CTX_data_main(C); SpaceNode *snode = CTX_wm_space_node(C); ARegion *region = CTX_wm_region(C); - ImageSampleInfo *info = op->customdata; + ImageSampleInfo *info = (ImageSampleInfo *)op->customdata; void *lock; Image *ima; ImBuf *ibuf; float fx, fy, bufx, bufy; ima = BKE_image_ensure_viewer(bmain, IMA_TYPE_COMPOSITE, "Viewer Node"); - ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock); + ibuf = BKE_image_acquire_ibuf(ima, nullptr, &lock); if (!ibuf) { info->draw = 0; return; @@ -570,8 +572,8 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) info->draw = 1; info->channels = ibuf->channels; - info->zp = NULL; - info->zfp = NULL; + info->zp = nullptr; + info->zfp = nullptr; if (ibuf->rect) { cp = (uchar *)(ibuf->rect + y * ibuf->x + x); @@ -616,7 +618,7 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) } else { info->draw = 0; - ED_node_sample_set(NULL); + ED_node_sample_set(nullptr); } BKE_image_release_ibuf(ima, ibuf, lock); @@ -626,9 +628,9 @@ static void sample_apply(bContext *C, wmOperator *op, const wmEvent *event) static void sample_exit(bContext *C, wmOperator *op) { - ImageSampleInfo *info = op->customdata; + ImageSampleInfo *info = (ImageSampleInfo *)op->customdata; - ED_node_sample_set(NULL); + ED_node_sample_set(nullptr); ED_region_draw_cb_exit(info->art, info->draw_handle); ED_area_tag_redraw(CTX_wm_area(C)); MEM_freeN(info); @@ -644,7 +646,7 @@ static int sample_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED; } - info = MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo"); + info = (ImageSampleInfo *)MEM_callocN(sizeof(ImageSampleInfo), "ImageSampleInfo"); info->art = region->type; info->draw_handle = ED_region_draw_cb_activate( region->type, sample_draw, info, REGION_DRAW_POST_PIXEL); |