71 if (win->scene != scene) {
77 const View3D *v3d = (
const View3D *)area->spacedata.first;
96 node.runtime->totr.
xmin,
97 node.runtime->totr.xmax,
98 node.runtime->totr.ymin,
99 node.runtime->totr.ymax,
131 switch (node->type) {
152 switch (node->type) {
213 sock.
flag &= ~SELECT;
215 if (node && deselect_node) {
220 if (input->flag &
SELECT) {
226 if (output->flag &
SELECT) {
233 node->flag &= ~SELECT;
250 bool changed =
false;
268 socket->flag &= ~SELECT;
272 if (deselect_nodes) {
274 if (socket->flag &
SELECT) {
281 node->flag &= ~SELECT;
298 socket->flag &= ~SELECT;
302 if (deselect_nodes) {
304 if (socket->flag &
SELECT) {
311 node->flag &= ~SELECT;
321 for (
bNode *input_node :
node_tree.nodes_by_type(zone_type->input_idname)) {
322 if (
bNode *output_node = zone_type->get_corresponding_output(
node_tree, *input_node)) {
339 selected_nodes.
add(node);
342 return selected_nodes;
355 bool changed =
false;
357 if ((node->flag &
SELECT) == 0) {
358 if (node->type == node_act.
type) {
369 bool changed =
false;
371 if ((node->flag &
SELECT) == 0) {
383 bool changed =
false;
384 const uint delims[] = {
'.',
'-',
'_',
'\0'};
385 size_t pref_len_act, pref_len_curr;
386 const char *sep, *suf_act, *suf_curr;
389 node_act.
name,
nullptr, delims, &sep, &suf_act, from_right);
392 if (from_right && !(sep && suf_act)) {
394 suf_act = node_act.
name;
398 if (node->flag &
SELECT) {
402 node->name,
nullptr, delims, &sep, &suf_curr, from_right);
405 if (from_right && !(sep && suf_curr)) {
407 suf_curr = node->name;
410 if ((from_right &&
STREQ(suf_act, suf_curr)) ||
411 (!from_right && (pref_len_act == pref_len_curr) &&
435 if (node_act ==
nullptr) {
439 bool changed =
false;
482 {0,
nullptr, 0,
nullptr,
nullptr},
486 ot->
name =
"Select Grouped";
488 ot->
idname =
"NODE_OT_select_grouped";
503 "Extend selection instead of deselecting everything first");
522 bool active_texture_changed =
false;
525 if (node_iter != &node) {
554 bNode *node =
nullptr;
560 bool changed =
false;
562 bool node_was_selected =
false;
574 node = &sock->owner_node();
586 node = &sock->owner_node();
599 for (
bNodeSocket *tsock : node->output_sockets()) {
611 for (
bNodeSocket *tsock : tnode->output_sockets()) {
628 found = (node !=
nullptr);
629 node_was_selected = node && (node->flag &
SELECT);
632 if ((found &&
params->select_passthrough) && (node->flag &
SELECT)) {
635 else if (found ||
params->deselect_all) {
669 if (node ==
nullptr) {
677 if (!(changed || found)) {
681 bool active_texture_changed =
false;
682 bool viewer_node_changed =
false;
683 if ((node !=
nullptr) && (node_was_selected ==
false ||
params->select_passthrough ==
false)) {
684 viewer_node_changed = (node->flag &
NODE_DO_OUTPUT) == 0 && node->type == GEO_NODE_VIEWER;
687 else if (node !=
nullptr && node->type == GEO_NODE_VIEWER) {
771 "Deactivate geometry nodes viewer when clicking in empty space");
799 switch (node->type) {
864 "Only activate when mouse is not over a node (useful for tweak gesture)");
903 switch (node->type) {
908 const float radius_adjusted =
float(radius) / zoom;
909 BLI_rctf_pad(&frame_inside, -2.0f * radius_adjusted, -2.0f * radius_adjusted);
934 ot->
name =
"Circle Select";
935 ot->
idname =
"NODE_OT_select_circle";
978 bool changed =
false;
994 switch (node->type) {
1017 ®ion->v2d, center.x, center.y, &screen_co.x, &screen_co.y) &&
1054 ot->
name =
"Lasso Select";
1056 ot->
idname =
"NODE_OT_select_lasso";
1073 "Only activate when mouse is not over a node (useful for tweak gesture)");
1138 ot->
name =
"(De)select All";
1167 for (
bNode *node : initial_selection) {
1168 for (
bNodeSocket *output_socket : node->output_sockets()) {
1169 if (!output_socket->is_available()) {
1172 for (
bNodeSocket *input_socket : output_socket->directly_linked_sockets()) {
1173 if (!input_socket->is_available()) {
1190 ot->
name =
"Select Linked To";
1191 ot->
description =
"Select nodes linked to the selected ones";
1192 ot->
idname =
"NODE_OT_select_linked_to";
1217 for (
bNode *node : initial_selection) {
1218 for (
bNodeSocket *input_socket : node->input_sockets()) {
1219 if (!input_socket->is_available()) {
1222 for (
bNodeSocket *output_socket : input_socket->directly_linked_sockets()) {
1223 if (!output_socket->is_available()) {
1240 ot->
name =
"Select Linked From";
1241 ot->
description =
"Select nodes linked from the selected ones";
1242 ot->
idname =
"NODE_OT_select_linked_from";
1260 return a.type ==
b.type;
1270 if (active_node ==
nullptr) {
1276 if (
node_tree.all_nodes().size() == 1) {
1281 const int index = toposort.
first_index(active_node);
1283 int new_index = index;
1285 new_index += (prev ? -1 : 1);
1294 bNode *new_active_node =
node_tree.all_nodes()[toposort[new_index]->index()];
1295 if (new_active_node == active_node) {
1312 ot->
name =
"Activate Same Type Next/Prev";
1313 ot->
description =
"Activate and view same node type, step by step";
1314 ot->
idname =
"NODE_OT_select_same_type_step";
1334 if (node->label[0]) {
1356 search.
add(name, node);
1361 for (
bNode *node : filtered_nodes) {
1387 static char search[256] =
"";
1425 std::array<int, 2> bounds_offset = {0, -
UI_UNIT_Y};
1441 ot->
description =
"Search for a node by name and focus and select it";
WorkSpace * CTX_wm_workspace(const bContext *C)
SpaceNode * CTX_wm_space_node(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
void BKE_viewer_path_clear(ViewerPath *viewer_path)
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
#define BLI_assert_unreachable()
bool BLI_lasso_is_point_inside(blender::Span< blender::int2 > mcoords, int sx, int sy, int error_value)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
#define LISTBASE_FOREACH(type, var, list)
MINLINE float square_f(float a)
MINLINE bool compare_v3v3(const float v1[3], const float v2[3], float limit) ATTR_WARN_UNUSED_RESULT
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
BLI_INLINE float BLI_rctf_cent_x(const struct rctf *rct)
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
bool BLI_rctf_isect_circle(const struct rctf *rect, const float xy[2], float radius)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y)
void BLI_rctf_rcti_copy(struct rctf *dst, const struct rcti *src)
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
bool BLI_rctf_inside_rctf(const rctf *rct_a, const rctf *rct_b)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
size_t size_t size_t BLI_str_partition_ex_utf8(const char *str, const char *end, const unsigned int delim[], const char **r_sep, const char **r_suf, bool from_right) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
#define STREQLEN(a, b, n)
void DEG_id_tag_update(ID *id, unsigned int flags)
void ED_node_set_active(Main *bmain, SpaceNode *snode, bNodeTree *ntree, bNode *node, bool *r_active_texture_changed)
void ED_node_set_active_viewer_key(SpaceNode *snode)
bool ED_operator_node_active(bContext *C)
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
#define SEL_OP_USE_PRE_DESELECT(sel_op)
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr)
void ED_select_pick_params_from_operator(PointerRNA *ptr, SelectPick_Params *params) ATTR_NONNULL(1
void std::string ED_select_pick_get_name(wmOperatorType *ot, PointerRNA *ptr)
bool ED_view3d_has_workbench_in_texture_color(const Scene *scene, const Object *ob, const View3D *v3d)
Read Guarded memory(de)allocation.
void UI_block_theme_style_set(uiBlock *block, char theme_style)
@ UI_BLOCK_MOVEMOUSE_QUIT
void UI_block_bounds_set_popup(uiBlock *block, int addval, const int bounds_offset[2])
uiBut * uiDefBut(uiBlock *block, int type, int retval, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, const char *tip)
void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free)
void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, void *arg, bool free_arg, uiFreeArgFunc search_arg_free_fn, uiButHandleFunc search_exec_fn, void *active)
bool UI_search_item_add(uiSearchItems *items, const char *name, void *poin, int iconid, int but_flag, uint8_t name_prefix_offset)
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, eUIEmbossType emboss)
int UI_searchbox_size_x()
int UI_searchbox_size_y()
uiBut * uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxncpy, int x, int y, short width, short height, const char *tip)
@ UI_BLOCK_THEME_STYLE_POPUP
void UI_block_flag_enable(uiBlock *block, int flag)
void UI_but_flag_enable(uiBut *but, int flag)
@ UI_BUT_ACTIVATE_ON_INIT
bool UI_view2d_view_to_region_clip(const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) ATTR_NONNULL()
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void UI_view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
@ OPTYPE_DEPENDS_ON_CURSOR
constexpr bool contains(int64_t value) const
constexpr int64_t first_index(const T &search_value) const
constexpr IndexRange index_range() const
void add(const StringRef str, T *user_data, const int weight=0)
Vector< T * > query(const StringRef query) const
local_group_size(16, 16) .push_constant(Type b
draw_view in_light_buf[] float
static bool is_inside(int x, int y, int cols, int rows)
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
bNode * node_get_active(bNodeTree *ntree)
Span< const bNodeZoneType * > all_zone_types()
bool node_set_selected(bNode *node, bool select)
static bool has_workbench_in_texture_color(const wmWindowManager *wm, const Scene *scene, const Object *ob)
static uiBlock * node_find_menu(bContext *C, ARegion *region, void *arg_optype)
static bool node_select_grouped_type(bNodeTree &node_tree, bNode &node_act)
rctf node_frame_rect_inside(const SpaceNode &snode, const bNode &node)
void node_deselect_all_input_sockets(bNodeTree &node_tree, bool deselect_nodes)
static void node_find_exec_fn(bContext *C, void *, void *arg2)
void NODE_OT_select_circle(wmOperatorType *ot)
static bool is_position_over_node_or_socket(SpaceNode &snode, ARegion ®ion, const float2 &mouse)
static int node_box_select_exec(bContext *C, wmOperator *op)
void tree_draw_order_update(bNodeTree &ntree)
static int node_lasso_select_exec(bContext *C, wmOperator *op)
static int node_select_same_type_step_exec(bContext *C, wmOperator *op)
bool space_node_view_flag(bContext &C, SpaceNode &snode, ARegion ®ion, int node_flag, int smooth_viewtx)
static bool node_mouse_select(bContext *C, wmOperator *op, const int2 mval, SelectPick_Params *params)
static bool do_lasso_select_node(bContext *C, const Span< int2 > mcoords, eSelectOp sel_op)
void node_select_paired(bNodeTree &node_tree)
void NODE_OT_find_node(wmOperatorType *ot)
static void node_find_update_fn(const bContext *C, void *, const char *str, uiSearchItems *items, const bool)
void NODE_OT_select_lasso(wmOperatorType *ot)
bool node_deselect_all(bNodeTree &node_tree)
void node_socket_select(bNode *node, bNodeSocket &sock)
bNodeSocket * node_find_indicated_socket(SpaceNode &snode, ARegion ®ion, const float2 &cursor, const eNodeSocketInOut in_out)
void NODE_OT_select(wmOperatorType *ot)
static bool node_select_grouped_name(bNodeTree &node_tree, bNode &node_act, const bool from_right)
Array< bNode * > tree_draw_order_calc_nodes_reversed(bNodeTree &ntree)
static void node_socket_toggle(bNode *node, bNodeSocket &sock, bool deselect_node)
static bool nodes_are_same_type_for_select(const bNode &a, const bNode &b)
void node_socket_deselect(bNode *node, bNodeSocket &sock, bool deselect_node)
static int node_lasso_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int node_find_node_invoke(bContext *C, wmOperator *op, const wmEvent *)
void NODE_OT_select_grouped(wmOperatorType *ot)
@ NODE_SELECT_GROUPED_SUFIX
@ NODE_SELECT_GROUPED_TYPE
@ NODE_SELECT_GROUPED_PREFIX
@ NODE_SELECT_GROUPED_COLOR
static int node_circleselect_exec(bContext *C, wmOperator *op)
static int node_select_all_exec(bContext *C, wmOperator *op)
static void node_find_create_label(const bNode *node, char *str, int str_maxncpy)
VectorSet< bNode * > get_selected_nodes(bNodeTree &node_tree)
void NODE_OT_select_linked_from(wmOperatorType *ot)
void node_deselect_all_output_sockets(bNodeTree &node_tree, bool deselect_nodes)
static int node_select_grouped_exec(bContext *C, wmOperator *op)
static bNode * node_under_mouse_select(const SpaceNode &snode, const float2 mouse)
static int node_box_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void NODE_OT_select_same_type_step(wmOperatorType *ot)
static int node_select_linked_to_exec(bContext *C, wmOperator *)
void node_select_single(bContext &C, bNode &node)
static bool node_select_grouped_color(bNodeTree &node_tree, bNode &node_act)
void NODE_OT_select_linked_to(wmOperatorType *ot)
static bool any_node_selected(const bNodeTree &node_tree)
bool node_or_socket_isect_event(const bContext &C, const wmEvent &event)
static bool node_under_mouse_tweak(const SpaceNode &snode, const float2 &mouse)
static int node_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
float2 node_to_view(const bNode &node, const float2 &co)
static bool is_event_over_node_or_socket(const bContext &C, const wmEvent &event)
static bool node_frame_select_isect_mouse(const SpaceNode &snode, const bNode &node, const float2 &mouse)
void NODE_OT_select_box(wmOperatorType *ot)
void NODE_OT_select_all(wmOperatorType *ot)
static int node_select_exec(bContext *C, wmOperator *op)
static int node_select_linked_from_exec(bContext *C, wmOperator *)
void activate_geometry_node(Main &bmain, SpaceNode &snode, bNode &node)
T distance_squared(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
T max(const T &a, const T &b)
#define NODE_RESIZE_MARGIN
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
SpaceNode_Runtime * runtime
struct bNodeTree * edittree
bNodeRuntimeHandle * runtime
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
std::string(* get_name)(wmOperatorType *ot, PointerRNA *ptr)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
struct wmOperatorType * type
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
void WM_gesture_box_cancel(bContext *C, wmOperator *op)
int WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
int WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
int WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_gesture_box(wmOperatorType *ot)
void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
void WM_operator_properties_border_to_rctf(wmOperator *op, rctf *r_rect)
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
void WM_operator_properties_gesture_circle(wmOperatorType *ot)
void WM_operator_properties_select_all(wmOperatorType *ot)
void WM_operator_properties_mouse_select(wmOperatorType *ot)
int WM_operator_flag_only_pass_through_on_press(int retval, const wmEvent *event)
int WM_menu_invoke(bContext *C, wmOperator *op, const wmEvent *)
int WM_operator_smooth_viewtx_get(const wmOperator *op)