Blender V4.3
drawnode.cc File Reference

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

#include "BLI_color.hh"
#include "BLI_string.h"
#include "BLI_system.h"
#include "BLI_threads.h"
#include "DNA_node_types.h"
#include "DNA_object_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_node.hh"
#include "BKE_node_enum.hh"
#include "BKE_node_runtime.hh"
#include "BKE_node_tree_update.hh"
#include "BKE_scene.hh"
#include "BKE_tracking.h"
#include "BLF_api.hh"
#include "BLT_translation.hh"
#include "BIF_glutil.hh"
#include "GPU_batch.hh"
#include "GPU_batch_presets.hh"
#include "GPU_framebuffer.hh"
#include "GPU_immediate.hh"
#include "GPU_matrix.hh"
#include "GPU_platform.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_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_shader.h"
#include "NOD_socket.hh"
#include "NOD_texture.h"
#include "node_intern.hh"

Go to the source code of this file.

Classes

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
 
#define NODELINK_GROUP_SIZE   256
 
#define LINK_RESOL   24
 
#define LINK_WIDTH   2.5f
 
#define ARROW_SIZE   (7 * UI_SCALE_FAC)
 

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 char *text)
 
static void blender::ed::space_node::node_buts_value (uiLayout *layout, bContext *, PointerRNA *ptr)
 
static void blender::ed::space_node::node_buts_rgb (uiLayout *layout, bContext *, PointerRNA *ptr)
 
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_ycc (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_backdrop_boxmask (SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
 
static void blender::ed::space_node::node_composit_backdrop_ellipsemask (SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
 
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)
 
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 void blender::ed::space_node::node_file_output_socket_draw (bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr)
 
static bool blender::ed::space_node::socket_needs_attribute_search (bNode &node, 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 char *text)
 
static void blender::ed::space_node::draw_node_socket_without_value (uiLayout *layout, bNodeSocket *sock, const char *text)
 
static void blender::ed::space_node::std_node_socket_draw (bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
 
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)
 
static 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)
 
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 uchar 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 (SpaceNode &)
 
void blender::ed::space_node::nodelink_batch_end (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)
 
void ED_node_draw_snap (View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos)
 
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 *, const char *)
 
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 []
 
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::Batch *   blender::ed::space_node::batch_single 
 
   gpu::VertBuf *   blender::ed::space_node::inst_vbo 
 
   uint   blender::ed::space_node::p0_id 
 
   uint   blender::ed::space_node::p1_id 
 
   uint   blender::ed::space_node::p2_id 
 
   uint   blender::ed::space_node::p3_id 
 
   uint   blender::ed::space_node::colid_id 
 
   uint   blender::ed::space_node::muted_id 
 
   uint   blender::ed::space_node::start_color_id 
 
   uint   blender::ed::space_node::end_color_id 
 
   uint   blender::ed::space_node::dim_factor_id 
 
   uint   blender::ed::space_node::thickness_id 
 
   uint   blender::ed::space_node::dash_params_id 
 
   uint   blender::ed::space_node::has_back_link_id 
 
   GPUVertBufRaw   blender::ed::space_node::p0_step 
 
   GPUVertBufRaw   blender::ed::space_node::p1_step 
 
   GPUVertBufRaw   blender::ed::space_node::p2_step 
 
   GPUVertBufRaw   blender::ed::space_node::p3_step 
 
   GPUVertBufRaw   blender::ed::space_node::colid_step 
 
   GPUVertBufRaw   blender::ed::space_node::muted_step 
 
   GPUVertBufRaw   blender::ed::space_node::start_color_step 
 
   GPUVertBufRaw   blender::ed::space_node::end_color_step 
 
   GPUVertBufRaw   blender::ed::space_node::dim_factor_step 
 
   GPUVertBufRaw   blender::ed::space_node::thickness_step 
 
   GPUVertBufRaw   blender::ed::space_node::dash_params_step 
 
   GPUVertBufRaw   blender::ed::space_node::has_back_link_step 
 
   uint   blender::ed::space_node::count 
 
   bool   blender::ed::space_node::enabled 
 
blender::ed::space_node::g_batch_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

◆ DEFAULT_FLAGS

#define DEFAULT_FLAGS   UI_ITEM_R_SPLIT_EMPTY_NAME

Definition at line 78 of file drawnode.cc.

Referenced by blender::ed::space_node::node_buts_combsep_color(), blender::ed::space_node::node_buts_frame_ex(), blender::ed::space_node::node_buts_image_user(), blender::ed::space_node::node_buts_image_views(), blender::ed::space_node::node_buts_math(), blender::ed::space_node::node_buts_mix_rgb(), blender::ed::space_node::node_buts_normal(), blender::ed::space_node::node_buts_output_shader(), blender::ed::space_node::node_buts_rgb(), blender::ed::space_node::node_buts_texture(), blender::ed::space_node::node_buts_time(), blender::ed::space_node::node_buts_value(), blender::ed::space_node::node_composit_buts_combsep_color(), blender::ed::space_node::node_composit_buts_cryptomatte(), blender::ed::space_node::node_composit_buts_cryptomatte_legacy(), blender::ed::space_node::node_composit_buts_ycc(), blender::ed::space_node::node_shader_buts_displacement(), blender::ed::space_node::node_shader_buts_glossy(), blender::ed::space_node::node_shader_buts_scatter(), blender::ed::space_node::node_shader_buts_tex_environment(), blender::ed::space_node::node_shader_buts_tex_environment_ex(), blender::ed::space_node::node_shader_buts_tex_image(), blender::ed::space_node::node_texture_buts_bricks(), blender::ed::space_node::node_texture_buts_combsep_color(), blender::ed::space_node::node_texture_buts_output(), blender::ed::space_node::node_texture_buts_proc(), blender::ed::space_node::std_node_socket_draw(), and blender::ed::space_node::std_node_socket_interface_draw().

◆ LINK_RESOL

#define LINK_RESOL   24

Definition at line 1814 of file drawnode.cc.

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

◆ LINK_WIDTH

#define LINK_WIDTH   2.5f

Definition at line 1815 of file drawnode.cc.

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

◆ 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 1100 of file drawnode.cc.

◆ ED_init_node_socket_type_virtual()

◆ ED_init_standard_node_socket_type()

◆ ED_node_draw_snap()

void ED_node_draw_snap ( View2D * v2d,
const float cent[2],
float size,
NodeBorder border,
uint pos )

◆ 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