Blender V5.0
drawnode.cc File Reference

lower level node drawing for nodes (boarders, headers etc), also node layout. More...

#include "BLI_color.hh"
#include "BLI_listbase.h"
#include "BLI_string_utf8.h"
#include "BLI_threads.h"
#include "DNA_node_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "BKE_context.hh"
#include "BKE_curve.hh"
#include "BKE_image.hh"
#include "BKE_main.hh"
#include "BKE_main_invariants.hh"
#include "BKE_node.hh"
#include "BKE_node_enum.hh"
#include "BKE_node_legacy_types.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_scene.hh"
#include "BKE_tracking.h"
#include "BLT_translation.hh"
#include "BIF_glutil.hh"
#include "GPU_batch.hh"
#include "GPU_batch_presets.hh"
#include "GPU_capabilities.hh"
#include "GPU_framebuffer.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_shader_shared.hh"
#include "GPU_state.hh"
#include "GPU_uniform_buffer.hh"
#include "DRW_engine.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_prototypes.hh"
#include "ED_node.hh"
#include "ED_space_api.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "UI_view2d.hh"
#include "IMB_colormanagement.hh"
#include "IMB_imbuf_types.hh"
#include "NOD_composite.hh"
#include "NOD_geometry.hh"
#include "NOD_geometry_nodes_gizmos.hh"
#include "NOD_node_declaration.hh"
#include "NOD_partial_eval.hh"
#include "NOD_socket.hh"
#include "NOD_socket_declarations.hh"
#include "node_intern.hh"

Go to the source code of this file.

Classes

struct  blender::ed::space_node::GBatchNodesocket
struct  blender::ed::space_node::NodeLinkDrawConfig

Namespaces

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

Macros

#define DEFAULT_FLAGS   UI_ITEM_R_SPLIT_EMPTY_NAME
#define SAMPLE_FLT_ISNONE   FLT_MAX

Typedefs

using blender::ed::space_node::SocketColorFn = void (*)(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color)

Functions

static void blender::ed::space_node::node_socket_button_label (bContext *, uiLayout *layout, PointerRNA *, PointerRNA *, const StringRef text)
static void blender::ed::space_node::node_buts_mix_rgb (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_time (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_colorramp (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_curvevec (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_curvefloat (uiLayout *layout, bContext *, PointerRNA *ptr)
void ED_node_sample_set (const float col[4])
static void blender::ed::space_node::node_buts_curvecol (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_normal (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_texture (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_math (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_combsep_color (uiLayout *layout, bContext *, PointerRNA *ptr)
NodeResizeDirection blender::ed::space_node::node_get_resize_direction (const SpaceNode &snode, const bNode *node, const int x, const int y)
static void blender::ed::space_node::node_draw_buttons_group (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_frame_ex (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_common_set_butfunc (blender::bke::bNodeType *ntype)
static void blender::ed::space_node::node_buts_image_user (uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr, const bool show_layer_selection, const bool show_color_management)
static void blender::ed::space_node::node_shader_buts_tex_image (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_buts_tex_image_ex (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_buts_tex_environment (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_buts_tex_environment_ex (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_buts_displacement (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_buts_glossy (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_buts_output_shader (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_buts_scatter (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_shader_set_butfunc (blender::bke::bNodeType *ntype)
static void blender::ed::space_node::node_buts_image_views (uiLayout *layout, bContext *, PointerRNA *ptr, PointerRNA *imaptr)
static void blender::ed::space_node::node_composit_buts_image (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_composit_buts_image_ex (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_composit_buts_huecorrect (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_composit_buts_combsep_color (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_composit_buts_cryptomatte_legacy (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_composit_buts_cryptomatte_legacy_ex (uiLayout *layout, bContext *, PointerRNA *)
static void blender::ed::space_node::node_composit_buts_cryptomatte (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_composit_set_butfunc (blender::bke::bNodeType *ntype)
static void blender::ed::space_node::node_texture_buts_bricks (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_texture_buts_proc (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_texture_buts_image (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_texture_buts_image_ex (uiLayout *layout, bContext *C, PointerRNA *ptr)
static void blender::ed::space_node::node_texture_buts_output (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_texture_buts_combsep_color (uiLayout *layout, bContext *, PointerRNA *ptr)
static void blender::ed::space_node::node_texture_set_butfunc (blender::bke::bNodeType *ntype)
void ED_node_init_butfuncs ()
void ED_init_custom_node_type (blender::bke::bNodeType *)
void ED_init_custom_node_socket_type (blender::bke::bNodeSocketType *stype)
void blender::ed::space_node::std_node_socket_colors_get (int socket_type, float *r_color)
template<int socket_type>
void blender::ed::space_node::std_node_socket_color_fn (bContext *, PointerRNA *, PointerRNA *, float *r_color)
static void blender::ed::space_node::std_node_socket_color_simple_fn (const bke::bNodeSocketType *type, float *r_color)
static bool blender::ed::space_node::socket_needs_attribute_search (bNode &node, bNodeSocket &socket)
static bool blender::ed::space_node::socket_needs_layer_search (const bNode &node, const bNodeSocket &socket)
static bool blender::ed::space_node::socket_needs_volume_grid_search (const bNode &node, const bNodeSocket &socket)
static void blender::ed::space_node::draw_gizmo_pin_icon (uiLayout *layout, PointerRNA *socket_ptr)
static void blender::ed::space_node::draw_node_socket_name_editable (uiLayout *layout, bNodeSocket *sock, const StringRef text)
static void blender::ed::space_node::draw_node_socket_without_value (uiLayout *layout, bNodeSocket *sock, const StringRef text)
static void blender::ed::space_node::std_node_socket_draw (bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, StringRef label)
static void blender::ed::space_node::std_node_socket_interface_draw (ID *id, bNodeTreeInterfaceSocket *interface_socket, bContext *, uiLayout *layout)
static void blender::ed::space_node::node_socket_virtual_draw_color (bContext *, PointerRNA *, PointerRNA *, float *r_color)
static void blender::ed::space_node::node_socket_virtual_draw_color_simple (const bke::bNodeSocketType *, float *r_color)
void ED_init_standard_node_socket_type (blender::bke::bNodeSocketType *stype)
void ED_init_node_socket_type_virtual (blender::bke::bNodeSocketType *stype)
void ED_node_type_draw_color (const char *idname, float *r_color)
void blender::ed::space_node::draw_nodespace_back_pix (const bContext &C, ARegion &region, SpaceNode &snode, bNodeInstanceKey parent_key)
float2 blender::ed::space_node::socket_link_connection_location (const bNode &node, const bNodeSocket &socket, const bNodeLink &link)
static void blender::ed::space_node::calculate_inner_link_bezier_points (std::array< float2, 4 > &points)
static std::array< float2, 4 > blender::ed::space_node::node_link_bezier_points (const bNodeLink &link)
static bool blender::ed::space_node::node_link_draw_is_visible (const View2D &v2d, const std::array< float2, 4 > &points)
void blender::ed::space_node::node_link_bezier_points_evaluated (const bNodeLink &link, std::array< float2, NODE_LINK_RESOL+1 > &coords)
Init Draw Callbacks For All Tree Types

Only called on node initialization, once.

static void blender::ed::space_node::node_property_update_default (Main *bmain, Scene *, PointerRNA *ptr)
static void blender::ed::space_node::node_socket_template_properties_update (blender::bke::bNodeType *ntype, blender::bke::bNodeSocketTemplate *stemp)
static void blender::ed::space_node::node_template_properties_update (blender::bke::bNodeType *ntype)
static void blender::ed::space_node::node_socket_undefined_draw (bContext *, uiLayout *layout, PointerRNA *, PointerRNA *, StringRef)
static void blender::ed::space_node::node_socket_undefined_draw_color (bContext *, PointerRNA *, PointerRNA *, float *r_color)
static void blender::ed::space_node::node_socket_undefined_draw_color_simple (const bke::bNodeSocketType *, float *r_color)
static void blender::ed::space_node::node_socket_undefined_interface_draw (ID *, bNodeTreeInterfaceSocket *, bContext *, uiLayout *layout)

Variables

static float _sample_col [4] = {SAMPLE_FLT_ISNONE}
static const float blender::ed::space_node::virtual_node_socket_color [4] = {0.2, 0.2, 0.2, 1.0}
static const float blender::ed::space_node::std_node_socket_colors [][4]
static const SocketColorFn blender::ed::space_node::std_node_socket_color_funcs []

Node Socket Drawing

#define MAX_SOCKET_PARAMETERS   4
#define MAX_SOCKET_INSTANCE   32
static GBatchNodesocketblender::ed::space_node::g_batch_nodesocket ()
static gpu::Batch * blender::ed::space_node::nodesocket_batch_init ()
static void blender::ed::space_node::nodesocket_cache_flush ()
void blender::ed::space_node::nodesocket_batch_start ()
void blender::ed::space_node::nodesocket_batch_end ()
static void blender::ed::space_node::draw_node_socket_batch (const NodeSocketShaderParameters &socket_params)
void blender::ed::space_node::node_draw_nodesocket (const rctf *rect, const float color_inner[4], const float color_outline[4], float outline_thickness, int shape, float aspect)

Node Link Drawing

#define NODELINK_GROUP_SIZE   256
#define LINK_RESOL   24
#define LINK_WIDTH   2.5f
#define ARROW_SIZE   (7 * UI_SCALE_FAC)
static float blender::ed::space_node::arrow_verts [3][2] = {{-1.0f, 1.0f}, {0.0f, 0.0f}, {-1.0f, -1.0f}}
static float blender::ed::space_node::arrow_expand_axis [3][2] = {{0.7071f, 0.7071f}, {M_SQRT2, 0.0f}, {0.7071f, -0.7071f}}
static float blender::ed::space_node::mute_verts [3][2] = {{0.7071f, 1.0f}, {0.7071f, 0.0f}, {0.7071f, -1.0f}}
static float blender::ed::space_node::mute_expand_axis [3][2] = {{1.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, -0.0f}}
struct { 
   gpu::Batch *   blender::ed::space_node::batch 
   gpu::StorageBuf *   blender::ed::space_node::link_buf 
   uint   blender::ed::space_node::count 
   bool   blender::ed::space_node::enabled 
   NodeLinkData   blender::ed::space_node::data [NODELINK_GROUP_SIZE
blender::ed::space_node::g_batch_link
static void blender::ed::space_node::nodelink_batch_reset ()
static void blender::ed::space_node::set_nodelink_vertex (gpu::VertBuf *vbo, uint uv_id, uint pos_id, uint exp_id, uint v, const float uv[2], const float pos[2], const float exp[2])
static void blender::ed::space_node::nodelink_batch_init ()
static char blender::ed::space_node::nodelink_get_color_id (int th_col)
static void blender::ed::space_node::nodelink_batch_draw (const SpaceNode &snode)
void blender::ed::space_node::nodelink_batch_start (const SpaceNode &)
void blender::ed::space_node::nodelink_batch_end (const SpaceNode &snode)
static void blender::ed::space_node::nodelink_batch_add_link (const SpaceNode &snode, const std::array< float2, 4 > &points, const NodeLinkDrawConfig &draw_config)
static void blender::ed::space_node::node_draw_link_end_marker (const float2 center, const float radius, const ColorTheme4f &color)
static void blender::ed::space_node::node_draw_link_end_markers (const bNodeLink &link, const NodeLinkDrawConfig &draw_config, const std::array< float2, 4 > &points, const bool outline)
static bool blender::ed::space_node::node_link_is_field_link (const SpaceNode &snode, const bNodeLink &link)
static bool blender::ed::space_node::node_link_is_gizmo_link (const SpaceNode &snode, const bNodeLink &link)
static NodeLinkDrawConfig blender::ed::space_node::nodelink_get_draw_config (const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link, const int th_col1, const int th_col2, const int th_col3, const bool selected)
static void blender::ed::space_node::node_draw_link_bezier_ex (const SpaceNode &snode, const NodeLinkDrawConfig &draw_config, const std::array< float2, 4 > &points)
void blender::ed::space_node::node_draw_link_bezier (const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link, const int th_col1, const int th_col2, const int th_col3, const bool selected)
void blender::ed::space_node::node_draw_link (const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link, const bool selected)
std::array< float2, 4 > blender::ed::space_node::node_link_bezier_points_dragged (const SpaceNode &snode, const bNodeLink &link)
void blender::ed::space_node::node_draw_link_dragged (const bContext &C, const View2D &v2d, const SpaceNode &snode, const bNodeLink &link)

Detailed Description

lower level node drawing for nodes (boarders, headers etc), also node layout.

Definition in file drawnode.cc.

Macro Definition Documentation

◆ ARROW_SIZE

#define ARROW_SIZE   (7 * UI_SCALE_FAC)

Definition at line 1848 of file drawnode.cc.

Referenced by blender::ed::space_node::nodelink_batch_draw().

◆ DEFAULT_FLAGS

◆ LINK_RESOL

#define LINK_RESOL   24

Definition at line 1846 of file drawnode.cc.

Referenced by blender::ed::space_node::nodelink_batch_init().

◆ LINK_WIDTH

#define LINK_WIDTH   2.5f

Definition at line 1847 of file drawnode.cc.

Referenced by blender::ed::space_node::nodelink_get_draw_config().

◆ MAX_SOCKET_INSTANCE

#define MAX_SOCKET_INSTANCE   32

◆ MAX_SOCKET_PARAMETERS

#define MAX_SOCKET_PARAMETERS   4

◆ NODELINK_GROUP_SIZE

#define NODELINK_GROUP_SIZE   256

◆ SAMPLE_FLT_ISNONE

Function Documentation

◆ ED_init_custom_node_socket_type()

void ED_init_custom_node_socket_type ( blender::bke::bNodeSocketType * stype)

◆ ED_init_custom_node_type()

void ED_init_custom_node_type ( blender::bke::bNodeType * ntype)

Definition at line 940 of file drawnode.cc.

◆ ED_init_node_socket_type_virtual()

◆ ED_init_standard_node_socket_type()

◆ ED_node_init_butfuncs()

◆ ED_node_sample_set()

void ED_node_sample_set ( const float col[4])

◆ ED_node_type_draw_color()

void ED_node_type_draw_color ( const char * idname,
float * r_color )

Variable Documentation

◆ _sample_col