Blender  V2.93
Functions
node_select.c File Reference
#include <stdlib.h>
#include "DNA_node_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_lasso_2d.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_string_search.h"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
#include "BKE_main.h"
#include "BKE_node.h"
#include "BKE_workspace.h"
#include "ED_node.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_view3d.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "UI_view2d.h"
#include "DEG_depsgraph.h"
#include "MEM_guardedalloc.h"
#include "node_intern.h"

Go to the source code of this file.

Functions

static bool has_workbench_in_texture_color (const wmWindowManager *wm, const Scene *scene, const Object *ob)
 
Public Node Selection API
static bNode * node_under_mouse_select (bNodeTree *ntree, int mx, int my)
 
static bNode * node_under_mouse_tweak (bNodeTree *ntree, int mx, int my)
 
static bool is_position_over_node_or_socket (SpaceNode *snode, float mouse[2])
 
static bool is_event_over_node_or_socket (bContext *C, const wmEvent *event)
 
static void node_toggle (bNode *node)
 
void node_socket_select (bNode *node, bNodeSocket *sock)
 
void node_socket_deselect (bNode *node, bNodeSocket *sock, const bool deselect_node)
 
static void node_socket_toggle (bNode *node, bNodeSocket *sock, int deselect_node)
 
void node_deselect_all (SpaceNode *snode)
 
void node_deselect_all_input_sockets (SpaceNode *snode, const bool deselect_nodes)
 
void node_deselect_all_output_sockets (SpaceNode *snode, const bool deselect_nodes)
 
Select (Cursor Pick) Operator
void node_select_single (bContext *C, bNode *node)
 
static int node_mouse_select (bContext *C, wmOperator *op, const int mval[2], bool wait_to_deselect_others)
 
static int node_select_exec (bContext *C, wmOperator *op)
 
void NODE_OT_select (wmOperatorType *ot)
 
Box Select Operator
static int node_box_select_exec (bContext *C, wmOperator *op)
 
static int node_box_select_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
void NODE_OT_select_box (wmOperatorType *ot)
 
Circle Select Operator
static int node_circleselect_exec (bContext *C, wmOperator *op)
 
void NODE_OT_select_circle (wmOperatorType *ot)
 
Lasso Select Operator
static int node_lasso_select_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static bool do_lasso_select_node (bContext *C, const int mcoords[][2], const int mcoords_len, eSelectOp sel_op)
 
static int node_lasso_select_exec (bContext *C, wmOperator *op)
 
void NODE_OT_select_lasso (wmOperatorType *ot)
 
(De)select All Operator
static int node_select_all_exec (bContext *C, wmOperator *op)
 
void NODE_OT_select_all (wmOperatorType *ot)
 
Select Linked To Operator
static int node_select_linked_to_exec (bContext *C, wmOperator *UNUSED(op))
 
void NODE_OT_select_linked_to (wmOperatorType *ot)
 
Select Linked From Operator
static int node_select_linked_from_exec (bContext *C, wmOperator *UNUSED(op))
 
void NODE_OT_select_linked_from (wmOperatorType *ot)
 
Select Same Type Step Operator
static int node_select_same_type_step_exec (bContext *C, wmOperator *op)
 
void NODE_OT_select_same_type_step (wmOperatorType *ot)
 
Find Node by Name Operator
static void node_find_create_label (const bNode *node, char *str, int maxlen)
 
static void node_find_update_fn (const struct bContext *C, void *UNUSED(arg), const char *str, uiSearchItems *items, const bool UNUSED(is_first))
 
static void node_find_exec_fn (struct bContext *C, void *UNUSED(arg1), void *arg2)
 
static uiBlock * node_find_menu (bContext *C, ARegion *region, void *arg_op)
 
static int node_find_node_invoke (bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 
void NODE_OT_find_node (wmOperatorType *ot)
 

Select Grouped Operator

enum  { NODE_SELECT_GROUPED_TYPE = 0 , NODE_SELECT_GROUPED_COLOR = 1 , NODE_SELECT_GROUPED_PREFIX = 2 , NODE_SELECT_GROUPED_SUFIX = 3 }
 
static bool node_select_grouped_type (SpaceNode *snode, bNode *node_act)
 
static bool node_select_grouped_color (SpaceNode *snode, bNode *node_act)
 
static bool node_select_grouped_name (SpaceNode *snode, bNode *node_act, const bool from_right)
 
static int node_select_grouped_exec (bContext *C, wmOperator *op)
 
void NODE_OT_select_grouped (wmOperatorType *ot)
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NODE_SELECT_GROUPED_TYPE 
NODE_SELECT_GROUPED_COLOR 
NODE_SELECT_GROUPED_PREFIX 
NODE_SELECT_GROUPED_SUFIX 

Definition at line 362 of file node_select.c.

Function Documentation

◆ do_lasso_select_node()

static bool do_lasso_select_node ( bContext *  C,
const int  mcoords[][2],
const int  mcoords_len,
eSelectOp  sel_op 
)
static

◆ has_workbench_in_texture_color()

static bool has_workbench_in_texture_color ( const wmWindowManager *  wm,
const Scene *  scene,
const Object *  ob 
)
static

Function to detect if there is a visible view3d that uses workbench in texture mode. This function is for fixing T76970 for Blender 2.83. The actual fix should add a mechanism in the depsgraph that can be used by the draw engines to check if they need to be redrawn.

We don't want to add these risky changes this close before releasing 2.83 without good testing hence this workaround. There are still cases were too many updates happen. For example when you have both a Cycles and workbench with textures viewport.

Definition at line 73 of file node_select.c.

References blender::compositor::area(), bScreen::areabase, BKE_workspace_active_screen_get(), ED_view3d_has_workbench_in_texture_color(), LISTBASE_FOREACH, scene, SPACE_VIEW3D, and wmWindowManager::windows.

Referenced by node_mouse_select(), and node_select_single().

◆ is_event_over_node_or_socket()

static bool is_event_over_node_or_socket ( bContext *  C,
const wmEvent *  event 
)
static

◆ is_position_over_node_or_socket()

static bool is_position_over_node_or_socket ( SpaceNode *  snode,
float  mouse[2] 
)
static

◆ node_box_select_exec()

static int node_box_select_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_box_select_invoke()

static int node_box_select_invoke ( bContext *  C,
wmOperator *  op,
const wmEvent *  event 
)
static

◆ node_circleselect_exec()

static int node_circleselect_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_deselect_all()

void node_deselect_all ( SpaceNode *  snode)

◆ node_deselect_all_input_sockets()

void node_deselect_all_input_sockets ( SpaceNode *  snode,
const bool  deselect_nodes 
)

◆ node_deselect_all_output_sockets()

void node_deselect_all_output_sockets ( SpaceNode *  snode,
const bool  deselect_nodes 
)

◆ node_find_create_label()

static void node_find_create_label ( const bNode *  node,
char *  str,
int  maxlen 
)
static

Definition at line 1180 of file node_select.c.

References BLI_snprintf(), BLI_strncpy(), node, and str.

Referenced by node_find_update_fn().

◆ node_find_exec_fn()

static void node_find_exec_fn ( struct bContext *  C,
void *  UNUSEDarg1,
void *  arg2 
)
static

◆ node_find_menu()

static uiBlock* node_find_menu ( bContext *  C,
ARegion *  region,
void *  arg_op 
)
static

◆ node_find_node_invoke()

static int node_find_node_invoke ( bContext *  C,
wmOperator *  op,
const wmEvent *  UNUSEDevent 
)
static

Definition at line 1289 of file node_select.c.

References C, node_find_menu(), NULL, OPERATOR_CANCELLED, and UI_popup_block_invoke().

Referenced by NODE_OT_find_node().

◆ node_find_update_fn()

static void node_find_update_fn ( const struct bContext *  C,
void *  UNUSEDarg,
const char *  str,
uiSearchItems *  items,
const bool   UNUSEDis_first 
)
static

◆ node_lasso_select_exec()

static int node_lasso_select_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_lasso_select_invoke()

static int node_lasso_select_invoke ( bContext *  C,
wmOperator *  op,
const wmEvent *  event 
)
static

◆ node_mouse_select()

static int node_mouse_select ( bContext *  C,
wmOperator *  op,
const int  mval[2],
bool  wait_to_deselect_others 
)
static

◆ NODE_OT_find_node()

void NODE_OT_find_node ( wmOperatorType *  ot)

◆ NODE_OT_select()

void NODE_OT_select ( wmOperatorType *  ot)

◆ NODE_OT_select_all()

void NODE_OT_select_all ( wmOperatorType *  ot)

◆ NODE_OT_select_box()

void NODE_OT_select_box ( wmOperatorType *  ot)

◆ NODE_OT_select_circle()

void NODE_OT_select_circle ( wmOperatorType *  ot)

◆ NODE_OT_select_grouped()

void NODE_OT_select_grouped ( wmOperatorType *  ot)

◆ NODE_OT_select_lasso()

void NODE_OT_select_lasso ( wmOperatorType *  ot)

◆ NODE_OT_select_linked_from()

void NODE_OT_select_linked_from ( wmOperatorType *  ot)

◆ NODE_OT_select_linked_to()

void NODE_OT_select_linked_to ( wmOperatorType *  ot)

◆ NODE_OT_select_same_type_step()

void NODE_OT_select_same_type_step ( wmOperatorType *  ot)

◆ node_select_all_exec()

static int node_select_all_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_select_exec()

static int node_select_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_select_grouped_color()

static bool node_select_grouped_color ( SpaceNode *  snode,
bNode *  node_act 
)
static

◆ node_select_grouped_exec()

static int node_select_grouped_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_select_grouped_name()

static bool node_select_grouped_name ( SpaceNode *  snode,
bNode *  node_act,
const bool  from_right 
)
static

◆ node_select_grouped_type()

static bool node_select_grouped_type ( SpaceNode *  snode,
bNode *  node_act 
)
static

◆ node_select_linked_from_exec()

static int node_select_linked_from_exec ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ node_select_linked_to_exec()

static int node_select_linked_to_exec ( bContext *  C,
wmOperator *  UNUSEDop 
)
static

◆ node_select_same_type_step_exec()

static int node_select_same_type_step_exec ( bContext *  C,
wmOperator *  op 
)
static

◆ node_select_single()

void node_select_single ( bContext *  C,
bNode *  node 
)

◆ node_socket_deselect()

void node_socket_deselect ( bNode *  node,
bNodeSocket *  sock,
const bool  deselect_node 
)

Definition at line 166 of file node_select.c.

References bNodeSocket::flag, bNodeSocket::next, node, and SELECT.

Referenced by node_mouse_select(), and node_socket_toggle().

◆ node_socket_select()

void node_socket_select ( bNode *  node,
bNodeSocket *  sock 
)

Definition at line 156 of file node_select.c.

References bNodeSocket::flag, node, and SELECT.

Referenced by node_mouse_select(), and node_socket_toggle().

◆ node_socket_toggle()

static void node_socket_toggle ( bNode *  node,
bNodeSocket *  sock,
int  deselect_node 
)
static

Definition at line 193 of file node_select.c.

References bNodeSocket::flag, node, node_socket_deselect(), node_socket_select(), and SELECT.

Referenced by node_mouse_select().

◆ node_toggle()

static void node_toggle ( bNode *  node)
static

Definition at line 151 of file node_select.c.

References node, nodeSetSelected(), and SELECT.

Referenced by node_mouse_select().

◆ node_under_mouse_select()

static bNode* node_under_mouse_select ( bNodeTree *  ntree,
int  mx,
int  my 
)
static

Definition at line 99 of file node_select.c.

References ListBase::last, node, bNodeTree::nodes, ntree, and NULL.

Referenced by node_mouse_select().

◆ node_under_mouse_tweak()

static bNode* node_under_mouse_tweak ( bNodeTree *  ntree,
int  mx,
int  my 
)
static

Definition at line 113 of file node_select.c.

References ListBase::last, node, bNodeTree::nodes, ntree, and NULL.

Referenced by is_position_over_node_or_socket().