Blender V4.3
node_draw.cc File Reference

higher level node drawing for the node editor. More...

#include <iomanip>
#include "MEM_guardedalloc.h"
#include "DNA_light_types.h"
#include "DNA_linestyle_types.h"
#include "DNA_material_types.h"
#include "DNA_modifier_types.h"
#include "DNA_node_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_text_types.h"
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "BLI_array.hh"
#include "BLI_bounds.hh"
#include "BLI_convexhull_2d.h"
#include "BLI_map.hh"
#include "BLI_set.hh"
#include "BLI_span.hh"
#include "BLI_string.h"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
#include "BLT_translation.hh"
#include "BKE_compute_contexts.hh"
#include "BKE_context.hh"
#include "BKE_curves.hh"
#include "BKE_global.hh"
#include "BKE_idtype.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_node.hh"
#include "BKE_node_enum.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_node_tree_zones.hh"
#include "BKE_object.hh"
#include "BKE_scene.hh"
#include "BKE_scene_runtime.hh"
#include "BKE_type_conversions.hh"
#include "IMB_imbuf.hh"
#include "DEG_depsgraph.hh"
#include "BLF_api.hh"
#include "BIF_glutil.hh"
#include "GPU_framebuffer.hh"
#include "GPU_immediate.hh"
#include "GPU_immediate_util.hh"
#include "GPU_matrix.hh"
#include "GPU_shader_shared.hh"
#include "GPU_state.hh"
#include "GPU_viewport.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "ED_gpencil_legacy.hh"
#include "ED_node.hh"
#include "ED_node_preview.hh"
#include "ED_screen.hh"
#include "ED_space_api.hh"
#include "ED_viewer_path.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "NOD_geometry_exec.hh"
#include "NOD_geometry_nodes_gizmos.hh"
#include "NOD_geometry_nodes_log.hh"
#include "NOD_node_declaration.hh"
#include "NOD_node_extra_info.hh"
#include "NOD_socket_declarations_geometry.hh"
#include "FN_field.hh"
#include "GEO_fillet_curves.hh"
#include "node_intern.hh"
#include <fmt/format.h>
#include <sstream>

Go to the source code of this file.

Classes

struct  TreeDrawContext
 
struct  blender::ed::space_node::NodeInterfaceItemData
 
struct  blender::ed::space_node::VisibilityUpdateState
 
struct  blender::ed::space_node::LocationUpdateState
 
struct  blender::ed::space_node::NodeErrorsTooltipData
 
struct  blender::ed::space_node::NamedAttributeTooltipArg
 

Namespaces

namespace  blender
 
namespace  blender::ed
 
namespace  blender::ed::space_node
 

Macros

#define NODE_TREE_SCALE_SMALL   0.2f
 
#define NODE_HEADER_ICON_SIZE   (0.8f * U.widget_unit)
 
#define NODE_FRAME_MARGIN   (1.5f * U.widget_unit)
 
#define USE_DRAW_TOT_UPDATE
 

Typedefs

using blender::ed::space_node::ItemIterator = Vector<NodeInterfaceItemData>::const_iterator
 

Functions

float ED_node_grid_size ()
 
void ED_node_tree_update (const bContext *C)
 
static bNodeTreenode_tree_from_ID (ID *id)
 
void ED_node_tag_update_id (ID *id)
 
static std::string blender::ed::space_node::node_socket_get_tooltip (const SpaceNode *snode, const bNodeTree &ntree, const bNodeSocket &socket)
 
static const char * blender::ed::space_node::node_socket_get_translation_context (const bNodeSocket &socket)
 
static void blender::ed::space_node::node_socket_add_tooltip_in_node_editor (const bNodeSocket &sock, uiLayout &layout)
 
static bool blender::ed::space_node::compare_node_depth (const bNode *a, const bNode *b)
 
void blender::ed::space_node::tree_draw_order_update (bNodeTree &ntree)
 
Array< bNode * > blender::ed::space_node::tree_draw_order_calc_nodes (bNodeTree &ntree)
 
Array< bNode * > blender::ed::space_node::tree_draw_order_calc_nodes_reversed (bNodeTree &ntree)
 
static Array< uiBlock * > blender::ed::space_node::node_uiblocks_init (const bContext &C, const Span< bNode * > nodes)
 
float2 blender::ed::space_node::node_to_view (const bNode &node, const float2 &co)
 
void blender::ed::space_node::node_to_updated_rect (const bNode &node, rctf &r_rect)
 
float2 blender::ed::space_node::node_from_view (const bNode &node, const float2 &co)
 
static bool blender::ed::space_node::is_node_panels_supported (const bNode &node)
 
static bool blender::ed::space_node::node_update_basis_buttons (const bContext &C, bNodeTree &ntree, bNode &node, nodes::PanelDrawButtonsFunction draw_buttons, uiBlock &block, int &dy)
 
const char * blender::ed::space_node::node_socket_get_label (const bNodeSocket *socket, const char *panel_label)
 
static bool blender::ed::space_node::node_update_basis_socket (const bContext &C, bNodeTree &ntree, bNode &node, const char *panel_label, bNodeSocket *input_socket, bNodeSocket *output_socket, uiBlock &block, const int &locx, int &locy)
 
static Vector< NodeInterfaceItemDatablender::ed::space_node::node_build_item_data (bNode &node)
 
static void blender::ed::space_node::node_update_panel_items_visibility_recursive (int num_items, const bool is_parent_collapsed, bNodePanelState &parent_state, VisibilityUpdateState &state)
 
static void blender::ed::space_node::add_panel_items_recursive (const bContext &C, bNodeTree &ntree, bNode &node, uiBlock &block, const int locx, int &locy, int num_items, const bool is_parent_collapsed, const char *parent_label, bke::bNodePanelRuntime *parent_runtime, LocationUpdateState &state)
 
static void blender::ed::space_node::node_update_basis_from_declaration (const bContext &C, bNodeTree &ntree, bNode &node, uiBlock &block, const int locx, int &locy)
 
static void blender::ed::space_node::node_update_basis_from_socket_lists (const bContext &C, bNodeTree &ntree, bNode &node, uiBlock &block, const int locx, int &locy)
 
static void blender::ed::space_node::node_update_basis (const bContext &C, const TreeDrawContext &, bNodeTree &ntree, bNode &node, uiBlock &block)
 
static void blender::ed::space_node::node_update_hidden (bNode &node, uiBlock &block)
 
static int blender::ed::space_node::node_get_colorid (TreeDrawContext &tree_draw_ctx, const bNode &node)
 
static void blender::ed::space_node::node_draw_mute_line (const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNode &node)
 
static void blender::ed::space_node::node_socket_draw (const bNodeSocket &sock, const float color[4], const float color_outline[4], const float size, const float locx, const float locy, uint pos_id, uint col_id, uint shape_id, uint size_id, uint outline_col_id)
 
static void blender::ed::space_node::node_socket_tooltip_set (uiBlock &block, const int socket_index_in_tree, const float2 location, const float2 size)
 
static void blender::ed::space_node::node_socket_draw_multi_input (uiBlock &block, const int index_in_tree, const float2 location, const float2 draw_size, const float color[4], const float color_outline[4], const float2 tooltip_size)
 
static void blender::ed::space_node::node_socket_outline_color_get (const bool selected, const int socket_type, float r_outline_color[4])
 
void blender::ed::space_node::node_socket_color_get (const bContext &C, const bNodeTree &ntree, PointerRNA &node_ptr, const bNodeSocket &sock, float r_color[4])
 
static void blender::ed::space_node::create_inspection_string_for_generic_value (const bNodeSocket &socket, const GPointer value, fmt::memory_buffer &buf)
 
static void blender::ed::space_node::create_inspection_string_for_field_info (const bNodeSocket &socket, const geo_log::FieldInfoLog &value_log, fmt::memory_buffer &buf)
 
static void blender::ed::space_node::create_inspection_string_for_geometry_info (const geo_log::GeometryInfoLog &value_log, fmt::memory_buffer &buf)
 
static void blender::ed::space_node::create_inspection_string_for_geometry_socket (fmt::memory_buffer &buf, const nodes::decl::Geometry *socket_decl)
 
static void blender::ed::space_node::create_inspection_string_for_default_socket_value (const bNodeSocket &socket, fmt::memory_buffer &buf)
 
static std::optional< std::string > blender::ed::space_node::create_description_inspection_string (const bNodeSocket &socket)
 
static std::optional< std::string > blender::ed::space_node::create_log_inspection_string (geo_log::GeoTreeLog *geo_tree_log, const bNodeSocket &socket)
 
static std::optional< std::string > blender::ed::space_node::create_declaration_inspection_string (const bNodeSocket &socket)
 
static geo_log::GeoTreeLogblender::ed::space_node::geo_tree_log_for_socket (const bNodeTree &ntree, const bNodeSocket &socket, TreeDrawContext &tree_draw_ctx)
 
static Vector< std::string > blender::ed::space_node::lines_of_text (std::string text)
 
static std::optional< std::string > blender::ed::space_node::create_multi_input_log_inspection_string (const bNodeTree &ntree, const bNodeSocket &socket, TreeDrawContext &tree_draw_ctx)
 
static std::optional< std::string > blender::ed::space_node::create_default_value_inspection_string (const bNodeSocket &socket)
 
static const bNodeSocketblender::ed::space_node::target_for_reroute (const bNodeSocket &reroute_output)
 
static std::optional< std::string > blender::ed::space_node::create_dangling_reroute_inspection_string (const bNodeTree &ntree, const bNodeSocket &socket)
 
void blender::ed::space_node::node_socket_add_tooltip (const bNodeTree &ntree, const bNodeSocket &sock, uiLayout &layout)
 
static void blender::ed::space_node::node_socket_draw_nested (const bContext &C, const bNodeTree &ntree, PointerRNA &node_ptr, uiBlock &block, const bNodeSocket &sock, const uint pos_id, const uint col_id, const uint shape_id, const uint size_id, const uint outline_col_id, const float size, const bool selected)
 
void blender::ed::space_node::node_socket_draw (bNodeSocket *sock, const rcti *rect, const float color[4], float scale)
 
static float blender::ed::space_node::node_tree_view_scale (const SpaceNode &snode)
 
static void blender::ed::space_node::node_draw_preview_background (rctf *rect)
 
static void blender::ed::space_node::node_draw_preview (const Scene *scene, ImBuf *preview, const rctf *prv)
 
static void blender::ed::space_node::node_toggle_button_cb (bContext *C, void *node_argv, void *op_argv)
 
static void blender::ed::space_node::node_draw_shadow (const SpaceNode &snode, const bNode &node, const float radius, const float alpha)
 
static void blender::ed::space_node::node_draw_sockets (const View2D &v2d, const bContext &C, const bNodeTree &ntree, const bNode &node, uiBlock &block, const bool draw_outputs, const bool select_all)
 
static void blender::ed::space_node::node_panel_toggle_button_cb (bContext *C, void *panel_state_argv, void *ntree_argv)
 
static void blender::ed::space_node::node_draw_panels_background (const bNode &node, uiBlock &block)
 
static void blender::ed::space_node::node_draw_panels (bNodeTree &ntree, const bNode &node, uiBlock &block)
 
static geo_log::NodeWarningType blender::ed::space_node::node_error_highest_priority (Span< geo_log::NodeWarning > warnings)
 
static std::string blender::ed::space_node::node_errors_tooltip_fn (bContext *, void *argN, const char *)
 
static void blender::ed::space_node::node_add_unsupported_compositor_operation_error_message_button (const bNode &node, uiBlock &block, const rctf &rect, float &icon_offset)
 
static void blender::ed::space_node::node_add_error_message_button (const TreeDrawContext &tree_draw_ctx, const bNode &node, uiBlock &block, const rctf &rect, float &icon_offset)
 
static std::optional< std::chrono::nanoseconds > blender::ed::space_node::geo_node_get_execution_time (const TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static bNodeInstanceKey blender::ed::space_node::current_node_instance_key (const SpaceNode &snode, const bNode &node)
 
static std::optional< std::chrono::nanoseconds > blender::ed::space_node::compositor_accumulate_frame_node_execution_time (const TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static std::optional< std::chrono::nanoseconds > blender::ed::space_node::compositor_node_get_execution_time (const TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static std::optional< std::chrono::nanoseconds > blender::ed::space_node::node_get_execution_time (const TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static std::string blender::ed::space_node::node_get_execution_time_label (TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static std::string blender::ed::space_node::named_attribute_tooltip (bContext *, void *argN, const char *)
 
static NodeExtraInfoRow blender::ed::space_node::row_from_used_named_attribute (const Map< StringRefNull, geo_log::NamedAttributeUsage > &usage_by_attribute_name)
 
static std::optional< NodeExtraInfoRowblender::ed::space_node::node_get_accessed_attributes_row (TreeDrawContext &tree_draw_ctx, const bNode &node)
 
static std::optional< NodeExtraInfoRowblender::ed::space_node::node_get_execution_time_label_row (TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static void blender::ed::space_node::node_get_compositor_extra_info (TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node, Vector< NodeExtraInfoRow > &rows)
 
static void blender::ed::space_node::node_get_invalid_links_extra_info (const SpaceNode &snode, const bNode &node, Vector< NodeExtraInfoRow > &rows)
 
static Vector< NodeExtraInfoRowblender::ed::space_node::node_get_extra_info (const bContext &C, TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node)
 
static void blender::ed::space_node::node_draw_extra_info_row (const bNode &node, uiBlock &block, const rctf &rect, const int row, const NodeExtraInfoRow &extra_info_row)
 
static void blender::ed::space_node::node_draw_extra_info_panel_back (const bNode &node, const rctf &extra_info_rect)
 
static void blender::ed::space_node::node_draw_extra_info_panel (const bContext &C, TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node, ImBuf *preview, uiBlock &block)
 
static void blender::ed::space_node::node_draw_basis (const bContext &C, TreeDrawContext &tree_draw_ctx, const View2D &v2d, const SpaceNode &snode, bNodeTree &ntree, const bNode &node, uiBlock &block, bNodeInstanceKey key)
 
static void blender::ed::space_node::node_draw_hidden (const bContext &C, TreeDrawContext &tree_draw_ctx, const View2D &v2d, const SpaceNode &snode, bNodeTree &ntree, bNode &node, uiBlock &block)
 
int blender::ed::space_node::node_get_resize_cursor (NodeResizeDirection directions)
 
static const bNodeblender::ed::space_node::find_node_under_cursor (SpaceNode &snode, const float2 &cursor)
 
void blender::ed::space_node::node_set_cursor (wmWindow &win, ARegion &region, SpaceNode &snode, const float2 &cursor)
 
static void blender::ed::space_node::count_multi_input_socket_links (bNodeTree &ntree, SpaceNode &snode)
 
static float blender::ed::space_node::frame_node_label_height (const NodeFrame &frame_data)
 
static void blender::ed::space_node::frame_node_prepare_for_draw (bNode &node, Span< bNode * > nodes)
 
static void blender::ed::space_node::reroute_node_prepare_for_draw (bNode &node)
 
static void blender::ed::space_node::node_update_nodetree (const bContext &C, TreeDrawContext &tree_draw_ctx, bNodeTree &ntree, Span< bNode * > nodes, Span< uiBlock * > blocks)
 
static void blender::ed::space_node::frame_node_draw_label (TreeDrawContext &tree_draw_ctx, const bNodeTree &ntree, const bNode &node, const SpaceNode &snode)
 
static void blender::ed::space_node::frame_node_draw_background (const ARegion &region, const SpaceNode &snode, const bNode &node)
 
static void blender::ed::space_node::frame_node_draw_overlay (const bContext &C, TreeDrawContext &tree_draw_ctx, const ARegion &region, const SpaceNode &snode, const bNodeTree &ntree, const bNode &node, uiBlock &block)
 
static Set< const bNodeSocket * > blender::ed::space_node::find_sockets_on_active_gizmo_paths (const bContext &C, const SpaceNode &snode)
 
static const bNodeblender::ed::space_node::reroute_node_get_linked_reroute (const bNode &reroute)
 
static StringRefNull blender::ed::space_node::reroute_node_get_auto_label (TreeDrawContext &tree_draw_ctx, const bNode &src_reroute)
 
static void blender::ed::space_node::reroute_node_draw_label (TreeDrawContext &tree_draw_ctx, const SpaceNode &snode, const bNode &node, uiBlock &block)
 
static void blender::ed::space_node::reroute_node_draw (const bContext &C, TreeDrawContext &tree_draw_ctx, ARegion &region, const SpaceNode &snode, bNodeTree &ntree, const bNode &node, uiBlock &block)
 
static void blender::ed::space_node::node_draw (const bContext &C, TreeDrawContext &tree_draw_ctx, ARegion &region, const SpaceNode &snode, bNodeTree &ntree, bNode &node, uiBlock &block, bNodeInstanceKey key)
 
static void blender::ed::space_node::add_rect_corner_positions (Vector< float2 > &positions, const rctf &rect)
 
static void blender::ed::space_node::find_bounds_by_zone_recursive (const SpaceNode &snode, const bNodeTreeZone &zone, const Span< std::unique_ptr< bNodeTreeZone > > all_zones, MutableSpan< Vector< float2 > > r_bounds_by_zone)
 
static void blender::ed::space_node::node_draw_zones_and_frames (const bContext &C, TreeDrawContext &tree_draw_ctx, const ARegion &region, const SpaceNode &snode, const bNodeTree &ntree, Span< uiBlock * > blocks)
 
static void blender::ed::space_node::node_draw_nodetree (const bContext &C, TreeDrawContext &tree_draw_ctx, ARegion &region, SpaceNode &snode, bNodeTree &ntree, Span< bNode * > nodes, Span< uiBlock * > blocks, bNodeInstanceKey parent_key)
 
static void blender::ed::space_node::draw_tree_path (const bContext &C, ARegion &region)
 
static void blender::ed::space_node::snode_setup_v2d (SpaceNode &snode, ARegion &region, const float2 &center)
 
static bool blender::ed::space_node::realtime_compositor_is_in_use (const bContext &context)
 
static void blender::ed::space_node::draw_nodetree (const bContext &C, ARegion &region, bNodeTree &ntree, bNodeInstanceKey parent_key)
 
static void blender::ed::space_node::draw_background_color (const SpaceNode &snode)
 
void blender::ed::space_node::node_draw_space (const bContext &C, ARegion &region)
 

Variables

static const float blender::ed::space_node::virtual_node_socket_outline_color [4] = {0.5, 0.5, 0.5, 1.0}
 

Detailed Description

higher level node drawing for the node editor.

Definition in file node_draw.cc.

Macro Definition Documentation

◆ NODE_FRAME_MARGIN

#define NODE_FRAME_MARGIN   (1.5f * U.widget_unit)

◆ NODE_HEADER_ICON_SIZE

◆ NODE_TREE_SCALE_SMALL

#define NODE_TREE_SCALE_SMALL   0.2f

Some elements of the node UI are hidden, when they get too small.

Definition at line 2130 of file node_draw.cc.

Referenced by blender::ed::space_node::node_draw_basis(), and blender::ed::space_node::reroute_node_draw_label().

◆ USE_DRAW_TOT_UPDATE

#define USE_DRAW_TOT_UPDATE

Definition at line 4653 of file node_draw.cc.

Function Documentation

◆ ED_node_grid_size()

float ED_node_grid_size ( )

Definition at line 142 of file node_draw.cc.

References NODE_GRID_STEP_SIZE.

Referenced by transform_snap_grid_init().

◆ ED_node_tag_update_id()

◆ ED_node_tree_update()

void ED_node_tree_update ( const bContext * C)

◆ node_tree_from_ID()

static bNodeTree * node_tree_from_ID ( ID * id)
static

Definition at line 162 of file node_draw.cc.

References GS, ID_NT, and blender::bke::node_tree_from_id().

Referenced by ED_node_tag_update_id().