Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-01-20 19:36:56 +0300
committerHans Goudey <h.goudey@me.com>2022-01-20 19:36:56 +0300
commit902a103f8092b6a69e28ea76f3cfdca14dc9a8b8 (patch)
treeeab29e5a8051ee693fbfaccef1d9c384b2de304c /source/blender/editors/space_node/node_relationships.cc
parent19622ffc5b84475a6c3b56ff0595811a503f461c (diff)
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
Diffstat (limited to 'source/blender/editors/space_node/node_relationships.cc')
-rw-r--r--source/blender/editors/space_node/node_relationships.cc39
1 files changed, 21 insertions, 18 deletions
diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc
index 45b2dbda48b..fd9420b173d 100644
--- a/source/blender/editors/space_node/node_relationships.cc
+++ b/source/blender/editors/space_node/node_relationships.cc
@@ -68,10 +68,6 @@
#include "node_intern.hh" /* own include */
using namespace blender::nodes::node_tree_ref_types;
-using blender::float2;
-using blender::StringRef;
-using blender::StringRefNull;
-using blender::Vector;
/* -------------------------------------------------------------------- */
/** \name Add Node
@@ -100,6 +96,8 @@ static void clear_picking_highlight(ListBase *links)
}
}
+namespace blender::ed::space_node {
+
static bNodeLink *create_drag_link(bNode &node, bNodeSocket &sock)
{
bNodeLink *oplink = MEM_cnew<bNodeLink>(__func__);
@@ -455,7 +453,7 @@ static void snode_autoconnect(Main &bmain,
/** \name Link Viewer Operator
* \{ */
-namespace blender::ed::nodes::viewer_linking {
+namespace viewer_linking {
/* Depending on the node tree type, different socket types are supported by viewer nodes. */
static bool socket_can_be_viewed(const OutputSocketRef &socket)
@@ -722,7 +720,7 @@ static int node_link_viewer(const bContext &C, bNode &bnode_to_view)
return link_socket_to_viewer(C, viewer_bnode, bnode_to_view, bsocket_to_view);
}
-} // namespace blender::ed::nodes::viewer_linking
+} // namespace viewer_linking
static int node_active_link_viewer_exec(bContext *C, wmOperator *UNUSED(op))
{
@@ -735,7 +733,7 @@ static int node_active_link_viewer_exec(bContext *C, wmOperator *UNUSED(op))
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
- if (blender::ed::nodes::viewer_linking::node_link_viewer(*C, *node) == OPERATOR_CANCELLED) {
+ if (viewer_linking::node_link_viewer(*C, *node) == OPERATOR_CANCELLED) {
return OPERATOR_CANCELLED;
}
@@ -1076,12 +1074,10 @@ static int node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (should_create_drag_link_search_menu(*snode.edittree, *nldrag)) {
bNodeLink &link = *nldrag->links.first();
if (nldrag->in_out == SOCK_OUT) {
- blender::ed::space_node::invoke_node_link_drag_add_menu(
- *C, *link.fromnode, *link.fromsock, cursor);
+ invoke_node_link_drag_add_menu(*C, *link.fromnode, *link.fromsock, cursor);
}
else {
- blender::ed::space_node::invoke_node_link_drag_add_menu(
- *C, *link.tonode, *link.tosock, cursor);
+ invoke_node_link_drag_add_menu(*C, *link.tonode, *link.tosock, cursor);
}
}
@@ -1949,8 +1945,12 @@ static bool ed_node_link_conditions(ScrArea *area,
return true;
}
+} // namespace blender::ed::space_node
+
void ED_node_link_intersect_test(ScrArea *area, int test)
{
+ using namespace blender::ed::space_node;
+
bNode *select;
SpaceNode *snode;
if (!ed_node_link_conditions(area, test, &snode, &select)) {
@@ -2010,6 +2010,8 @@ void ED_node_link_intersect_test(ScrArea *area, int test)
}
}
+namespace blender::ed::space_node {
+
/** \} */
/* -------------------------------------------------------------------- */
@@ -2049,20 +2051,17 @@ static int get_main_socket_priority(const bNodeSocket *socket)
/** Get the "main" socket based on the node declaration or an heuristic. */
static bNodeSocket *get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out)
{
- using namespace blender;
- using namespace blender::nodes;
-
ListBase *sockets = (in_out == SOCK_IN) ? &node.inputs : &node.outputs;
/* Try to get the main socket based on the socket declaration. */
nodeDeclarationEnsure(&ntree, &node);
- const NodeDeclaration *node_decl = node.declaration;
+ const nodes::NodeDeclaration *node_decl = node.declaration;
if (node_decl != nullptr) {
- Span<SocketDeclarationPtr> socket_decls = (in_out == SOCK_IN) ? node_decl->inputs() :
- node_decl->outputs();
+ Span<nodes::SocketDeclarationPtr> socket_decls = (in_out == SOCK_IN) ? node_decl->inputs() :
+ node_decl->outputs();
int index;
LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, sockets, index) {
- const SocketDeclaration &socket_decl = *socket_decls[index];
+ const nodes::SocketDeclaration &socket_decl = *socket_decls[index];
if (nodeSocketIsHidden(socket)) {
continue;
}
@@ -2426,12 +2425,16 @@ void NODE_OT_insert_offset(wmOperatorType *ot)
/** \} */
+} // namespace blender::ed::space_node
+
/* -------------------------------------------------------------------- */
/** \name Note Link Insert
* \{ */
void ED_node_link_insert(Main *bmain, ScrArea *area)
{
+ using namespace blender::ed::space_node;
+
bNode *select;
SpaceNode *snode;
if (!ed_node_link_conditions(area, true, &snode, &select)) {