From 902a103f8092b6a69e28ea76f3cfdca14dc9a8b8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 20 Jan 2022 10:36:56 -0600 Subject: Cleanup: Move node editor files to proper namespace This commit moves code in all node editor files to the `blender::ed::space_node` namespace, except for C API functions defined in `ED_node.h`, which can only be moved once all areas calling them are moved to C++. The change is fairly straightforward, I just moved a couple of "ED_" code blocks around to make the namespace more contiguous, and there's the method for adding a pointer to a struct in a C++ namespace in DNA. Differential Revision: https://developer.blender.org/D13871 --- source/blender/editors/space_node/node_draw.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'source/blender/editors/space_node/node_draw.cc') diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index ee6dbc15c15..82da890fa9b 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -88,13 +88,6 @@ #include "node_intern.hh" /* own include */ -using blender::Array; -using blender::float2; -using blender::Map; -using blender::Set; -using blender::Span; -using blender::Vector; -using blender::VectorSet; using blender::fn::CPPType; using blender::fn::FieldCPPType; using blender::fn::FieldInput; @@ -115,6 +108,8 @@ float ED_node_grid_size() void ED_node_tree_update(const bContext *C) { + using namespace blender::ed::space_node; + SpaceNode *snode = CTX_wm_space_node(C); if (snode) { snode_set_context(*C); @@ -176,6 +171,8 @@ void ED_node_tag_update_id(ID *id) } } +namespace blender::ed::space_node { + static bool compare_nodes(const bNode *a, const bNode *b) { /* These tell if either the node or any of the parent nodes is selected. @@ -1071,8 +1068,12 @@ static void node_socket_draw_nested(const bContext &C, UI_block_emboss_set(&block, old_emboss); } +} // namespace blender::ed::space_node + void ED_node_socket_draw(bNodeSocket *sock, const rcti *rect, const float color[4], float scale) { + using namespace blender::ed::space_node; + const float size = 2.25f * NODE_SOCKSIZE * scale; rcti draw_rect = *rect; float outline_color[4] = {0}; @@ -1119,6 +1120,8 @@ void ED_node_socket_draw(bNodeSocket *sock, const rcti *rect, const float color[ GPU_blend(state); } +namespace blender::ed::space_node { + /* ************** Socket callbacks *********** */ static void node_draw_preview_background(rctf *rect) @@ -2879,3 +2882,5 @@ void node_draw_space(const bContext &C, ARegion ®ion) /* Scrollers. */ UI_view2d_scrollers_draw(&v2d, nullptr); } + +} // namespace blender::ed::space_node -- cgit v1.2.3